Search code examples
c++mathematical-optimizationlinear-programmingcplexinteger-programming

How to set gap when solving with cplex


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?


Solution

  • EpGap is a part of an enum within the class IloCplex

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