I have tried to solve a simple minimization problem in AMPL like so:
.mod:
set PARTS; # set of parts we can produce
set MACHINES; # set of machines that produces parts
param cap {MACHINES} >= 0; # capacity of production for each machine
param req {PARTS} >= 0; # required amount of each part
param cost {MACHINES, PARTS} >= 0; # cost for machine m to produce part p
var Produce {MACHINES, PARTS} >= 0; # how many of part p does machine m produce
minimize Total_Cost: sum {m in MACHINES, p in PARTS} Produce[m,p] * cost[m,p];
s.t. Capacity {m in MACHINES}: sum {p in PARTS} Produce[m,p] <= cap[m]; # we do not produce more than cap
s.t. Required {p in PARTS}: sum {m in MACHINES} Produce[m,p] >= req[p]; # we do not produce less than required
.dat:
param: MACHINE: cap :=
1 80
2 30
3 70;
param: PARTS: req :=
1 10
2 40
3 60
4 20
5 20
6 30;
param cost :
1 2 3 4 5 6 :=
1 3 3 2 5 2 1
2 4 1 1 2 2 1
3 2 2 5 1 1 2;
.run:
reset;
model machineparts.mod;
data machineparts.dat;
solve;
display {m in MACHINES}: {p in PARTS} Produce[m,p];
But when I run the line include machineparts.run;
in the console this is all I get:
ampl: include machineparts.run
ampl:
As you can see, nothing is displayesd. I have tried writing the run file like this:
reset;
model machineparts.mod;
data machineparts.dat;
solve;
display Produce;
But I still get no output in console. What am I doing wrong?