> From:
am...@googlegroups.com [mailto:
am...@googlegroups.com] On Behalf Of
>
vap...@op.pl
> Sent: Tuesday, October 25, 2005 6:21 AM
> To: AMPL Modeling Language
> Subject: [AMPL] export AMPL model (.mod) to LP format (.lp)
>
> is it possible?
> lp format is soo inconvenient.. :/
You can get something like LP format by use of AMPL's "expand" command. For
example the AMPL commands
ampl: model transp.mod;
ampl: data transp.dat;
ampl: expand >transp.lp;
create a file transp.lp that has the contents shown below. This might not be
too hard to convert into one of the LP-type formats recognized by various
solvers. Your experience might depend on the solver, however; I'm not aware of
any well-observed standard for model representations of this type.
Bob Fourer
4...@ampl.com
Contents of file transp.lp:
minimize total_cost:
39*Trans['GARY','FRA'] + 14*Trans['GARY','DET'] +
11*Trans['GARY','LAN'] + 14*Trans['GARY','WIN'] +
16*Trans['GARY','STL'] + 82*Trans['GARY','FRE'] + 8*Trans['GARY','LAF']
+ 27*Trans['CLEV','FRA'] + 9*Trans['CLEV','DET'] +
12*Trans['CLEV','LAN'] + 9*Trans['CLEV','WIN'] + 26*Trans['CLEV','STL']
+ 95*Trans['CLEV','FRE'] + 17*Trans['CLEV','LAF'] +
24*Trans['PITT','FRA'] + 14*Trans['PITT','DET'] +
17*Trans['PITT','LAN'] + 13*Trans['PITT','WIN'] +
28*Trans['PITT','STL'] + 99*Trans['PITT','FRE'] +
20*Trans['PITT','LAF'];
subject to Supply['GARY']:
Trans['GARY','FRA'] + Trans['GARY','DET'] + Trans['GARY','LAN'] +
Trans['GARY','WIN'] + Trans['GARY','STL'] + Trans['GARY','FRE'] +
Trans['GARY','LAF'] = 1400;
subject to Supply['CLEV']:
Trans['CLEV','FRA'] + Trans['CLEV','DET'] + Trans['CLEV','LAN'] +
Trans['CLEV','WIN'] + Trans['CLEV','STL'] + Trans['CLEV','FRE'] +
Trans['CLEV','LAF'] = 2600;
subject to Supply['PITT']:
Trans['PITT','FRA'] + Trans['PITT','DET'] + Trans['PITT','LAN'] +
Trans['PITT','WIN'] + Trans['PITT','STL'] + Trans['PITT','FRE'] +
Trans['PITT','LAF'] = 2900;
subject to Demand['FRA']:
Trans['GARY','FRA'] + Trans['CLEV','FRA'] + Trans['PITT','FRA'] = 900;
subject to Demand['DET']:
Trans['GARY','DET'] + Trans['CLEV','DET'] + Trans['PITT','DET'] = 1200;
subject to Demand['LAN']:
Trans['GARY','LAN'] + Trans['CLEV','LAN'] + Trans['PITT','LAN'] = 600;
subject to Demand['WIN']:
Trans['GARY','WIN'] + Trans['CLEV','WIN'] + Trans['PITT','WIN'] = 400;
subject to Demand['STL']:
Trans['GARY','STL'] + Trans['CLEV','STL'] + Trans['PITT','STL'] = 1700;
subject to Demand['FRE']:
Trans['GARY','FRE'] + Trans['CLEV','FRE'] + Trans['PITT','FRE'] = 1100;
subject to Demand['LAF']:
Trans['GARY','LAF'] + Trans['CLEV','LAF'] + Trans['PITT','LAF'] = 1000;