Python Forum

Full Version: help for python and cplex
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,
I have a model built on cplex but I want to call its solution to python . I applied template below; Can you tell me where I should indicate the name of the model and data I want to work ? Thanks in advance
[import cplex
import sys
def sample1(filename):
c=cplex.Cplex(filename)
try:
c.solve()
except CplexSolverError:
print "Exception raised during solve"
return
status=c.solution.get_status()
print "Solution Status=", status,":",
print c.solution.status[status]
print "Objective value=",c.solution.get_objective_value()]