Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

dox/Common/vtkAmoebaMinimizer.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkAmoebaMinimizer.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00031 #ifndef __vtkAmoebaMinimizer_h 00032 #define __vtkAmoebaMinimizer_h 00033 00034 #include "vtkObject.h" 00035 00036 class VTK_COMMON_EXPORT vtkAmoebaMinimizer : public vtkObject 00037 { 00038 public: 00039 static vtkAmoebaMinimizer *New(); 00040 vtkTypeRevisionMacro(vtkAmoebaMinimizer,vtkObject); 00041 void PrintSelf(ostream& os, vtkIndent indent); 00042 00049 void SetFunction(void (*f)(void *), void *arg); 00050 00052 void SetFunctionArgDelete(void (*f)(void *)); 00053 00055 00061 void SetParameterValue(const char *name, double value); 00062 void SetParameterValue(int i, double value); 00064 00066 00070 void SetParameterScale(const char *name, double scale); 00071 double GetParameterScale(const char *name); 00072 void SetParameterScale(int i, double scale); 00073 double GetParameterScale(int i) { return this->ParameterScales[i]; }; 00075 00077 00081 double GetParameterValue(const char *name); 00082 double GetParameterValue(int i) { return this->ParameterValues[i]; }; 00084 00087 const char *GetParameterName(int i) { return this->ParameterNames[i]; }; 00088 00090 int GetNumberOfParameters() { return this->NumberOfParameters; }; 00091 00094 void Initialize(); 00095 00098 virtual void Minimize(); 00099 00102 virtual int Iterate(); 00103 00105 00106 vtkSetMacro(FunctionValue,double); 00107 double GetFunctionValue() { return this->FunctionValue; }; 00109 00111 00112 vtkSetMacro(Tolerance,double); 00113 vtkGetMacro(Tolerance,double); 00115 00117 00118 vtkSetMacro(MaxIterations,int); 00119 vtkGetMacro(MaxIterations,int); 00121 00123 00125 vtkGetMacro(Iterations,int); 00127 00129 00130 vtkGetMacro(FunctionEvaluations,int); 00132 00135 void EvaluateFunction(); 00136 00137 protected: 00138 vtkAmoebaMinimizer(); 00139 ~vtkAmoebaMinimizer(); 00140 00141 //BTX 00142 void (*Function)(void *); 00143 void (*FunctionArgDelete)(void *); 00144 void *FunctionArg; 00145 //ETX 00146 00147 int NumberOfParameters; 00148 char **ParameterNames; 00149 double *ParameterValues; 00150 double *ParameterScales; 00151 double FunctionValue; 00152 00153 double Tolerance; 00154 int MaxIterations; 00155 int Iterations; 00156 int FunctionEvaluations; 00157 00158 private: 00159 // specific to amoeba simplex minimization 00160 //BTX 00161 double **AmoebaVertices; 00162 double *AmoebaValues; 00163 double *AmoebaSum; 00164 int AmoebaNStepsNoImprovement; 00165 00166 void InitializeAmoeba(); 00167 void GetAmoebaParameterValues(); 00168 void TerminateAmoeba(); 00169 double TryAmoeba(double sum[], int high, double fac); 00170 int PerformAmoeba(); 00171 //ETX 00172 00173 vtkAmoebaMinimizer(const vtkAmoebaMinimizer&); // Not implemented. 00174 void operator=(const vtkAmoebaMinimizer&); // Not implemented. 00175 }; 00176 00177 #endif