Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00034 #ifndef ACADO_TOOLKIT_TAYLOR_MODEL_HPP
00035 #define ACADO_TOOLKIT_TAYLOR_MODEL_HPP
00036
00037 #include <acado/utils/acado_utils.hpp>
00038
00039
00040 BEGIN_NAMESPACE_ACADO
00041
00042 template <typename T> class TaylorVariable;
00043
00051 template <typename T>
00052 class TaylorModel
00054 {
00055
00056 friend class TaylorVariable<T>;
00057 template <typename U> friend class TaylorModel;
00058
00059 public:
00060
00062 TaylorModel
00063 ( const unsigned int nvar_, const unsigned int nord_ )
00064 { _size( nvar_, nord_ ); }
00065
00067 ~TaylorModel()
00068 { _cleanup(); }
00069
00071 unsigned int nvar() const
00072 { return _nvar; };
00074 unsigned int nord() const
00075 { return _nord; };
00077 void reset()
00078 { _reset(); };
00079
00081 class Exceptions
00082 {
00083 public:
00085 enum TYPE{
00086 DIV=1,
00087 INTER,
00088 EIGEN,
00089 SCALING,
00090 SIZE=-1,
00091 INIT=-2,
00092 INCON=-3,
00093 TMODEL=-4,
00094 UNDEF=-33
00095 };
00097 Exceptions( TYPE ierr_ ) : _ierr( ierr_ ){}
00099 int ierr(){ return _ierr; }
00100
00101 private:
00102 TYPE _ierr;
00103 };
00104
00106 struct Options
00107 {
00109 Options():
00110 BOUNDER_TYPE(LSB), PROPAGATE_BNDT(false), INTER_WITH_BNDT(false),
00111 SCALE_VARIABLES(true), CENTER_REMAINDER(true), REF_MIDPOINT(true)
00112 {}
00114 template <typename U> Options
00115 ( U&_options )
00116 : BOUNDER_TYPE( _options.BOUNDER_TYPE ),
00117 PROPAGATE_BNDT( _options.PROPAGATE_BNDT ),
00118 INTER_WITH_BNDT( _options.INTER_WITH_BNDT ),
00119 SCALE_VARIABLES( _options.SCALE_VARIABLES ),
00120 CENTER_REMAINDER( _options.CENTER_REMAINDER ),
00121 REF_MIDPOINT( _options.REF_MIDPOINT )
00122 {}
00123 template <typename U> Options& operator =
00124 ( U&_options ){
00125 BOUNDER_TYPE = _options.BOUNDER_TYPE;
00126 PROPAGATE_BNDT = _options.PROPAGATE_BNDT;
00127 INTER_WITH_BNDT = _options.INTER_WITH_BNDT;
00128 SCALE_VARIABLES = _options.SCALE_VARIABLES;
00129 CENTER_REMAINDER = _options.CENTER_REMAINDER;
00130 REF_MIDPOINT = _options.REF_MIDPOINT;
00131 return *this;
00132 }
00134 enum BOUNDER{
00135 NAIVE=0,
00136 LSB,
00137 EIGEN,
00138 HYBRID
00139 };
00141 int BOUNDER_TYPE;
00143 bool PROPAGATE_BNDT;
00145 bool INTER_WITH_BNDT;
00147 bool SCALE_VARIABLES;
00149 bool CENTER_REMAINDER;
00151 bool REF_MIDPOINT;
00152 } options;
00153
00155 static void pause();
00156
00157 private:
00159 unsigned int _nord;
00161 unsigned int _nvar;
00163 unsigned int _nmon;
00165 unsigned int *_posord;
00167 unsigned int *_expmon;
00169 unsigned int **_prodmon;
00171 T *_bndmon;
00173 bool _modvar;
00175 unsigned int *_binom;
00177 T **_bndpow;
00179 double *_refpoint;
00181 double *_scaling;
00182
00184 TaylorVariable<T>* _TV;
00185
00187 void _size
00188 ( const unsigned int nvar, const unsigned int nord );
00189
00190
00191
00192
00193
00195 void _set_bndpow
00196 ( const unsigned int ix, const T&X, const double scaling );
00197
00199 void _set_bndmon();
00200
00202 void _set_posord();
00203
00205 void _set_expmon();
00206
00208 void _next_expmon
00209 ( unsigned int *iexp, const unsigned int iord );
00210
00212 void _set_prodmon();
00213
00215 unsigned int _loc_expmon
00216 ( const unsigned int *iexp );
00217
00219 void _set_binom();
00220
00222 unsigned int _get_binom
00223 ( const unsigned int n, const unsigned int k ) const;
00224
00226 void _reset();
00227
00229 void _cleanup();
00230
00232 template< typename U > static void _display
00233 ( const unsigned int m, const unsigned int n, U*&a, const unsigned int lda,
00234 const std::string&stra, std::ostream&os );
00235 };
00236
00237
00238 CLOSE_NAMESPACE_ACADO
00239
00240 #include <acado/set_arithmetics/taylor_variable.hpp>
00241 #include <acado/set_arithmetics/taylor_model.ipp>
00242 #include <acado/set_arithmetics/taylor_variable.ipp>
00243
00244 #endif // ACADO_TOOLKIT_TAYLOR_MODEL_HPP
00245