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:
40  static vtkAmoebaMinimizer *New();
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 
157  void EvaluateFunction();
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
const char * GetParameterName(int i)
nonlinear optimization with a simplex
abstract base class for most VTK objects
Definition: vtkObject.h:61
double GetParameterValue(int i)
virtual void PrintSelf(ostream &os, vtkIndent indent)
double GetParameterScale(int i)
a simple class to control print indentation
Definition: vtkIndent.h:38
static vtkObject * New()
#define VTKCOMMONMATH_EXPORT