class SHHSearch : public SimplexSearch

The SHHSearch class implements the Spendley, Hext and Himsworth Simplex Search

Inheritance:


Public

Constructors and destructor
SHHSearch(long dim, Vector<double> &startPoint)
Constructor
SHHSearch(long dim, Vector<double> &startPoint, double sig)
Constructor which allows shrinking coefficient initialization
SHHSearch(long dim, Vector<double> &startPoint, double sig, Vector<double> &lengths )
Constructor which allows shrinking coefficient initialization and specification of starting_edgeLengths
SHHSearch(const SHHSearch& Original)
Copy constructor
SHHSearch(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 ~SHHSearch()
Destructor
Other public methods
SHHSearch& operator=(const SHHSearch& A)
Overloaded assignment operator
void BeginSearch()
Begins the actual search, using the algorithm described by Spendley, Hext and Himsworth
virtual void ChooseRegularSimplex()
Allows the user to choose a regular simplex for the search, rather than the default fixed length right simplex
virtual void ChooseRightSimplex()
Deletes any existing simplex and replaces it with a right-angle simplex in the following manner:

minPoint points to the point that will be the "origin" or base point of the simplex points (it will be a part of the simplex) starting_edgeLengths points to a vector of n doubles, where n is the dimension of the given search

void ReadInFile(istream& fp)
May also pass cin as input stream if desired
void GetCurrentSimplexAges(long* &simAges) const
Performs a deep copy of the simplexAges array to a double pointer points to a newly allocated chunk of memory upon return USER SHOULD PASS JUST A NULL POINTER, WITHOUT PREALLOCATED MEMORY
void PrintDesign() const
Prints out the simplex points by row, their corresponding f(x) values, and the number of function calls thus far
protected methods
virtual void ExploratoryMoves()
This method does the actual work of the search
virtual bool Stop()
Returns true if the stopping criteria have been satisfied
virtual void InitRegSimplex()
Inititializes a regular simplex, following an algorithm given by Jacoby, Kowalik, and Pizzo in "Iterative Methods for Nonlinear Optimization Problems," Prentice-Hall (1972)
virtual void InitRightSimplex()
Inititializes a right simplex
virtual void InitGeneralSimplex(Matrix<double> *plex)
Deletes any existing design matrix and replaces it with one pointed to by plex
void FindMinReplacementIndices(long replacementSkipIndex)
Sets minIndex to the simplex index of the point which generates the lowest value of f(x) sets replacementIndex to the simplex index of the point which generates the highest value of f(x) excluding the point at replacementSkipIndex if replacementSkipIndex is set to a valid simplex index, the replacement search will skip over that index during its search this is used to prevent the simplex from getting stuck in a "back and forth" infinite loop
void FindReflectionPt()
Finds the reflection point and sets its f(x) value
int AgesTooOld()
Determines when to shrink the simplex based on how old the individual simplex points are returns 1 if true and a shrink should occur, 0 otherwise
void UpdateAges(long newIndex)
Increments the ages of all simplex points EXCEPT the point with index newIndex, which gets an age of 1
void ResetAges()
Resets all simplex point ages to 1
protected fields
long* simplexAges
Will point to an array of longs that corresponds to the simplex ages
Vector <double> * reflectionPt
The reflection point of the simplex
double reflectionPtValue
The value of f(reflectionPt)

Inherited from SimplexSearch:

Public Fields

static const int def_Length

Public

Accessor and mutator methods

long GetReplacementIndex() const
Returns replacementIndex
void SetStartingEdgeLengths(const Vector<double> & lengths)
Sets starting_edgeLengths to equal lengths
void GetStartingEdgeLengths(Vector<double> & lengths)
Assigns the input Vector lengths the values of the member field starting_edgeLengths
void SetSigma(double newSigma)
Allows the user to set a new value for the shrinking coefficient
double GetSigma()
Returns the value of sigma
void GetCurrentSimplexValues(double* &simValues) const
performs a deep copy of the simplexValues array to a double pointer points to a newly allocated chunk of memory upon return USER SHOULD PASS JUST A NULL POINTER, WITHOUT PREALLOCATED MEMORY
int GetTolHit() const
Returns toleranceHit, which indicates whether the simplex size has refined down to the value of stoppingStepLength
long GetMinIndex() const
Returns minIndex
void GetCentroid(Vector<double>* &troid)
Upon return the input Vector* troid will point to a newly allocated Vector of doubles representing the centroid of the simplex
double GetDelta()
Returns delta, the length of the longest simplex edge
bool Is_Stop_on_std() const
Returns value of the Stop_on_std field
void Set_Stop_on_std()
Allows user to specify that the standard Nelder-Mead stopping criterion will be used
void Set_Stop_on_delta()
Allows users to specify that the search will terminated based on delta

Protected fields

double* simplexValues
f(x) values of the points corresponding to the rows of the design matrix
Vector <double> * starting_edgeLengths
The edgelengths of the simplex that will be represented by the design matrix
double sigma
The shrinking coefficient
long minIndex
Index of point generating min f(x)
long replacementIndex
Index of point to be replaced
Vector <double> * centroid
The current centroid
int toleranceHit
Flag to indicate the reason for stopping the search
bool SimplexSpecified
Flag to indicate whether a specific simplex type has been chosen
bool Stop_on_std
Flag to indicate that the user has chosen (where available) to use the standard-deviation (i
double delta
Named to recall the "delta" of the pattern searches, this is generally the length of (at the start) the longest edge of the simplex; it is used for the stopping test where Stop_on_std is false (as it is by default)
Vector <double> * scratch
The two scratch vectors are simply extra storage space to be used by methods that require a vector of size = dimensions

Inherited from DirectSearch:

Public Fields

static const long NO_MAX

Public

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

Search method

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

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

virtual void ExploratoryMoves()
virtual bool Stop()
void fcnCall(long n, Vector<double> &x, double & f, bool& flag, void * nothing)
virtual void CopySearch(const DirectSearch & Original)
bool BreakOnExact()
void (*fcn_name)(long dim, Vector<double> &x, double & function, bool & success, void* an_object)

Documentation

The SHHSearch class implements the Spendley, Hext and Himsworth Simplex Search.

Constructors and destructor

SHHSearch(long dim, Vector<double> &startPoint)
Constructor. This constructor has two parameters. Other data members will be set to default values, as follows. This is of course in addition to assignments and initializations made in DirectSearch and SimplexSearch classes.

    simplexAges = NULL
    memory is allocated for field reflectionPt
    IDnumber = 3100

Parameters:
dim - the dimension of the problem
startpoint - the start point for the search. This will be initialized as the minPoint.

SHHSearch(long dim, Vector<double> &startPoint, double sig)
Constructor which allows shrinking coefficient initialization. sigma will be set to the value of sig by the SimplexSearch constructor with the same signature. Other fields will be assigned as in SHHSearch(long dim, Vector<double> &startPoint).

Parameters:
dim - the dimension of the problem.
startpoint - the start point for the search. This will be initialized as the minPoint.
sig - the user-defined value for sigma, the shrinking coefficient.

SHHSearch(long dim, Vector<double> &startPoint, double sig, Vector<double> &lengths )
Constructor which allows shrinking coefficient initialization and specification of starting_edgeLengths. sigma will be set to the value of sig by SimplexSearch constructor with the same signature, and starting_edgeLengths will be initialized from lengths. Other fields will be assigned as in SHHSearch(long dim, Vector<double> &startPoint).

Parameters:
dim - the dimension of the problem.
startpoint - the start point for the search. This will be initialized as the minPoint.
sig - the user-defined value for sigma, the shrinking coefficient.
lengths - reference to a Vector of doubles representing the desired edgelengths of the simplex.

SHHSearch(const SHHSearch& Original)
Copy constructor
Parameters:
Original - a reference to the object from which to construct *this.

SHHSearch(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. The objective function can be sent in as the fourth parameter here; the last parameter is used for any other information that may be necessary; it is used in MAPS, for example, to send in an object from an outside class. Usually, though, the final parameter will simply be set to NULL.

This constructor takes six input parameters. All are sent to the SimplexSearch constructor with the same signature. Other fields are set by default as in SHHSearch(long dim, Vector<double> &startPoint).

Parameters:
dim - the dimension of the problem
startPoint - a Vector of doubles, the starting point for the search
startStep - will be used as the edge length of a fixed-length right simplex.
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.

virtual ~SHHSearch()
Destructor

Other public methods

SHHSearch& operator=(const SHHSearch& A)
Overloaded assignment operator
Returns:
SHHSearch&
Parameters:
A - the search to be assigned to *this.

void BeginSearch()
Begins the actual search, using the algorithm described by Spendley, Hext and Himsworth
Returns:
void

virtual void ChooseRegularSimplex()
Allows the user to choose a regular simplex for the search, rather than the default fixed length right simplex
Returns:
void

virtual void ChooseRightSimplex()
Deletes any existing simplex and replaces it with a right-angle simplex in the following manner:

minPoint points to the point that will be the "origin" or base point of the simplex points (it will be a part of the simplex) starting_edgeLengths points to a vector of n doubles, where n is the dimension of the given search. x_1 will then be located a distance of starting_edgeLengths[0] away from the base point along the the x_1 axis, x_2 is edgeLengths[1] away on the x_2 axis, etc.

functionCalls is reset to 0.

Returns:
void

void ReadInFile(istream& fp)
May also pass cin as input stream if desired. Input the values of each trial point NOTE: THIS FUNCTION WILL ONLY ACCEPT n+1 POINTS

functionCalls is reset to 0 and ALL FUNCTION VALUES ARE CALCULATED.

Returns:
void
Parameters:
fp - reference to an input stream

void GetCurrentSimplexAges(long* &simAges) const
Performs a deep copy of the simplexAges array to a double pointer points to a newly allocated chunk of memory upon return USER SHOULD PASS JUST A NULL POINTER, WITHOUT PREALLOCATED MEMORY
Returns:
void
Parameters:
simAges - reference to a pointer to an array of doubles, should be NULL going in.

void PrintDesign() const
Prints out the simplex points by row, their corresponding f(x) values, and the number of function calls thus far
Returns:
void

protected methods

virtual void ExploratoryMoves()
This method does the actual work of the search. It uses the Spendley, Hext and Himsworth algorithm to find function minimum.
Returns:
void

virtual bool Stop()
Returns true if the stopping criteria have been satisfied.
Returns:
bool

virtual void InitRegSimplex()
Inititializes a regular simplex, following an algorithm given by Jacoby, Kowalik, and Pizzo in "Iterative Methods for Nonlinear Optimization Problems," Prentice-Hall (1972). This algorithm also appears in Spendley, Hext, and Himsworth, "Sequential Application of Simplex Designs in Optimisation and Evolutionary Operation," Technometrics, Vol. 4, No. 4, November 1962, pages 441--461. Note that Input matrix plex must be of the correct dimensions.

Returns:
void
Parameters:
plex - pointer to a Matrix of doubles, of appropriate size.

virtual void InitRightSimplex()
Inititializes a right simplex. Input matrix plex must be of the correct dimensions.
Returns:
void
Parameters:
plex - pointer to a Matrix of doubles, of appropriate size.

virtual void InitGeneralSimplex(Matrix<double> *plex)
Deletes any existing design matrix and replaces it with one pointed to by plex. functionCalls is set to 0 and ALL FUNCTION VALUES ARE CALCULATED.
Returns:
void
Parameters:
plex - pointer to a Matrix of doubles, from which design will be initialized.

void FindMinReplacementIndices(long replacementSkipIndex)
Sets minIndex to the simplex index of the point which generates the lowest value of f(x) sets replacementIndex to the simplex index of the point which generates the highest value of f(x) excluding the point at replacementSkipIndex if replacementSkipIndex is set to a valid simplex index, the replacement search will skip over that index during its search this is used to prevent the simplex from getting stuck in a "back and forth" infinite loop. When the min replacement index is found, minPoint is reset as well, to the appropriate values.
Returns:
void
Parameters:
replacementSkipIndex - the index to skip over

void FindReflectionPt()
Finds the reflection point and sets its f(x) value
Returns:
void

int AgesTooOld()
Determines when to shrink the simplex based on how old the individual simplex points are returns 1 if true and a shrink should occur, 0 otherwise
Returns:
int

void UpdateAges(long newIndex)
Increments the ages of all simplex points EXCEPT the point with index newIndex, which gets an age of 1
Returns:
void
Parameters:
newIndex - the index of the new point, whose age will not be incremented.

void ResetAges()
Resets all simplex point ages to 1.
Returns:
void

protected fields

long* simplexAges
Will point to an array of longs that corresponds to the simplex ages

Vector <double> * reflectionPt
The reflection point of the simplex

double reflectionPtValue
The value of f(reflectionPt)


This class has no child classes.
Author:
Adam Gurson College of William & Mary 1999, revised by P.L. 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