AMPL’s expand command can display any explicit linear constraint, or indexed collection of constraints. For example:
ampl: model transp.mod;
ampl: data transp.dat;
ampl: expand Demand['STL'];
s.t. Demand['STL']:
Trans['GARY','STL'] + Trans['CLEV','STL'] +
Trans['PITT','STL'] = 1700;
ampl: expand Supply;
s.t. Supply['GARY']:
Trans['GARY','FRA'] + Trans['GARY','DET'] +
Trans['GARY','LAN'] + Trans['GARY','WIN'] +
Trans['GARY','STL'] + Trans['GARY','FRE'] +
Trans['GARY','LAF'] = 1400;
s.t. Supply['CLEV']:
Trans['CLEV','FRA'] + Trans['CLEV','DET'] +
Trans['CLEV','LAN'] + Trans['CLEV','WIN'] +
Trans['CLEV','STL'] + Trans['CLEV','FRE'] +
Trans['CLEV','LAF'] = 2600;
s.t. Supply['PITT']:
Trans['PITT','FRA'] + Trans['PITT','DET'] +
Trans['PITT','LAN'] + Trans['PITT','WIN'] +
Trans['PITT','STL'] + Trans['PITT','FRE'] +
Trans['PITT','LAF'] = 2900;
The expand command also works with variables and objectives, and has indexing options similar to those of display or print for specifying which components are expanded.