class PatternSearch : public DirectSearch

The PatternSearch class is derived from the DirectSearch class

Inheritance:


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
The number of "columns" in design matrix, i
double delta
The density of the underlying lattice
double initialStepLength
The initial setting for delta

Protected Methods

virtual bool Stop()
Whether nor not to stop, based either on maxCalls or lattice resolution
virtual void ExploratoryMoves()
PatternSearch::Exploratory Moves is an unimplemented virtual void function
virtual void CopySearch(const PatternSearch & Original)
Used to implement the overloaded assignment operator
virtual void NextPoint(long index, const Vector<double> & currentPoint, Vector<double> & nextPoint)
NextPoint() calculates the next trial point by adding the design matrix column at index to the current vector
virtual void ReplaceMinimum(Vector<double> & newPoint, double newValue)
Replaces the minimizer & the minimum objective function value
virtual void ScalePattern(double scalar)
Scale lattice step length by 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

The PatternSearch class is derived from the DirectSearch class. PatternSearch is an abstract base class.
Constructors & Destructor

PatternSearch(long dim, Vector<double> &startPoint)
Constructor for class PatternSearch. This constructor has two parameters. Other data members will be set to default values, as follows (in addition to data members set by the DirectSearch constructor):
    patternLength = 0
    initialStepLength = .25
    delta = initialStepLength
    IDnumber = 2000

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

PatternSearch(const PatternSearch & Original)
Deep copy constructor for class PatternSearch
Parameters:
Original - a reference to the object to be copied. Note that this will in ordinary practice actually be a member of a concrete class derived from 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. The objective function can be sent in as the fifth 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.
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.

virtual ~PatternSearch()
Destructor

Other Initialization Methods

virtual PatternSearch& operator=(const PatternSearch& A)
Overloaded assignment operator. note that because PatternSearch is an abstract base class, the object actually returned will be of a type corresponding to one of the concrete classes.
Returns:
PatternSearch&
Parameters:
A - reference to a const PatternSearch object

virtual void CleanSlate(long dim, Vector<double> &startpoint)
Reinitializes values in order to reuse the same search object. This version of CleanSlate takes two parameters. Other data members are set by default as in the constructor PatternSearch(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)

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. This version of CleanSlate takes six parameters.
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 InitializeDesign(long patternSize, const Matrix<double> * designPtr)
Deletes any existing pattern and replaces it with the one pointed to by designPtr. Calls DesignSearch::InitializeDesign() and then initializes patternLength.
Returns:
void
Parameters:
patternSize - the number of "columns", i.e. trial points, in design matrix
pat - a pointer to a design matrix

void ReadInFile(istream & fp)
Reads the design in from a file. You may also pass cin as the input stream as desired. Input first the pattern length and then the values of each trial vector (i.e. input the pattern by column)
Returns:
void
Parameters:
fp - the filestream --or cin may be used

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. It is to be implemented in the concrete classes. There, BeginSearch() will call the methods that implement the actual search algorithms.

Accessors

void GetPatternLength(long & pattern) const
Returns the number of "columns" of the pattern matrix
Returns:
void
Parameters:
pattern - a long provided by the user; will be assigned the value of patternLength

double GetDelta() const
Returns delta, the lattice step length
Returns:
double

void GetInitialStepLength(double & stepLen)
Returns initialStepLength, the initial value of delta
Returns:
void
Parameters:
stepLen - a reference to a double: will be assigned the value of initialStepLength

void SetInitialStepLength(double & stepLen)
Assigns the value of steplen to initialStepLength
Returns:
void
Parameters:
stepLen - a reference to a double:initialStepLength will be assigned this value.

virtual bool Stop()
Whether nor not to stop, based either on maxCalls or lattice resolution
Returns:
bool

virtual void ExploratoryMoves()
PatternSearch::Exploratory Moves is an unimplemented virtual void function. It will be implemented in the concrete classes as the workhorse for the algorithmic implementations

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

virtual void NextPoint(long index, const Vector<double> & currentPoint, Vector<double> & nextPoint)
NextPoint() calculates the next trial point by adding the design matrix column at index to the current vector. Returns the prospect in nextPoint.
Returns:
void
Parameters:
index - the index of a column of the design matrix
currentPoint - a reference to the current vector
nextPoint - a reference to a vector, which will be assigned the value of the appropriate point to be evaluated next.

virtual void ReplaceMinimum(Vector<double> & newPoint, double newValue)
Replaces the minimizer & the minimum objective function value
Returns:
void
Parameters:
newPoint - the point that will be assigned as the new minPoint
newValue - the value that will be assigned to minValue

virtual void ScalePattern(double scalar)
Scale lattice step length by scalar
Returns:
void
Parameters:
scalar - the value by which to scale the pattern

long patternLength
The number of "columns" in design matrix, i.e. trial points

double delta
The density of the underlying lattice

double initialStepLength
The initial setting for delta


Direct child classes:
NLessSearch
HJSearch
EdHJSearch
CoordinateSearch
CompassSearch

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