Friday, June 27, 2008

Nonrectangular Domains

GAMS only allows rectangular domains, ie we can use

variable flow(i,j,k);

but not

set links(i,j,k) /.../;
positive variable flow(links);

It is the responsibility of the modeler to check every occurrence of FLOW() in the model equations to make sure no FLOW(i,j,k) outside the set LINKS is referenced.

AMPL allows a better, safer approach: you can specify a set as domain:

set LINKS := ....
var flow{LINKS} >= 0;

This will check that you don't use flow outside its LINKS domain.