NOMAD Source  Version 4.0.0 Beta
CacheInterface Class Reference

#include <CacheInterface.hpp>

Collaboration diagram for CacheInterface:

Public Member Functions

 CacheInterface (const Step *step)
 Constructor. More...
 
size_t findBestFeas (std::vector< EvalPoint > &evalPointList, const EvalType &evalType, const Eval *refeval) const
 Find best feasible point(s) in cache. More...
 
size_t findBestInf (std::vector< EvalPoint > &evalPointList, const Double &hMax, const EvalType &evalType, const Eval *refeval) const
 Find best infeasible point(s) in cache. More...
 
bool smartInsert (const EvalPoint &evalPoint, const short maxNumberEval=1, const EvalType &evalType=EvalType::BB)
 Interface for CacheBase::smartInsert. More...
 
size_t find (const Point &x, EvalPoint &evalPoint, const EvalType &evalType=EvalType::UNDEFINED)
 Interface for CacheBase::smartFind. More...
 
size_t find (std::function< bool(const EvalPoint &)> crit, std::vector< EvalPoint > &evalPointList, bool findInSubspace=false) const
 Find points in the cache fulfilling a criteria. More...
 
size_t getAllPoints (std::vector< EvalPoint > &evalPointList) const
 Get all points from the cache. More...
 

Private Member Functions

void init ()
 Helper for constructor. More...
 

Private Attributes

const Step_step
 Step that uses the Cache. More...
 
Point _fixedVariable
 Full dimension point including fixed variables. More...
 

Detailed Description

Used by algorithm and step classes. The CacheInterface takes care of converting points from subproblems to full dimension before adding them to the cache, and from full dimension to subproblems when retrieving them from the cache.

Definition at line 62 of file CacheInterface.hpp.

Constructor & Destructor Documentation

◆ CacheInterface()

CacheInterface::CacheInterface ( const Step step)
inlineexplicit

Constructor.

Parameters
stepThe step using this CacheInterface

Definition at line 74 of file CacheInterface.hpp.

75  : _step(step)
76  {
77  init();
78  }

Member Function Documentation

◆ find() [1/2]

size_t CacheInterface::find ( const Point x,
EvalPoint evalPoint,
const EvalType evalType = EvalType::UNDEFINED 
)

Interface for CacheBase::smartFind.

Transform the point into full space before looking into cache.

Parameters
xThe point to find – IN.
evalPointThe found EvalPointOUT.
evalTypeIf not UNDEFINED, wait for Eval of this EvalType to be completed. – IN.

◆ find() [2/2]

size_t CacheInterface::find ( std::function< bool(const EvalPoint &)>  crit,
std::vector< EvalPoint > &  evalPointList,
bool  findInSubspace = false 
) const

Find points in the cache fulfilling a criteria.

Parameters
critThe criteria function (function of EvalPoint) – IN.
evalPointListThe vector of EvalPoints found – OUT.
findInSubspaceThe flag to find in subspace – IN.
Returns
The number of points found

◆ findBestFeas()

size_t CacheInterface::findBestFeas ( std::vector< EvalPoint > &  evalPointList,
const EvalType evalType,
const Eval refeval 
) const

Find best feasible point(s) in cache.

Parameters
evalPointListThe found evaluation points – OUT.
evalTypeCriteria for EvalType – IN.
refevalThe point of reference – IN.
Returns
Number of points found

◆ findBestInf()

size_t CacheInterface::findBestInf ( std::vector< EvalPoint > &  evalPointList,
const Double hMax,
const EvalType evalType,
const Eval refeval 
) const

Find best infeasible point(s) in cache.

Parameters
evalPointListThe found evaluation points – OUT.
hMaxPoints' h value must be under this value – IN.
evalTypePoints' EvalType to look at – IN.
refevalThe point of reference – IN.
Returns
Number of points found

◆ getAllPoints()

size_t CacheInterface::getAllPoints ( std::vector< EvalPoint > &  evalPointList) const

Get all points from the cache.

Parameters
evalPointListThe vector of EvalPoints – OUT
Returns
The number of points

◆ init()

void CacheInterface::init ( )
private

Helper for constructor.

◆ smartInsert()

bool CacheInterface::smartInsert ( const EvalPoint evalPoint,
const short  maxNumberEval = 1,
const EvalType evalType = EvalType::BB 
)

Interface for CacheBase::smartInsert.

The full dimension point is reconstructed from step fixed variables information.

Parameters
evalPointThe point to insert – IN.
maxNumberEvalMaximun number of times this point may be evaluated – IN.
evalTypeCriteria for EvalType – IN.
Returns
True if the point may be sent for evaluation, false otherwise

Member Data Documentation

◆ _fixedVariable

Point CacheInterface::_fixedVariable
private

Full dimension point including fixed variables.

Definition at line 67 of file CacheInterface.hpp.

◆ _step

const Step* CacheInterface::_step
private

Step that uses the Cache.

Definition at line 66 of file CacheInterface.hpp.


The documentation for this class was generated from the following file:
CacheInterface::init
void init()
Helper for constructor.
CacheInterface::_step
const Step * _step
Step that uses the Cache.
Definition: CacheInterface.hpp:66