]>
gitweb.michael.orlitzky.com - dead/census-tools.git/blob - bin/example-lp
4 Solve an example problem with lp_solve.
11 # Add LP_SOLVE_PATH to our path.
12 LP_SOLVE_PATH
= '../lib/lp_solve'
13 site
.addsitedir(os
.path
.dirname(os
.path
.abspath(sys
.argv
[0])) + '/' + LP_SOLVE_PATH
)
15 from lp_solve
import *
17 c
= [5, 100, 30, 10, 20, 300]
25 e
= [ -1, -1, 0, 0, 0 ]
27 b
= [ 500, 600, 400, 300, 200 ]
29 [v
,x
,duals
] = lp_solve(c
,A
,b
,e
)
31 print 'Optimal objective function value: ', v
32 print 'Optimal solution vector: ', x
33 print 'Duals: ', duals