Originally posted by: MchelLeo
Hi Alex,
I edited the constraint as follows:
Why Q3=0, Q4=0 while X3=1, X4=1?. I want, if X=0 then Q=0. Please help me.
................mod....................
{string} n = ...;
float bubget =10;
tuple profit{
float cost;
float quantity;
float availability;
float null;
}
float M = 99999999;
profit profits [n] = ...;
dvar float+ Q[n];
dvar boolean X[n];
dexpr float profits_value = sum (i in n) Q[i];
maximize profits_value;
subject to {
forall (i in n){
Q[i] <= M * X[i];
}
forall (i in n){
Q[i] <= profits[i].availability;
}
forall (i in n){
sum (i in n) Q[i] * 2 <=bubget;
}
}
...........................dat.......................................
n = {n1,n2,n3,n4};
profits = [<1, 2, 2, 0>
<3, 1, 3, 0>
<5, 2, 5, 0>
<8, 1, 6, 0>];
Thanks,
Van Can
#DecisionOptimization