AMPL error, duplicate number for set

对着背影说爱祢 提交于 2019-12-13 18:31:07

问题


In AMPL, I have a set which should store some similar values. But I have a "duplicate number" error.

Is there any way to do that? What is the simplest method to solve this problem?

The set is:

set A;

data: set A := 1 1 2;

Thanks


回答1:


Set elements should be unique in AMPL. To store duplicate values use parameter instead:

set S;
param A{S};
data;
param:
 S: A :=  
 1  1
 2  1
 3  2;


来源:https://stackoverflow.com/questions/26739400/ampl-error-duplicate-number-for-set

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