Assume I have the following example code in a larger model
SET INDEX /A, B, C, D, E/;
ALIAS (INDEX,INDEX2);
POSITIVE VARIABLE PFLOW(INDEX,INDEX2);
This set of code implements a 5x5 matrix of values zero or greater in the name PFLOW indexed A…E by A…E
Assume that the variable PFLOW is a choice variable in a model.
My problem is that I need to have PFLOW(INDEX,INDEX2) to be mutual exclusive with PFLOW(INDEX2,INDEX)
For example if PFLOW(A,B) is >0 then PFLOW(B,A) = 0.
This rule does not apply when INDEX=INDEX2
I have tried the following:
-
add a binary variable corresponding to the PFLOW array
BINARY VARIABLE bPFLOW(INDEX,INDEX2); -
add the following equation to set the BPFLOW value to zero if the value is zero and 1 if not zero
eqn(INDEX,INDEX2)…
PFLOW(INDEX,INDEX2) - 1e8 * bPFLOW(INDEX,INDEX2) =L= 0.0; -
constraint to limit one of the pair to have a value >0
eqn2(INDEX,INDEX2)…
bPFLOW(INDEX,INDEX2) + bPFLOW(INDEX2,INDEX) =L= 1.0;
The problem is that equation 2 can assign 0 or 1 to bPFLOW if the value of PFLOW is zero.
I am willing to change the structure of the model so the PFLOW become SOS1 variables, but I’m not sure how to do that. The real model is 11x11 with only 15 pairs (and their inverse) active in the model.
In short, I need an algorithm with choice positive variable A and choice positive variable B to not both be > zero using indexes and not defining pairs of SOS1 variables
Thanks
Michael Reed