Search code examples
setampl

AMPL error, duplicate number for set


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


Solution

  • 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;