NOMAD Source  Version 4.0.0 Beta
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EvalPoint Class Reference

Class for the representation of an evaluation point. More...

#include <EvalPoint.hpp>

Inheritance diagram for EvalPoint:
Collaboration diagram for EvalPoint:

Public Member Functions

 EvalPoint ()
 Constructor #1. More...
 
 EvalPoint (size_t n)
 Constructor #2. More...
 
 EvalPoint (const Point &x)
 Constructor #3. More...
 
 EvalPoint (const EvalPoint &evalPoint)
 Copy constructor. More...
 
EvalPointoperator= (const EvalPoint &evalPoint)
 Affectation operator. More...
 
virtual ~EvalPoint ()
 Destructor. More...
 
const PointgetX () const
 
EvalgetEval (const bool useSgte=false) const
 Get the evaluation of the true or the surrogate blackbox evaluation. More...
 
void setEval (const Eval &eval, const bool useSgte=false)
 Set the evaluation of the true or the surrogate blackbox evaluation. More...
 
void clearEvalSgte ()
 Clear the surrogate blackbox evaluation of *this. More...
 
Double getF (const bool useSgte=false) const
 Get the objective function value of the the true or the surrogate blackbox evaluation. More...
 
void setF (const Double f, const bool useSgte=false)
 Set the objective function value of the true or the surrogate blackbox evaluation. More...
 
Double getH (const bool useSgte=false) const
 Get the infeasibility measure of the true or the surrogate blackbox evaluation. More...
 
void setH (const Double &h, const bool useSgte=false)
 Set the infeasibility measure of the true or the surrogate blackbox evaluation. More...
 
std::string getBBO (const bool useSgte=false) const
 Get the true or surrogate blackbox output as a string. More...
 
void setBBO (const std::string &bbo, const BBOutputTypeList &bboutputtypes, const bool useSgte=false, const bool evalOk=true)
 Set the true or surrogate blackbox output from a string. More...
 
void setBBO (const std::string &bbo, const std::string &sBBOutputTypes, const bool useSgte=false, const bool evalOk=true)
 Set the true or surrogate blackbox output from a string. More...
 
void setBBO (const BBOutput bbo, const bool useSgte=false, const bool evalOk=true)
 Set the true or surrogate blackbox output. More...
 
EvalStatusType getEvalStatus (const bool useSgte=false) const
 Get evaluation status of the true or the surrogate blackbox evaluation. More...
 
void setEvalStatus (const EvalStatusType &evalStatus, const bool useSgte=false)
 Set evaluation status of the true or the surrogate blackbox evaluation. More...
 
short getNumberEval () const
 
void setNumberEval (const short numEval)
 
void incNumberEval ()
 
const std::shared_ptr< PointgetPointFrom () const
 Get the from point EvalPoint::_pointFrom. More...
 
const std::shared_ptr< PointgetPointFrom (const Point &fixedVariable) const
 Get the EvalPoint::_pointFrom. More...
 
void setPointFrom (const std::shared_ptr< Point > pointFrom)
 Set the from point EvalPoint::_pointFrom. More...
 
void setPointFrom (std::shared_ptr< Point > pointFrom, const Point &fixedVariable)
 Set the from point EvalPoint::_pointFrom . The from point. More...
 
bool isFeasible (const bool useSgte=false) const
 Get evaluation feasibility flag of the true or the surrogate blackbox evaluation. More...
 
void recomputeFH (const BBOutputTypeList &bbOutputType)
 Recompute f and h, for a given list of blackbox output type considering that raw blackbox output is set. More...
 
bool dominates (const EvalPoint &rhs) const
 Comparison operator used by NM algorithm. More...
 
bool isBetterThan (const EvalPoint &rhs) const
 Comparison operator (used by NM). More...
 
EvalPoint makeFullSpacePointFromFixed (const Point &fixedVariable) const
 Convert a point from sub space to full space using fixed variables. More...
 
EvalPoint makeSubSpacePointFromFixed (const Point &fixedVariable) const
 Convert a point from full space to sub space using fixed variables. More...
 
bool operator== (const EvalPoint &evalPoint) const
 Comparison operator ==. More...
 
bool operator!= (const EvalPoint &evalPoint) const
 Comparison operator !=. More...
 
