用cplex解决时如何设置差距(How to set gap when solving with cplex)

我用c ++编写代码并调用CPLEX来解决它。 它可以快速找到一个非常好的解决方案,但需要很长时间才能改进它。 所以我想将间隙设置为更大的值来终止代码,这就是我使用的:

cplex_model.setParam(EpGap, 0.01);

但编译器给出了一个错误,说EpGap是一个未声明的标识符。 相对差距的默认名称是什么?

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?

最满意答案

EpGap是IloCplex类中枚举的一部分

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

EpGap is a part of an enum within the class IloCplex

cplex_model.setParam(IloCplex::EpGap, 0.01);用cplex解决时如何设置差距(How to set gap when solving with cplex)

我用c ++编写代码并调用CPLEX来解决它。 它可以快速找到一个非常好的解决方案,但需要很长时间才能改进它。 所以我想将间隙设置为更大的值来终止代码,这就是我使用的:

cplex_model.setParam(EpGap, 0.01);

但编译器给出了一个错误,说EpGap是一个未声明的标识符。 相对差距的默认名称是什么?

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?

最满意答案

EpGap是IloCplex类中枚举的一部分

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

EpGap is a part of an enum within the class IloCplex

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