condensing_based_cp_solver.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 
00034 #ifndef ACADO_TOOLKIT_CONDENSING_BASED_CP_SOLVER_HPP
00035 #define ACADO_TOOLKIT_CONDENSING_BASED_CP_SOLVER_HPP
00036 
00037 #include <acado/utils/acado_utils.hpp>
00038 #include <acado/matrix_vector/matrix_vector.hpp>
00039 #include <acado/conic_solver/banded_cp_solver.hpp>
00040 #include <acado/conic_solver/dense_qp_solver.hpp>
00041 
00042 
00043 
00044 BEGIN_NAMESPACE_ACADO
00045 
00046 
00059 class CondensingBasedCPsolver: public BandedCPsolver {
00060 
00061 
00062     //
00063     // PUBLIC MEMBER FUNCTIONS:
00064     //
00065     public:
00066 
00068         CondensingBasedCPsolver( );
00069                 
00070         CondensingBasedCPsolver(        UserInteraction* _userInteraction,
00071                                                                         uint nConstraints_,
00072                                                                 const DVector& blockDims_
00073                                                                 );
00074 
00076         CondensingBasedCPsolver( const CondensingBasedCPsolver& rhs );
00077 
00079         virtual ~CondensingBasedCPsolver( );
00080 
00082         CondensingBasedCPsolver& operator=( const CondensingBasedCPsolver& rhs );
00083 
00084 
00086         virtual BandedCPsolver* clone() const;
00087 
00088 
00090         virtual returnValue init( const OCPiterate &iter_ );
00091 
00092 
00094         virtual returnValue prepareSolve(       BandedCP& cp
00095                                                                                         );
00096 
00106         virtual returnValue solve(      BandedCP& cp
00107                                                                         );
00108 
00110         virtual returnValue finalizeSolve(      BandedCP& cp
00111                                                                                         );
00112 
00113 
00114                 inline uint getNX( ) const;
00115                 inline uint getNXA( ) const;
00116                 inline uint getNP( ) const;
00117                 inline uint getNU( ) const;
00118                 inline uint getNW( ) const;
00119 
00120                 inline uint getNC( ) const;
00121                 inline uint getNF( ) const;
00122                 inline uint getNA( ) const;
00123 
00124                 inline uint getNumPoints( ) const;
00125 
00126 
00127                 virtual returnValue getParameters        ( DVector        &p_  ) const;
00128                 virtual returnValue getFirstControl      ( DVector        &u0_ ) const;
00129 
00130 
00136         virtual returnValue getVarianceCovariance( DMatrix &var );
00137 
00138                 
00139                 virtual returnValue setRealTimeParameters(      const DVector& DeltaX,
00140                                                                                                         const DVector& DeltaP = emptyConstVector
00141                                                                                                         );
00142 
00143                 inline BooleanType areRealTimeParametersDefined( ) const;
00144 
00145 
00146                 virtual returnValue freezeCondensing( );
00147 
00148                 virtual returnValue unfreezeCondensing( );
00149 
00150 
00151 
00152     //
00153     // PROTECTED MEMBER FUNCTIONS:
00154     //
00155     protected:
00156 
00160         virtual returnValue initializeCPsolver( InfeasibleQPhandling infeasibleQPhandling
00161                                                                                                 );
00162 
00163 
00168                 virtual returnValue solveQP(    uint maxIter,                           
00169                                                                                 InfeasibleQPhandling infeasibleQPhandling = IQH_UNDEFINED
00170                                                                                 );
00171 
00172 
00173 
00174 
00175 
00176         virtual returnValue solveCPsubproblem( );
00177 
00178 
00179 
00186         returnValue projectHessian( DMatrix &H_, double dampingFactor );
00187 
00188 
00189                 // --------
00190                 // SQP DATA
00191                 // --------
00192 
00195         returnValue condense(   BandedCP& cp
00196                                                                 );
00197 
00198 
00201         returnValue expand(             BandedCP& cp
00202                                                                 );
00203 
00204 
00205         returnValue generateHessianBlockLine   ( uint nn, uint rowOffset, uint& rowOffset1 );
00206         returnValue generateConstraintBlockLine( uint nn, uint rowOffset, uint& rowOffset1 );
00207         returnValue generateStateBoundBlockLine( uint nn, uint rowOffset, uint& rowOffset1 );
00208         returnValue generateConstraintVectors  ( uint nn, uint rowOffset, uint& rowOffset1 );
00209         returnValue generateStateBoundVectors  ( uint nn, uint rowOffset, uint& rowOffset1 );
00210 
00211 
00212         returnValue generateBoundVectors     ( );
00213         returnValue generateObjectiveGradient( );
00214 
00215 
00216         returnValue initializeCondensingOperator( );
00217                 
00218                 returnValue computeCondensingOperator(  BandedCP& cp
00219                                                                                                 );
00220 
00221 
00223         virtual returnValue setupRelaxedQPdata( InfeasibleQPhandling infeasibleQPhandling,
00224                                                                                                 DenseCP& _denseCPrelaxed                                        
00225                                                                                                 ) const;
00226 
00228         virtual returnValue setupRelaxedQPdataL1(       DenseCP& _denseCPrelaxed                                        
00229                                                                                                         ) const;
00230 
00232         virtual returnValue setupRelaxedQPdataL2(       DenseCP& _denseCPrelaxed                                        
00233                                                                                                         ) const;
00234 
00235 
00236 
00237     //
00238     // DATA MEMBERS:
00239     //
00240     protected:
00241 
00242         OCPiterate iter;
00243         DVector blockDims;
00244         uint nConstraints;
00245 
00246                 CondensingStatus condensingStatus;
00247 
00248 
00249         // THE CONDENSING OPERATORS:
00250         // -----------------------------------------------------
00251         BlockMatrix   T;    
00252         BlockMatrix   d;    
00254                 BlockMatrix  hT;
00255         // ------------------------------------------------
00256 
00257 
00258         // DENSE QP IN BLOCK-MATRIX FORM:
00259         // ----------------------------------------------------------------------
00260 
00261         BlockMatrix        HDense;    
00262         BlockMatrix        gDense;    
00263         BlockMatrix        ADense;    
00264         BlockMatrix      lbADense;    
00265         BlockMatrix      ubADense;    
00266         BlockMatrix       lbDense;    
00267         BlockMatrix       ubDense;    
00268         // ----------------------------------------------------------------------
00269 
00270 
00271         DenseCPsolver* cpSolver;
00272         DenseQPsolver* cpSolverRelaxed;
00273 
00274         DenseCP        denseCP;
00275 
00276                 DVector deltaX;
00277                 DVector deltaP;
00278 };
00279 
00280 
00281 CLOSE_NAMESPACE_ACADO
00282 
00283 
00284 #include <acado/conic_solver/condensing_based_cp_solver.ipp>
00285 
00286 
00287 #endif  // ACADO_TOOLKIT_CONDENSING_BASED_CP_SOLVER_HPP
00288 
00289 /*
00290  *  end of file
00291  */


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:58:02