AMPL FAQS
Ø
I don’t have a copy of the AMPL book. Where can I go for
help?
You might
share a copy of the ampl book with your team mates --- that's about $10 each.
No text is required for the class. If I had required the AMPL book....
You can
look at lots of examples at
http://www.ampl.com/EXAMPLES/index.html
You can
get the 1st chapter of the book at
http://www.ampl.com/BOOK/contents.html
Type the two words "AMPL" and “your command” into Google. That will generate lots of examples.
Ø I don't quite understand this peice of code in your lecture:
set EDGES := (PLANTS cross DCS) union (DCS cross CUSTS);
More specifically, I can guess what it means, but I have trouble using EDGES later on in the model.
You need
to define the set EDGES. It's the "within" command that's giving you
problems. It limits what can be in the set EDGES, but does not say what is in
the set edges. Try this:
let
PLANTS := {'plant1', 'plant2'};
let
PRODUCTS := {'prod1', 'prod2'};
let CUSTS
:= {'cust1', 'cust2'};
let DCS
:= {'dc'};
/* This statement defines the set of EDGES. It
is what you are missing */
let EDGES
:= PLANTS cross DCS union DCS cross CUSTS;
let {prd
in PRODUCTS, p in PLANTS} Supply[prd, p] := 5;
let {prd
in PRODUCTS, c in CUSTS} Demand[prd, c] := 4;
let {(i,
j) in EDGES} Cost[i,j] := 1;
let
{(i,j) in EDGES} Capacity[i,j] := 100;
save this
as:
Example.run
invoke
ampl
model
[your model file].mod;
include
example.run;
solve;
display
Flow;