Programs with multiple solve statements

Top  Previous  Next

Multiple solve statements can be present in a program.

Example:

(PROLOG.gms , Risk.gms)

solve nortonl using nlp maximizing z;

solve nortonn using nlp maximizing z;

solve nortone using nlp maximizing z;

 

loop (raps,rap=riskaver(raps);

            solve evportfol using nlp maximizing obj ;

            var = sum(stock, sum(stocks,

                invest.l(stock)*covar(stock,stocks)*invest.l(stocks))) ;

            output("rap",raps)=rap;

            output(stocks,raps)=invest.l(stocks);

            output("obj",raps)=obj.l;);

Notes:

If you have to solve sequences of expensive or difficult models, you should consider using save and restart to interrupt and continue program execution.
When more than one solve statement is present, GAMS uses information from the previous solution to provide a starting point for the next solution (see the Basis chapter for a discussion).
Multiple solve statements can be used not only to solve different models, but also to conduct sensitivity tests, or to perform case (or scenario) analysis of models by changing data or bounds and then solving the same model again (risk.gms).