class HJSearch : public PatternSearch

Hooke and Jeeves search based on the class PatternSearch For a good description of the Hooke and Jeeves search algorithm I recommend Non-Linear Optimization Techniques by Box, Davies, and Swann, 1969

Inheritance:



Inherited from PatternSearch:

Public

Constructors & Destructor

PatternSearch(long dim, Vector<double> &startPoint)
Constructor for class PatternSearch
PatternSearch(const PatternSearch & Original)
Deep copy constructor for class PatternSearch
PatternSearch(long dim, Vector<double> &startPoint, double startStep, double stopStep, void (*objective)(long vars, Vector<double> &x, double & func, bool& flag, void* an_obj), void * input_obj)
Special constructor using void function and object pointers
virtual ~PatternSearch()
Destructor

Other Initialization Methods

virtual PatternSearch& operator=(const PatternSearch& A)
Overloaded assignment operator
virtual void CleanSlate(long dim, Vector<double> &startpoint)
Reinitializes values in order to reuse the same search object
virtual void CleanSlate(long dim, Vector<double> &startpoint, double startStep, double stopStep, void (*objective)(long vars, Vector<double> &x, double & func, bool& flag, void* an_obj), void * input_obj)
overloaded version of CleanSlate using void function and object pointers
void InitializeDesign(long patternSize, const Matrix<double> * designPtr)
Deletes any existing pattern and replaces it with the one pointed to by designPtr
void ReadInFile(istream & fp)
Reads the design in from a file
void PrintDesign() const
Prints out useful information about the search

Search method

virtual void BeginSearch()
BeginSearch() is an unimplemented virtual void method in the abstract base classes

Accessors

void GetPatternLength(long & pattern) const
Returns the number of "columns" of the pattern matrix
double GetDelta() const
Returns delta, the lattice step length
void GetInitialStepLength(double & stepLen)
Returns initialStepLength, the initial value of delta
void SetInitialStepLength(double & stepLen)
Assigns the value of steplen to initialStepLength

Protected Fields

long patternLength
double delta
double initialStepLength

Protected Methods

virtual bool Stop()
virtual void ExploratoryMoves()
virtual void CopySearch(const PatternSearch & Original)
virtual void NextPoint(long index, const Vector<double> & currentPoint, Vector<double> & nextPoint)
virtual void ReplaceMinimum(Vector<double> & newPoint, double newValue)
virtual void ScalePattern(double scalar)

Inherited from DirectSearch:

Public Fields

static const long NO_MAX

Public

Constructors and destructor

DirectSearch(long dim, Vector<double> &startPoint)
Constructor
DirectSearch(const DirectSearch & Original)
Copy constructor
DirectSearch(long dim, Vector<double> &startPoint, double stopStep, void (*objective)(long vars, Vector<double> &x, double &func, bool &flag, void* an_obj), void * input_obj)
special constructor using void function and object pointers
virtual ~DirectSearch()
Destructor
DirectSearch& operator=(const DirectSearch& A)
Overloaded assignment operator

Other initialization methods

virtual void ReadInFile(istream & fp)
Reads the design in from a file supplied by the user
virtual void CleanSlate(long dim, Vector<double> & startPoint)
Reinitializes values in order to reuse the same search object
virtual void CleanSlate(long dim, Vector<double> &startPoint, double stopStep, void (*objective)(long vars, Vector<double> &x, double &func, bool &flag, void* an_obj), void * input_obj)
overloaded version of CleanSlate using void function and object pointers
void InitializeDesign(const Matrix<double> *designPtr)
Deletes any existing pattern and replaces it with the one pointed to by designPtr
virtual void PrintDesign() const
Prints out search information

Accessors and Mutators

