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

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 =========================================================================*/
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 //BTX  
00152   void (*Function)(void *);
00153   void (*FunctionArgDelete)(void *);
00154   void *FunctionArg;
00155 //ETX
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 // specific to amoeba simplex minimization 
00170 //BTX
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 //ETX
00182 
00183   vtkAmoebaMinimizer(const vtkAmoebaMinimizer&);  // Not implemented.
00184   void operator=(const vtkAmoebaMinimizer&);  // Not implemented.
00185 };
00186 
00187 #endif