Model not full optimized - Finishes yearlier

Problems with modeling
Post Reply
pmgcs74@gmail.com
User
User
Posts: 10
Joined: 5 months ago

Model not full optimized - Finishes yearlier

Post by pmgcs74@gmail.com » 2 weeks ago

Hi,

I'm modeling (NLP - CONOPT) a entire year for a battery (8760 hours) with some constraints, variables and limits.

The results were not so good as I expected. The model left a lot of optimization to do
So I run it in several pieces (1 month each time) and sum the results in the end.
With this approach the results were much better.

It seems like GAMS "give up" (convergence too slow) on finding the best solution when running the 8760 hours model.

Is it possible that the model is to big?
Can I make GAMS run automatic 12 (1 for each month) smaller problems in order to be faster and more effective?

Thanks
Paulo

User avatar
dirkse
Moderator
Moderator
Posts: 145
Joined: 4 years ago
Location: Fairfax, VA

Re: Model not full optimized - Finishes yearlier

Post by dirkse » 2 weeks ago

Paulo,

There are many reasons that CONOPT might terminate with a "convergence too slow" message. The log file is structured to provide clues about this when it occurs - it would help to see that attached to your post. The model size might be an issue. Or perhaps there are underlying issues that don't come to the surface if you solve only the smaller, monthly version of the model.

You ask about having GAMS (or more likely the solver) automatically run your yearly model as 12 smaller monthly models. In general a solver cannot do this - this would ignore constraints that span the gap between months. In this case, the state of the battery is one such item. It sounds like you are solving as 12 monthly models solved in sequence, so this would allow you to keep the battery state consistent between months, but you are not guaranteed to get an optimal yearly strategy this way. For example, this would ignore the benefits of finishing one month fully charged because of high demand or prices in the next month.

-Steve

pmgcs74@gmail.com
User
User
Posts: 10
Joined: 5 months ago

Re: Model not full optimized - Finishes yearlier

Post by pmgcs74@gmail.com » 2 weeks ago

Hi Steve,

Thanks for your reply.
The model is quite complex and when I reduce the complexity I get better results... this is my problem
To reduce complexity means to let the solver to choose within 1 market instead of 3 markets to get the better solution. 1 market is a subset of the 3 markets. It should a least give me the same result

Yes, I'm solving as a 12 models in sequence (Manually). You have a point that I don't get full optimization because I need to set the boundaries/constraint, battery fully charge at the last hour at the end of each month. Since each month have more than 700 hours this is not a big issue for me.

Do you know if it is possible to automate this model running in sequence ? This could help me on this project and other projects when I need to run for several years

Thanks Steve
Paulo

User avatar
dirkse
Moderator
Moderator
Posts: 145
Joined: 4 years ago
Location: Fairfax, VA

Re: Model not full optimized - Finishes yearlier

Post by dirkse » 2 weeks ago

Paulo,

Yes, it is possible to run the 12 months automatically. You would do this using a loop: this is a very typical thing to do in GAMS. You can read all about loops in the docs:

https://www.gams.com/latest/docs/UG_Flo ... ntrol_Loop
https://www.gams.com/latest/docs/UG_ModelSolve.html (search for loop)

And many models in the GAMS Model Library solve models in loops, including knights, senstran, and icut.

Typically you would run the models in sequence, because the end condition for January is the start for February. If your models are truly independent, there are also ways to run them simultaneously in individual threads, but I would advise first making this work by running them in sequence. An example showing how to run models in parallel on independent threads is given in model tgridmix.

HTH,

-Steve

pmgcs74@gmail.com
User
User
Posts: 10
Joined: 5 months ago

Re: Model not full optimized - Finishes yearlier

Post by pmgcs74@gmail.com » 2 weeks ago

Thanks a lot Steve !!!

Regards
Paulo

Post Reply