When running the cplex model, I noticed that the CPLEX repeats the same gap value several times. I ask if there is a parameter in docplex that limits the number of iterations without improvements or just stop it after obtaining n times the same value on the gap.


Please read the relevant manuals. I am not aware of any such functionality and a search of named parameters in the documentation yields no results either.

However this page goes into details how to get the information you want and also documents in an example how to stop it from this callback based on this information using the C Interface.

  • 1
    $\begingroup$ The question is tagged docplex, which is the interface being used. Essentially, it's Python. $\endgroup$
    – prubin
    May 22 '21 at 19:01
  • $\begingroup$ Thanks, i didn't know and edited my answer. $\endgroup$ May 23 '21 at 21:56
  • $\begingroup$ To expand on this answer: No, this cannot be done by a parameter. You would need to attach a callback (a node callback would work). In the callback, you would need to get the MIP gap (for which there is a function), compare it to previous gaps (acquired the same way), and if there were no change for too long stop the solver (using the abort function). There seems to be a way to use callbacks from DOCplex ("cb_mixin module"), about which I know nothing. $\endgroup$
    – prubin
    May 24 '21 at 22:22
  • $\begingroup$ Thank you, I figure out how to stop the solver depending on the gap using a callback function but it's not what I really needed, I am looking for a way to direct the search like changing the search space without stopping the solver? $\endgroup$
    – Nada.M
    May 25 '21 at 22:44
  • $\begingroup$ @Nada.M Based on the comments above and the fact you have tried something yourself and looking for something different, I would suggest that you edit your question and add this additional information. $\endgroup$
    – EhsanK
    Jun 18 '21 at 14:31

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.