option csvdisplay_header 0;
print "Location,Product,Amount" > output.csv;
csvdisplay {(l,p) in LOCPROD}Amount[l,p]>output.csv;
close output.csv;
It seems like there would be a way to assign "Index_1" to be
"Location", but I can't figure out the syntax. Any suggestions?
Thanks.
If you can work with tab-separated fields then one alternative is to use
AMPL "table" command which produces much the same output but with complete
flexibility in generating column headings. For example in a model that has
set LINKS within {ORIG,DEST};
var Trans {LINKS} >= 0;
one can use the commands
table transtab OUT "transfile.tab":
{(i,j) in LINKS} -> [origin,destination], Trans[i,j] ~ shipped;
write table transtab;
to get a file transfile.tab that begins
ampl.tab 2 1
origin destination shipped
GARY DET 0
GARY LAN 0
GARY STL 800
GARY LAF 600
CLEV FRA 0
...
There are numerous options to regulate what appears in the table, as
described in chapter 10 of the AMPL book.
Bob Fourer
4...@ampl.com