VTK
vtkAmoebaMinimizer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkAmoebaMinimizer.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
31 #ifndef vtkAmoebaMinimizer_h
32 #define vtkAmoebaMinimizer_h
33 
34 #include "vtkCommonMathModule.h" // For export macro
35 #include "vtkObject.h"
36 
38 {
39 public:
42  void PrintSelf(ostream& os, vtkIndent indent);
43 
50  void SetFunction(void (*f)(void *), void *arg);
51 
53  void SetFunctionArgDelete(void (*f)(void *));
54 
56 
62  void SetParameterValue(const char *name, double value);
63  void SetParameterValue(int i, double value);
65 
67 
71  void SetParameterScale(const char *name, double scale);
72  double GetParameterScale(const char *name);
73  void SetParameterScale(int i, double scale);
74  double GetParameterScale(int i) { return this->ParameterScales[i]; };
76 
78 
82  double GetParameterValue(const char *name);
83  double GetParameterValue(int i) { return this->ParameterValues[i]; };
85 
88  const char *GetParameterName(int i) { return this->ParameterNames[i]; };
89 
91  int GetNumberOfParameters() { return this->NumberOfParameters; };
92 
95  void Initialize();
96 
99  virtual void Minimize();
100 
103  virtual int Iterate();
104 
106 
107  vtkSetMacro(FunctionValue,double);
108  double GetFunctionValue() { return this->FunctionValue; };
110 
112 
115  vtkSetClampMacro(ContractionRatio,double,0.5,1.0);
116  vtkGetMacro(ContractionRatio,double);
118 
120 
122  vtkSetClampMacro(ExpansionRatio,double,1.0,2.0);
123  vtkGetMacro(ExpansionRatio,double);
125 
127 
128  vtkSetMacro(Tolerance,double);
129  vtkGetMacro(Tolerance,double);
131 
133 
134  vtkSetMacro(ParameterTolerance,double);
135  vtkGetMacro(ParameterTolerance,double);
137 
139 
140  vtkSetMacro(MaxIterations,int);
141  vtkGetMacro(MaxIterations,int);
143 
145 
147  vtkGetMacro(Iterations,int);
149 
151 
152  vtkGetMacro(FunctionEvaluations,int);
154 
158 
159 protected:
162 
163 //BTX
164  void (*Function)(void *);
165  void (*FunctionArgDelete)(void *);
166  void *FunctionArg;
167 //ETX
168 
174 
177 
178  double Tolerance;
183 
184 private:
185 // specific to amoeba simplex minimization
186 //BTX
187  double **AmoebaVertices;
188  double *AmoebaValues;
189  double *AmoebaSum;
190  double AmoebaSize;
191  double AmoebaHighValue;
192  int AmoebaNStepsNoImprovement;
193 
194  void InitializeAmoeba();
195  void GetAmoebaParameterValues();
196  void TerminateAmoeba();
197  double TryAmoeba(double sum[], int high, double fac);
198  int PerformAmoeba();
199  int CheckParameterTolerance();
200 //ETX
201 
202  vtkAmoebaMinimizer(const vtkAmoebaMinimizer&); // Not implemented.
203  void operator=(const vtkAmoebaMinimizer&); // Not implemented.
204 };
205 
206 #endif
vtkAmoebaMinimizer
nonlinear optimization with a simplex
Definition: vtkAmoebaMinimizer.h:38
vtkAmoebaMinimizer::NumberOfParameters
int NumberOfParameters
Definition: vtkAmoebaMinimizer.h:169
vtkAmoebaMinimizer::Tolerance
double Tolerance
Definition: vtkAmoebaMinimizer.h:178
vtkAmoebaMinimizer::Initialize
void Initialize()
vtkAmoebaMinimizer::GetNumberOfParameters
int GetNumberOfParameters()
Definition: vtkAmoebaMinimizer.h:91
vtkAmoebaMinimizer::ExpansionRatio
double ExpansionRatio
Definition: vtkAmoebaMinimizer.h:176
vtkAmoebaMinimizer::SetParameterScale
void SetParameterScale(const char *name, double scale)
vtkgl::scale
GLenum GLenum GLenum GLenum GLenum scale
Definition: vtkgl.h:15942
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkAmoebaMinimizer::GetFunctionValue
double GetFunctionValue()
Definition: vtkAmoebaMinimizer.h:108
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkAmoebaMinimizer::~vtkAmoebaMinimizer
~vtkAmoebaMinimizer()
vtkAmoebaMinimizer::vtkAmoebaMinimizer
vtkAmoebaMinimizer()
vtkAmoebaMinimizer::MaxIterations
int MaxIterations
Definition: vtkAmoebaMinimizer.h:180
vtkAmoebaMinimizer::EvaluateFunction
void EvaluateFunction()
vtkAmoebaMinimizer::Minimize
virtual void Minimize()
vtkAmoebaMinimizer::GetParameterScale
double GetParameterScale(int i)
Definition: vtkAmoebaMinimizer.h:74
vtkAmoebaMinimizer::GetParameterValue
double GetParameterValue(const char *name)
vtkAmoebaMinimizer::ParameterScales
double * ParameterScales
Definition: vtkAmoebaMinimizer.h:172
vtkAmoebaMinimizer::SetParameterScale
void SetParameterScale(int i, double scale)
vtkSetClampMacro
#define vtkSetClampMacro(name, type, min, max)
Definition: vtkSetGet.h:143
vtkgl::name
GLuint const GLchar * name
Definition: vtkgl.h:11983
vtkgl::value
GLsizei const GLfloat * value
Definition: vtkgl.h:12021
vtkAmoebaMinimizer::FunctionValue
double FunctionValue
Definition: vtkAmoebaMinimizer.h:173
vtkAmoebaMinimizer::Iterations
int Iterations
Definition: vtkAmoebaMinimizer.h:181
vtkAmoebaMinimizer::GetParameterValue
double GetParameterValue(int i)
Definition: vtkAmoebaMinimizer.h:83
vtkAmoebaMinimizer::FunctionEvaluations
int FunctionEvaluations
Definition: vtkAmoebaMinimizer.h:182
vtkAmoebaMinimizer::SetParameterValue
void SetParameterValue(int i, double value)
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkAmoebaMinimizer::ParameterTolerance
double ParameterTolerance
Definition: vtkAmoebaMinimizer.h:179
vtkAmoebaMinimizer::Iterate
virtual int Iterate()
vtkCommonMathModule.h
vtkGetMacro
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:93
VTKCOMMONMATH_EXPORT
#define VTKCOMMONMATH_EXPORT
Definition: vtkCommonMathModule.h:15
vtkAmoebaMinimizer::ParameterNames
char ** ParameterNames
Definition: vtkAmoebaMinimizer.h:170
vtkgl::f
GLclampf f
Definition: vtkgl.h:14181
vtkObject.h
vtkAmoebaMinimizer::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
vtkAmoebaMinimizer::GetParameterName
const char * GetParameterName(int i)
Definition: vtkAmoebaMinimizer.h:88
vtkAmoebaMinimizer::SetFunction
void SetFunction(void(*f)(void *), void *arg)
vtkAmoebaMinimizer::SetFunctionArgDelete
void SetFunctionArgDelete(void(*f)(void *))
vtkAmoebaMinimizer::GetParameterScale
double GetParameterScale(const char *name)
vtkAmoebaMinimizer::SetParameterValue
void SetParameterValue(const char *name, double value)
vtkgl::void
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
vtkAmoebaMinimizer::New
static vtkAmoebaMinimizer * New()
vtkAmoebaMinimizer::ParameterValues
double * ParameterValues
Definition: vtkAmoebaMinimizer.h:171
vtkAmoebaMinimizer::FunctionArg
void * FunctionArg
Definition: vtkAmoebaMinimizer.h:166
vtkAmoebaMinimizer::ContractionRatio
double ContractionRatio
Definition: vtkAmoebaMinimizer.h:175