$title Test limited domains for variables in model (limdom01,SEQ=812) $onText With GAMS 31 we introduced the capability to limit the domain of variables in the model statement. This test uses the trnsport model to verify that this new feature leads to the same result as using explicit dollar conditions and that explicit dollar conditions can also be used together with variables with limited domains. Contributor: Lutz Westermann, March 2020 $offText Set i 'canning plants' / seattle, san-diego / j 'markets' / new-york, chicago, topeka /; Parameter a(i) 'capacity of plant i in cases' / seattle 350 san-diego 600 / b(j) 'demand at market j in cases' / new-york 325 chicago 300 topeka 275 /; Table d(i,j) 'distance in thousands of miles' new-york chicago topeka seattle 2.5 1.7 1.8 san-diego 2.5 1.8 1.4; Scalar f 'freight in dollars per case per thousand miles' / 90 /; Parameter c(i,j) 'transport cost in thousands of dollars per case'; c(i,j) = f*d(i,j)/1000; Set ij(i,j) / #i.#j /; Variable x(i,j) 'shipment quantities in cases' z 'total transportation costs in thousands of dollars'; Positive Variable x; Equation cost 'define objective function' costD 'define objective function' supply(i) 'observe supply limit at plant i' supplyD(i) 'observe supply limit at plant i' demand(j) 'satisfy demand at market j' demandD(j) 'satisfy demand at market j'; cost.. z =e= sum((i,j), c(i,j)*x(i,j)); costD.. z =e= sum((i,j), c(i,j)*x(i,j)$ij(i,j)); supply(i).. sum(j, x(i,j)) =l= a(i); supplyD(i).. sum(j, x(i,j)$ij(i,j)) =l= a(i); demand(j).. sum(i, x(i,j)) =g= b(j); demandD(j).. sum(i, x(i,j)$ij(i,j)) =g= b(j); Model transportExplDol Use explicut dollar conditions / costD, supplyD, demandD /; Model transportImplDol Limit the domain of variable x / cost, supply, demand, x(ij) /; Model transportTwoDol Combine explicit dollar conditions and the limited domain of x / costD, supplyD, demandD, x(ij) /; option lp=convert; Alias (i,ii), (j,jj); loop((ii,jj), ij(ii, jj) = no; solve transportExplDol using lp minimizing z; execute.CheckErrorLevel 'grep -v "LP written by GAMS" gams.gms > transportExplDol.gms'; solve transportImplDol using lp minimizing z; execute.CheckErrorLevel 'grep -v "LP written by GAMS" gams.gms > transportImplDol.gms'; solve transportTwoDol using lp minimizing z; execute.CheckErrorLevel 'grep -v "LP written by GAMS" gams.gms > transportTwoDol.gms'; execute.CheckErrorLevel '=diff -b transportExplDol.gms transportImplDol.gms'; execute.CheckErrorLevel '=diff -b transportExplDol.gms transportTwoDol.gms'; ij(ii, jj) = yes; );