long GetFunctionCalls() const
Returns number of objective function evaluations so far
void SetFunctionCalls(long newCalls)
Sets number of function calls already used--useful for times when you are using multiple searches for the same optimization; for example, if you wanted to do 100 function calls worth of SMDSearch followed by 100 calls (max) of HJSearch
int GetID() const
Returns the ID Number of the search
void GetMinPoint(Vector<double> & minimum) const
Retrieves the minimum point and assigns it to minimum The vector minimum should be of the correct dimension
void SetMinPoint(Vector<double> & minimum) const
Resets minPoint to the point represented by the input parameter minimum
void GetMinVal(double & value) const
Retrieves the best objective function value found thus far
void SetMinVal(double & value)
Resets the minimum value to the value of the input parameter
long GetDimension() const
Returns the dimension of the problem
long GetMaxCalls() const
Returns the number of function calls in the budget; if the value is equal to NO_MAX, will terminate based only on refinement of the design
void SetMaxCalls(long calls)
Use to set a function call budget; by default set to the value of NO_MAX, which indicates no budget, in which case the search will terminate based only upon grid refinement
void SetMaxCallsExact(long calls)
Sets maxCalls to the value of calls, and sets exact_count to true, so search will terminate precisely when the call budget runs out
Matrix <double> * GetDesign()
Returns a pointer to a matrix initialized from the design matrix
void CopyDesign(Matrix<double>* &designPtr) const
Deep copy of the pattern to a Matrix pointer
double GetStoppingStepLength() const
Returns stoppingStepLength, the smallest step length allowed in the search
void SetStoppingStepLength(double len)
Sets stoppingStepLength, the smallest step length allowed in the search, to the value of the input parameter
virtual void SetExact()
Allows the user to specify that the search will terminate precicely upon completion of maxCalls number of function calls
virtual void SetInexact()
Allows the user to specify that the search will terminate upon completion of roughly maxCalls number of function calls, but only after a pattern decrease or "shrink" step
virtual bool IsExact()
Returns the value of exact_count(q

Protected Fields

Matrix <double> * design
long dimension
Vector <double> * minPoint
double minValue
long functionCalls
long maxCalls
double stoppingStepLength
void* some_object
bool exact_count
int IDnumber

Protected Methods

void fcnCall(long n, Vector<double> &x, double & f, bool& flag, void * nothing)
bool BreakOnExact()
void (*fcn_name)(long dim, Vector<double> &x, double & function, bool & success, void* an_object)

Documentation

Hooke and Jeeves search based on the class PatternSearch For a good description of the Hooke and Jeeves search algorithm I recommend Non-Linear Optimization Techniques by Box, Davies, and Swann, 1969.

HJSearch(long numberOfVariables, Vector<double> &startPoint)
Constructor. This constructor has two parameters. It calls the PatternSearch constructor with the same signature, then initializes three member fields with default values as follows:

step = initialStepLength; factor = 0.5; IDnumber = 2300;

Parameters:
dim - the dimension of the problem
startpoint - the start point for the search
See Also:
PatternSearch::PatternSearch(long dim, Vector &startPoint)

HJSearch(const HJSearch & Original)
Copy constructor. Makes a deep copy of the search by calling the PatternSearch copy constructor and then initializing the additional two fields. The new search will have the same values as those of the input parameter Original.
Parameters:
Original - the search to be copied

HJSearch(long dim, Vector<double> &startPoint, double startStep, double stopStep, void(objective)(long vars, Vector<double> &x, double & func, bool& flag, void* an_obj), void * input_obj)
Special constructor using void function and object pointers. This constructor calls the PatternSearch constructor with the same signature, then initializes the three additional member fields as in HJSearch(long numberOfVariables, Vector<double> &startPoint);

This constructor takes six input parameters.

Parameters:
dim - the dimension of the problem
startPoint - a Vector of doubles, the starting point for the search
startStep - the beginning delta, or lattice step length
stopStep - the stopping step length for the search
objective - a pointer to the function to be minimized
input_obj - used to send additional data as needed--will normally be set to NULL.
See Also:
PatternSearch(long dim, Vector &startPoint, double startStep, double stopStep, void (*objective)(long vars, Vector &x, double & func, bool& flag, void* an_obj), void * input_obj)

~HJSearch()
Destructor

virtual HJSearch& operator=(const HJSearch& A)
Overloaded assignment operator
Returns:
HJSearch&
Parameters:
A - the search to be copied

void BeginSearch()
BeginSearch() will call the methods that implement the actual compass search algorithm.
Returns:
void

double GetDelta()
overrides the PatternSearch version with an acurate length. Returns the value of step.
Returns:
double

void CleanSlate(long dimensions, Vector<double> &startPoint)
Reinitializes values in order to reuse the same search object. This version of CleanSlate takes two parameters. It calls the PatternSearch version of CleanSlate with the same signature, and Other data members are set by default as in the constructor HJSearch(long, Vector<double>&).
Returns:
void
Parameters:
dim - the dimension of the problem
startPoint - the new starting point for the search
See Also:
CleanSlate(long dim, Vector &startpoint, double * startStep, double stopStep, void (*objective)(long vars, Vector &x, double & func, bool& flag, void* an_obj), void * input_obj)

void CleanSlate(long dim, Vector<double> &startPoint, double startStep, double stopStep, void (*objective)(long vars, Vector<double> &x, double & func, bool& flag, void* an_obj), void * input_obj)
Overloaded version of CleanSlate using void function and object pointers. This version of CleanSlate takes six parameters. It calls the PatternSearch method with the same signature and sets additional fields to default values as in the constructors.
Returns:
void
Parameters:
dim - the dimension of the problem
startPoint - a Vector of doubles, the starting point for the search
startStep - the beginning delta, or lattice step length
stopStep - the stopping step length for the search
objective - a pointer to the function to be minimized
input_obj - used to send additional data as needed--will normally be set to NULL.
See Also:
CleanSlate(long dim, Vector &startpoint)

void ExploratoryMoves()
Exploratory Moves does the real work of the search. It searches in a Hooke and Jeeves pattern for a better solution to the objective function
Returns:
void

void CopySearch(const HJSearch & Original)
Used to implement the overloaded assignment operator
Returns:
void
Parameters:
Original - a reference to an HJSearch object

bool Stop()
makes certain search has not exceeded maxCalls or is stepping at less than stoppingStepLength
Returns:
bool

double step
step length

double factor
factor by which the step is reduced


This class has no child classes.
Author:
Liz Dolan, The College of William and Mary, 1999; modified by P.L.(Anne) Shepherd, 2000-2001

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de