Slide 22
Slide 22 text
ઢܗܭը : ࣮
# Create the linear solver with the GLOP backend.
solver = pywraplp.Solver('Hello, world, again',
pywraplp.Solver.GLOP_LINEAR_PROGRAMMING)
infinity = solver.infinity()
# Create variables
x = solver.NumVar(-infinity, infinity, 'x')
y = solver.NumVar(-infinity, infinity, 'y')
# Add constrains
solver.Add(x + 2 * y <= 14)
solver.Add(3 * x - y >= 0)
solver.Add(x - y <= 2)
# Set objective function
solver.Maximize(objective(x, y, z))
# Invoke the solver
result = solver.Solve()