Accelerate the solving procedure of dynamic CGE models using GAMS

GAMS is one of popular software that are used to solve CGE models. However, the whole solution procedure will be quite time-consuming if your models are extended to dynamic ones with more regions and more sectors. This slow-down mainly comes from two parts. The first is the increased dimensions of regions and sectors and the second is the increased distance between initial guessed vector and equilibrium solution.

For example, in the newest version of global CGE model developed by myself based on GTAP 8 database, there are nine regions and 57 sectors. If I use aggregated armington goods assumption, which means each sector demands one type of armington good of sector i, it just takes less than two minutes to solve one scenario for one year. However, if the aggregated armington goods assumption is relaxed, which means each sector demands different armington goods of sector i, it would take nearly 45 minutes to solve one scenario for one year, more than 20 times than the previous one.

Now comes the question. Whether the solving time can be reduced or not?

As I have mentioned above, the “dimension curse” cannot be solved easily only if the solver (for example, PATH) is updated and optimized. Moreover, the purpose of increasing dimensions is to simulate the economic system more precisely, and we cannot analyze certain policies with such low dimensions. As a result, we have to find new ways.

Fortunately, initial distances can be reduced. If we guess a solution vector which is closer to the equilibrium state, we will wait much shorter time.

Just take MPSGE solver as an example, the default initial value is zero for each variable. If you set up a scenario path and run your recursive dynamic model from year 2007 to 2020. the initial values will all be zeros, which means your initial residuals will be farther year by year, causing longer time to solve the model.

But why using zeros to guess the solution sets in each year? Generally, a dynamic scenario path would not change the solution a lot between sequent two years. In that case, we could absolutely use the solution set calculated in the previous year to guess the equilibrium solution in this year. Using this method will get extremely small initial residuals.

Assume your model names Dyn_CGE, the steps in detail is listed as follows:

  1. Use
    Dyn_CGE.Savepoint = 1;

    to told GAMS to save variable levels each time after finding a solution set.

  2. Use
    EXECUTE_LOADPOINT 'Dyn_CGE_p';

    statement to load solution found in previous year’s iteration before your “SOLVE” statement.

Once updated, you will find that initial residuals will maintain at very low levels except in the first year. Time consumed in the first year is worthy for finding a solution vector which is relatively close to the equilibrium state.

Following contents are excerpted from McCarl GAMS User Guide:

This option tells GAMS to save a point format GDX file that contains the information on the current solution point. One can save the solution information from the last solve or from every solve. The points that are saved can be used to provide an advanced basis, integer program starting point or NLP starting point.

In one of my recent Monte Carlo simulation using CGE model, the 1000-times experiment takes only one and a half hour to finish which is greatly reduced from origin 10 hours.

That’s amazing! Just try it now!