首页 > 解决方案 > 约束中系数矩阵的函数

问题描述

我需要约束中的系数矩阵。CPLEX Concert C++ 中有一个函数 getObjCoef 用于目标系数,但我不知道是否有任何函数可以检索系数矩阵?

标签: visual-c++cplex

解决方案


尝试使用 IloExpr::LinearIterator 迭代系数

IloExpr exprCt = rangeCt.getExpr(); 

for (IloExpr::LinearIterator t = exprCt.getLinearIterator(); t.ok(); ++t) 
{ std::cout << t.getCoef() << " * " << t.getVar() << std::endl; }

推荐阅读