File: lp.py

package info (click to toggle)
cvxopt 1.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, trixie
  • size: 2,800 kB
  • sloc: ansic: 23,229; python: 11,991; makefile: 75; sh: 7
file content (9 lines) | stat: -rwxr-xr-x 262 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
# The small LP of section 8.3 (Linear programming). 

from cvxopt import matrix, 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("\nx = \n")
print(sol['x'])