bool operator< (const EvalPoint &x) const
 Comparison operator <, used for set ordering. More...
 
bool isEvalOk (const bool useSgte=false) const
 
std::string display (const ArrayOfDouble &format=ArrayOfDouble()) const override
 Display with or without format. More...
 
std::string displayAll () const
 Display both true and surrogate evaluations. Useful for debugging. More...
 
bool toEval (short maxPointEval, const bool useSgte=false) const
 Function to test if evaluation is required. More...
 
bool isDefined () const override
 
- Public Member Functions inherited from Point
 Point (const size_t n=0, const Double &val=Double())
 
 Point (const Point &pt)
 Copy constructors. More...
 
const Pointoperator= (const Point &pt)
 Assignment operator. More...
 
const Pointoperator= (const ArrayOfDouble &aod)
 Assignment operator. More...
 
virtual ~Point ()
 Destructor. More...
 
std::string display (const ArrayOfDouble &prec=ArrayOfDouble()) const override
 Formated Point display. More...
 
std::string displayNoPar (const ArrayOfDouble &prec=ArrayOfDouble()) const
 Formated Point display. More...
 
bool operator< (const Point &point __attribute__((unused))) const
 Comparison operator <. More...
 
Point operator+ (const Direction &dir) const
 Addition Point = Point + Direction. More...
 
Point makeFullSpacePointFromFixed (const Point &fixedVariable) const
 Convert a point from sub space to full space using fixed variables. More...
 
Point makeSubSpacePointFromFixed (const Point &fixedVariable) const
 Convert a point from full space to sub space using fixed variables. More...
 
bool hasFixed (const Point &fixedVariable) const
 Verify if a Point is part of the sub-space defined by fixed variable. More...
 
- Public Member Functions inherited from ArrayOfDouble
 ArrayOfDouble (const size_t n=0, const Double &val=Double())
 Constructor. More...
 
 ArrayOfDouble (const ArrayOfDouble &coords)
 Copy constructor. More...
 
const ArrayOfDoubleoperator= (const ArrayOfDouble &coords)
 Affectation operator. More...
 
virtual ~ArrayOfDouble ()
 Destructor. More...
 
Doubleoperator[] (size_t i) const
 Operator []. More...
 
size_t size () const
 Access to the dimension of the array. More...
 
void reset (size_t n=0, const Double &d=Double())
 Change the ArrayOfDouble dimension, and set all coordinates to d. More...
 
void resize (size_t n, const Double &d=Double())
 Change the dimensionof the array. The values are kept. More...
 
bool isEmpty () const
 Test if empty. More...
 
void set (const Double &d) const
 Set all the coordinates to a specific value. More...
 
void set (size_t index, const Double &d, bool relative=false, const Double &lb=Double(), const Double &ub=Double())
 
void set (size_t n, const Double *a)
 Set the coordinates with an array of reals. More...
 
bool isComplete () const
 Check if all the coordinates are defined. More...
 
size_t nbDefined () const
 Count the number of defined values. More...
 
bool toBeDefined () const
 
void snapToBounds (const ArrayOfDouble &lb, const ArrayOfDouble &ub, const ArrayOfDouble &frameCenter, const ArrayOfDouble &meshSize)
 Snap an array to the bounds. Remain on mesh centered on frameCenter. More...
 
void readValuesAsArray (const ArrayOfString &valueString)
 Read values and fill the array with corresponding double values. More...
 
Double max () const
 Return max of all defined values. More...
 
const ArrayOfDoubleoperator*= (const Double &d)
 Mutiplication with a scalar. More...
 
const ArrayOfDouble operator+ (const ArrayOfDouble &p) const
 Addition with another array. More...
 
const ArrayOfDouble operator- (const ArrayOfDouble &p) const
 Substraction with an other array. More...
 
bool isMultipleOf (const ArrayOfDouble &gran, int &index) const
 
bool operator== (const ArrayOfDouble &coords) const
 Comparison operator ==. More...
 
bool operator!= (const ArrayOfDouble &coords) const
 Comparison operator !=. More...
 
virtual bool operator<= (const ArrayOfDouble &coords) const
 Comparison operator <=. More...
 
