Python Forum
help for python and cplex - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: help for python and cplex (/thread-5416.html)



help for python and cplex - juniorcoder - Oct-02-2017

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()]