Description
Test the GAMS execution system for set assignments that use the target set itself as a controlling domain subset on the RHS (e.g., `SetA(i) = sum(SetA(j)$cond, ...))`. Contributor: Lutz Westermann, November 2025
Small Model of Type : GAMS
Category : GAMS Test library
Main file : assign4.gms
$title 'Test set assignment with LHS symbol that is used for domain jumps on the RHS' (ASSIGN1,SEQ=990)
$onText
Test the GAMS execution system for set assignments that use the target set itself as a
controlling domain subset on the RHS (e.g., `SetA(i) = sum(SetA(j)$cond, ...))`.
Contributor: Lutz Westermann, November 2025
$offText
SET n set of nodes /n1*n120/,
succ(n,n) successor set,
listA(n), listB(n), diff(n);
ALIAS(n,nn,parent,child);
* Define a regular tree
succ(n,child) = yes$(ord(child) >= 3*ord(n)-1 AND ord(child) <= 3*ord(n)+1);
* Backward recursion, from leafs to root
listA(n)$(NOT sum(succ(n,child), yes)) = yes;
listB(n)$(NOT sum(succ(n,child), yes)) = yes;
* list update
listA(parent) = yes$(sum(n$(listA(n) AND succ(parent,n)), yes));
listB(parent) = yes$(sum(listB(n)$succ(parent,n), yes));
diff(n) = (listA(N) - listB(n)) + (listB(n) - listA(n));
abort$[sum(diff(n), yes)] 'ERROR: difference in sets', diff;