Optimization of Differential Algebraic Systems (DAEs)

This tutorial explains how to solve optimal control problems for which the model equation contains not only differential, but also algebraic states.

Mathematical formulation of general DAE optimization problems

For the general DAE formulation we summarize the differential and algebraic states of the DAE in one vector x . Moreover, we denote by u the control input, by p a constant parameter, and by T the time horizon length of an DAE optimization problem. The general problem formulation reads now as follows:

\begin{eqnarray*} \displaystyle\min_{x(\cdot), u(\cdot), p, T} & \Phi(x(\cdot), u(\cdot), p, T) \\ \textrm{subject to} & \\ \forall t \in [0,T]: & 0 = F(t, x(t), \dot{x}(t), u(t), p), \\ \forall t \in [0,T]: & 0 \leq h(t, x(t), u(t), p), \\ & 0 = r(x(0), x(T), p)\\ \end{eqnarray*}

Here, the function F denotes the model equation, Φ the objective functional, h the path constraints, and r the boundary constraints of the optimization problem.

Remarks:

An ACADO tutorial code for semi-implicit DAEs

The following piece of code illustrates how to setup a simple DAE optimization problem for the case that the DAE is semi-implicit:

#include <acado_optimal_control.hpp>
#include <include/acado_gnuplot/gnuplot_window.hpp>

int main( )
{
        USING_NAMESPACE_ACADO
        
        // INTRODUCE THE VARIABLES:
        // -------------------------
        DifferentialState     x;
        DifferentialState     l;
        AlgebraicState        z;
        Control               u;
        DifferentialEquation  f;
        
        const double t_start =  0.0;
        const double t_end   = 10.0;
        
        // DEFINE A DIFFERENTIAL EQUATION:
        // -------------------------------
        f << dot(x) == -x + 0.5*x*x + u + 0.5*z;
        f << dot(l) ==  x*x + 3.0*u*u            ;
        f <<      0 ==  z + exp(z) - 1.0 + x     ;
        
        
        // DEFINE AN OPTIMAL CONTROL PROBLEM:
        // ----------------------------------
        OCP ocp( t_start, t_end, 10 );
        ocp.minimizeMayerTerm( l );
        
        ocp.subjectTo( f );
        ocp.subjectTo( AT_START, x == 1.0 );
        ocp.subjectTo( AT_START, l == 0.0 );
        
        GnuplotWindow window;
        window.addSubplot(x,"DIFFERENTIAL STATE  x");
        window.addSubplot(z,"ALGEBRAIC STATE  z"   );
        window.addSubplot(u,"CONTROL  u"   );
        
        
        // DEFINE AN OPTIMIZATION ALGORITHM AND SOLVE THE OCP:
        // ----------------------------------------------------
        OptimizationAlgorithm algorithm(ocp);
        
        algorithm.set( ABSOLUTE_TOLERANCE    , 1e-7          );
        algorithm.set( INTEGRATOR_TOLERANCE  , 1e-7          );
        algorithm.set( HESSIAN_APPROXIMATION , EXACT_HESSIAN );
        
        algorithm << window;
        algorithm.solve();
        
        return 0;
}

Running this example, the corresponding Gnuplot output should look as follows:

example_006_1.jpg
Simulation results

DAE optimization options for advanced users

work in progress

Next example: Optimal Control of Discrete-Time Systems



acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Sat Jun 8 2019 19:40:23