Reusing optimal values

Frequently asked questions about GAMS

Moderator: aileen

Forum rules
Please ask questions in the other sub-forums
Locked
aileen
User
User
Posts: 136
Joined: 4 years ago

Reusing optimal values

Post by aileen »

How can I save the optimal values of a certain variable x that appears in one model, and reuse in another model that is otherwise unrelated, i.e. the save/restart facilities are not appropriate?
aileen
User
User
Posts: 136
Joined: 4 years ago

Re: Reusing optimal values

Post by aileen »

Write the level and the marginals of the variables you are interested in into a GDX container and load that GDX container into your second model.

At the end of the first model add something like (assuming that you are interested in x): execute_unload 'results.gdx', x; and load this data into your second model before the solve statement: execute_loadpoint 'results.gdx', x;

Another approach is to use the savePoint option. Just add a line option savePoint=1; or option savePoint=2; to your first model before the solve statement. In your second model add the line execute_loadpoint 'name_of_the_first_model_p.gdx';.
Locked