In [3]:
using MathProgBase

In [5]:
# examples from http://mathprogbasejl.readthedocs.io/en/latest/linprog.html


MethodError: no method matching @repl(::Symbol, ::Int64)
Closest candidates are:
  @repl(::ANY) at docs/utils.jl:134

In [8]:
methods(linprog)


Out[8]:
4 methods for generic function linprog:
\begin{split}\min_{x,y}\quad &-x\\ s.t. \quad &2x + y \leq 1.5\\ & x \geq 0, y \geq 0\end{split}

Form 1

linprog(c, A, lb, ub, l, u)
\begin{split}\min_{x}\quad &c^Tx\\ s.t.\quad &lb \leq Ax \leq ub\\ &l \leq x \leq u\\\end{split}

In [ ]:
sol = linprog([-1,0],[2 1],-Inf,1.5,0,Inf)

Form 1'

(shortcut with implicit [0,Inf] constraints)


In [11]:
sol = linprog([-1,0],[2 1],-Inf,1.5)


Out[11]:
MathProgBase.HighLevelInterface.LinprogSolution(:Optimal,-0.75,[0.75,0.0],Dict{Any,Any}(Pair{Any,Any}(:redcost,[0.0,0.5]),Pair{Any,Any}(:lambda,[-0.5])))

Form 2

linprog(c, A, sense, b, l, u)
\begin{split}\min_{x}\quad &c^Tx\\ s.t. \quad &a_i^Tx \text{ sense}_i \, b_i \forall\,\, i\\ &l \leq x \leq u\\\end{split}

In [7]:
sol = linprog([-1,0],[2 1],'<',1.5)


Out[7]:
MathProgBase.HighLevelInterface.LinprogSolution(:Optimal,-0.75,[0.75,0.0],Dict{Any,Any}(Pair{Any,Any}(:redcost,[0.0,0.5]),Pair{Any,Any}(:lambda,[-0.5])))