NOMAD Source  Version 4.0.0 Beta
Barrier Class Reference

Class for barrier following algorithm 12.2 of DFBO. More...

#include <Barrier.hpp>

Collaboration diagram for Barrier:

Public Member Functions

 Barrier (const Double &hMax=INF, const Point &fixedVariable=Point(), const EvalType &evalType=EvalType::BB, const std::vector< EvalPoint > &evalPointList=std::vector< EvalPoint >())
 Constructor. More...
 
const std::vector< EvalPointgetAllXFeas () const
 Get all feasible points in the barrier. More...
 
void updateRefBests ()
 Update ref best feasible and ref best infeasible values. More...
 
EvalPointPtr getFirstXFeas () const
 Get the first feasible point in the barrier. More...
 
EvalPointPtr getRefBestFeas () const
 Get the point that was previously the first feasible point in the barrier. More...
 
void setRefBestFeas (const EvalPointPtr refBestFeas)
 
size_t nbXFeas () const
 Number of feasible points in the barrier. More...
 
void addXFeas (const EvalPoint &xFeas, const EvalType &evalType)
 Add a feasible point in the barrier. More...
 
void clearXFeas ()
 Remove feasible points from the barrier. More...
 
const std::vector< EvalPointgetAllXInf () const
 Get all infeasible points in the barrier. More...
 
EvalPointPtr getFirstXInf () const
 Get the first infeasible point in the barrier. More...
 
EvalPointPtr getRefBestInf () const
 Get the point that was previously the first infeasible point in the barrier. More...
 
void setRefBestInf (const EvalPointPtr refBestInf)
 
size_t nbXInf () const
 Number of infeasible points in the barrier. More...
 
void addXInf (const EvalPoint &xInf)
 Add an infeasible point in the barrier. More...
 
void clearXInf ()
 Remove infeasible points from the barrier. More...
 
std::vector< EvalPointgetAllPoints ()
 Get all feasible and infeasable points. More...
 
Double getHMax () const
 Get the current hMax of the barrier. More...
 
void setHMax (const Double &hMax)
 Set the hMax of the barrier. More...
 
bool updateWithPoints (const std::vector< EvalPoint > &evalPointList, const EvalType &evalType, const bool keepAllPoints)
 Update xFeas and xInf according to given points. More...
 
std::string display (const size_t max=INF_SIZE_T) const
 Return the barrier as a string. More...
 

Private Member Functions

void init (const Point &fixedVariable, const EvalType &evalType, const std::vector< EvalPoint > &evalPointList)
 Helper function for constructor. More...
 
void setN ()
 Helper function for init/constructor. More...
 
void checkCache ()
 Helper function for init/constructor. More...
 
void checkXFeas (const EvalType &evalType)
 Helper function for insertion. More...
 
void checkXFeasIsFeas (const EvalType &evalType)
 Helper function for insertion. More...
 
void checkXInf ()
 Helper function for insertion. More...
 
void checkHMax ()
 Helper function for init/setHMax. More...
 

Private Attributes

std::vector< EvalPoint_xFeas
 Current feasible incumbent solutions. More...
 
std::vector< EvalPoint_xInf
 Current infeasible incumbent solutions. More...
 
EvalPointPtr _refBestFeas
 Previous first feasible incumbent. More...
 
EvalPointPtr _refBestInf
 Previous first infeasible incumbent. More...
 
Double _hMax
 Maximum acceptable value for h. More...
 
size_t _n
 Dimension of the points in the barrier. More...
 

Detailed Description

Class for barrier following algorithm 12.2 of DFBO.

Definition at line 54 of file Barrier.hpp.

Constructor & Destructor Documentation

◆ Barrier()

Barrier::Barrier ( const Double hMax = INF,
const Point fixedVariable = Point(),
const EvalType evalType = EvalType::BB,
const std::vector< EvalPoint > &  evalPointList = std::vector<EvalPoint>() 
)
inline

Constructor.

hMax will be updated during optimization.

Parameters
hMaxThe max of h to keep a point in the barrier – IN.
fixedVariableThe fixed variables have a fixed value – IN.
evalTypeType of evaluation (BB or SGTE) – IN.
evalPointListAdditional points to consider in building the barrier – IN.

