gams:reusing_optimal_values

*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.*

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';`

.

IMPRESSUM / LEGAL NOTICE
PRIVACY POLICY
gams/reusing_optimal_values.txt · Last modified: 2020/05/18 15:15 by Michael Bussieck