rk_export.cpp
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 
27 
35 
36 
37 
39 
40 
41 //
42 // PUBLIC MEMBER FUNCTIONS:
43 //
44 
46  const std::string& _commonHeaderName
47  ) : IntegratorExport( _userInteraction,_commonHeaderName )
48 {
49 }
50 
51 
53  ) : IntegratorExport( arg )
54 {
55  copy( arg );
56 }
57 
58 
60 {
61  clear( );
62 }
63 
64 
66  )
67 {
68  if( this != &arg )
69  {
70  clear( );
72  copy( arg );
73  }
74  return *this;
75 }
76 
77 
79 
80  if( _cc.isEmpty() || !_AA.isSquare() || _AA.getNumRows() != _bb.getDim() || _bb.getDim() != _cc.getDim() ) return RET_INVALID_OPTION;
81 
82  numStages = _cc.getDim();
83  is_symmetric = checkSymmetry( _cc );
84 // std::cout << "Symmetry of the chosen method: " << is_symmetric << "\n";
85  AA = _AA;
86  bb = _bb;
87  cc = _cc;
88 
89  return SUCCESSFUL_RETURN;
90 }
91 
92 
94 
95  if( _cc.getDim() <= 1 ) return BT_FALSE;
97  uint i;
98  for( i = 0; i < _cc.getDim(); i++ ) {
99  int tmp = acadoRoundAway(1.0 - _cc(i) - _cc(_cc.getDim()-1-i));
100  if( symmetry ) symmetry = (tmp == 0);
101  }
102  return symmetry;
103 }
104 
105 
107 
108  return numStages;
109 }
110 
111 
113 
114  return RET_INVALID_OPTION;
115 }
116 
117 
118 
119 // PROTECTED:
120 
121 
123  )
124 {
125  numStages = arg.numStages;
126  AA = arg.AA;
127  bb = arg.bb;
128  cc = arg.cc;
129 
130  rhs = arg.rhs;
131  diffs_rhs = arg.diffs_rhs;
132  grid = arg.grid;
133 
134  // ExportVariables
135  rk_ttt = arg.rk_ttt;
136  rk_xxx = arg.rk_xxx;
137  rk_kkk = arg.rk_kkk;
138 
139  // ExportFunctions
140  integrate = arg.integrate;
141 
142  return SUCCESSFUL_RETURN;
143 }
144 
145 
146 
148 
149 // end of file.
bool isSquare() const
Definition: matrix.cpp:135
Allows to export a tailored Runge-Kutta integrator for fast model predictive control.
Definition: rk_export.hpp:54
ExportAcadoFunction diffs_rhs
Allows to pass back messages to the calling function.
ExportVariable rk_kkk
Definition: rk_export.hpp:189
returnValue setNARXmodel(const uint delay, const DMatrix &parms)
Definition: rk_export.cpp:112
BEGIN_NAMESPACE_ACADO typedef unsigned int uint
Definition: acado_types.hpp:42
RungeKuttaExport(UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="")
Definition: rk_export.cpp:45
#define CLOSE_NAMESPACE_ACADO
bool isEmpty() const
Definition: vector.hpp:176
virtual returnValue copy(const RungeKuttaExport &arg)
Definition: rk_export.cpp:122
int acadoRoundAway(double x)
unsigned getDim() const
Definition: vector.hpp:172
Encapsulates all user interaction for setting options, logging data and plotting results.
ExportFunction integrate
unsigned getNumRows() const
Definition: matrix.hpp:185
returnValue initializeButcherTableau(const DMatrix &_AA, const DVector &_bb, const DVector &_cc)
Definition: rk_export.cpp:78
#define BT_TRUE
Definition: acado_types.hpp:47
Allows to export a tailored integrator for fast model predictive control.
ExportVariable rk_xxx
virtual ~RungeKuttaExport()
Definition: rk_export.cpp:59
ExportVariable rk_ttt
BooleanType checkSymmetry(const DVector &_cc)
Definition: rk_export.cpp:93
#define BEGIN_NAMESPACE_ACADO
RungeKuttaExport & operator=(const RungeKuttaExport &arg)
Definition: rk_export.cpp:65
#define BT_FALSE
Definition: acado_types.hpp:49
IntegratorExport & operator=(const IntegratorExport &arg)
int symmetry()
virtual returnValue clear()
ExportAcadoFunction rhs
BooleanType is_symmetric
Definition: rk_export.hpp:194


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