QProblem.hpp
Go to the documentation of this file.
00001 /*
00002  *      This file is part of qpOASES.
00003  *
00004  *      qpOASES -- An Implementation of the Online Active Set Strategy.
00005  *      Copyright (C) 2007-2008 by Hans Joachim Ferreau et al. All rights reserved.
00006  *
00007  *      qpOASES is free software; you can redistribute it and/or
00008  *      modify it under the terms of the GNU Lesser General Public
00009  *      License as published by the Free Software Foundation; either
00010  *      version 2.1 of the License, or (at your option) any later version.
00011  *
00012  *      qpOASES is distributed in the hope that it will be useful,
00013  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  *      Lesser General Public License for more details.
00016  *
00017  *      You should have received a copy of the GNU Lesser General Public
00018  *      License along with qpOASES; if not, write to the Free Software
00019  *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00020  *
00021  */
00022 
00023 
00036 #ifndef QPOASES_QPROBLEM_HPP
00037 #define QPOASES_QPROBLEM_HPP
00038 
00039 
00040 #include <QProblemB.hpp>
00041 #include <Constraints.hpp>
00042 #include <CyclingManager.hpp>
00043 
00044 
00053 class QProblem : public QProblemB
00054 {
00055         /* allow SolutionAnalysis class to access private members */
00056         friend class SolutionAnalysis;
00057         
00058         /*
00059          *      PUBLIC MEMBER FUNCTIONS
00060          */
00061         public:
00063                 QProblem( );
00064 
00066                 QProblem(       int _nV,                                        
00067                                         int _nC                                         
00068                                         );
00069 
00071                 QProblem(       const QProblem& rhs     
00072                                         );
00073 
00075                 ~QProblem( );
00076 
00078                 QProblem& operator=(    const QProblem& rhs             
00079                                                                 );
00080 
00081 
00085                 returnValue reset( );
00086 
00087 
00101                 returnValue init(       const real_t* const _H,                 
00102                                                         const real_t* const _g,                 
00103                                                         const real_t* const _A,                 
00104                                                         const real_t* const _lb,                
00106                                                         const real_t* const _ub,                
00108                                                         const real_t* const _lbA,               
00110                                                         const real_t* const _ubA,               
00112                                                         int& nWSR,                                              
00114                                                         const real_t* const yOpt = 0,   
00115                                                         real_t* const cputime = 0               
00116                                                         );
00117 
00118 
00132                 returnValue hotstart(   const real_t* const g_new,              
00133                                                                 const real_t* const lb_new,             
00135                                                                 const real_t* const ub_new,             
00137                                                                 const real_t* const lbA_new,    
00139                                                                 const real_t* const ubA_new,    
00141                                                                 int& nWSR,                                              
00143                                                                 real_t* const cputime                   
00144                                                                 );
00145 
00146 
00149                 inline returnValue getA(        real_t* const _A        
00150                                                                         ) const;
00151 
00155                 inline returnValue getA(        int number,                     
00156                                                                         real_t* const row       
00157                                                                         ) const;
00158 
00161                 inline returnValue getLBA(      real_t* const _lbA      
00162                                                                         ) const;
00163 
00167                 inline returnValue getLBA(      int number,             
00168                                                                         real_t& value   
00169                                                                         ) const;
00170 
00173                 inline returnValue getUBA(      real_t* const _ubA      
00174                                                                         ) const;
00175 
00179                 inline returnValue getUBA(      int number,             
00180                                                                         real_t& value   
00181                                                                         ) const;
00182 
00183 
00186                 inline returnValue getConstraints(      Constraints* const _constraints 
00187                                                                                         ) const;
00188 
00189 
00192                 inline int getNC( ) const;
00193 
00196                 inline int getNEC( ) const;
00197 
00200                 inline int getNAC( );
00201 
00204                 inline int getNIAC( );
00205 
00208                 int getNZ( );
00209 
00210 
00214                 returnValue getDualSolution(    real_t* const yOpt      
00215                                                                                 ) const;
00216 
00217 
00218         /*
00219          *      PROTECTED MEMBER FUNCTIONS
00220          */
00221         protected:
00225                 returnValue setupSubjectToType( );
00226 
00230                 returnValue setupCholeskyDecompositionProjected( );
00231 
00235                 returnValue setupTQfactorisation( );
00236 
00237 
00249                 returnValue solveInitialQP(     const real_t* const xOpt,                                               
00251                                                                         const real_t* const yOpt,                                               
00253                                                                         const Bounds* const guessedBounds,                              
00255                                                                         const Constraints* const guessedConstraints,    
00257                                                                         int& nWSR,                                                                              
00259                                                                         real_t* const cputime                                                   
00260                                                                         );
00261 
00268                 returnValue obtainAuxiliaryWorkingSet(  const real_t* const xOpt,                                               
00270                                                                                                 const real_t* const yOpt,                                               
00272                                                                                                 const Bounds* const guessedBounds,                              
00273                                                                                                 const Constraints* const guessedConstraints,    
00274                                                                                                 Bounds* auxiliaryBounds,                                                
00276                                                                                                 Constraints* auxiliaryConstraints                               
00278                                                                                                 ) const;
00279 
00288                 returnValue setupAuxiliaryWorkingSet(   const Bounds* const auxiliaryBounds,                    
00289                                                                                                 const Constraints* const auxiliaryConstraints,  
00290                                                                                                 BooleanType setupAfresh                                                 
00292                                                                                                 );
00293 
00296                 returnValue setupAuxiliaryQPsolution(   const real_t* const xOpt,                       
00298                                                                                                 const real_t* const yOpt                        
00300                                                                                                 );
00301 
00306                 returnValue setupAuxiliaryQPgradient( );
00307 
00313                 returnValue setupAuxiliaryQPbounds(     const Bounds* const auxiliaryBounds,                    
00314                                                                                         const Constraints* const auxiliaryConstraints,  
00315                                                                                         BooleanType useRelaxation                                               
00316                                                                                         );
00317 
00318 
00324                 returnValue addConstraint(      int number,                                     
00325                                                                         SubjectToStatus C_status,       
00326                                                                         BooleanType updateCholesky      
00327                                                                         );
00328 
00334                 returnValue addConstraint_checkLI(      int number                      
00335                                                                                         );
00336 
00345                 returnValue addConstraint_ensureLI(     int number,                                     
00346                                                                                         SubjectToStatus C_status        
00347                                                                                         );
00348 
00354                 returnValue addBound(   int number,                                     
00355                                                                 SubjectToStatus B_status,       
00356                                                                 BooleanType updateCholesky      
00357                                                                 );
00358 
00363                 returnValue addBound_checkLI(   int number                      
00364                                                                                 );
00365 
00374                 returnValue addBound_ensureLI(  int number,                                     
00375                                                                                 SubjectToStatus B_status        
00376                                                                                 );
00377 
00383                 returnValue removeConstraint(   int number,                                     
00384                                                                                 BooleanType updateCholesky      
00385                                                                                 );
00386 
00392                 returnValue removeBound(        int number,                                     
00393                                                                         BooleanType updateCholesky      
00394                                                                         );
00395 
00396 
00400                 returnValue backsolveR( const real_t* const b,  
00401                                                                 BooleanType transposed, 
00402                                                                 real_t* const a                 
00403                                                                 );
00404 
00409                 returnValue backsolveR( const real_t* const b,          
00410                                                                 BooleanType transposed,         
00411                                                                 BooleanType removingBound,      
00412                                                                 real_t* const a                         
00413                                                                 );
00414 
00415 
00419                 returnValue backsolveT( const real_t* const b,  
00420                                                                 BooleanType transposed, 
00421                                                                 real_t* const a                 
00422                                                                 );
00423 
00424 
00427                 returnValue hotstart_determineDataShift(const int* const FX_idx,        
00428                                                                                                 const int* const AC_idx,        
00429                                                                                                 const real_t* const g_new,      
00430                                                                                                 const real_t* const lbA_new,
00431                                                                                                 const real_t* const ubA_new,
00432                                                                                                 const real_t* const lb_new,     
00433                                                                                                 const real_t* const ub_new,     
00434                                                                                                 real_t* const delta_g,          
00435                                                                                                 real_t* const delta_lbA,        
00436                                                                                                 real_t* const delta_ubA,        
00437                                                                                                 real_t* const delta_lb,         
00438                                                                                                 real_t* const delta_ub,         
00439                                                                                                 BooleanType& Delta_bC_isZero,
00440                                                                                                 BooleanType& Delta_bB_isZero
00441                                                                                                 );
00442 
00447                 returnValue hotstart_determineStepDirection(const int* const FR_idx,            
00448                                                                                                         const int* const FX_idx,                
00449                                                                                                         const int* const AC_idx,                
00450                                                                                                         const real_t* const delta_g,    
00451                                                                                                         const real_t* const delta_lbA,  
00452                                                                                                         const real_t* const delta_ubA,  
00453                                                                                                         const real_t* const delta_lb,   
00454                                                                                                         const real_t* const delta_ub,   
00455                                                                                                         BooleanType Delta_bC_isZero,    
00456                                                                                                         BooleanType Delta_bB_isZero,    
00457                                                                                                         real_t* const delta_xFX,                
00458                                                                                                         real_t* const delta_xFR,                
00459                                                                                                         real_t* const delta_yAC,                
00460                                                                                                         real_t* const delta_yFX                 
00461                                                                                                         );
00462 
00465                 returnValue hotstart_determineStepLength(       const int* const FR_idx,                        
00466                                                                                                         const int* const FX_idx,                        
00467                                                                                                         const int* const AC_idx,                        
00468                                                                                                         const int* const IAC_idx,                       
00469                                                                                                         const real_t* const delta_lbA,          
00470                                                                                                         const real_t* const delta_ubA,          
00471                                                                                                         const real_t* const delta_lb,           
00472                                                                                                         const real_t* const delta_ub,           
00473                                                                                                         const real_t* const delta_xFX,          
00474                                                                                                         const real_t* const delta_xFR,          
00475                                                                                                         const real_t* const delta_yAC,          
00476                                                                                                         const real_t* const delta_yFX,          
00477                                                                                                         real_t* const delta_Ax,                         
00478                                                                                                         int& BC_idx,                                            
00479                                                                                                         SubjectToStatus& BC_status,                     
00480                                                                                                         BooleanType& BC_isBound                         
00481                                                                                                         );
00482 
00489                 returnValue hotstart_performStep(       const int* const FR_idx,                        
00490                                                                                         const int* const FX_idx,                        
00491                                                                                         const int* const AC_idx,                        
00492                                                                                         const int* const IAC_idx,                       
00493                                                                                         const real_t* const delta_g,            
00494                                                                                         const real_t* const delta_lbA,          
00495                                                                                         const real_t* const delta_ubA,          
00496                                                                                         const real_t* const delta_lb,           
00497                                                                                         const real_t* const delta_ub,           
00498                                                                                         const real_t* const delta_xFX,          
00499                                                                                         const real_t* const delta_xFR,          
00500                                                                                         const real_t* const delta_yAC,          
00501                                                                                         const real_t* const delta_yFX,          
00502                                                                                         const real_t* const delta_Ax,           
00503                                                                                         int BC_idx,                                             
00504                                                                                         SubjectToStatus BC_status,                      
00505                                                                                         BooleanType BC_isBound                          
00506                                                                                         );
00507 
00508 
00513                 BooleanType areBoundsConsistent(        const real_t* const delta_lb,   
00514                                                                                         const real_t* const delta_ub,   
00515                                                                                         const real_t* const delta_lbA,  
00516                                                                                         const real_t* const delta_ubA   
00517                                                                                         ) const;
00518 
00519 
00523                 returnValue setupQPdata(        const real_t* const _H,         
00524                                                                         const real_t* const _g,         
00525                                                                         const real_t* const _A,         
00526                                                                         const real_t* const _lb,        
00528                                                                         const real_t* const _ub,        
00530                                                                         const real_t* const _lbA,       
00532                                                                         const real_t* const _ubA        
00534                                                                         );
00535 
00536 
00537                 #ifdef PC_DEBUG  /* Define print functions only for debugging! */
00538 
00541                 returnValue printIteration(     int iteration,                          
00542                                                                         int BC_idx,                             
00543                                                                         SubjectToStatus BC_status,      
00544                                                                         BooleanType BC_isBound          
00545                                                                         );
00546 
00550                 returnValue printIteration(     int iteration,                          
00551                                                                         int BC_idx,                             
00552                                                                         SubjectToStatus BC_status       
00553                                                                         );
00554 
00555                 #endif  /* PC_DEBUG */
00556 
00557 
00563                 returnValue checkKKTconditions( );
00564 
00565 
00569                 inline returnValue setA(        const real_t* const A_new       
00570                                                                         );
00571 
00576                 inline returnValue setA(        int number,                                     
00577                                                                         const real_t* const value       
00578                                                                         );
00579 
00580 
00583                 inline returnValue setLBA(      const real_t* const lbA_new     
00584                                                                         );
00585 
00589                 inline returnValue setLBA(      int number,             
00590                                                                         real_t value    
00591                                                                         );
00592 
00595                 inline returnValue setUBA(      const real_t* const ubA_new     
00596                                                                         );
00597 
00601                 inline returnValue setUBA(      int number,             
00602                                                                         real_t value    
00603                                                                         );
00604 
00605 
00606         /*
00607          *      PROTECTED MEMBER VARIABLES
00608          */
00609         protected:
00610                 real_t A[NCMAX_ALLOC*NVMAX];            
00611                 real_t lbA[NCMAX_ALLOC];                        
00612                 real_t ubA[NCMAX_ALLOC];                        
00614                 Constraints constraints;                        
00616                 real_t T[NVMAX*NVMAX];                          
00617                 real_t Q[NVMAX*NVMAX];                          
00618                 int sizeT;                                                      
00620                 real_t Ax[NCMAX_ALLOC];                         
00622                 CyclingManager cyclingManager;          
00623 };
00624 
00625 
00626 #include <QProblem.ipp>
00627 
00628 #endif  /* QPOASES_QPROBLEM_HPP */
00629 
00630 
00631 /*
00632  *      end of file
00633  */


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