virtual bool operator< (const ArrayOfDouble &coords) const
 Comparison operator <. More...
 

Static Public Member Functions

static void clearEvalSgte (EvalPoint &evalPoint)
 Clear the surrogate blackbox evaluation of a point. More...
 
- Static Public Member Functions inherited from Point
static bool weakLess (const Point &lhs, const Point &rhs)
 Weak comparison operator. More...
 
static Double dist (const Point &X, const Point &Y)
 Euclidean distance between two points. More...
 
static Direction vectorize (const Point &X, const Point &Y)
 Create a Direction by substracting 2 Points. More...
 

Static Public Attributes

static const std::string ptFrom
 Static string "<", used for indicating pointFrom in I/O. More...
 
- Static Public Attributes inherited from ArrayOfDouble
static const std::string pStart
 Static variable used for array delimitation. More...
 
static const std::string pEnd
 Static variable used for array delimitation. More...
 

Private Member Functions

void copyMembers (const EvalPoint &evalPoint)
 Helper for copy constructor and others. More...
 

Private Attributes

EvalUPtr _eval
 Value of the evaluation (truth / blackbox) More...
 
EvalUPtr _evalSgte
 Value of the surrogate evaluation. More...
 
short _numberEval
 Number of times *this point has been evaluated (blackbox only) More...
 
std::shared_ptr< Point_pointFrom
 The frame center which generated *this point (blackbox only) More...
 

Additional Inherited Members

- Protected Member Functions inherited from ArrayOfDouble
void verifySizesMatch (size_t n1, size_t n2, std::string filename, size_t linenum) const
 Helper function to verify that n1 == n2. More...
 
void compare (const ArrayOfDouble &aod, bool &isInf, bool &isStrictInf) const
 Helper function to compare arrays. More...
 
- Protected Attributes inherited from ArrayOfDouble
size_t _n
 Dimension of the array. More...
 
Double_array
 Values of the array. More...
 

Detailed Description

Class for the representation of an evaluation point.

An evaluation point gathers the point coordinates x, and the blackbox outputs at these coordinates f(x).

Definition at line 29 of file EvalPoint.hpp.

Constructor & Destructor Documentation

EvalPoint::EvalPoint ( )
explicit

Constructor #1.

EvalPoint::EvalPoint ( size_t  n)
explicit

Constructor #2.

Parameters
nNumber of variables – IN.
EvalPoint::EvalPoint ( const Point x)
explicit

Constructor #3.

Parameters
xCoordinates of the eval point – IN.
EvalPoint::EvalPoint ( const EvalPoint evalPoint)

Copy constructor.

Parameters
evalPointThe copied object – IN.
virtual EvalPoint::~EvalPoint ( )
virtual

Destructor.

Member Function Documentation

void EvalPoint::clearEvalSgte ( )
inline

Clear the surrogate blackbox evaluation of *this.

Definition at line 102 of file EvalPoint.hpp.

102 { _evalSgte = nullptr; }
EvalUPtr _evalSgte
Value of the surrogate evaluation.
Definition: EvalPoint.hpp:39
static void EvalPoint::clearEvalSgte ( EvalPoint evalPoint)
inlinestatic

Clear the surrogate blackbox evaluation of a point.

Definition at line 105 of file EvalPoint.hpp.

105 { evalPoint.clearEvalSgte(); }
void clearEvalSgte()
Clear the surrogate blackbox evaluation of *this.
Definition: EvalPoint.hpp:102
void EvalPoint::copyMembers ( const EvalPoint evalPoint)
private

Helper for copy constructor and others.

std::string EvalPoint::display ( const ArrayOfDouble format = ArrayOfDouble()) const
overridevirtual

Display with or without format.

Reimplemented from ArrayOfDouble.

std::string EvalPoint::displayAll ( ) const

Display both true and surrogate evaluations. Useful for debugging.

bool EvalPoint::dominates ( const EvalPoint rhs) const

Comparison operator used by NM algorithm.

Parameters
rhsSecond eval points to compare – IN.
Returns
true if *this dominates x.
std::string EvalPoint::getBBO ( const bool  useSgte = false) const

Get the true or surrogate blackbox output as a string.

