在 C++ 中使用 cplex:添加条件约束
Use cplex with c++: add conditional constraint
我是 cplex 的新手,我在 python 中找到了函数:add_indicator_constraint,但在 c++ 中我找不到类似的东西。有人可以告诉我吗?
in the example ilofixnet.cpp in CPLEX_Studio201\cplex\examples\src\cpp you can see a good example of indicator constraint in C++
// Add logical constraints that require x[i]==0 if f[i] is 0.
for (IloInt i = 0; i < x.getSize(); ++i)
model.add(IloIfThen(env, f[i] == 0, x[i] == 0));
我是 cplex 的新手,我在 python 中找到了函数:add_indicator_constraint,但在 c++ 中我找不到类似的东西。有人可以告诉我吗?
in the example ilofixnet.cpp in CPLEX_Studio201\cplex\examples\src\cpp you can see a good example of indicator constraint in C++
// Add logical constraints that require x[i]==0 if f[i] is 0.
for (IloInt i = 0; i < x.getSize(); ++i)
model.add(IloIfThen(env, f[i] == 0, x[i] == 0));