ocp.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 
32 #ifndef ACADO_TOOLKIT_OCP_HPP
33 #define ACADO_TOOLKIT_OCP_HPP
34 
37 
39 
40 class Grid;
41 class Objective;
42 class Constraint;
43 
90 {
91 public:
92 
95  OCP( const double &tStart_ = 0.0,
96  const double &tEnd_ = 1.0,
97  const int &N_ = 20 );
98 
99 
102  OCP( const double &tStart_,
103  const double &tEnd_,
104  const DVector& _numSteps );
105 
106 
110  OCP( const double &tStart_,
111  const Parameter &tEnd_,
112  const int &N_ = 20 );
113 
114 
117  OCP( const Grid &grid_ );
118 
119 
121  virtual ~OCP( );
122 
127 
128 
134  returnValue minimizeMayerTerm( const int &multiObjectiveIdx, const Expression& arg );
135 
136 
145 
146 
151 
152 
157 
176  returnValue minimizeLSQ( const DMatrix &S,
177  const Function &h,
178  const DVector &r );
179 
180  returnValue minimizeLSQ( const Function &h,
181  const DVector &r );
182 
183  returnValue minimizeLSQ( const Function &h );
184 
186  const Function &h,
187  const VariablesGrid &r );
188 
189  returnValue minimizeLSQ( const DMatrix &S,
190  const Function &h,
191  const VariablesGrid &r );
192 
193  returnValue minimizeLSQ( const Function &h,
194  const VariablesGrid &r );
195 
197  const Function &h,
198  const char* rFilename );
199 
200  returnValue minimizeLSQ( const DMatrix &S,
201  const Function &h,
202  const char* rFilename );
203 
204  returnValue minimizeLSQ( const Function &h,
205  const char* rFilename );
206 
208  returnValue minimizeLSQ( const DMatrix& S,
209  const Function& h );
210 
213  returnValue minimizeLSQ( const BMatrix& S,
214  const Function& h );
215 
217  returnValue minimizeLSQ( const DMatrix& S,
218  const std::string& h );
219 
222  returnValue minimizeLSQ( const BMatrix& S,
223  const std::string& h );
224 
243  const Function & m,
244  const DVector & r );
245 
247  const DVector & r );
248 
251  const Function& m );
252 
255  const std::string& m );
256 
260  const Function& m );
261 
265  const std::string& m );
266 
275  const DVector& Slu );
276 
280  const BVector& Slu );
290  returnValue subjectTo( const DifferentialEquation& differentialEquation_ );
291 
292 
297  returnValue subjectTo( const ConstraintComponent& component );
298 
299 
304  returnValue subjectTo( int index_, const ConstraintComponent& component );
305 
306 
322  returnValue subjectTo( const double lb_,
323  const Expression& arg1,
324  const Expression& arg2,
325  const double ub_ );
326 
327 
343  returnValue subjectTo( const double lb_, const Expression *arguments, const double ub_ );
344 
357  returnValue subjectTo( const DVector& _lb, const Expression& _expr, const DVector& _ub );
358 
359  returnValue subjectTo( int _index, const DVector& _lb, const Expression& _expr, const DVector& _ub );
360 
367  BooleanType hasObjective () const;
368  BooleanType hasConstraint () const;
369 
370  returnValue getGrid ( Grid& grid_ ) const;
371  returnValue getObjective ( Objective& objective_ ) const;
372  returnValue getObjective ( const int &multiObjectiveIdx, Expression **arg ) const;
373 
374  returnValue getConstraint( Constraint& constraint_ ) const;
375 
376  returnValue setObjective ( const Objective & objective_ );
377  returnValue setConstraint( const Constraint& constraint_ );
378  returnValue setNumberIntegrationSteps( const uint numSteps );
379 
384  virtual BooleanType hasEquidistantGrid( ) const;
385 
386  double getStartTime ( ) const;
387  double getEndTime( ) const;
390 protected:
391 
392  void setupGrid( double tStart, double tEnd, int N );
393  void setupGrid( const DVector& times );
394 
396  std::shared_ptr<Grid> grid;
398  std::shared_ptr<Objective> objective;
400  std::shared_ptr<Constraint> constraint;
401 };
402 
404 
405 #endif // ACADO_TOOLKIT_OCP_HPP
#define N
OCP(const double &tStart_=0.0, const double &tEnd_=1.0, const int &N_=20)
Definition: ocp.cpp:45
Allows to setup and evaluate a general function based on SymbolicExpressions.
Definition: function_.hpp:59
void setupGrid(double tStart, double tEnd, int N)
Definition: ocp.cpp:423
returnValue getObjective(Objective &objective_) const
Definition: ocp.cpp:330
std::shared_ptr< Objective > objective
Definition: ocp.hpp:398
returnValue minimizeLagrangeTerm(const Expression &arg)
Definition: ocp.cpp:240
returnValue setNumberIntegrationSteps(const uint numSteps)
Definition: ocp.cpp:346
returnValue maximizeLagrangeTerm(const Expression &arg)
Definition: ocp.cpp:241
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.
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 subjectTo(const DifferentialEquation &differentialEquation_)
Definition: ocp.cpp:153
#define CLOSE_NAMESPACE_ACADO
returnValue minimizeMayerTerm(const Expression &arg)
Definition: ocp.cpp:238
returnValue getConstraint(Constraint &constraint_) const
Definition: ocp.cpp:331
Data class for symbolically formulating constraints within optimal control problems.
returnValue setConstraint(const Constraint &constraint_)
Definition: ocp.cpp:339
Base class for all variables within the symbolic expressions family.
Definition: expression.hpp:56
std::shared_ptr< Grid > grid
Definition: ocp.hpp:396
double getEndTime() const
Definition: ocp.cpp:362
returnValue minimizeLSQ(const DMatrix &S, const Function &h, const DVector &r)
Definition: ocp.cpp:244
Container class to store and pass data to the ModelData class.
returnValue minimizeLSQEndTerm(const DMatrix &S, const Function &m, const DVector &r)
Definition: ocp.cpp:297
Encapsulates functionality for defining OCPs having multiple objectives.
Provides a time grid consisting of matrix-valued optimization variables at each grid point...
BooleanType hasConstraint() const
Definition: ocp.cpp:322
std::shared_ptr< Constraint > constraint
Definition: ocp.hpp:400
double getStartTime() const
Definition: ocp.cpp:361
returnValue minimizeLSQLinearTerms(const DVector &Slx, const DVector &Slu)
Definition: ocp.cpp:411
virtual ~OCP()
Definition: ocp.cpp:101
Data class for defining optimal control problems.
Definition: ocp.hpp:89
virtual BooleanType hasEquidistantGrid() const
Definition: ocp.cpp:364
returnValue getGrid(Grid &grid_) const
Definition: ocp.cpp:329
#define BEGIN_NAMESPACE_ACADO
BooleanType hasObjective() const
Definition: ocp.cpp:316
returnValue setObjective(const Objective &objective_)
Definition: ocp.cpp:334
returnValue maximizeMayerTerm(const Expression &arg)
Definition: ocp.cpp:239
Stores and evaluates the objective function of optimal control problems.
Definition: objective.hpp:123
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