Reputation: 1
i'm currently having a project coding on IBM ILOG Cplex. I've been translating the mathematical model to constraint in CPLEX. here it is, i wonder how we code this constraint on cplex since it has 3 elements. i've try the OR logical but the results seem wrong enter image description here
Upvotes: 0
Views: 188
Reputation: 10037
Or works fine in OPL but you write that as ||
See example https://github.com/AlexFleischerParis/zooopl/blob/master/zoodisjunction.mod
int nbKids=300;
float costBus40=500;
float costBus30=400;
dvar int+ nbBus40;
dvar int+ nbBus30;
minimize
costBus40*nbBus40 +nbBus30*costBus30;
subject to
{
40*nbBus40+nbBus30*30>=nbKids;
//with nb buses 40 less than 3 or more than 7
(nbBus40<=3) || (nbBus40>=7);
}
Upvotes: 0