vtkAmoebaMinimizer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00041 #ifndef __vtkAmoebaMinimizer_h
00042 #define __vtkAmoebaMinimizer_h
00043
00044 #include "vtkObject.h"
00045
00046 class VTK_COMMON_EXPORT vtkAmoebaMinimizer : public vtkObject
00047 {
00048 public:
00049 static vtkAmoebaMinimizer *New();
00050 vtkTypeRevisionMacro(vtkAmoebaMinimizer,vtkObject);
00051 void PrintSelf(ostream& os, vtkIndent indent);
00052
00059 void SetFunction(void (*f)(void *), void *arg);
00060
00062 void SetFunctionArgDelete(void (*f)(void *));
00063
00065
00071 void SetParameterValue(const char *name, double value);
00072 void SetParameterValue(int i, double value);
00074
00076
00080 void SetParameterScale(const char *name, double scale);
00081 double GetParameterScale(const char *name);
00082 void SetParameterScale(int i, double scale);
00083 double GetParameterScale(int i) { return this->ParameterScales[i]; };
00085
00087
00091 double GetParameterValue(const char *name);
00092 double GetParameterValue(int i) { return this->ParameterValues[i]; };
00094
00097 const char *GetParameterName(int i) { return this->ParameterNames[i]; };
00098
00100 int GetNumberOfParameters() { return this->NumberOfParameters; };
00101
00104 void Initialize();
00105
00108 virtual void Minimize();
00109
00112 virtual int Iterate();
00113
00115
00116 vtkSetMacro(FunctionValue,double);
00117 double GetFunctionValue() { return this->FunctionValue; };
00119
00121
00122 vtkSetMacro(Tolerance,double);
00123 vtkGetMacro(Tolerance,double);
00125
00127
00128 vtkSetMacro(MaxIterations,int);
00129 vtkGetMacro(MaxIterations,int);
00131
00133
00135 vtkGetMacro(Iterations,int);
00137
00139
00140 vtkGetMacro(FunctionEvaluations,int);
00142
00145 void EvaluateFunction();
00146
00147 protected:
00148 vtkAmoebaMinimizer();
00149 ~vtkAmoebaMinimizer();
00150
00151
00152 void (*Function)(void *);
00153 void (*FunctionArgDelete)(void *);
00154 void *FunctionArg;
00155
00156
00157 int NumberOfParameters;
00158 char **ParameterNames;
00159 double *ParameterValues;
00160 double *ParameterScales;
00161 double FunctionValue;
00162
00163 double Tolerance;
00164 int MaxIterations;
00165 int Iterations;
00166 int FunctionEvaluations;
00167
00168 private:
00169
00170
00171 double **AmoebaVertices;
00172 double *AmoebaValues;
00173 double *AmoebaSum;
00174 int AmoebaNStepsNoImprovement;
00175
00176 void InitializeAmoeba();
00177 void GetAmoebaParameterValues();
00178 void TerminateAmoeba();
00179 double TryAmoeba(double sum[], int high, double fac);
00180 int PerformAmoeba();
00181
00182
00183 vtkAmoebaMinimizer(const vtkAmoebaMinimizer&);
00184 void operator=(const vtkAmoebaMinimizer&);
00185 };
00186
00187 #endif