Hi,
In the program I need to solve an optimization many times. Every time
the model is the same. The only difference is I fix some different
virables before solving them. I seem to have heard
that if the model is the same, there is a function in gams that can
keep the model after building it the first time. So it can save time
on generating models. Do you know how can I do this?
Thanks.
Gary
\
Gary,
The feature you are refering to is the “Scenario Solver”. This is
under current development and a beta version is part of the recent
GAMS systems. There is no documentation just a simple example model
(http://www.gams.com/testlib/libhtml/scensol1.htm). The Scenario
Solver has the advantage of generating the model just once and use
some update mechanism to go from model instance to model instance. You
can do more than have different bounds on variables, you can actually
change matrix coefficients and nonlinear expressions based on data in
a reliable fashion. Moreover, Scenario Solver keeps the model hot
inside the solver (if the solver permits this), so the time for
setting up the model inside the solver is also reduced and the solver
(if available) can use hot starts.
There are restrictions when using the current version of Scenario
Solver:
- You need to have all the data for all the models runs ready at the
first model generation, i.e. the modification of a subsequent model
cannot depend of the outcome of a previous model.
- The model rim (equations, variables) cannot change from model to
model
- We currently only support some model types and solvers with Scenario
Solver (all the solvelink=5 “in-core” solvers like, ConoptD, MinosD,
CplexD, Gurobi and their model types). So no MINLP and MCP for now.
Scenario Solver shows its power when you have many small models that
are quick to solve and benefit from hot starts in the solver (mostly
LPs). If ratio model solution time/model generation time becomes
bigger, the performance improvements of Scenario Solver versus an
ordinary GAMS loop become smaller.
As I mentioned Scenario Solver is still under development and its use
is not as easy as it should be. You can already improve the overall
performance in a regular GAMS model by 1) changing your solvelink
setting to 2 or 5 (see McCarl User’s Guide for details), and b) tuning
your model generation. Turn on “profile” and see which equations take
a long time to generate. If you have a lot of $() condition logic you
might be able to improve generation time by introducing subsets ahead
of time and using those to express the logic.
Hope this helps,
Michael Bussieck - GAMSWorld Coordinator
On Aug 2, 5:12 pm, gary wrote:
Hi,
In the program I need to solve an optimization many times. Every time
the model is the same. The only difference is I fix some different
virables before solving them. I seem to have heard
that if the model is the same, there is a function in gams that can
keep the model after building it the first time. So it can save time
on generating models. Do you know how can I do this?
Thanks.
Gary
\