Description
This tests the correct handling of set attributes in a sparse assignment. Contributor: Lutz Westermann, August 2024
Small Model of Type : GAMS
Category : GAMS Test library
Main file : attrib02.gms
$title Test set attributes (ATTRIB02,SEQ=962)
$onText
This tests the correct handling of set attributes in a sparse assignment.
Contributor: Lutz Westermann, August 2024
$offText
Set n / n1*n4 /
t / t1*t3 /
nt(n,t);
nt(n,t) = yes$(t.ord + n.ord gt 3);
Set tempS(t), tempS1(n,t), tempS2(n,t),
errorFirst(n,t), errorLast(n,t);
tempS(t) = t.first;
tempS1(n,t) = yes$(tempS(t) and nt(n,t));
tempS2(n,t) = yes$(t.first and nt(n,t));
errorFirst(n,t) = tempS1(n,t) xor tempS2(n,t);
abort$(card(errorFirst)) errorFirst;
tempS(t) = t.last;
tempS1(n,t) = yes$(tempS(t) and nt(n,t));
tempS2(n,t) = yes$(t.last and nt(n,t));
errorLast(n,t) = tempS1(n,t) xor tempS2(n,t);
abort$(card(errorLast)) errorLast;
Parameter tempP(t), tempP1(n,t), tempP2(n,t);
Set errorPos(n,t), errorOrd(n,t), errorOff(n,t)
errorRev(n,t), errorUel(n,t);
tempP(t) = t.pos;
tempP1(n,t) = sum(nt(n,t), tempP(t));
tempP2(n,t) = sum(nt(n,t), t.pos );
errorPos(n,t) = tempP1(n,t) <> tempP2(n,t);
abort$(card(errorPos)) errorPos, tempP1, tempP2;
tempP(t) = t.ord;
tempP1(n,t) = sum(nt(n,t), tempP(t));
tempP2(n,t) = sum(nt(n,t), t.ord );
errorOrd(n,t) = tempP1(n,t) <> tempP2(n,t);
abort$(card(errorOrd)) errorOrd, tempP1, tempP2;
tempP(t) = t.off;
tempP1(n,t) = sum(nt(n,t), tempP(t));
tempP2(n,t) = sum(nt(n,t), t.off );
errorOff(n,t) = tempP1(n,t) <> tempP2(n,t);
abort$(card(errorOff)) errorOff, tempP1, tempP2;
tempP(t) = t.rev;
tempP1(n,t) = sum(nt(n,t), tempP(t));
tempP2(n,t) = sum(nt(n,t), t.rev );
errorRev(n,t) = tempP1(n,t) <> tempP2(n,t);
abort$(card(errorRev)) errorRev, tempP1, tempP2;
tempP(t) = t.uel;
tempP1(n,t) = sum(nt(n,t), tempP(t));
tempP2(n,t) = sum(nt(n,t), t.uel );
errorUel(n,t) = tempP1(n,t) <> tempP2(n,t);
abort$(card(errorUel)) errorUel, tempP1, tempP2;