## 1. A new specialized class: optimization

A new specialized class, called `optimization`

, in which the proposed Optimica-specific constructs are valid is supported by Optimica. This approach is consistent with the Modelica language, since there are already several other specialized classes, e.g., `record`

, `function`

and `model`

. By introducing a new specialized class, it also becomes straightforward to check the validity of a program, since the Optimica-specific constructs are only valid inside an `optimization`

class. The `optimization`

class corresponds to an optimization problem, static or dynamic, as specified above. Apart from the Optimica-specific constructs, an `optimization`

class can also contain component and variable declarations, local classes, and equations.

It is not possible to declare components from `optimization`

classes in the current version of Optimica. Rather, the underlying assumption is that an `optimization`

class defines an optimization problem, that is solved off-line. An interesting extension would, however, be to allow for `optimization`

classes to be instantiated. With this extension, it would be possible to solve optimization problems, on-line, during simulation. A particularly interesting application of this feature is model predictive control, which is a control strategy that involves on-line solution of optimization problems during execution.

As a starting-point for the formulation of the optimization problem consider the `optimization`

class:

optimization DIMinTime
DoubleIntegrator di;
input Real u = di.u;
end DIMinTime;

This class contains only one component representing the dynamic system model, but will be extended in the following to incorporate also the other elements of the optimization problem.