export_gauss_newton_cn2_factorization.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 
00032 #ifndef ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CN2_FACTORIZATION_HPP
00033 #define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CN2_FACTORIZATION_HPP
00034 
00035 #include <acado/code_generation/export_nlp_solver.hpp>
00036 #include <acado/code_generation/linear_solvers/export_cholesky_solver.hpp>
00037 
00038 BEGIN_NAMESPACE_ACADO
00039 
00049 class ExportGaussNewtonCn2Factorization : public ExportNLPSolver
00050 {
00051 public:
00052 
00058         ExportGaussNewtonCn2Factorization(      UserInteraction* _userInteraction = 0,
00059                                                                                 const std::string& _commonHeaderName = ""
00060                                                                                 );
00061 
00063         virtual ~ExportGaussNewtonCn2Factorization( )
00064         {}
00065 
00070         virtual returnValue setup( );
00071 
00079         virtual returnValue getDataDeclarations(        ExportStatementBlock& declarations,
00080                                                                                                 ExportStruct dataStruct = ACADO_ANY
00081                                                                                                 ) const;
00082 
00090         virtual returnValue getFunctionDeclarations(    ExportStatementBlock& declarations
00091                                                                                                         ) const;
00092 
00093 
00101         virtual returnValue getCode(    ExportStatementBlock& code
00102                                                                         );
00103 
00104 
00109         unsigned getNumQPvars( ) const;
00110 
00115         virtual unsigned getNumStateBounds( ) const;
00116 
00117 protected:
00118 
00125         virtual returnValue setupObjectiveEvaluation( void );
00126 
00132         virtual returnValue setupConstraintsEvaluation( void );
00133 
00138         virtual returnValue setupVariables( );
00139 
00144         virtual returnValue setupMultiplicationRoutines( );
00145 
00150         virtual returnValue setupEvaluation( );
00151 
00152         virtual returnValue setupQPInterface( );
00153 
00154         virtual returnValue setupCondensing( );
00155 
00156         bool performFullCondensing( ) const;
00157 
00158 protected:
00159 
00160         ExportFunction evaluateObjective;
00161 
00162         ExportVariable x0, Dx0;
00163 
00164         ExportFunction setObjQ1Q2;
00165         ExportFunction setObjR1R2;
00166         ExportFunction setObjQN1QN2;
00167 
00169         ExportVariable H, H00, H10, H11;
00171         ExportVariable U;
00173         ExportVariable A;
00174 
00176         ExportVariable g, g0, g1;
00177 
00179         ExportVariable lb;
00180 
00182         ExportVariable ub;
00183 
00185         ExportVariable lbA;
00186 
00188         ExportVariable ubA;
00189 
00191         ExportVariable xVars;
00192 
00194         ExportVariable yVars;
00195 
00196         std::vector< unsigned > xBoundsIdxRev, xBoundsIdx;
00197         ExportVariable lbValues, ubValues;
00198         ExportVariable lbAValues, ubAValues;
00199 
00200         ExportVariable Qd;
00201 
00202         ExportFunction condensePrep;
00203         ExportFunction condenseFdb;
00204         ExportFunction expand;
00205 
00206         ExportVariable E, QE, QGx, QDy;
00207 
00208         ExportFunction multGxd;
00209         ExportFunction moveGxT;
00210         ExportFunction multGxGx;
00211         ExportFunction multGxGu;
00212         ExportFunction moveGuE;
00213         ExportFunction setBlockH11;
00214         ExportFunction zeroBlockH11;
00215         ExportFunction copyHTH;
00216         ExportFunction multQ1d;
00217         ExportFunction multQN1d;
00218         ExportFunction multRDy;
00219         ExportFunction multQDy;
00220         ExportFunction multEQDy;
00221         ExportFunction multQETGx;
00222         ExportFunction zeroBlockH10;
00223         ExportFunction multEDu;
00224         ExportFunction multQ1Gx;
00225         ExportFunction multQN1Gx;
00226         ExportFunction multQ1Gu;
00227         ExportFunction multQN1Gu;
00228         ExportFunction zeroBlockH00;
00229         ExportFunction multCTQC;
00230 
00231         ExportVariable A10;
00232         ExportVariable A20;
00233         ExportVariable pacA01Dx0;
00234         ExportVariable pocA02Dx0;
00235         ExportFunction multHxC;
00236         ExportFunction multHxE;
00237         ExportFunction macHxd;
00238 
00239         ExportFunction macCTSlx;
00240         ExportFunction macETSlu;
00241 
00242         ExportFunction preparation;
00243         ExportFunction feedback;
00244 
00245         ExportFunction getKKT;
00246 
00247         // N2 condensing related
00248         ExportVariable W1, W2;
00249         ExportVariable sbar, w1, w2;
00250 
00251         ExportFunction mult_H_W2T_W3, mac_H_W2T_W3_R, mac_W3_G_W1T_G;
00252 
00253         ExportFunction multBTW1, macBTW1_R1, multGxTGu, macQEW2;
00254         ExportFunction macATw1QDy, macBTw1, macQSbarW2, macASbar, macASbarD2;
00255         ExportFunction expansionStep;
00256 
00257         ExportCholeskySolver cholSolver;
00258 
00259         ExportFunction mac_R_T2_B_D;
00260         ExportFunction move_D_U;
00261         ExportFunction mult_L_E_U;
00262         ExportFunction updateQ;
00263         ExportFunction mul_T2_A_L;
00264         ExportFunction mult_BT_T1_T2;
00265 
00266         ExportVariable D, L;
00267 
00268         ExportVariable T1, T2, T3, F;
00269 
00270         ExportFunction mac_R_BT_F_D, mult_FT_A_L;
00271         ExportFunction updateQ2;
00272         ExportFunction mac_W1_T1_E_F;
00273         ExportFunction move_GxT_T3;
00274 };
00275 
00276 CLOSE_NAMESPACE_ACADO
00277 
00278 #endif  // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_CN2_FACTORIZATION_HPP


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