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_FORCES_HPP 00033 #define ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_FORCES_HPP 00034 00035 #include <acado/code_generation/export_nlp_solver.hpp> 00036 00037 BEGIN_NAMESPACE_ACADO 00038 00039 class ExportForcesInterface; 00040 class ExportForcesGenerator; 00041 00053 class ExportGaussNewtonForces : public ExportNLPSolver 00054 { 00055 public: 00056 00062 ExportGaussNewtonForces( UserInteraction* _userInteraction = 0, 00063 const std::string& _commonHeaderName = "" 00064 ); 00065 00068 virtual ~ExportGaussNewtonForces( ) 00069 {} 00070 00075 virtual returnValue setup( ); 00076 00084 virtual returnValue getDataDeclarations( ExportStatementBlock& declarations, 00085 ExportStruct dataStruct = ACADO_ANY 00086 ) const; 00087 00095 virtual returnValue getFunctionDeclarations( ExportStatementBlock& declarations 00096 ) const; 00097 00098 00106 virtual returnValue getCode( ExportStatementBlock& code 00107 ); 00108 00109 00114 unsigned getNumQPvars( ) const; 00115 00116 protected: 00117 00124 virtual returnValue setupObjectiveEvaluation( void ); 00125 00131 virtual returnValue setupConstraintsEvaluation( void ); 00132 00137 virtual returnValue setupVariables( ); 00138 00143 virtual returnValue setupMultiplicationRoutines( ); 00144 00149 virtual returnValue setupEvaluation( ); 00150 00151 virtual returnValue setupQPInterface( ); 00152 00153 private: 00155 ExportVariable x0; 00156 00159 ExportFunction evaluateObjective; 00160 00161 std::vector< ExportVariable > objHessians; 00162 std::vector< ExportVariable > objGradients; 00163 00164 ExportFunction setStageH; 00165 ExportFunction setStagef; 00166 00167 ExportFunction setObjQ1Q2; 00168 ExportFunction setObjR1R2; 00169 ExportFunction setObjQN1QN2; 00170 00171 bool diagH; 00172 bool diagHN; 00177 std::vector< ExportVariable > conLB; 00178 std::vector< ExportVariable > conUB; 00179 ExportVariable lbValues, ubValues; 00180 00181 std::vector< std::vector< unsigned > > conLBIndices, conUBIndices; 00182 std::vector< std::vector< double > > conLBValues, conUBValues; 00183 00184 ExportFunction evaluateConstraints; 00185 ExportFunction conSetGxGu; 00186 ExportVariable conStageC; 00187 00188 std::vector< ExportVariable > conC; 00189 std::vector< ExportVariable > cond; 00190 ExportFunction conSetd; 00195 ExportFunction preparation; 00196 ExportFunction feedback; 00197 00198 ExportFunction getKKT; 00203 ExportFunction acc; 00208 std::string qpModuleName; 00209 std::string qpObjPrefix; 00210 00211 std::tr1::shared_ptr< ExportForcesInterface > qpInterface; 00212 std::tr1::shared_ptr< ExportForcesGenerator > qpGenerator; 00214 }; 00215 00216 CLOSE_NAMESPACE_ACADO 00217 00218 #endif // ACADO_TOOLKIT_EXPORT_GAUSS_NEWTON_FORCES_HPP