The AMPL data-file format does not have an option to read the transpose of a
table of this kind, with parameter names (rate, profit, market) on the left
and index names (BANDS, COILS, PLATE, ...) on the top. To read something
like the transpose, you would have to define a 2-dimensional parameter that
contains all the data, then copy it to the 1-dimensional parameters. For
example:
set PROD;
set parname = {"rate","profit","market"};
param rpm {parname,PROD};
param rate {p in PROD} = rpm["rate",p];
param profit {p in PROD} = rpm["profit",p];
param market {p in PROD} = rpm["market",p];
Then the data could be written like this:
set PROD := BANDS COILS PLATE ;
param rpm: BANDS COILS PLATE :=
rate 200 140 120
profit 25 30 29
market 6000 4000 3500 ;
If instead you are using "table" statements to read directly from a
spreadsheet (rather than dumping the spreadsheet's contents to a text file),
then the arrangement of data in the sheet has to consist of one or more key
(index) columns followed by one or more data (parameter) columns, so again
the transpose of this arrangement is not recognized. You could try reading
the spreadsheet data into a parameter like rpm above, however, following the
instructions for "Indexed collections of data columns" on page 196 of
chapter 10 in the AMPL book (
www.ampl.com/BOOK/download.html).
Of course Excel has a way of copying any table to its transpose, but
presumably the idea here is to avoid that.
Bob Fourer
4...@ampl.com