Definition of disjunctions with restricted domain - Example 3
Example 3: using with and ord clause to controlling disjunction domains and domains that are already controlled
This example is a modification of the previous. For this case we need to control a domain set which is already controlled. An ALIAS definition in the GAMS section isneeded. Given the following definition in the GAMS Section:
SET I /1*3/ , J /1*4/;
ALIAS (J,JJ)
...and the following disjunction declaration and definition in LogMIP Section:
$ONECHO > "%lm.info%"
Disjunction D(i,j);
D(i,j) with (ord(i) < ord(j)) IS IF Y(i,j) THEN
CONSTR1(j);
CONSTR2(i,jj) with (ord(jj) le 2); ELSE
CONSTR3(j);
CONSTR4(j,k) with (ord(k) lt card(k)); ENDIF; $OFFECHO
Since the domain j is controlled by the disjunction, and for CONSTR2 you need a different control, the ALIAS definition allow that you can define a with clause over it. The previous example will generate the following disjunctions:
D('1', '2'), D('1', '3'), D('1','4'), D('2','3'), D('2','4') y D('3', '4').
Note that:
For the first term of disjunction D(‘1’,’2’) the following constraints must be satisfied: CONSTR1(‘2’), CONSTR2(‘1’,‘1’) and CONSTR2(‘1’, ‘2’).
For the first term of disjunction D(‘2’,‘3’) the following constraints must be satisfied: CONSTRAINT1(‘3’), CONSTRAINT2(‘2’, ‘1’), CONSTRAINT2(‘2’, ‘2’).
And so on...
If you control the domain of a particular constraint with the sentence with you must be aware which domain expansion is assumed in order to avoid errors on it, that in the previous example it has been compared the order of a set item against an integer number, because the order is related to a position into the set, the position in which the item has been defined in the set.