Feasiblity and ObjVal of an initial solution

22 views
Skip to first unread message

Frank Imeson

unread,
Aug 30, 2016, 1:29:32 PM8/30/16
to Gurobi Optimization
Hello, I have a working MILP model within the Gurobi python interface. I am looking to test an initial solutions feasibility and then if feasible get an initial value. However I am unable to find the relevant commands.

Thank you for your help ahead of time.

Some code:
for var in initial_solution:
  var.start = 1.0
milp_model.update()
if milp_model.feasible():
  print milp_model.objVal

PS. This is also posted on StackOverflow.

Sonja Mars

unread,
Sep 1, 2016, 3:19:43 AM9/1/16
to gur...@googlegroups.com
Hi,

There is no method for testing if a solution is feasible.

However, what you can do is for example, handing over the MIP start to Gurobi and start the optimization. If your MIP start is not feasible Gurobi will let you know about this.

Another way would be to create a model, where all variables are fixed to the values in the MIP Start and then solve this model. If it is infeasible, Gurobi will show this as a result.

Best regards,
Sonja Mars


----
Dr. Sonja Mars
Gurobi Optimization - Technical Support
Reply all
Reply to author
Forward
0 new messages