Iterative Hotstarts

Questions on using the GAMS APIs (Python, .NET, etc.)
Post Reply
S. Marnach
User
User
Posts: 2
Joined: 5 months ago

Iterative Hotstarts

Post by S. Marnach » 5 months ago

I would like to have iterative hot starts:
I want to adjust some parameter, solve my problem, look at the solution, adjust that parameter again and then resolve the problem as a hot start; starting from the solution the last solve call yielded.... adjust that parameter again, resolve as hot start from the solution of the previous solve call .... and so on.

Can i do that via iterative calls to "solve" on the same modelInstance (and changing the parameter via its sync db beforehand) or will each solve call start in the state provided by the checkpoint the instance was generated from. And if thats possible will i have to clear the sync_db in each iteration before passing my "new" adjustments (will the previous adjustments still be in sync_db?)? If thats not possible, how else can i achieve that? Do i just have to preset all variables of a new instance?

Thanks
S. Marnach

User avatar
bussieck
Moderator
Moderator
Posts: 615
Joined: 4 years ago

Re: Iterative Hotstarts

Post by bussieck » 5 months ago

The model instance after a solve saves state (primal and dual variables), so you do a restart from this. For a MIP there is little you can do with this information though (perhaps a mipstart). The syncdb does not through away the modifiers from before the solve statement, so if you don't want to apply them for the next solve you need to clear them (see e.g. transport7.py, https://www.gams.com/latest/docs/API_PY ... G_MODIFIER): xup.clear(). You can specify in the modifier how the modifiers are applied (e.g. on top of the instantiated model or accumulated) via the update_type argument.

Hope this helps,
-Michael

S. Marnach
User
User
Posts: 2
Joined: 5 months ago

Re: Iterative Hotstarts

Post by S. Marnach » 5 months ago

Thank you Michael,
this helps a lot.

Best regards
S. Marnach

Post Reply