16.01.2015 Views

GAMS — The Solver Manuals - Available Software

GAMS — The Solver Manuals - Available Software

GAMS — The Solver Manuals - Available Software

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

408 MPSWRITE<br />

the macros @i and @j. In the string, ANALYZE recognizes the characters between ’&’ and ’:’ as representing<br />

the stem of the index name corresponding to the string following the ’@’ macro in the gams file, and the number<br />

immediately following the ’:’ as the number of characters from the left of the row/column name that the particular<br />

set label stem begins. As an illustration, in the row syntax for X, we see the strings &I.:2 and &J.:4. This means<br />

that in any row of X, say XSENE, the label corresponding to I begins at the second position (SE) while the label<br />

corresponding to J begins at the fourth position (NE). This is used by the ANALYZE command EXPLAIN. For<br />

further information on this topic, consult the ANALYZE manual.<br />

<strong>The</strong> ANALYZE LP file shown in the ”ANALYZE LP file with FIXED=1” demonstrates the effect of the option<br />

fixed which uses a fixed field format for the LP file. This makes the file size larger but at the same time it is<br />

easier to read.<br />

Modified ’trnsport.gms’<br />

\$TITLE A TRANSPORTATION PROBLEM (TRNSPORT,SEQ=1)<br />

\$OFFUPPER<br />

SETS<br />

I canning plants / SEATTLE, SAN-DIEGO /<br />

J markets / NEW-YORK, CHICAGO, TOPEKA / ;<br />

PARAMETERS<br />

A(I) capacity of plant i in cases<br />

/ SEATTLE 350<br />

SAN-DIEGO 600 /<br />

B(J) demand at market j in cases<br />

/ NEW-YORK 325<br />

CHICAGO 300<br />

TOPEKA 275 / ;<br />

TABLE D(I,J) distance in thousands of miles<br />

NEW-YORK CHICAGO TOPEKA<br />

SEATTLE 2.5 1.7 1.8<br />

SAN-DIEGO 2.5 1.8 1.4 ;<br />

SCALAR F freight in dollars per case per thousand miles /90/ ;<br />

PARAMETER C(I,J) transport cost in thousands of dollars per case ;<br />

C(I,J) = F * D(I,J) / 1000 ;<br />

VARIABLES<br />

X(I,J) shipment quantities in cases from @i to @j<br />

Z total transportation costs in thousands of dollars ;<br />

POSITIVE VARIABLE X ;<br />

EQUATIONS<br />

COST<br />

define objective function<br />

SUPPLY(I) observe supply limit at plant @i<br />

DEMAND(J) satisfy demand at market @j ;<br />

COST .. Z =E= SUM((I,J), C(I,J)*X(I,J)) ;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!