optimization_algorithm_base.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of ACADO Toolkit.
3  *
4  * ACADO Toolkit -- A Toolkit for Automatic Control and Dynamic Optimization.
5  * Copyright (C) 2008-2014 by Boris Houska, Hans Joachim Ferreau,
6  * Milan Vukov, Rien Quirynen, KU Leuven.
7  * Developed within the Optimization in Engineering Center (OPTEC)
8  * under supervision of Moritz Diehl. All rights reserved.
9  *
10  * ACADO Toolkit is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 3 of the License, or (at your option) any later version.
14  *
15  * ACADO Toolkit is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with ACADO Toolkit; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  *
24  */
25 
26 
33 #ifndef ACADO_TOOLKIT_OPTIMIZATION_ALGORITHM_BASE_HPP
34 #define ACADO_TOOLKIT_OPTIMIZATION_ALGORITHM_BASE_HPP
35 
38 //#include <acado/ocp/ocp.hpp>
41 
42 
44 
45 class OCP;
46 
47 
66 {
67  //
68  // PUBLIC MEMBER FUNCTIONS:
69  //
70  public:
71 
74 
76  OptimizationAlgorithmBase( const OCP& ocp_ );
77 
80 
82  virtual ~OptimizationAlgorithmBase( );
83 
86 
87 
89  returnValue initializeDifferentialStates( const char* fileName , BooleanType autoinit=BT_FALSE);
90  returnValue initializeAlgebraicStates ( const char* fileName , BooleanType autoinit=BT_FALSE);
91  returnValue initializeParameters ( const char* fileName);
92  returnValue initializeControls ( const char* fileName);
93  returnValue initializeDisturbances ( const char* fileName);
94 
100 
106 
110  returnValue getParameters ( DVector &u_ ) const;
111  returnValue getControls ( VariablesGrid &p_ ) const;
113 
114  returnValue getDifferentialStates( const char* fileName ) const;
115  returnValue getAlgebraicStates ( const char* fileName ) const;
116  returnValue getParameters ( const char* fileName ) const;
117  returnValue getControls ( const char* fileName ) const;
118  returnValue getDisturbances ( const char* fileName ) const;
119 
120  double getObjectiveValue ( const char* fileName ) const;
121  double getObjectiveValue () const;
122 
123 
125  ) const;
126 
128  ) const;
129 
131  ) const;
132 
134  ) const;
135 
137  ) const;
138 
139 
142  virtual uint getNX( ) const;
143 
146  virtual uint getNXA( ) const;
147 
150  virtual uint getNP( ) const;
151 
154  virtual uint getNU( ) const;
155 
158  virtual uint getNW( ) const;
159 
160 
161  double getStartTime ( ) const;
162 
163  double getEndTime( ) const;
164 
165 
166  //
167  // PROTECTED MEMBER FUNCTIONS:
168  //
169  protected:
170 
171  returnValue clear( );
172 
174  returnValue init( UserInteraction* _userIteraction
175  );
176 
179  Constraint *H
180  ) const;
181 
184  Constraint *H
185  ) = 0;
186 
187  virtual returnValue initializeNlpSolver( const OCPiterate& _userInit
188  ) = 0;
189 
191  ) = 0;
192 
193 
194  virtual returnValue extractOCPdata( Objective** objective,
195  DifferentialEquation*** differentialEquation,
196  Constraint** constraint,
197  Grid& unionGrid
198  );
199 
200  virtual returnValue setupObjective( Objective* objective,
201  DifferentialEquation** differentialEquation,
202  Constraint* constraint,
203  Grid unionGrid
204  );
205 
206  virtual returnValue setupDifferentialEquation( Objective* objective,
207  DifferentialEquation** differentialEquation,
208  Constraint* constraint,
209  Grid unionGrid
210  );
211 
212  virtual returnValue setupDynamicDiscretization( UserInteraction* _userIteraction,
213  Objective* objective,
214  DifferentialEquation** differentialEquation,
215  Constraint* constraint,
216  Grid unionGrid,
217  DynamicDiscretization** dynamicDiscretization
218  );
219 
220  virtual returnValue determineDimensions( Objective* const _objective,
221  DifferentialEquation** const _differentialEquation,
222  Constraint* const _constraint,
223  uint& _nx,
224  uint& _nxa,
225  uint& _np,
226  uint& _nu,
227  uint& _nw
228  ) const;
229 
230  virtual returnValue initializeOCPiterate( Constraint* const _constraint,
231  const Grid& _unionGrid,
232  uint nx,
233  uint nxa,
234  uint np,
235  uint nu,
236  uint nw
237  );
238 
239  //
240  // DATA MEMBERS:
241  //
242  protected:
243 
245  OCP *ocp ;
246 
249 };
250 
252 
253 #endif // ACADO_TOOLKIT_OPTIMIZATION_ALGORITHM_BASE_HPP
254 
255 /*
256  * end of file
257  */
Data class for storing generic optimization variables.
Definition: ocp_iterate.hpp:57
Implements a very rudimentary block sparse matrix class.
OptimizationAlgorithmBase & operator=(const OptimizationAlgorithmBase &arg)
returnValue getSensitivitiesXA(BlockMatrix &_sens) const
virtual returnValue initializeNlpSolver(const OCPiterate &_userInit)=0
returnValue initializeControls(const char *fileName)
virtual returnValue initializeOCPiterate(Constraint *const _constraint, const Grid &_unionGrid, uint nx, uint nxa, uint np, uint nu, uint nw)
returnValue initializeDisturbances(const char *fileName)
Stores and evaluates the constraints of optimal control problems.
Definition: constraint.hpp:60
Provides a time grid consisting of vector-valued optimization variables at each grid point...
Allows to pass back messages to the calling function.
returnValue getSensitivitiesW(BlockMatrix &_sens) const
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
Allows to conveniently handle (one-dimensional) grids consisting of time points.
Definition: grid.hpp:58
returnValue getParameters(VariablesGrid &u_) const
virtual returnValue setupDynamicDiscretization(UserInteraction *_userIteraction, Objective *objective, DifferentialEquation **differentialEquation, Constraint *constraint, Grid unionGrid, DynamicDiscretization **dynamicDiscretization)
returnValue initializeParameters(const char *fileName)
#define CLOSE_NAMESPACE_ACADO
returnValue getSensitivitiesP(BlockMatrix &_sens) const
Base class for user-interfaces to formulate and solve optimal control problems and static NLPs...
Base class for discretizing a DifferentialEquation for use in optimal control algorithms.
virtual returnValue allocateNlpSolver(Objective *F, DynamicDiscretization *G, Constraint *H)=0
returnValue getAlgebraicStates(VariablesGrid &xa_) const
returnValue getSensitivitiesX(BlockMatrix &_sens) const
const int nu
BooleanType isLinearQuadratic(Objective *F, DynamicDiscretization *G, Constraint *H) const
returnValue getSensitivitiesU(BlockMatrix &_sens) const
returnValue initializeDifferentialStates(const char *fileName, BooleanType autoinit=BT_FALSE)
returnValue getDisturbances(VariablesGrid &w_) const
Encapsulates all user interaction for setting options, logging data and plotting results.
virtual returnValue setupObjective(Objective *objective, DifferentialEquation **differentialEquation, Constraint *constraint, Grid unionGrid)
Data class for defining optimal control problems.
Definition: ocp.hpp:89
virtual returnValue extractOCPdata(Objective **objective, DifferentialEquation ***differentialEquation, Constraint **constraint, Grid &unionGrid)
Base class for different algorithms for solving nonlinear programming (NLP) problems.
Definition: nlp_solver.hpp:59
returnValue getControls(VariablesGrid &p_) const
returnValue initializeAlgebraicStates(const char *fileName, BooleanType autoinit=BT_FALSE)
virtual returnValue setupDifferentialEquation(Objective *objective, DifferentialEquation **differentialEquation, Constraint *constraint, Grid unionGrid)
virtual returnValue initializeObjective(Objective *F)=0
#define BEGIN_NAMESPACE_ACADO
#define BT_FALSE
Definition: acado_types.hpp:49
virtual returnValue determineDimensions(Objective *const _objective, DifferentialEquation **const _differentialEquation, Constraint *const _constraint, uint &_nx, uint &_nxa, uint &_np, uint &_nu, uint &_nw) const
returnValue init(UserInteraction *_userIteraction)
Stores and evaluates the objective function of optimal control problems.
Definition: objective.hpp:123
returnValue getDifferentialStates(VariablesGrid &xd_) const
Allows to setup and evaluate differential equations (ODEs and DAEs) based on SymbolicExpressions.


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:54