Eval* EvalPoint::getEval ( const bool  useSgte = false) const
inline

Get the evaluation of the true or the surrogate blackbox evaluation.

Definition at line 96 of file EvalPoint.hpp.

96 { return (useSgte) ? _evalSgte.get() : _eval.get(); }
EvalUPtr _eval
Value of the evaluation (truth / blackbox)
Definition: EvalPoint.hpp:36
EvalUPtr _evalSgte
Value of the surrogate evaluation.
Definition: EvalPoint.hpp:39
EvalStatusType EvalPoint::getEvalStatus ( const bool  useSgte = false) const

Get evaluation status of the true or the surrogate blackbox evaluation.

Double EvalPoint::getF ( const bool  useSgte = false) const

Get the objective function value of the the true or the surrogate blackbox evaluation.

Double EvalPoint::getH ( const bool  useSgte = false) const

Get the infeasibility measure of the true or the surrogate blackbox evaluation.

short EvalPoint::getNumberEval ( ) const
inline

Definition at line 163 of file EvalPoint.hpp.

163 { return _numberEval; }
short _numberEval
Number of times *this point has been evaluated (blackbox only)
Definition: EvalPoint.hpp:42
const std::shared_ptr<Point> EvalPoint::getPointFrom ( ) const
inline

Get the from point EvalPoint::_pointFrom.

Definition at line 168 of file EvalPoint.hpp.

168 { return _pointFrom; }
std::shared_ptr< Point > _pointFrom
The frame center which generated *this point (blackbox only)
Definition: EvalPoint.hpp:44
const std::shared_ptr<Point> EvalPoint::getPointFrom ( const Point fixedVariable) const

Get the EvalPoint::_pointFrom.

Get a new from point if a fixedVariable is provided.

const Point* EvalPoint::getX ( ) const
inline

Definition at line 93 of file EvalPoint.hpp.

93 { return dynamic_cast<const Point*>(this); }
Class for the representation of a point.
Definition: Point.hpp:23
void EvalPoint::incNumberEval ( )
inline

Definition at line 165 of file EvalPoint.hpp.

165 { _numberEval++; }
short _numberEval
Number of times *this point has been evaluated (blackbox only)
Definition: EvalPoint.hpp:42
bool EvalPoint::isBetterThan ( const EvalPoint rhs) const

Comparison operator (used by NM).

Parameters
rhsThe right-hand side object – IN.
Returns
A boolean equal to true if lhs is better than rhs.
bool EvalPoint::isDefined ( ) const
inlineoverridevirtual
Warning
It is unclear if the caller wants to verify if the base point is defined, or if f is defined. To avoid mistakes and confusion, throw an error.

Reimplemented from ArrayOfDouble.

Definition at line 270 of file EvalPoint.hpp.

271  {
272  throw Exception(__FILE__,__LINE__,"Error: Calling EvalPoint::isDefined(). Choose ArrayOfDouble::isDefined() or Double::isDefined() instead.");
273  }
Exception utility.
bool EvalPoint::isEvalOk ( const bool  useSgte = false) const
bool EvalPoint::isFeasible ( const bool  useSgte = false) const

Get evaluation feasibility flag of the true or the surrogate blackbox evaluation.

EvalPoint EvalPoint::makeFullSpacePointFromFixed ( const Point fixedVariable) const

Convert a point from sub space to full space using fixed variables.

Remarks
The evaluation part of *this is unchanged.
EvalPoint EvalPoint::makeSubSpacePointFromFixed ( const Point fixedVariable) const

Convert a point from full space to sub space using fixed variables.

Remarks
The evaluation part of *this is unchanged.
bool EvalPoint::operator!= ( const EvalPoint evalPoint) const
inline

Comparison operator !=.

Parameters
evalPointThe right-hand side object – IN.
Returns
false if *this == p, true if not.

Definition at line 234 of file EvalPoint.hpp.

234 { return !(*this == evalPoint); }
bool EvalPoint::operator< ( const EvalPoint x) const

Comparison operator <, used for set ordering.

Parameters
xRight-hand side object – IN.
Returns
true if *this < x, false if not..
EvalPoint& EvalPoint::operator= ( const EvalPoint evalPoint)

Affectation operator.

