Is there a way for GAMS interruption and re-run from where it lasted? Topic is solved

Problems with syntax of GAMS
Post Reply
dunyayigezerken
User
User
Posts: 29
Joined: 5 years ago

Is there a way for GAMS interruption and re-run from where it lasted?

Post by dunyayigezerken »

Hello,

If I have 5 hours to wait for GAMS result on Monday and 3 hours on Tuesday, and if I know that the model will be solved after 8 hours first run, is there a way to interrupt GAMS on Monday after 5 hours and run again on Tuesday from where it stopped on Monday.
So, I will get result on Tuesday but totally within 8 hours.

Thanks
User avatar
Renger
Posts: 639
Joined: 7 years ago

Re: Is there a way for GAMS interruption and re-run from where it lasted?

Post by Renger »

Hi
You might have a look at savepoint and split your models in two files.
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist
dunyayigezerken
User
User
Posts: 29
Joined: 5 years ago

Re: Is there a way for GAMS interruption and re-run from where it lasted?

Post by dunyayigezerken »

I changed the code and applied it. Flow is like the attachement but I dont understand what is going on background and I am not sure is it true. I expect that I will run my code, after 5 hours I will shut GAMS off then I will re-run it tomorrow from point where I stopped for example;

if I stop it at 5000 sec, I will run tomorrow from 5000 sec to where it lasts, not from 0 sec to where it lasts.

Does it provide this? How will I stop it and re-run from where I stopped tomorrow?

Thanks,
Screenshot.PNG
Fred
Posts: 372
Joined: 7 years ago

Re: Is there a way for GAMS interruption and re-run from where it lasted?

Post by Fred »

Hi,

it seems that you do not want to restart GAMS but a solver run. There is no way to do this.
With savepoint you can conveniently store a solution in a gdx file. You could load that solution a a start point the next day but that does not mean that the solver just restarts from the state of second 5000 from the previous day.

I hope this helps!

Fred
dunyayigezerken
User
User
Posts: 29
Joined: 5 years ago

Re: Is there a way for GAMS interruption and re-run from where it lasted?

Post by dunyayigezerken »

Hi Fred,

Thanks for your answer, I will do it like that

Code: Select all


my model block 

Model optvar /all/ ;  

optvar.savepoint=1;
optvar.nodlim = 1000000;
option mip=bdmlp,limrow=0,limcol=0;

solve optvar using mip maximizing z ;

option clear=z,clear=k1,clear=k2,clear=k3,clear=k4,clear=k5,clear=k7,clear=k8,clear=k9,clear=k10,clear=k11,clear=k12,clear=k13,clear=k14,clear=k15,clear=k16;

a.l(i) = 0; a.m(i)=0; b.l(i)=0; b.m(i)=0; c.l(i)=0; c.m(i)=0; x.l(i,j)=0; x.m(i,j)=0; y.l(i,k)=0; y.m(i,k)=0; y1.l(i,k)=0; y1.m(i,k)=0; y2.l(i)=0; y2.m(i)=0;

execute_loadpoint 'optvar_p';

solve optvar using mip maximizing z;

abort$(optvar.solvestat <> %solvestat.NormalCompletion% or
       optvar.modelstat <> %modelstat.Optimal% or
       optvar.iterusd   <> 0    )  'something really wrong';
Does it create gdx file and how can I load another day to go on?
Fred
Posts: 372
Joined: 7 years ago

Re: Is there a way for GAMS interruption and re-run from where it lasted?

Post by Fred »

You can find the info you need in the documentation:

https://www.gams.com/latest/docs/UG_Gam ... Osavepoint
https://www.gams.com/latest/docs/UG_GDX ... _LOADPOINT

Providing a start point to a MIP solver may require to set an extra solver option (see e.g. viewtopic.php?f=2&t=11234).

In general, i am skeptical that this approach will gain you much. In the screenshot, the solver did not (yet) find a single integer feasible solution. If you have no solution after day 1, you cannot provide a solution as starting point on day 2 and will have to start from scartch again. Even if you would have a feaisble solution you could provide as a starting point, there is a chance but no guarantee that this will speedup the solution process.

I wonder why you actually have to interupt...?
If it takes too long to find a (optimal) solution, you might also want to consider things like
- Is the version you are using up to date? If not, there is a chance that updating improves performance.
- Is the model formulation good? (Often, there are many alternative formulations, some work better than others).
- Is the model well scaled?
-...

Fred
dunyayigezerken
User
User
Posts: 29
Joined: 5 years ago

Re: Is there a way for GAMS interruption and re-run from where it lasted?

Post by dunyayigezerken »

Hello Fred,

Your questions are fair-enough. However, I need it, because I use office computer and dont have any possibility to get it home with me. So, I want to slide the program working from where I stop. I think this will be necessary feature if it is possible. Besides, for your questions, model and formulation are good however gams version is old. But, the main subject here is a way of what I need,
In addition, I really dont understand what is the mission of interrupt button on GAMS. I use to cut programme where I want. But it cannot be shown feasible solution.

Thanks,
Kind regards,
Post Reply