Solving the market model
The solution of the market model with its close to 750.000 equations of which some are highly non-linear poses a serious challenge for any non-linear solver. CAPRI applies CONOPT which has proven quite stable and fast to solve both constrained system and optimization problems. However, even CONOPT would spend quite some time when trying to solve the full market model in one block after a larger shock is introduced.
Therefore, a sequence of pre-solves is introduced (see ‘arm\simu_prestep.gms’). Firstly, single commodity models are defined by only allowing changes of the endogenous variables of one commodity in the equation template. Cross prices and their effects on quantities for variables related to the current market are hence fixed. These relatively small models can typically be solved rapidly by the solver, and are solved in parallel based on the so-called “grid solve option” in GAMS. That process is repeated a few times, each time updating the cross prices, to let differences between the single models and the full system decrease.
As a next step, the single products are clustered to groups where larger cross price effects can be expected, such as all cereals or all oilseeds. Again, these groups are solved repeatedly, in each round with updated cross-prices, to close in to the final solution. The full system is only solved at the very end.
Heuristics track the time needed for these solves and determine if it looks promising to skip solving single commodity and start with solving the groups or even the full model directly. The solution time of the model clearly depends on the hardware platform the models runs, but the heuristics do not take that into account. Accordingly, it cannot be guaranteed that the model finds exactly the same solution in a scenario on different machines.
Another problem possible problem beside long solution times is the occurrence of infeasibilities. Bounds are generally introduced for all endogenous variables to avoid numerical errors such as a division by zero. Bounds also help the solver in the solution process. However, they might also restrict the solution space so that no feasible solution exists. The CES functions for the Armington might as a response to a larger price shocks – e.g. provoked by removal of very large tariffs – drive trade flows almost to zero towards their lower bounds. Once that bounds are hit, the equation system is not longer symmetric as a new constraint becomes binding, and typically, the system will become infeasibility. If one would have the time to inspect the solution, one might perhaps accept that if the infeasibility is small and found only for that CES share equation. It is however generally impossible to leave it up to the model user to decide if she accepts infeasibility solutions or not, simply as there is simply not enough time to check these infeasibilities.
Fortunately, CONOPT helps us with in that case as it uses a gradient approach to reduce the sum of infeasibilities. It therefore introduces an objective into our problem, does also adding dual values to the constraints. We hence can inspect automatically the solution to find out which bounds carry a shadow values – removing these bounds will reduce the sum of infeasibilities. There is hence code (‘arm\widen_bounds.gms’) which in case of a infeasible solution will check which bounds carry dual values and will expand those stepwise. That proceeding generally guarantees that for most shocks, the market model finds a feasible solution.