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 00027 00035 #ifndef ACADO_TOOLKIT_OBJECTIVE_ELEMENT_HPP 00036 #define ACADO_TOOLKIT_OBJECTIVE_ELEMENT_HPP 00037 00038 00039 #include <acado/variables_grid/variables_grid.hpp> 00040 #include <acado/function/function.hpp> 00041 00042 BEGIN_NAMESPACE_ACADO 00043 00044 00055 class ObjectiveElement{ 00056 00057 00058 // 00059 // PUBLIC MEMBER FUNCTIONS: 00060 // 00061 public: 00062 00064 ObjectiveElement( ); 00065 00067 ObjectiveElement( const Grid &grid_ ); 00068 00070 ObjectiveElement( const ObjectiveElement& rhs ); 00071 00073 virtual ~ObjectiveElement( ); 00074 00076 ObjectiveElement& operator=( const ObjectiveElement& rhs ); 00077 00078 00079 00080 00081 00082 // ========================================================================== 00083 // 00084 // INITIALIZATION 00085 // 00086 // ========================================================================== 00087 00088 00093 inline returnValue setGrid( const Grid &grid_ ); 00094 00095 00096 00101 returnValue init( const OCPiterate &x ); 00102 00103 00104 00105 // ======================================================================================= 00106 // 00107 // DEFINITION OF SEEDS: 00108 // 00109 // ======================================================================================= 00110 00111 00112 00118 virtual returnValue setForwardSeed( BlockMatrix *xSeed_ , 00119 BlockMatrix *xaSeed_, 00120 BlockMatrix *pSeed_ , 00121 BlockMatrix *uSeed_ , 00122 BlockMatrix *wSeed_ , 00123 int order ); 00124 00125 00126 00132 virtual returnValue setBackwardSeed( BlockMatrix *seed, 00133 int order ); 00134 00135 00136 00137 00138 // ======================================================================================= 00139 // 00140 // RESULTS OF THE EVALUATION 00141 // 00142 // ======================================================================================= 00143 00144 00149 virtual returnValue getObjectiveValue( double &objectiveValue ); 00150 00151 00152 00158 virtual returnValue getForwardSensitivities( BlockMatrix *D , 00161 int order ); 00162 00163 00164 00170 virtual returnValue getBackwardSensitivities( BlockMatrix *D , 00173 int order ); 00174 00175 00176 00177 00178 // ======================================================================================= 00179 // 00180 // DIMENSIONS 00181 // 00182 // ======================================================================================= 00183 00184 00188 inline int getNX () const; 00189 00193 inline int getNXA () const; 00194 00198 inline int getNP () const; 00199 00203 inline int getNU () const; 00204 00208 inline int getNW () const; 00209 00213 returnValue getFunction( Function& _function ); 00214 00215 00216 00217 // ========================================================================== 00218 // 00219 // PROTECTED MEMBER FUNCTIONS: 00220 // 00221 // ========================================================================== 00222 00223 protected: 00224 00225 00227 inline Grid getGrid() const; 00228 00229 00230 // 00231 // DATA MEMBERS: 00232 // 00233 protected: 00234 00235 Grid grid ; 00236 Function fcn ; 00238 EvaluationPoint z ; 00239 EvaluationPoint JJ ; 00240 00241 int *y_index; 00242 int t_index; 00244 int nx ; 00245 int na ; 00246 int nu ; 00247 int np ; 00248 int nw ; 00249 int ny ; 00252 // INPUT STORAGE: 00253 // ------------------------ 00254 BlockMatrix *xSeed ; 00255 BlockMatrix *xaSeed ; 00256 BlockMatrix *pSeed ; 00257 BlockMatrix *uSeed ; 00258 BlockMatrix *wSeed ; 00260 BlockMatrix *bSeed ; 00262 BlockMatrix *xSeed2 ; 00263 BlockMatrix *xaSeed2 ; 00264 BlockMatrix *pSeed2 ; 00265 BlockMatrix *uSeed2 ; 00266 BlockMatrix *wSeed2 ; 00268 BlockMatrix *bSeed2 ; 00271 // RESULTS: 00272 // ------------------------ 00273 double obj; 00275 BlockMatrix dForward ; 00276 BlockMatrix dBackward; 00278 }; 00279 00280 00281 CLOSE_NAMESPACE_ACADO 00282 00283 00284 00285 #include <acado/objective/objective_element.ipp> 00286 00287 00288 #endif // ACADO_TOOLKIT_OBJECTIVE_ELEMENT_HPP 00289 00290 /* 00291 * end of file 00292 */