문제

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 is a part of an enum within the class IloCplex

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top