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 "vtkObject.h"
35 
37 {
38 public:
39  static vtkAmoebaMinimizer *New();
41  void PrintSelf(ostream& os, vtkIndent indent);
42 
49  void SetFunction(void (*f)(void *), void *arg);
50 
52  void SetFunctionArgDelete(void (*f)(void *));
53 
55 
61  void SetParameterValue(const char *name, double value);
62  void SetParameterValue(int i, double value);
64 
66 
70  void SetParameterScale(const char *name, double scale);
71  double GetParameterScale(const char *name);
72  void SetParameterScale(int i, double scale);
73  double GetParameterScale(int i) { return this->ParameterScales[i]; };
75 
77 
81  double GetParameterValue(const char *name);
82  double GetParameterValue(int i) { return this->ParameterValues[i]; };
84 
87  const char *GetParameterName(int i) { return this->ParameterNames[i]; };
88 
90  int GetNumberOfParameters() { return this->NumberOfParameters; };
91 
94  void Initialize();
95 
98  virtual void Minimize();
99 
102  virtual int Iterate();
103 
105 
106  vtkSetMacro(FunctionValue,double);
107  double GetFunctionValue() { return this->FunctionValue; };
109 
111 
112  vtkSetMacro(Tolerance,double);
113  vtkGetMacro(Tolerance,double);
115 
117 
118  vtkSetMacro(MaxIterations,int);
119  vtkGetMacro(MaxIterations,int);
121 
123 
125  vtkGetMacro(Iterations,int);
127 
129 
130  vtkGetMacro(FunctionEvaluations,int);
132 
135  void EvaluateFunction();
136 
137 protected:
140 
141 //BTX
142  void (*Function)(void *);
143  void (*FunctionArgDelete)(void *);
144  void *FunctionArg;
145 //ETX
146 
152 
153  double Tolerance;
157 
158 private:
159 // specific to amoeba simplex minimization
160 //BTX
161  double **AmoebaVertices;
162  double *AmoebaValues;
163  double *AmoebaSum;
164  int AmoebaNStepsNoImprovement;
165 
166  void InitializeAmoeba();
167  void GetAmoebaParameterValues();
168  void TerminateAmoeba();
169  double TryAmoeba(double sum[], int high, double fac);
170  int PerformAmoeba();
171 //ETX
172 
173  vtkAmoebaMinimizer(const vtkAmoebaMinimizer&); // Not implemented.
174  void operator=(const vtkAmoebaMinimizer&); // Not implemented.
175 };
176 
177 #endif
const char * GetParameterName(int i)
nonlinear optimization with a simplex
abstract base class for most VTK objects
Definition: vtkObject.h:60
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:37
#define VTK_COMMON_EXPORT
static vtkObject * New()