Definition at line 83 of file Barrier.hpp.

87  : _xFeas(),
88  _xInf(),
89  _refBestFeas(nullptr),
90  _refBestInf(nullptr),
91  _hMax(hMax),
92  _n(0)
93  {
94  init(fixedVariable, evalType, evalPointList);
95  }

Member Function Documentation

◆ addXFeas()

void Barrier::addXFeas ( const EvalPoint xFeas,
const EvalType evalType 
)

Add a feasible point in the barrier.

If the point is feasible it is added, if not an exception is triggered.

Parameters
xFeasThe eval point to add – IN.
evalTypeWhich eval (Blackbox or Surrogate) of the EvalPoint to use to verify feasibility – IN.

◆ addXInf()

void Barrier::addXInf ( const EvalPoint xInf)

Add an infeasible point in the barrier.

If the point is nullptr an exception is triggered.

Parameters
xInfThe eval point to add – IN.

◆ checkCache()

void Barrier::checkCache ( )
private

Helper function for init/constructor.

Throw an exception if the Cache has not been instantiated yet. Will remain silent otherwise.

◆ checkHMax()

void Barrier::checkHMax ( )
private

Helper function for init/setHMax.

Will throw exceptions or output error messages if something is wrong. Will remain silent otherwise.

◆ checkXFeas()

void Barrier::checkXFeas ( const EvalType evalType)
private

Helper function for insertion.

Will throw exceptions or output error messages if something is wrong. Will remain silent otherwise.

◆ checkXFeasIsFeas()

void Barrier::checkXFeasIsFeas ( const EvalType evalType)
private

Helper function for insertion.

Will throw exceptions or output error messages if something is wrong. Will remain silent otherwise.

◆ checkXInf()

void Barrier::checkXInf ( )
private

Helper function for insertion.

Will throw exceptions or output error messages if something is wrong. Will remain silent otherwise.

◆ clearXFeas()

void Barrier::clearXFeas ( )

Remove feasible points from the barrier.

◆ clearXInf()

void Barrier::clearXInf ( )

Remove infeasible points from the barrier.

◆ display()

std::string Barrier::display ( const size_t  max = INF_SIZE_T) const

Return the barrier as a string.

◆ getAllPoints()

std::vector<EvalPoint> Barrier::getAllPoints ( )

Get all feasible and infeasable points.

◆ getAllXFeas()

const std::vector<EvalPoint> Barrier::getAllXFeas ( ) const
inline

Get all feasible points in the barrier.

Returns
All the eval points that are feasible.

Definition at line 104 of file Barrier.hpp.

104 { return _xFeas; }

◆ getAllXInf()

const std::vector<EvalPoint> Barrier::getAllXInf ( ) const
inline

Get all infeasible points in the barrier.

Returns
All the eval points that are infeasible.

Definition at line 145 of file Barrier.hpp.

145 { return _xInf; }

◆ getFirstXFeas()

EvalPointPtr Barrier::getFirstXFeas ( ) const

Get the first feasible point in the barrier.

If there is no feasible point, return a nullptr

Returns
A single feasible eval point.

◆ getFirstXInf()

EvalPointPtr Barrier::getFirstXInf ( ) const

Get the first infeasible point in the barrier.

If there is no infeasible point, return a nullptr

Returns
A single infeasible eval point.

◆ getHMax()

Double Barrier::getHMax ( ) const
inline

Get the current hMax of the barrier.

Definition at line 182 of file Barrier.hpp.

182 { return _hMax; }

◆ getRefBestFeas()

EvalPointPtr Barrier::getRefBestFeas ( ) const
inline

Get the point that was previously the first feasible point in the barrier.

If there is no feasible point, return a nullptr

Returns
A single feasible eval point.

Definition at line 121 of file Barrier.hpp.

121 { return _refBestFeas; }

◆ getRefBestInf()

EvalPointPtr Barrier::getRefBestInf ( ) const
inline

Get the point that was previously the first infeasible point in the barrier.

If there is no feasible point, return a nullptr

