C#Cplex设置参数

时间:2015-03-12 13:05:36

标签: c# .net optimization mathematical-optimization cplex

我正在研究简单的优化问题。我的模型正在运行,但随着输入数量的增加需要花费太多时间。 我使用CPLEX在c#中编写了代码。

所以,我想在MIPGAP = 0.5时停止它,但我无法找到如何做到这一点。

当我的代码达到0.5间隙时,我应该如何,在哪里以及应该添加什么来阻止它。

谢谢你提前。

1 个答案:

答案 0 :(得分:0)

以类似的方式设置差距,你在Param中有TimeLimit

    IloCplex solver(...);   //initialise the solver with the model
    ... //many other commands
    solver.setParam(IloCplex::Param::TimeLimit,timeout);//customised timeout
    solver.setParam(IloCplex::EpGap,data.m_epgap);  //uses customised epgap
    if(!solver.solve()) {
        //non found
        return 0;
        }