In the constraint
subject to six_fivea {t in 1..T}:
sum {k in reservoirs} open_res[k,1] >= resmin_num_fperiod[k];
there are two errors. First, k is only defined on the left side of the >= constraint, where it is used in the summation; AMPL cannot determine what value of k to use on the right side. This is the cause of the "k is not defined" error message. Second, the parameter on the right side has been defined to be indexed over two sets:
param resmin_num_fperiod {reservoirs,1..T};
Thus when you refer to resmin_num_fperiod you need to index it with two "subscripts" -- for example, resmin_num_fperiod[k,t] would be acceptable, but not resmin_num_fperiod[k]. This is the cause of the "resmin_num_fperiod needs 2 subscripts, not 1" error message. The other error messages that you see are caused the same errors in three other constraints.
Since resmin_num_fperiod is defined as "minimum number of reservoirs that are open at the beginning of the first time period" this parameter should probably not be indexed over {reservoirs,1..T} -- it is just one number, not an indexed collection of numbers. Also the constraint six_fivea should probably not be indexed over {t in 1..T} since it does not depend on the time period t at all. (You should suspect something wrong when the constraint is indexed by t but then t is never used in the constraint expression.)
Bob Fourer
am...@googlegroups.com
=======
From:
am...@googlegroups.com [mailto:
am...@googlegroups.com] On Behalf Of Nasiru Abdullahi
Sent: Monday, August 15, 2016 8:37 PM
To: ampl
Subject: Re: [AMPL 12460] Indexing over sets and time periods
I have developed the model but I have been encountering a lot of errors, this one am stuck on it since two days ago
see the attached document for the whole model.
My problem in snstraints six_fivea, constraint six_fiveb, constraints six_sixa and constraints six_sixb.