Fixing parts of multidimensional variable for another run
Posted: Wed Jan 04, 2023 6:47 pm
Hey guys,
I am somewhat of a beginner in GAMS. Therefore excuse me if the question is trivial. Still would be very thankful for your help.
I'll try and explain the problem I have:
I want to create a timetable. Through modeling I got a binary variable X(c, r, t, s, h, d) which is 1 if class c in room r is taught by teacher t in subject s at hour h on day d and 0 else.
Now I am supposed to change the teacher assignement, while the rest of the timetable remains the same. (One could imagine new teachers arrive and you would have to rebalance the schedule). How am I supposed to use the .fx here? Alternatively, I could write a new model using something like this:
but it does not seem too practical to do it that way. I think you could probably use loop() here, my idea was something like this, which does not work:
Would anyone be willing to give a hint?
Best regards
I am somewhat of a beginner in GAMS. Therefore excuse me if the question is trivial. Still would be very thankful for your help.
I'll try and explain the problem I have:
I want to create a timetable. Through modeling I got a binary variable X(c, r, t, s, h, d) which is 1 if class c in room r is taught by teacher t in subject s at hour h on day d and 0 else.
Now I am supposed to change the teacher assignement, while the rest of the timetable remains the same. (One could imagine new teachers arrive and you would have to rebalance the schedule). How am I supposed to use the .fx here? Alternatively, I could write a new model using something like this:
Code: Select all
...
parameter InputNew(c, r, s, h, d);
InputNew(c, r, s, h, d) = sum(t, X.l(c, r, t, s, h, d));
...
Code: Select all
loop(c,
loop(r,
loop(s,
loop(h,
if ((x.l(c, r, t, s, h, d) = 1;
X.fx(c, r, t, s, h, d) = sum(t, X.l(c, r, t, s, h, d)));
);
);
);
);
Best regards