Returns
A single feasible eval point.

Definition at line 159 of file Barrier.hpp.

159 { return _refBestInf; }

◆ init()

void Barrier::init ( const Point fixedVariable,
const EvalType evalType,
const std::vector< EvalPoint > &  evalPointList 
)
private

Helper function for constructor.

Will throw exceptions or output error messages if something is wrong. Will remain silent otherwise.

Parameters
fixedVariableThe fixed variables have a fixed value – IN.
evalTypeWhich eval (Blackbox or Surrogate) to use to verify feasibility – IN.
evalPointListAdditional points to consider to construct barrier. – IN.

◆ nbXFeas()

size_t Barrier::nbXFeas ( ) const
inline

Number of feasible points in the barrier.

Definition at line 125 of file Barrier.hpp.

125 { return _xFeas.size(); }

◆ nbXInf()

size_t Barrier::nbXInf ( ) const
inline

Number of infeasible points in the barrier.

Definition at line 163 of file Barrier.hpp.

163 { return _xInf.size(); }

◆ setHMax()

void Barrier::setHMax ( const Double hMax)

Set the hMax of the barrier.

Parameters
hMaxThe hMax – IN.

◆ setN()

void Barrier::setN ( )
private

Helper function for init/constructor.

◆ setRefBestFeas()

void Barrier::setRefBestFeas ( const EvalPointPtr  refBestFeas)
inline

Definition at line 122 of file Barrier.hpp.

122 { _refBestFeas = refBestFeas; }

◆ setRefBestInf()

void Barrier::setRefBestInf ( const EvalPointPtr  refBestInf)
inline

Definition at line 160 of file Barrier.hpp.

160 { _refBestInf = refBestInf; }

◆ updateRefBests()

void Barrier::updateRefBests ( )

Update ref best feasible and ref best infeasible values.

◆ updateWithPoints()

bool Barrier::updateWithPoints ( const std::vector< EvalPoint > &  evalPointList,
const EvalType evalType,
const bool  keepAllPoints 
)

Update xFeas and xInf according to given points.

Member Data Documentation

◆ _hMax

Double Barrier::_hMax
private

Maximum acceptable value for h.

Definition at line 64 of file Barrier.hpp.

◆ _n

size_t Barrier::_n
private

Dimension of the points in the barrier.

Used for verification only. To be reviewed when we address category variables. /see _n in CacheBase.

Definition at line 72 of file Barrier.hpp.

◆ _refBestFeas

EvalPointPtr Barrier::_refBestFeas
private

Previous first feasible incumbent.

Definition at line 61 of file Barrier.hpp.

◆ _refBestInf

EvalPointPtr Barrier::_refBestInf
private

Previous first infeasible incumbent.

Definition at line 62 of file Barrier.hpp.

◆ _xFeas

std::vector<EvalPoint> Barrier::_xFeas
private

Current feasible incumbent solutions.

Definition at line 58 of file Barrier.hpp.

◆ _xInf

std::vector<EvalPoint> Barrier::_xInf
private

Current infeasible incumbent solutions.

Definition at line 59 of file Barrier.hpp.


The documentation for this class was generated from the following file:
Barrier::_xFeas
std::vector< EvalPoint > _xFeas
Current feasible incumbent solutions.
Definition: Barrier.hpp:58
Barrier::_xInf
std::vector< EvalPoint > _xInf
Current infeasible incumbent solutions.
Definition: Barrier.hpp:59
Barrier::init
void init(const Point &fixedVariable, const EvalType &evalType, const std::vector< EvalPoint > &evalPointList)
Helper function for constructor.
Barrier::_refBestInf
EvalPointPtr _refBestInf
Previous first infeasible incumbent.
Definition: Barrier.hpp:62
Barrier::_hMax
Double _hMax
Maximum acceptable value for h.
Definition: Barrier.hpp:64
Barrier::_refBestFeas
EvalPointPtr _refBestFeas
Previous first feasible incumbent.
Definition: Barrier.hpp:61
Barrier::_n
size_t _n
Dimension of the points in the barrier.
Definition: Barrier.hpp:72