简体   繁体   中英

Use cplex with c++: add conditional constraint

I'm new in cplex, I found in python the function: add_indicator_constraint, but in c++ I can't find anything like that. Can someone show me, please?

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));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM