NOMAD Source
Version 4.0.0 Beta
|
Class for the representation of an evaluation point. More...
#include <EvalPoint.hpp>
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... | |
EvalPoint & | operator= (const EvalPoint &evalPoint) |
Affectation operator. More... | |
virtual | ~EvalPoint () |
Destructor. More... | |
const Point * | getX () const |
Get Point part of this EvalPoint. More... | |
Eval * | getEval (const EvalType &evalType=EvalType::BB) const |
Get the Eval part of this EvalPoint, using the right EvalType (BB or SGTE) More... | |
void | setEval (const Eval &eval, const EvalType &evalType) |
Set the Eval part of this EvalPoint, using the right EvalType (BB or SGTE) More... | |
void | clearEvalSgte () |
Clear the surrogate evaluation of *this . More... | |
Double | getF (const EvalType &evalType=EvalType::BB) const |
Get the objective function value of Eval of this EvalType. More... | |
void | setF (const Double f, const EvalType &evalType) |
Set the objective function value of the Eval of this EvalType. More... | |
Double | getH (const EvalType &evalType=EvalType::BB) const |
Get the infeasibility measure of the Eval of this EvalType. More... | |
void | setH (const Double &h, const EvalType &evalType) |
Set the infeasibility measure of the Eval of this EvalType. More... | |
std::string | getBBO (const EvalType &evalType) const |
Get the blackbox output for the Eval of this EvalType as a string . More... | |
void | setBBO (const std::string &bbo, const BBOutputTypeList &bboutputtypes, const EvalType &evalType=EvalType::BB, const bool evalOk=true) |
Set the blackbox output for the Eval of this EvalType from a string . More... | |
void | setBBO (const std::string &bbo, const std::string &sBBOutputTypes, const EvalType &evalType=EvalType::BB, const bool evalOk=true) |
Set the true or surrogate blackbox output from a string . More... | |
void | setBBO (const BBOutput &bbo, const EvalType &evalType=EvalType::BB, const bool evalOk=true) |
Set the true or surrogate blackbox output. More... | |
EvalStatusType | getEvalStatus (const EvalType &evalType) const |
Get evaluation status of the Eval of this EvalType. More... | |
void | setEvalStatus (const EvalStatusType &evalStatus, const EvalType &evalType) |
Set evaluation status of the Eval of this EvalType. More... | |
size_t | getTag () const |
void | updateTag () const |
Modifies mutable _tag, and increments static _currentTag. More... | |
int | getThreadAlgo () const |
void | setThreadAlgo (const int threadAlgo) |
short | getNumberEval () const |
void | setNumberEval (const short numEval) |
void | incNumberEval () |
const std::shared_ptr< Point > | getPointFrom () const |
Get the Point which was the center when this point was generated. More... | |
const std::shared_ptr< Point > | getPointFrom (const Point &fixedVariable) const |
Get the Point which was the center when this point was generated. More... | |
void | setPointFrom (const std::shared_ptr< Point > pointFrom) |
Set the Point for which this point was generated. More... | |
void | setPointFrom (std::shared_ptr< Point > pointFrom, const Point &fixedVariable) |
Set the Point for which this point was generated. More... | |
bool | isFeasible (const EvalType &evalType) const |
Get evaluation feasibility flag f the Eval of this EvalType. 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 EvalType &evalType) const |
Comparison operator used by NM algorithm. 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 EvalType &evalType) 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 EvalType &evalType) const |
Function to test if evaluation is required. More... | |
bool | isDefined () const override |
![]() | |
Point (const size_t n=0, const Double &val=Double()) | |
Point (const Point &pt) | |
Copy constructors. More... | |
Point & | operator= (const Point &pt) |
Assignment operator. More... | |
Point & | operator= (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 bool verifyValues=true) const |
Convert a point from full space to sub space using fixed variables. More... | |
Point | projectPointToSubspace (const Point &fixedVariable) const |
Project 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... | |
![]() | |
ArrayOfDouble (const size_t n=0, const Double &val=Double()) | |
Constructor. More... | |
ArrayOfDouble (const ArrayOfDouble &coords) | |
Copy constructor. More... | |
ArrayOfDouble & | operator= (const ArrayOfDouble &coords) |
Affectation operator. More... | |
virtual | ~ArrayOfDouble () |
Destructor. More... | |
Double & | operator[] (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... | |
bool | inBounds (const ArrayOfDouble &lowerBound, const ArrayOfDouble &upperBound) const |
Verify if the array is inside the bounds. Ignores undefined bounds. More... | |
void | readValuesAsArray (const ArrayOfString &valueString) |
Read values and fill the array with corresponding double values. More... | |
ArrayOfDouble | abs () const |
Double | max () const |
Return max of all defined values. More... | |
const ArrayOfDouble & | operator*= (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 evaluation of a point. More... | |
static void | resetCurrentTag () |
Reset tag numbers: Use with caution. Expected to be used in unit tests and runner only. More... | |
static bool | hasSgteEval (const EvalPoint &evalPoint) |
static bool | hasBbEval (const EvalPoint &evalPoint) |
![]() | |
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... | |
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... | |
size_t | _tag |
Tag: Ordinal representing the order of creation. More... | |
int | _threadAlgo |
Main thread that generated this point. 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... | |
Static Private Attributes | |
static size_t | _currentTag |
Value of the current tag. More... | |
Additional Inherited Members | |
![]() | |
static const std::string | pStart |
Static variable used for array delimitation. More... | |
static const std::string | pEnd |
Static variable used for array delimitation. More... | |
![]() | |
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... | |
![]() | |
size_t | _n |
Dimension of the array. More... | |
Double * | _array |
Values of the array. More... | |
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 75 of file EvalPoint.hpp.
|
explicit |
Constructor #1.
|
explicit |
Constructor #2.
n | Number of variables – IN. |
|
explicit |
Constructor #3.
x | Coordinates of the eval point – IN. |
EvalPoint::EvalPoint | ( | const EvalPoint & | evalPoint | ) |
Copy constructor.
evalPoint | The copied object – IN. |
|
virtual |
Destructor.
|
inline |
|
inlinestatic |
|
private |
Helper for copy constructor and others.
|
overridevirtual |
Display with or without format.
Reimplemented from ArrayOfDouble.
std::string EvalPoint::displayAll | ( | ) | const |
Display both true and surrogate evaluations. Useful for debugging.
Comparison operator used by NM algorithm.
rhs | Second eval points to compare – IN. |
evalType | Blackbox or surrogate evaluation – IN. |
true
if *this
dominates x. std::string EvalPoint::getBBO | ( | const EvalType & | evalType | ) | const |
Get the blackbox output for the Eval of this EvalType as a string
.
Eval* EvalPoint::getEval | ( | const EvalType & | evalType = EvalType::BB | ) | const |
EvalStatusType EvalPoint::getEvalStatus | ( | const EvalType & | evalType | ) | const |
Get evaluation status of the Eval of this EvalType.
Double EvalPoint::getF | ( | const EvalType & | evalType = EvalType::BB | ) | const |
Get the objective function value of Eval of this EvalType.
Double EvalPoint::getH | ( | const EvalType & | evalType = EvalType::BB | ) | const |
Get the infeasibility measure of the Eval of this EvalType.
|
inline |
Definition at line 217 of file EvalPoint.hpp.
|
inline |
Get the Point which was the center when this point was generated.
Definition at line 222 of file EvalPoint.hpp.
|
inline |
Definition at line 209 of file EvalPoint.hpp.
|
inline |
Definition at line 214 of file EvalPoint.hpp.
|
inline |
|
static |
|
static |
|
inline |
Definition at line 219 of file EvalPoint.hpp.
|
inlineoverridevirtual |
Reimplemented from ArrayOfDouble.
Definition at line 321 of file EvalPoint.hpp.
bool EvalPoint::isEvalOk | ( | const EvalType & | evalType | ) | const |
bool EvalPoint::isFeasible | ( | const EvalType & | evalType | ) | const |
Get evaluation feasibility flag f the Eval of this EvalType.
Convert a point from sub space to full space using fixed variables.
*this
is unchanged. Convert a point from full space to sub space using fixed variables.
*this
is unchanged.
|
inline |
Comparison operator !=
.
evalPoint | The right-hand side object – IN. |
false
if *this
==
p
, true
if not. Definition at line 285 of file EvalPoint.hpp.
bool EvalPoint::operator< | ( | const EvalPoint & | x | ) | const |
Comparison operator <
, used for set ordering.
x | Right-hand side object – IN. |
true
if *this
<
x
, false
if not.. Affectation operator.
evalPoint | The right-hand side object – IN. |
*this
as the result of the affectation. bool EvalPoint::operator== | ( | const EvalPoint & | evalPoint | ) | const |
Comparison operator ==
.
evalPoint | The right-hand side object – IN. |
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.
bbOutputType | The list of blackbox output types. |
|
static |
Reset tag numbers: Use with caution. Expected to be used in unit tests and runner only.
void EvalPoint::setBBO | ( | const BBOutput & | bbo, |
const EvalType & | evalType = EvalType::BB , |
||
const bool | evalOk = true |
||
) |
Set the true or surrogate blackbox output.
bbo | A blackbox evaluation output – IN. |
evalType | Blackbox or surrogate evaluation – IN. |
evalOk | Flag for evaluation status – IN. |
void EvalPoint::setBBO | ( | const std::string & | bbo, |
const BBOutputTypeList & | bboutputtypes, | ||
const EvalType & | evalType = EvalType::BB , |
||
const bool | evalOk = true |
||
) |
Set the blackbox output for the Eval of this EvalType from a string
.
bbo | The string containg the raw result of the blackbox evaluation – IN. |
bboutputtypes | The list of blackbox output types – IN. |
evalType | Blackbox or surrogate evaluation – IN. |
evalOk | Flag for evaluation status – IN. |
void EvalPoint::setBBO | ( | const std::string & | bbo, |
const std::string & | sBBOutputTypes, | ||
const EvalType & | evalType = EvalType::BB , |
||
const bool | evalOk = true |
||
) |
Set the true or surrogate blackbox output from a string
.
bbo | The string containg the raw result of the blackbox evaluation – IN. |
sBBOutputTypes | The blackbox output types coded as a single string – IN. |
evalType | Blackbox or surrogate evaluation – IN. |
evalOk | Flag for evaluation status – IN. |
void EvalPoint::setEvalStatus | ( | const EvalStatusType & | evalStatus, |
const EvalType & | evalType | ||
) |
Set evaluation status of the Eval of this EvalType.
Set the objective function value of the Eval of this EvalType.
Set the infeasibility measure of the Eval of this EvalType.
|
inline |
Definition at line 218 of file EvalPoint.hpp.
void EvalPoint::setPointFrom | ( | const std::shared_ptr< Point > | pointFrom | ) |
Set the Point for which this point was generated.
Set the Point for which this point was generated.
Use the fixedVariable to convert pointFrom from Subspace dimension to the full dimension.
|
inline |
Definition at line 215 of file EvalPoint.hpp.
bool EvalPoint::toEval | ( | short | maxPointEval, |
const EvalType & | evalType | ||
) | const |
Function to test if evaluation is required.
Depending on the status of the Eval, should we evaluate (possibly re-evaluate) this point?
maxPointEval | The maximum number of point evaluations – IN. |
evalType | Blackbox or surrogate evaluation – IN. |
true
if evaluation is required and false
otherwise. void EvalPoint::updateTag | ( | ) | const |
Modifies mutable _tag, and increments static _currentTag.
|
staticprivate |
Value of the current tag.
Definition at line 79 of file EvalPoint.hpp.
|
private |
Value of the evaluation (truth / blackbox)
Definition at line 81 of file EvalPoint.hpp.
|
private |
Value of the surrogate evaluation.
Definition at line 83 of file EvalPoint.hpp.
|
private |
Number of times *this
point has been evaluated (blackbox only)
Definition at line 89 of file EvalPoint.hpp.
|
private |
The frame center which generated *this
point (blackbox only)
Definition at line 91 of file EvalPoint.hpp.
|
mutableprivate |
Tag: Ordinal representing the order of creation.
Definition at line 85 of file EvalPoint.hpp.
|
private |
Main thread that generated this point.
Definition at line 87 of file EvalPoint.hpp.