【问题标题】:How to access current solution after an iteration of the Barrier algorithm?迭代障碍算法后如何访问当前解决方案?
【发布时间】:2015-12-16 09:10:25
【问题描述】:

我想在一次 Barrier 算法迭代后访问 QP 的当前解决方案。每次迭代后都会触发一个回调ContinuousCallbackI。 我修改了回调代码示例:

static ILOBARRIERCALLBACK2(MyCallback, IloCplex, cplex, IloNumVarArray, x) {
    cout << "Iteration " << getNiterations() << ": ";

    if (isFeasible()) {
        cout << "Objective = " << getObjValue() << endl;
        //cout << "x[0] = " << (float)cplex.getValue(x[0]) << endl; 
        //CPLEX Error  1217: No solution exists.
    }
    else {
        cout << "Infeasibility measure = " << getInfeasibility() << endl;
    }
}

但是 cplex 没有解决方案(错误)。有什么方法可以在迭代后访问当前的解决方案?

【问题讨论】:

    标签: c++ callback cplex


    【解决方案1】:

    无法访问当前的解决方案。

    在回调内部,只能调用回调类的成员函数。这些成员函数列在https://www.ibm.com/support/knowledgecenter/SSSA5P_12.9.0/ilog.odms.ide.help/refcppopl/html/classes/IloCplex_BarrierCallbackI.html,没有一个可以查询当前的解决方案。

    【讨论】:

      猜你喜欢
      • 2020-04-23
      • 1970-01-01
      • 2021-02-16
      • 1970-01-01
      • 1970-01-01
      • 2013-07-22
      • 1970-01-01
      • 1970-01-01
      • 2016-03-19
      相关资源
      最近更新 更多