evaluation_template.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 
27 
34 #ifndef ACADO_TOOLKIT_EVALUATION_TEMPLATE_HPP
35 #define ACADO_TOOLKIT_EVALUATION_TEMPLATE_HPP
36 
39 
40 
42 
51 template <typename T>
53 
54 public:
55 
59 
60  virtual ~EvaluationTemplate();
61 
62  virtual void addition ( Operator &arg1, Operator &arg2 );
63  virtual void subtraction( Operator &arg1, Operator &arg2 );
64  virtual void product ( Operator &arg1, Operator &arg2 );
65  virtual void quotient ( Operator &arg1, Operator &arg2 );
66  virtual void power ( Operator &arg1, Operator &arg2 );
67  virtual void powerInt ( Operator &arg1, int &arg2 );
68 
69  virtual void project ( int &idx );
70  virtual void set ( double &arg );
71  virtual void Acos ( Operator &arg );
72  virtual void Asin ( Operator &arg );
73  virtual void Atan ( Operator &arg );
74  virtual void Cos ( Operator &arg );
75  virtual void Exp ( Operator &arg );
76  virtual void Log ( Operator &arg );
77  virtual void Sin ( Operator &arg );
78  virtual void Tan ( Operator &arg );
79 
81  T res;
82 
83 };
84 
85 
86 
88 
90 
92 
93 
94 
97 { val = _val; }
99 
100 template <typename T> void EvaluationTemplate<T>::addition( Operator &arg1, Operator &arg2 ){
101 
103  arg1.evaluate( this );
104  arg2.evaluate( &r );
105  res += r.res;
106 }
107 
108 template <typename T> void EvaluationTemplate<T>::subtraction( Operator &arg1, Operator &arg2 ){
109 
111  arg1.evaluate( this );
112  arg2.evaluate( &r );
113  res -= r.res;
114 }
115 
116 template <typename T> void EvaluationTemplate<T>::product( Operator &arg1, Operator &arg2 ){
117 
119  arg1.evaluate( this );
120  arg2.evaluate( &r );
121  res *= r.res;
122 }
123 
124 template <typename T> void EvaluationTemplate<T>::quotient( Operator &arg1, Operator &arg2 ){
125 
127  arg1.evaluate( this );
128  arg2.evaluate( &r );
129  res /= r.res;
130 }
131 
132 template <typename T> void EvaluationTemplate<T>::power( Operator &arg1, Operator &arg2 ){
133 
135  arg1.evaluate( this );
136  arg2.evaluate( &r );
137  res = pow(res,r.res);
138 }
139 
140 template <typename T> void EvaluationTemplate<T>::powerInt( Operator &arg1, int &arg2 ){
141 
142  arg1.evaluate( this );
143  res = pow( res, arg2 );
144 }
145 
146 
147 template <typename T> void EvaluationTemplate<T>::project( int &idx ){
148 
149  res = val->operator()(idx);
150 }
151 
152 
153 template <typename T> void EvaluationTemplate<T>::set( double &arg ){
154 
155  res = arg;
156 }
157 
158 
159 template <typename T> void EvaluationTemplate<T>::Acos( Operator &arg ){
160 
161  arg.evaluate( this );
162  res = acos( res );
163 }
164 
165 template <typename T> void EvaluationTemplate<T>::Asin( Operator &arg ){
166 
167  arg.evaluate( this );
168  res = asin( res );
169 }
170 
171 template <typename T> void EvaluationTemplate<T>::Atan( Operator &arg ){
172 
173  arg.evaluate( this );
174  res = atan( res );
175 }
176 
177 template <typename T> void EvaluationTemplate<T>::Cos( Operator &arg ){
178 
179  arg.evaluate( this );
180  res = cos( res );
181 }
182 
183 template <typename T> void EvaluationTemplate<T>::Exp( Operator &arg ){
184 
185  arg.evaluate( this );
186  res = exp( res );
187 }
188 
189 template <typename T> void EvaluationTemplate<T>::Log( Operator &arg ){
190 
191  arg.evaluate( this );
192  res = log( res );
193 }
194 
195 template <typename T> void EvaluationTemplate<T>::Sin( Operator &arg ){
196 
197  arg.evaluate( this );
198  res = sin( res );
199 }
200 
201 template <typename T> void EvaluationTemplate<T>::Tan( Operator &arg ){
202 
203  arg.evaluate( this );
204  res = tan( res );
205 }
206 
208 
209 #endif
USING_NAMESPACE_ACADO IntermediateState sin(const Expression &arg)
Implements a templated dense matrix class.
Definition: t_matrix.hpp:53
IntermediateState atan(const Expression &arg)
USING_NAMESPACE_ACADO typedef TaylorVariable< Interval > T
Abstract base class for all scalar-valued symbolic operators.
Definition: operator.hpp:60
virtual void Asin(Operator &arg)
virtual void product(Operator &arg1, Operator &arg2)
virtual void Atan(Operator &arg)
IntermediateState asin(const Expression &arg)
IntermediateState pow(const Expression &arg1, const Expression &arg2)
IntermediateState tan(const Expression &arg)
virtual void project(int &idx)
#define CLOSE_NAMESPACE_ACADO
virtual void quotient(Operator &arg1, Operator &arg2)
IntermediateState cos(const Expression &arg)
virtual void Tan(Operator &arg)
virtual void Log(Operator &arg)
virtual void Sin(Operator &arg)
virtual void subtraction(Operator &arg1, Operator &arg2)
IntermediateState acos(const Expression &arg)
virtual void set(double &arg)
virtual void Exp(Operator &arg)
virtual returnValue evaluate(int number, double *x, double *result)=0
virtual void powerInt(Operator &arg1, int &arg2)
virtual void Acos(Operator &arg)
virtual void addition(Operator &arg1, Operator &arg2)
virtual void power(Operator &arg1, Operator &arg2)
Templated class for operator evaluation.
#define BEGIN_NAMESPACE_ACADO
Abstract base class for templated evaluation of operators.
IntermediateState exp(const Expression &arg)
virtual void Cos(Operator &arg)
IntermediateState log(const Expression &arg)


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