mathematical optimization - CPLEX with logical if/else operation -
i new cplex user. have question, can use if/else logical operation in cplex? (not inside constraint).
from question not clear whether you're using cplex opl or cplex interface programming language c++, c#, java, matlab, , on. tell , next responses less generic.
let assume you're testing if variable x equal 1. in positive case use inequality model_ineq_1, otherwise model_ineq_2 should used. following expression should work in cases:
(x == 1) ? model_ineq_1 : model_ineq_2 as can see tests (condition_happens) ? do_this_if_true : do_this_if_false. called ternary operator , provides inline if-then-else statement.
Comments
Post a Comment