Hi AMPL experts! I’m running into unexpected behavior. I have the following definitions:
param timeInterval default 5;
set minutes := 0..59 by timeInterval;
set hours := 800..1500 by 100;
set timeSlots := setof{h in hours, m in minutes} (h + m);
set times := {days, timeSlots};
set schedule within {grades, days, st in timeSlots, et in timeSlots: st <= et - timeInterval};
set scheduleTimes{(g,d,st,et) in schedule} := {(d,t) in {days, timeSlots}: t <= et - timeInterval and t >= st};
In my mind, each indexed set scheduleTimes should be comprised of ordered pairs like (M, 845). (The timeSlots st and et are start times and end times for an interval.)
But, for some really simple data, I don’t get ordered pairs.
ampl: display scheduleTimes;
set scheduleTimes[5,M,845,900] := 845 850 855; <--- These are just timeSlots
If I manually enter a diplay command like the following, I get the expected behavior:
ampl: display {(d,t) in {days, timeSlots}: t <= 900 - timeInterval and t >= 845};
set {d in days, t in timeSlots: t <= 900 - timeInterval && t >= 845} :=
(M,845) (M,855) (T,850) (W,845) (W,855) (R,850) (F,845) (F,855)
(M,850) (T,845) (T,855) (W,850) (R,845) (R,855) (F,850); <--- Ordered pairs
Any thoughts? Happy to send the whole model and data file, if it would be helpful. They are still quite small.
Thanks,
Andy