1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2014 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21 #ifndef optimisation_H
22 #define optimisation_H
32 private: // attributes
40 double m_AverageError
;
49 void set(QString settings_txt
);
50 void setName(QString name
) { m_Name
= name
; }
51 QString
name() { return m_Name
; }
52 double operator()(double x
);
53 double maxError() { return m_MaxErr
; }
54 void reset(bool reset_average
);
55 bool active() { return m_Active
&& (m_Err0
> 1e-10); }
56 double averageError();
58 void activate() { m_Active
= true; }
59 void deactivate() { m_Active
= false; }
67 protected: // attributes
75 QList
<ErrorFunction
*> m_ErrorFunctions
;
79 virtual double func(vec3_t x
) = 0;
80 virtual double func(double x
, double y
, double z
) { return func(vec3_t(x
,y
,z
)); }
81 virtual void computeDerivatives(vec3_t x
);
83 void getErrSet(QString group
, QString key
, double err0
, double xs
, ErrorFunction
* err_func
);
84 double angleX(const vec3_t
&v1
, const vec3_t
&v2
);
85 void resetErrorFunctions(bool reset_average
= false);
92 virtual vec3_t
optimise(vec3_t x
);
93 void setDeltas(double d
) { Dx
= d
; Dy
= d
; Dz
= d
; }
94 void setDx(double d
) { Dx
= d
; }
95 void setDy(double d
) { Dy
= d
; }
96 void setDz(double d
) { Dz
= d
; }