dox/Common/vtkAmoebaMinimizer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00035 #ifndef __vtkAmoebaMinimizer_h
00036 #define __vtkAmoebaMinimizer_h
00037
00038 #include "vtkObject.h"
00039
00040 class VTK_COMMON_EXPORT vtkAmoebaMinimizer : public vtkObject
00041 {
00042 public:
00043 static vtkAmoebaMinimizer *New();
00044 vtkTypeRevisionMacro(vtkAmoebaMinimizer,vtkObject);
00045 void PrintSelf(ostream& os, vtkIndent indent);
00046
00053 void SetFunction(void (*f)(void *), void *arg);
00054
00056 void SetFunctionArgDelete(void (*f)(void *));
00057
00059
00065 void SetParameterValue(const char *name, double value);
00066 void SetParameterValue(int i, double value);
00068
00070
00074 void SetParameterScale(const char *name, double scale);
00075 double GetParameterScale(const char *name);
00076 void SetParameterScale(int i, double scale);
00077 double GetParameterScale(int i) { return this->ParameterScales[i]; };
00079
00081
00085 double GetParameterValue(const char *name);
00086 double GetParameterValue(int i) { return this->ParameterValues[i]; };
00088
00091 const char *GetParameterName(int i) { return this->ParameterNames[i]; };
00092
00094 int GetNumberOfParameters() { return this->NumberOfParameters; };
00095
00098 void Initialize();
00099
00102 virtual void Minimize();
00103
00106 virtual int Iterate();
00107
00109
00110 vtkSetMacro(FunctionValue,double);
00111 double GetFunctionValue() { return this->FunctionValue; };
00113
00115
00116 vtkSetMacro(Tolerance,double);
00117 vtkGetMacro(Tolerance,double);
00119
00121
00122 vtkSetMacro(MaxIterations,int);
00123 vtkGetMacro(MaxIterations,int);
00125
00127
00129 vtkGetMacro(Iterations,int);
00131
00133
00134 vtkGetMacro(FunctionEvaluations,int);
00136
00139 void EvaluateFunction();
00140
00141 protected:
00142 vtkAmoebaMinimizer();
00143 ~vtkAmoebaMinimizer();
00144
00145
00146 void (*Function)(void *);
00147 void (*FunctionArgDelete)(void *);
00148 void *FunctionArg;
00149
00150
00151 int NumberOfParameters;
00152 char **ParameterNames;
00153 double *ParameterValues;
00154 double *ParameterScales;
00155 double FunctionValue;
00156
00157 double Tolerance;
00158 int MaxIterations;
00159 int Iterations;
00160 int FunctionEvaluations;
00161
00162 private:
00163
00164
00165 double **AmoebaVertices;
00166 double *AmoebaValues;
00167 double *AmoebaSum;
00168 int AmoebaNStepsNoImprovement;
00169
00170 void InitializeAmoeba();
00171 void GetAmoebaParameterValues();
00172 void TerminateAmoeba();
00173 double TryAmoeba(double sum[], int high, double fac);
00174 int PerformAmoeba();
00175
00176
00177 vtkAmoebaMinimizer(const vtkAmoebaMinimizer&);
00178 void operator=(const vtkAmoebaMinimizer&);
00179 };
00180
00181 #endif