Iterative models/ Dynamic sets

Problems with modeling
Post Reply
Leon
User
User
Posts: 2
Joined: 1 week ago

Iterative models/ Dynamic sets

Post by Leon » 1 week ago

Dear All,

I am working on a power model that the output of the day 1 will be used as an input for the second day and it will continue for a month.
I tried to do this procedure for this goal. I defined a set: tt /1*744/ and then defined adynamic set day1(tt) /1*24/. Day2(tt) /25*48/....Day31(tt)/720*744/
Alias (t,Day1(tt));
I have lots of parameters and variables depended on time (like: Loading for different days(t,x)) with many constraints.
After the model declaration and minimizing the objective for the first iteration(day). I would like to update some of my parameters and then use the "day2" for all the parameters. Something like this

solve model using MIP minimizing obj1; //for the first day//

then: Alias (t, Day2(tt)); // I already know I cant redefine a set but I do not have any clue how I should solve this issue//
Update some of the parameters

solve model using MIP minimizing obj1; //for the second day//

* and same steps till the 31 days.



Best,
Leon

User avatar
Renger
Posts: 127
Joined: 1 year ago

Re: Iterative models/ Dynamic sets

Post by Renger » 1 week ago

Hi Leon

Instead of having everything based on the hours, you make them depending on hours (1*24) and days (1*31).
You then loop over the days:

Code: Select all

loop(day,
     assing parameter values from tables
     solve mymodel
     assign solution to other parameters
     )

e.g.
A parameter is also defined over days and hours

Code: Select all

  table capacity(day,hours)
     1 2 3 4 5 ... 24
  1
...
31
Hope this helps
Renger

Leon
User
User
Posts: 2
Joined: 1 week ago

Re: Iterative models/ Dynamic sets

Post by Leon » 5 days ago

Thank you Renger. It solved my problem.
Before I post my question, I checked the GAMS world for any similar question and I saw your response to other people as well.
That is really kind of you.
Thank you again.

Post Reply