2
$\begingroup$

I try to solve a model in docplex(python) the model was stopped after a specific time limit. I want when the model stop return the best upper bound was found.

$\endgroup$
2
  • $\begingroup$ Are you minimizing or maximizing? Do you want the bound of the last node processed or the best bound found by the solver? $\endgroup$
    – fontanf
    Oct 8 at 10:25
  • $\begingroup$ minimizing. I want the best bound found $\endgroup$
    – Nada.M
    Oct 8 at 11:09
3
$\begingroup$

Once you solve a docplex model, it creates an internal SolveDetails object that contains the best bound you're looking for. You can access it in two ways:

  1. Assuming you've defined your docplex model as model (an instance of the class docplex.mp.model.Model)
print(model.get_solve_details().best_bound)
  1. Assuming you've stored your model's solution in sol (an instance of the class docplex.mp.solution.SolveSolution)
sol = model.solve()
print(sol.solve_details.best_bound)

Check out the documentation for more details.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.