# Re: [AMPL 24419] AMPLPY using list as a parameter value

For the specific situation you are describing, the following definitions would be sufficient:

``````set D circular = {'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'} ;
param demand {D};

var x {D} >= 0;

subject to day_constraint {d in D}:
sum {dd in D diff {next(d),next(d,2)}} x[dd] >= demand[d];
``````

Then you would just need to provide AMPL with data for param demand. However, if you need something more general then you can use an indexed collection of AMPL sets:

``````set D circular = {'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'} ;
set O {D};
param demand {D};

var x {D} >= 0;

subject to day_constraint {d in D}:
sum {dd in D diff O[d]} x[dd] >= demand[d];
``````

Then you also need to provide AMPL with the members of the sets O[d] for each d in D. Write back if you need help with that.

Thanks so much Robert for your prompt response and amazingly elegant solution!! Greatly appreciate it. AMPL is just fantastic!

Thanks
Atma