8.3 Linear Programming
lp(c, G, h[, A, b[, solver[, primalstart[, dualstart]]]])
- Solves the pair of primal and dual linear programs
The inequalities are componentwise vector inequalities.The solver argument is used to choose among three solvers. When it is omitted or None, the CVXOPT function conelp() is used. The external solvers GLPK and MOSEK (if installed) can be selected by setting solver = 'glpk' or solver = 'mosek'; see section 8.8.
The meaning of the other arguments and the return value are the same as for conelp() called with dims = {'l': G.size[0], 'q': [], 's': []}. The initial values are ignored when solver = 'mosek' or solver = 'glpk'.
As a simple example we solve the LP
>>> from cvxopt.base import matrix
>>> from cvxopt import solvers
>>> c = matrix([-4., -5.])
>>> G = matrix([[2., 1., -1., 0.], [1., 2., 0., -1.]])
>>> h = matrix([3., 3., 0., 0.])
>>> sol = solvers.lp(c, G, h)
>>> print sol['x']
[ 1.00e+00]
[ 1.00e+00]