2D plots of linear/integer programming models in R
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
R
inst/examples
man
.Rbuildignore
.gitignore
.travis.yml
DESCRIPTION
NAMESPACE
NEWS.md
README-ex-1.png
README-ex-2.png
README.Rmd
ReadMe.md
cran-comments.md
gMOIP.Rproj

ReadMe.md

Travis-CI Build Status CRAN_Status_Badge CRAN_Downloads_Badge

gMOIP - 2D plots of LP/IP programming models

Make 2D plots of the polyeder of a linear programming (LP), integer programming (IP) model, or mixed integer linear programming (MILP) model, including integer points, ranges and iso profit curve. Can also make a plot of a bi-objective criterion space and the non-dominated (Pareto) set.

Usage

# Define the LP max/min coeff*x st. Ax<=b, x>=0
A <- matrix(c(9,10,2,4,-3,2), ncol = 2, byrow = TRUE)
b <- c(90,27,3)
coeff <- c(7.75, 10)

# Corner points of the polytope
cPoints<-cornerPoints(A, b)
# Integer points in the polytope
iPoints<-integerPoints(A, b)
# plot polytope (ggplot2)
plotPolytope(cPoints, iPoints, iso = coeff, crit = "max")

# Plot of criterion points given a bi-objective vector
zPoints<-criterionPoints(iPoints, c1 = c(coeff[1], 0), c2 = c(0, coeff[2]), crit = "max")
plotCriterion(zPoints, addHull = FALSE, addTriangles = TRUE)

For more examples see example("gMOIP-package") or my blog post. You may also create a tikz file of the plot for LaTeX using

library(tikzDevice)
tikz(file = "plot_polytope.tex", standAlone=F, width = 7, height = 6)
plotPolytope(cPoints, zPoints, showLbl = TRUE)
dev.off()

Installation

Install the latest stable release from CRAN:

install.packages("gMOIP")

Alternatively, install the latest development version from GitHub:

install.packages("devtools")
devtools::install_github("relund/gMOIP")

library(gMOIP)
example("gMOIP-package")