optimization_algorithm_base.hpp
Go to the documentation of this file.
00001 /*
00002  *    This file is part of ACADO Toolkit.
00003  *
00004  *    ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
00005  *    Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
00006  *    Milan Vukov, Rien Quirynen, KU Leuven.
00007  *    Developed within the Optimization in Engineering Center (OPTEC)
00008  *    under supervision of Moritz Diehl. All rights reserved.
00009  *
00010  *    ACADO Toolkit is free software; you can redistribute it and/or
00011  *    modify it under the terms of the GNU Lesser General Public
00012  *    License as published by the Free Software Foundation; either
00013  *    version 3 of the License, or (at your option) any later version.
00014  *
00015  *    ACADO Toolkit is distributed in the hope that it will be useful,
00016  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  *    Lesser General Public License for more details.
00019  *
00020  *    You should have received a copy of the GNU Lesser General Public
00021  *    License along with ACADO Toolkit; if not, write to the Free Software
00022  *    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023  *
00024  */
00025 
00026 
00033 #ifndef ACADO_TOOLKIT_OPTIMIZATION_ALGORITHM_BASE_HPP
00034 #define ACADO_TOOLKIT_OPTIMIZATION_ALGORITHM_BASE_HPP
00035 
00036 #include <acado/matrix_vector/matrix_vector.hpp>
00037 #include <acado/variables_grid/variables_grid.hpp>
00038 //#include <acado/ocp/ocp.hpp>
00039 #include <acado/nlp_solver/nlp_solver.hpp>
00040 #include <acado/nlp_solver/scp_method.hpp>
00041 
00042 
00043 BEGIN_NAMESPACE_ACADO
00044 
00045 class OCP;
00046 
00047 
00065 class OptimizationAlgorithmBase
00066 {
00067     //
00068     // PUBLIC MEMBER FUNCTIONS:
00069     //
00070     public:
00071 
00073         OptimizationAlgorithmBase();
00074 
00076         OptimizationAlgorithmBase( const OCP& ocp_ );
00077 
00079         OptimizationAlgorithmBase( const OptimizationAlgorithmBase& arg );
00080 
00082         virtual ~OptimizationAlgorithmBase( );
00083 
00085         OptimizationAlgorithmBase& operator=( const OptimizationAlgorithmBase& arg );
00086 
00087 
00089         returnValue initializeDifferentialStates( const char* fileName , BooleanType autoinit=BT_FALSE);
00090         returnValue initializeAlgebraicStates   ( const char* fileName , BooleanType autoinit=BT_FALSE);
00091         returnValue initializeParameters        ( const char* fileName);
00092         returnValue initializeControls          ( const char* fileName);
00093         returnValue initializeDisturbances      ( const char* fileName);
00094 
00095         returnValue initializeDifferentialStates( const VariablesGrid &xd_init_ , BooleanType autoinit=BT_FALSE);
00096         returnValue initializeAlgebraicStates   ( const VariablesGrid &xa_init_ , BooleanType autoinit=BT_FALSE);
00097         returnValue initializeParameters        ( const VariablesGrid &u_init_);
00098         returnValue initializeControls          ( const VariablesGrid &p_init_);
00099         returnValue initializeDisturbances      ( const VariablesGrid &w_init_);
00100 
00105         returnValue simulateStatesForInitialization();
00106 
00107         returnValue getDifferentialStates( VariablesGrid &xd_ ) const;
00108         returnValue getAlgebraicStates   ( VariablesGrid &xa_ ) const;
00109         returnValue getParameters        ( VariablesGrid &u_  ) const;
00110         returnValue getParameters        ( DVector &u_  ) const;
00111         returnValue getControls          ( VariablesGrid &p_  ) const;
00112         returnValue getDisturbances      ( VariablesGrid &w_  ) const;
00113 
00114         returnValue getDifferentialStates( const char* fileName ) const;
00115         returnValue getAlgebraicStates   ( const char* fileName ) const;
00116         returnValue getParameters        ( const char* fileName ) const;
00117         returnValue getControls          ( const char* fileName ) const;
00118         returnValue getDisturbances      ( const char* fileName ) const;
00119 
00120         double getObjectiveValue         ( const char* fileName ) const;
00121         double getObjectiveValue         () const;
00122 
00123                 
00124                 returnValue getSensitivitiesX(  BlockMatrix& _sens
00125                                                                                 ) const;
00126 
00127                 returnValue getSensitivitiesXA( BlockMatrix& _sens
00128                                                                                 ) const;
00129 
00130                 returnValue getSensitivitiesP(  BlockMatrix& _sens
00131                                                                                 ) const;
00132 
00133                 returnValue getSensitivitiesU(  BlockMatrix& _sens
00134                                                                                 ) const;
00135 
00136                 returnValue getSensitivitiesW(  BlockMatrix& _sens
00137                                                                                 ) const;
00138 
00139 
00142                 virtual uint getNX( ) const;
00143 
00146                 virtual uint getNXA( ) const;
00147 
00150                 virtual uint getNP( ) const;
00151 
00154                 virtual uint getNU( ) const;
00155 
00158                 virtual uint getNW( ) const;
00159 
00160 
00161                 double getStartTime ( ) const;
00162 
00163                 double getEndTime( ) const;
00164 
00165 
00166     //
00167     // PROTECTED MEMBER FUNCTIONS:
00168     //
00169     protected:
00170 
00171                 returnValue clear( );
00172 
00174                 returnValue init(       UserInteraction* _userIteraction
00175                                                         );
00176 
00177                 BooleanType isLinearQuadratic(  Objective *F,
00178                                                                                 DynamicDiscretization *G,
00179                                                                                 Constraint *H
00180                                                                                 ) const;
00181 
00182         virtual returnValue allocateNlpSolver(  Objective *F,
00183                                                                                                 DynamicDiscretization *G,
00184                                                                                                 Constraint *H
00185                                                                                                 ) = 0;
00186 
00187         virtual returnValue initializeNlpSolver(        const OCPiterate& _userInit
00188                                                                                                         ) = 0;
00189 
00190         virtual returnValue initializeObjective(        Objective* F
00191                                                                                                         ) = 0;
00192 
00193 
00194                 virtual returnValue extractOCPdata(     Objective** objective,
00195                                                                                         DifferentialEquation*** differentialEquation,
00196                                                                                         Constraint** constraint,
00197                                                                                         Grid& unionGrid
00198                                                                                         );
00199 
00200                 virtual returnValue setupObjective(     Objective* objective,
00201                                                                                         DifferentialEquation** differentialEquation,
00202                                                                                         Constraint* constraint,
00203                                                                                         Grid unionGrid
00204                                                                                         );
00205 
00206                 virtual returnValue setupDifferentialEquation(  Objective* objective,
00207                                                                                                                 DifferentialEquation** differentialEquation,
00208                                                                                                                 Constraint* constraint,
00209                                                                                                                 Grid unionGrid
00210                                                                                                                 );
00211 
00212                 virtual returnValue setupDynamicDiscretization( UserInteraction* _userIteraction,
00213                                                                                                                 Objective* objective,
00214                                                                                                                 DifferentialEquation** differentialEquation,
00215                                                                                                                 Constraint* constraint,
00216                                                                                                                 Grid unionGrid,
00217                                                                                                                 DynamicDiscretization** dynamicDiscretization
00218                                                                                                                 );
00219 
00220                 virtual returnValue determineDimensions(        Objective* const _objective,
00221                                                                                                         DifferentialEquation** const _differentialEquation,
00222                                                                                                         Constraint* const _constraint,
00223                                                                                                         uint& _nx,
00224                                                                                                         uint& _nxa,
00225                                                                                                         uint& _np,
00226                                                                                                         uint& _nu,
00227                                                                                                         uint& _nw
00228                                                                                                         ) const;
00229 
00230                 virtual returnValue initializeOCPiterate(       Constraint* const _constraint,
00231                                                                                                         const Grid& _unionGrid,
00232                                                                                                         uint nx,
00233                                                                                                         uint nxa,
00234                                                                                                         uint np,
00235                                                                                                         uint nu,
00236                                                                                                         uint nw
00237                                                                                                         );
00238 
00239     //
00240     // DATA MEMBERS:
00241     //
00242     protected:
00243 
00244         NLPsolver *nlpSolver ;
00245         OCP       *ocp       ;
00246 
00247                 OCPiterate iter;
00248                 OCPiterate userInit;
00249 };
00250 
00251 CLOSE_NAMESPACE_ACADO
00252 
00253 #endif  // ACADO_TOOLKIT_OPTIMIZATION_ALGORITHM_BASE_HPP
00254 
00255 /*
00256  *   end of file
00257  */


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