1

I am writing code in c++ and calling CPLEX to solve it. It finds a very good solution quickly, but takes a very long time trying to improve it. So I want to set the gap to a larger value to terminate the code, and this is what I use:

    cplex_model.setParam(EpGap, 0.01);

But the compiler gives me an error saying EpGap is an undeclared identifier. What is the default name for relative gap?

David Nehme
  • 21,379
  • 8
  • 78
  • 117
Anna
  • 83
  • 1
  • 7
  • 17

2 Answers2

5

EpGap is a part of an enum within the class IloCplex

cplex_model.setParam(IloCplex::EpGap, 0.01);
David Nehme
  • 21,379
  • 8
  • 78
  • 117
  • This removed the error, but the code keeps running even after it is smaller than my gam! I set it cplex_model.setParam(IloCplex::EpGap, 1); but now although the gap is 0.46% it is still running! – Anna Mar 05 '12 at 20:22
-1

cplex_model.setParam(IloCplex::EpGap, 0.01); is correct

If the EpGap is 1 (1%) it goes to the next feasible solution found that gives a duality gap of 1% or less, so once it goes under 1% it should stop and give you that solution. So in your case, it may go from duality gap > 1% to 0.43%!