# A Matlab Package (OCMat) for Analyzing Optimal Control Problems

**FWF Project No.**** P23084**, (2010 - 2013), Project leader: Dieter Grass

Keywords: Optimal Control Theory, Multiple Optimal Solutions, Bifurcation Theory, Infinite Time BVP

The main topic of this project was the development of a MATLAB based software package (OCMat), that allows the analysis of optimal control problems over an infinite time horizon. Since most of the models are not analytically tractable the analysis relies on numerical methods. One of the difficulties for problems over an infinite time horizon is the provision of conditions that the solution has to satisfy ‘at the end’. In a first step the models limiting behaviour is analyzed.

This includes the calculation of steady states, periodic solutions and possible divergent behaviour as well. When all possible long-run solutions are determined this information is used to calculate the solutions for arbitrary initial points. Therefore, the numerical algorithm bases on a boundary value solver combined with a continuation step. This approach allows to start from the long-run solution to continue and find the solution for arbitrary initial states or parameter values.

OCMat is implemented within the MATLAB environment. Using the symbolic computation capabilities of MATLAB many of the necessary recurrent steps were automatized. Specifically this includes the derivation of the first order necessary optimality conditions and the generation of the MATLAB files that are needed for the numerical computations. Therefore, the user writes an initiation function and usually the automatization procedure allows to start a few minutes later with the numerical analysis. Even though this task is not of specific mathematical interest it eases the handling tremendously and changes in the model formulation can be adapted very fast and flexible.

A further task, beside the development of the numerical algorithms, was the provision of a programming environment that facilitates the storing and reloading of (numerical) results. But also the graphical depiction and printing used for presentations and publications. Therefore, the object oriented programming environment of MATLAB was used. This allows a consistent representation of the different models and the provision of specific functions for loading, storing, plotting, etc.

Beyond the scientific work another important aspect is the dissemination of the results within the non-scientific community. A promising approach is the graphical presentation as short animations, where the entire information about the models behaviour can be maintained but the underlying mathematics is removed. For that purpose an interface to the opens source software ‘Synfig Studio’ and ‘Blender’ (for 2D/3D animations) were programmed. This opens the possibility for a discussion between the scientist and public on equal terms. Examples from a talk held at the workshop ‘The Economics of Complex Systems workshop, April 28-29 at the Beijer Institute of Ecological Economics, can be downloaded from orcos.tuwien.ac.at/research/ocmat_software/.