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.




  1. 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:


    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:

    • The model function  F  can in practice often be written as
      In this case, we say that the DAE is semi-implicit.

    • Another special case, which often occurs in practice, is that the function  F  is linear in  dx/dt  such that we have
      for a matrix valued function M. However, in ACADO linear dependencies are automatically detected such that from the user point of view, we do not have to make a difference between linear and fully-implicit DAEs.

    [back to top]

     

  2. 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:

    [back to top]

     

  3. DAE optimization options for advanced users

    work in progress

[back to top]