gpt4 book ai didi

c++ - Barrier算法迭代后如何访问当前解决方案?

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:48:09 26 4
gpt4 key购买 nike

我想在 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 没有解决方案(错误)。有没有办法在迭代后访问当前解决方案?

最佳答案

无法访问当前解决方案。

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

关于c++ - Barrier算法迭代后如何访问当前解决方案?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34307888/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com