Reputation: 3
I am using Docplex (Cplex python version) with a maximization objective. I set the time limit, using
mdl.solve(TimeLimit=600)
.
It is possible that the model doesn't reach the optimal during this time, so i want to get the objective value (sub-optimal) when the timeLimit is reached. How can i do it? For the optimal, i use :
mdl.get_objective_values()
It gives me None when the time limit is reached!
Thanks,
Upvotes: 0
Views: 827
Reputation: 10059
your model could be either infeasible or not provide a solution in the given time limit. You should test the status after solve:
sol = mdl.solve(TimeLimit=600)
if sol is not None:
print_information("Ok")
else:
print("* model is infeasible")
Upvotes: 0