问题
suppose we have the following ampl model:
set objects;
set sacks;
...
var Take{objects, sacks} binary;
...
display Take;
after solving the optimization problem I want to display only the lines of Take that equal 1
回答1:
You can do something like this:
for{o in objects, s in sacks: Take[o,s] = 1} {
printf "\n %s %s", o,s;
}
来源:https://stackoverflow.com/questions/49281515/ampl-display-variable-depending-on-a-condition