Common/vtkAmoebaMinimizer.h Source File

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

# Common/vtkAmoebaMinimizer.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program:   Visualization Toolkit
    00004   Module:    $RCSfile: vtkAmoebaMinimizer.h,v $
    00005   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00045 #ifndef __vtkAmoebaMinimizer_h
    00046 #define __vtkAmoebaMinimizer_h
    00047
    00048 #include "vtkObject.h"
    00049
    00050 class VTK_COMMON_EXPORT vtkAmoebaMinimizer : public vtkObject
    00051 {
    00052 public:
    00053   static vtkAmoebaMinimizer *New();
    00054   vtkTypeRevisionMacro(vtkAmoebaMinimizer,vtkObject);
    00055   void PrintSelf(ostream& os, vtkIndent indent);
    00056
    00063   void SetFunction(void (*f)(void *), void *arg);
    00064
    00066   void SetFunctionArgDelete(void (*f)(void *));
    00067
    00069
    00075   void SetParameterValue(const char *name, double value);
    00076   void SetParameterValue(int i, double value);
    00078
    00080
    00084   void SetParameterScale(const char *name, double scale);
    00085   double GetParameterScale(const char *name);
    00086   void SetParameterScale(int i, double scale);
    00087   double GetParameterScale(int i) { return this->ParameterScales[i]; };
    00089
    00091
    00095   double GetParameterValue(const char *name);
    00096   double GetParameterValue(int i) { return this->ParameterValues[i]; };
    00098
    00101   const char *GetParameterName(int i) { return this->ParameterNames[i]; };
    00102
    00104   int GetNumberOfParameters() { return this->NumberOfParameters; };
    00105
    00108   void Initialize();
    00109
    00112   virtual void Minimize();
    00113
    00116   virtual int Iterate();
    00117
    00119
    00120   vtkSetMacro(FunctionValue,double);
    00121   double GetFunctionValue() { return this->FunctionValue; };
    00123
    00125
    00126   vtkSetMacro(Tolerance,double);
    00127   vtkGetMacro(Tolerance,double);
    00129
    00131
    00132   vtkSetMacro(MaxIterations,int);
    00133   vtkGetMacro(MaxIterations,int);
    00135
    00137
    00139   vtkGetMacro(Iterations,int);
    00141
    00143
    00144   vtkGetMacro(FunctionEvaluations,int);
    00146
    00149   void EvaluateFunction();
    00150
    00151 protected:
    00152   vtkAmoebaMinimizer();
    00153   ~vtkAmoebaMinimizer();
    00154
    00155 //BTX
    00156   void (*Function)(void *);
    00157   void (*FunctionArgDelete)(void *);
    00158   void *FunctionArg;
    00159 //ETX
    00160
    00161   int NumberOfParameters;
    00162   char **ParameterNames;
    00163   double *ParameterValues;
    00164   double *ParameterScales;
    00165   double FunctionValue;
    00166
    00167   double Tolerance;
    00168   int MaxIterations;
    00169   int Iterations;
    00170   int FunctionEvaluations;
    00171
    00172 private:
    00173 // specific to amoeba simplex minimization
    00174 //BTX
    00175   double **AmoebaVertices;
    00176   double *AmoebaValues;
    00177   double *AmoebaSum;
    00178   int AmoebaNStepsNoImprovement;
    00179
    00180   void InitializeAmoeba();
    00181   void GetAmoebaParameterValues();
    00182   void TerminateAmoeba();
    00183   double TryAmoeba(double sum[], int high, double fac);
    00184   int PerformAmoeba();
    00185 //ETX
    00186
    00187   vtkAmoebaMinimizer(const vtkAmoebaMinimizer&);  // Not implemented.
    00188   void operator=(const vtkAmoebaMinimizer&);  // Not implemented.
    00189 };
    00190
    00191 #endif