Chapter 8 - Linear Programming and Game Theory

Ex:8.2.2 Pg: 238

In [2]:
from scipy.optimize import linprog
from numpy import array, transpose
A=array([[1, 0 ,1 ,6, 2],[0, 1, 1, 0, 3]])
b=transpose(array([8, 9]))
c=transpose(array([0, 0, 7 ,-1, -3]))
lb=transpose(array([0, 0 ,0 ,0 ,0]))
ub=[]
ans=linprog(c,A,b)
x=ans.x
f=ans.fun
print 'New corner:',x
print 'Minimum cost:',f
New corner: [ 0.          0.          0.          0.33333333  3.        ]
Minimum cost: -9.33333333333