Parameters
evalPointThe right-hand side object – IN.
Returns
*this as the result of the affectation.
bool EvalPoint::operator== ( const EvalPoint evalPoint) const

Comparison operator ==.

Parameters
evalPointThe right-hand side object – IN.
Returns
true if *this == p, false if not.
void EvalPoint::recomputeFH ( const BBOutputTypeList bbOutputType)

Recompute f and h, for a given list of blackbox output type considering that raw blackbox output is set.

Parameters
bbOutputTypeThe list of blackbox output types.
void EvalPoint::setBBO ( const std::string &  bbo,
const BBOutputTypeList bboutputtypes,
const bool  useSgte = false,
const bool  evalOk = true 
)

Set the true or surrogate blackbox output from a string.

Parameters
bboThe string containg the raw result of the blackbox evaluation – IN.
bboutputtypesThe list of blackbox output types – IN.
useSgteFlag for true or surrogate evaluation – IN.
evalOkFlag for evaluation status – IN.
void EvalPoint::setBBO ( const std::string &  bbo,
const std::string &  sBBOutputTypes,
const bool  useSgte = false,
const bool  evalOk = true 
)

Set the true or surrogate blackbox output from a string.

Parameters
bboThe string containg the raw result of the blackbox evaluation – IN.
sBBOutputTypesThe blackbox output types coded as a single string – IN.
useSgteFlag for true or surrogate evaluation – IN.
evalOkFlag for evaluation status – IN.
void EvalPoint::setBBO ( const BBOutput  bbo,
const bool  useSgte = false,
const bool  evalOk = true 
)

Set the true or surrogate blackbox output.

Parameters
bboA blackbox evaluation output – IN.
useSgteFlag for true or surrogate evaluation – IN.
evalOkFlag for evaluation status – IN.
void EvalPoint::setEval ( const Eval eval,
const bool  useSgte = false 
)

Set the evaluation of the true or the surrogate blackbox evaluation.

void EvalPoint::setEvalStatus ( const EvalStatusType evalStatus,
const bool  useSgte = false 
)

Set evaluation status of the true or the surrogate blackbox evaluation.

void EvalPoint::setF ( const Double  f,
const bool  useSgte = false 
)

Set the objective function value of the true or the surrogate blackbox evaluation.

void EvalPoint::setH ( const Double h,
const bool  useSgte = false 
)

Set the infeasibility measure of the true or the surrogate blackbox evaluation.

void EvalPoint::setNumberEval ( const short  numEval)
inline

Definition at line 164 of file EvalPoint.hpp.

164 { _numberEval = numEval; }
short _numberEval
Number of times *this point has been evaluated (blackbox only)
Definition: EvalPoint.hpp:42
void EvalPoint::setPointFrom ( const std::shared_ptr< Point pointFrom)

Set the from point EvalPoint::_pointFrom.

void EvalPoint::setPointFrom ( std::shared_ptr< Point pointFrom,
const Point fixedVariable 
)

Set the from point EvalPoint::_pointFrom . The from point.

bool EvalPoint::toEval ( short  maxPointEval,
const bool  useSgte = false 
) const

Function to test if evaluation is required.

Depending on the status of the Eval, should we evaluate (possibly re-evaluate) this point?

Parameters
maxPointEvalThe maximum number of point evaluations – IN.
useSgteUse true or surrogate evaluation.
Returns
true if evaluation is required and false otherwise.

Member Data Documentation

EvalUPtr EvalPoint::_eval
private

Value of the evaluation (truth / blackbox)

Definition at line 36 of file EvalPoint.hpp.

EvalUPtr EvalPoint::_evalSgte
private

Value of the surrogate evaluation.

Definition at line 39 of file EvalPoint.hpp.

short EvalPoint::_numberEval
private

Number of times *this point has been evaluated (blackbox only)

Definition at line 42 of file EvalPoint.hpp.

std::shared_ptr<Point> EvalPoint::_pointFrom
private

The frame center which generated *this point (blackbox only)

Definition at line 44 of file EvalPoint.hpp.

const std::string EvalPoint::ptFrom
static

Static string "<", used for indicating pointFrom in I/O.

Definition at line 32 of file EvalPoint.hpp.


The documentation for this class was generated from the following file: