ampl display variable depending on a condition

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 18:12:31

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!