Command Environment
display ORIG, DEST, LINKS;
display PROD, AREA;
display union {p in PROD} AREA[p];
display {(i,j) in LINKS: cost[i,j] * amount[i,j] > 500} ;
display {p in PROD, t in 1..T} (revenue[p,t], sell[p,t]);
display T;
display avail["reheat"], avail["roll
"] ;
display {p in PROD, t in 1..T} revenue[p,t]*sell[p,t];
display sum {p in PROD, t in 1..T} revenue[p,t]*sell[p,t];
display {p in PROD, t in 1..T} (revenue[p,t]*sell[p,t], prodcost[p]*Make[p,t);
display ORIG, DEST, LINKS, PROD > multi.out;
display supply > multi.out;
close multi.out;
display demand > multi.out;
display demand >> multi.out;
Bounds and slacks:
Variables: display Buy.lb, Buy.ub, Buy.slack;
Constraints: display Time.lb, Time.body, Time.ub, Time.slack;
Dual values and reduced costs:
Dual values of constraints: display Time;
Reduced cost of variables: display Buy.rc;
drop:
ignore certain constraints or objectives
Model: subject to diet_max {i in MAXREQ}
sum {j in FOOD} amt[i,j] * Buy[j] <= n_max[i];
drop {diet_max["CAL"]};
drop {i in MAXREQ} diet_max[i];
drop diet_max;
restore:
reverse the effect of drop. It has the same syntax. Except for the keyword restore.
fix:
fix specified variables at their current value.
Model:
var Buy{j in FOOD} :=f_min[j], >=f_min[j], <=f_max[j];
ampl: fix {j in FOOD: amt["NA",j] > 1200} Buy[j];
unfix:
reverse the effect of fix.
reset:
delete the current data for several model components without changing the current model.reset data MINREQ, MAXREQ, amt, n_min, n_max;
reset data;
update:
similar to reset, but does not delete any data until new values are assigned.update data MINREQ, MAXREQ, amt, n_min, n_max;
let:
change particular data values while leaving the model the same.
let f_max["CHK"] := 11;
let {f in FOOD} f_max[f] := 8;
let {f in FOOD} f_max[f] := 2 * f_max[f];
You may put the commands into a file, and run them automatically by typing include and the filename.
diet.run:
model diet.mod;
data diet.dat;
solve;
display Buy;
ampl:
include diet.run;