Dear all. I am using CPLEX engine solver in C# environment to solve a mixed integer program and I want to set a conditional termination criterion. For example, if computational time is less than 30 minutes, the model should be solved with relative_gap=0. However, if computational time is more than 30 minutes, I want that the model to be solved with relative_gap=5%. Can I know if it is possible and in case of possibility how?


asked 05 Feb, 02:55

Amin-Sh's gravatar image

accept rate: 0%

Set a time limit of 30 minutes. If the solver stops due to hitting the time limit, change the relative gap to 5%, change the time limit to something longer, and restart the solver. As long as the model itself has not changed, the solver will resume where it left off.


answered 05 Feb, 08:21

Paul%20Rubin's gravatar image

Paul Rubin ♦♦
accept rate: 19%

Dear Rubin. Thanks.Can I know how it would be possible to run the CPLEX until a feasible solution is found? I want to solve the original problem without changing the objective. Generally, how this condition should be declared in C#? Thanks

(07 Feb, 13:45) Amin-Sh

I don't know anything about C#, but I'm pretty sure there is a parameter that sets a limit to the number of feasible solutions found. Check the parameters manual (MIP section). Setting that to 1 should stop CPLEX as soon as the first feasible solution is found.

(07 Feb, 13:53) Paul Rubin ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 05 Feb, 02:55

Seen: 163 times

Last updated: 07 Feb, 13:53

OR-Exchange! Your site for questions, answers, and announcements about operations research.