gauss_legendre6_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 
37 
39 
40 
41 //
42 // PUBLIC MEMBER FUNCTIONS:
43 //
44 
46  const std::string& _commonHeaderName
47  ) : ImplicitRungeKuttaExport( _userInteraction,_commonHeaderName )
48 {
49  numStages = 3;
50 }
51 
52 
54  ) : ImplicitRungeKuttaExport( arg )
55 {
56  numStages = 3;
57  copy( arg );
58 }
59 
60 
62 {
63  clear( );
64 }
65 
66 
67 // PROTECTED:
68 
69 //
70 // Register the integrator
71 //
72 
74  const std::string &_commonHeaderName)
75 {
76  DMatrix AA(3,3);
77  DVector bb(3);
78  DVector cc(3);
79 
80  AA(0,0) = 5.0/36.0;
81  AA(0,1) = 2.0/9.0-1.0/15.0*sqrt(15.0);
82  AA(0,2) = 5.0/36.0-1.0/30.0*sqrt(15.0);
83  AA(1,0) = 5.0/36.0+1.0/24.0*sqrt(15.0);
84  AA(1,1) = 2.0/9.0;
85  AA(1,2) = 5.0/36.0-1.0/24.0*sqrt(15.0);
86  AA(2,0) = 5.0/36.0+1.0/30.0*sqrt(15.0);
87  AA(2,1) = 2.0/9.0+1.0/15.0*sqrt(15.0);
88  AA(2,2) = 5.0/36.0;
89 
90  bb(0) = 5.0/18.0;
91  bb(1) = 4.0/9.0;
92  bb(2) = 5.0/18.0;
93 
94  cc(0) = 1.0/2.0-sqrt(15.0)/10.0;
95  cc(1) = 1.0/2.0;
96  cc(2) = 1.0/2.0+sqrt(15.0)/10.0;
97 
98  // SIMPLIFIED NEWTON:
99  DMatrix _eig(2,2);
100  _eig(0,0) = 3.677814645373912; _eig(0,1) = 3.508761919567443; // the second column is the imaginary part
101  _eig(1,0) = 4.644370709252173; _eig(1,1) = 0.0;
102 
103  DMatrix _simplified_transf1(3,3);
104  _simplified_transf1(0,0) = -18.636486890695167; _simplified_transf1(0,1) = -15.250990917842101; _simplified_transf1(0,2) = 3.156971624093098;
105  _simplified_transf1(1,0) = -27.017033488529613; _simplified_transf1(1,1) = 7.134863930477463; _simplified_transf1(1,2) = 1.101474723408009;
106  _simplified_transf1(2,0) = 28.095293818520428; _simplified_transf1(2,1) = 5.341817943917859; _simplified_transf1(2,2) = 2.027127483041268;
107 
108  DMatrix _simplified_transf2(3,3);
109  _simplified_transf2(0,0) = -0.077948357550038; _simplified_transf2(0,1) = -0.056982523211087; _simplified_transf2(0,2) = 0.071464556714801;
110  _simplified_transf2(1,0) = 0.050295169925554; _simplified_transf2(1,1) = 0.299699605816585; _simplified_transf2(1,2) = 0.117700617809852;
111  _simplified_transf2(2,0) = 0.947801449544836; _simplified_transf2(2,1) = 0.0; _simplified_transf2(2,2) = 0.990474321575646;
112 
113  DMatrix _simplified_transf1_T(3,3);
114  _simplified_transf1_T(0,0) = -4.866177185043021e-01; _simplified_transf1_T(0,1) = 1.236550876742378e+00; _simplified_transf1_T(0,2) = 3.485838052042621e+00;
115  _simplified_transf1_T(1,0) = 6.393107026830797e-02; _simplified_transf1_T(1,1) = 9.257658225120670e-01; _simplified_transf1_T(1,2) = -3.325609633473744e+00;
116  _simplified_transf1_T(2,0) = 3.319078939559111e-01; _simplified_transf1_T(2,1) = 5.466453018169597e-01; _simplified_transf1_T(2,2) = 4.600129927392348e+00;
117 
118  DMatrix _simplified_transf2_T(3,3);
119  _simplified_transf2_T(0,0) = -6.321680651380311e+00; _simplified_transf2_T(0,1) = -1.314846346969297e+00; _simplified_transf2_T(0,2) = 6.049321980812397e+00;
120  _simplified_transf2_T(1,0) = -1.201954582051780e+00; _simplified_transf2_T(1,1) = 3.086679860636697e+00; _simplified_transf2_T(1,2) = 1.150170448985970e+00;
121  _simplified_transf2_T(2,0) = 5.989523296137209e-01; _simplified_transf2_T(2,1) = -2.719295284863776e-01; _simplified_transf2_T(2,2) = 4.364697845938469e-01;
122 
123 
124  // SINGLE NEWTON:
125  double _single_tau = 0.202740066519113;
126  DVector _lower_triang(3);
127  _lower_triang(0) = 1.291180015430378; _lower_triang(1) = -1.430998974529736; _lower_triang(2) = 2.108070244672127;
128 
129  DMatrix _single_transf1(3,3);
130  _single_transf1(0,0) = 1.000000000000000; _single_transf1(0,1) = 0.358037439038676; _single_transf1(0,2) = -0.031545235223924;
131  _single_transf1(1,0) = -1.291180015430378; _single_transf1(1,1) = 0.537709213937389; _single_transf1(1,2) = 0.059994748344832;
132  _single_transf1(2,0) = 1.430998974529736; _single_transf1(2,1) = -1.595719036564529; _single_transf1(2,2) = 0.914248574982086;
133 
134  DMatrix _single_transf2(3,3);
135  _single_transf2(0,0) = 1.0; _single_transf2(0,1) = -0.358037439038676; _single_transf2(0,2) = 0.038442529688880;
136  _single_transf2(1,0) = 0.0; _single_transf2(1,1) = 1.0; _single_transf2(1,2) = -0.019264171041652;
137  _single_transf2(2,0) = 0.0; _single_transf2(2,1) = 0.0; _single_transf2(2,2) = 1.0;
138 
139  DMatrix _single_transf1_T(3,3);
140  _single_transf1_T(0,0) = 1.517302006625726e+00; _single_transf1_T(0,1) = -1.318747024436147e+00; _single_transf1_T(0,2) = 1.430998974529736e+00;
141  _single_transf1_T(1,0) = -4.390769920057278e-01; _single_transf1_T(1,1) = 1.040610225761180e+00; _single_transf1_T(1,2) = -2.108070244672127e+00;
142  _single_transf1_T(2,0) = 3.844252968887955e-02; _single_transf1_T(2,1) = -1.926417104165177e-02; _single_transf1_T(2,2) = 1.000000000000000e+00;
143 
144  DMatrix _single_transf2_T(3,3);
145  _single_transf2_T(0,0) = 1.0; _single_transf2_T(0,1) = 0.0; _single_transf2_T(0,2) = 0.0;
146  _single_transf2_T(1,0) = 3.580374390386760e-01; _single_transf2_T(1,1) = 1.0; _single_transf2_T(1,2) = 0.0;
147  _single_transf2_T(2,0) = -3.154523522392352e-02; _single_transf2_T(2,1) = 1.926417104165177e-02; _single_transf2_T(2,2) = 1.0;
148 
149 
150  ImplicitRungeKuttaExport* integrator = createImplicitRungeKuttaExport(_userInteraction, _commonHeaderName);
151  integrator->initializeButcherTableau(AA, bb, cc);
152 
153  integrator->setEigenvalues(_eig);
154  integrator->setSimplifiedTransformations(_simplified_transf1, _simplified_transf2, _simplified_transf1_T, _simplified_transf2_T);
155 
156  integrator->setSingleTransformations(_single_tau, _lower_triang, _single_transf1, _single_transf2, _single_transf1_T, _single_transf2_T);
157 
158  return integrator;
159 }
160 
162 
163 // end of file.
IntermediateState sqrt(const Expression &arg)
returnValue setSimplifiedTransformations(const DMatrix &_transf1, const DMatrix &_transf2)
#define CLOSE_NAMESPACE_ACADO
returnValue setSingleTransformations(const double _tau, const DVector &_low_tria, const DMatrix &_transf1, const DMatrix &_transf2)
GaussLegendre6Export(UserInteraction *_userInteraction=0, const std::string &_commonHeaderName="")
virtual returnValue copy(const ImplicitRungeKuttaExport &arg)
Allows to export a tailored implicit Runge-Kutta integrator for fast model predictive control...
Definition: irk_export.hpp:55
Encapsulates all user interaction for setting options, logging data and plotting results.
returnValue initializeButcherTableau(const DMatrix &_AA, const DVector &_bb, const DVector &_cc)
Definition: rk_export.cpp:78
Allows to export a tailored integrator for fast model predictive control.
returnValue setEigenvalues(const DMatrix &_eig)
#define BEGIN_NAMESPACE_ACADO
Allows to export a tailored Gauss-Legendre method of order 6 for fast model predictive control...
virtual returnValue clear()
IntegratorExport * createGaussLegendre6Export(UserInteraction *_userInteraction, const std::string &_commonHeaderName)


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