Question

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?

Was it helpful?

Solution

EpGap is a part of an enum within the class IloCplex

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

OTHER TIPS

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%!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top