NOMAD Source  Version 4.0.0 Beta
NMSearchMethod Class Referencefinal

Class to perform a Search method using Nelder Mead simplex algorithm. More...

#include <NMSearchMethod.hpp>

Inheritance diagram for NMSearchMethod:
Collaboration diagram for NMSearchMethod:

Public Member Functions

 NMSearchMethod (const Step *parentStep)
 Constructor. More...
 
virtual bool runImp () override
 
- Public Member Functions inherited from SearchMethodAlgo
 SearchMethodAlgo (const Step *parentStep)
 Constructor. More...
 
void startImp () override
 
- Public Member Functions inherited from SearchMethodBase
 SearchMethodBase (const Step *parentStep)
 Constructor. More...
 
bool isEnabled () const
 
void setEnabled (const bool enabled)
 
const std::string & getComment () const
 
bool hasComment () const
 
void setComment (const std::string &comment)
 
void endImp () override
 Implementation of endImp (not virtual) More...
 
void generateTrialPoints () override
 Intermediate function (not yet implementation that can generate the trial points) More...
 
- Public Member Functions inherited from Step
 Step ()
 Constructor #1 for MainStep (no parent) More...
 
 Step (const Step *parentStep, const std::shared_ptr< RunParameters > &runParams=nullptr, const std::shared_ptr< PbParameters > &pbParams=nullptr)
 Constructor #2 for child step of a parent sharing the same stopReason. More...
 
 Step (const Step *parentStep, std::shared_ptr< AllStopReasons > stopReasons, const std::shared_ptr< RunParameters > &runParams=nullptr, const std::shared_ptr< PbParameters > &pbParams=nullptr)
 Constructor #3: for a child Step with a provided stopReason (such as an algorithm) More...
 
virtual ~Step ()
 Destructor. More...
 
const StepgetParentStep () const
 Get the parent step. More...
 
virtual const std::string & getName () const
 Get the name of this step. More...
 
void setName (const std::string &name)
 Set the name of this step. More...
 
const std::shared_ptr< AllStopReasons > & getAllStopReasons () const
 
const std::shared_ptr< RunParameters > & getRunParams () const
 
const std::shared_ptr< PbParameters > & getPbParams () const
 
void addCallback (const CallbackType &callbackType, const StepEndCbFunc &stepEndCbFunc)
 Set user callback. More...
 
void addCallback (const CallbackType &callbackType, const HotRestartCbFunc &hotRestartCbFunc)
 
void AddOutputInfo (const std::string &s, bool isBlockStart, bool isBlockEnd) const
 display output More...
 
void AddOutputInfo (const std::string &s, OutputLevel outputLevel=OutputLevel::LEVEL_INFO) const
 
void AddOutputError (const std::string &s) const
 
void AddOutputWarning (const std::string &s) const
 
void AddOutputVeryHigh (const std::string &s) const
 
void AddOutputHigh (const std::string &s) const
 
void AddOutputDebug (const std::string &s) const
 
void AddOutputInfo (OutputInfo outputInfo) const
 
template<typename T >
getParentOfType (const bool stopAtAlgo=true) const
 Template function to get the parent of given type. More...
 
bool isAnAlgorithm () const
 
const AlgorithmgetRootAlgorithm () const
 Get Algorithm ancestor that has no Algorithm ancestor. More...
 
std::string getAlgoName () const
 
virtual std::string getAlgoComment () const
 
virtual void setAlgoComment (const std::string &algoComment, const bool force=false)
 
virtual void resetPreviousAlgoComment (const bool force=false)
 
const std::shared_ptr< MeshBasegetIterationMesh () const
 
const std::shared_ptr< EvalPointgetIterationFrameCenter () const
 
const std::shared_ptr< BarriergetMegaIterationBarrier () const
 
void start ()
 
bool run ()
 
void end ()
 
virtual void hotRestartOnUserInterrupt ()
 Helper for hot restart functionalities. More...
 
void debugShowCallStack () const
 For debugging purposes. Show the stack of Steps for this step. More...
 
- Public Member Functions inherited from IterationUtils
 IterationUtils (const Step *parentStep)
 Constructor. More...
 
virtual ~IterationUtils ()
 Destructor. More...
 
const SuccessTypegetSuccessType () const
 
void setSuccessType (const SuccessType &success)
 
size_t getTrialPointsCount () const
 
const EvalPointSetgetTrialPoints () const
 
bool insertTrialPoint (const EvalPoint &evalPoint)
 Insert a trial point. More...
 
void clearTrialPoints (void)
 Clear trial points. More...
 
virtual bool postProcessing (const EvalType &evalType)
 Helper for end task. More...
 
void verifyPointsAreOnMesh (const std::string &name) const
 Helper for start task. More...
 
bool snapPointToBoundsAndProjectOnMesh (Point &point, const ArrayOfDouble &lowerBound, const ArrayOfDouble &upperBound)
 Snap a given trial point to the bounds and project on mesh. More...
 
bool evalTrialPoints (Step *step)
 Start evaluation of the trial points. More...
 
size_t getNbEvalPointsThatNeededEval () const
 Get the number of evaluation points in the queue for evaluation. More...
 
void updatePointsWithFrameCenter ()
 Add current frame center as originator of each point in trialPoints. More...
 

Private Member Functions

void init ()
 Helper for constructor. More...
 
virtual void generateTrialPointsImp () override
 Generate new points (no evaluation) More...
 

Additional Inherited Members

- Static Public Member Functions inherited from Step
static bool getUserTerminate ()
 Interruption call by user. More...
 
static void setUserTerminate ()
 Interruption requested. More...
 
static void userInterrupt (int signalValue)
 Interruption call by user. More...
 
static void debugSegFault (int signalValue)
 
static bool getUserInterrupt ()
 
static void runCallback (CallbackType callbackType, const Step &step, bool &stop)
 Run user callback. More...
 
static void runCallback (CallbackType callbackType, std::vector< std::string > &paramLines)
 
static void disableWarnings ()
 
- Protected Member Functions inherited from SearchMethodBase
void init ()
 
- Protected Member Functions inherited from Step
void verifyParentNotNull ()
 Helper for constructors. More...
 
void verifyGenerateAllPointsBeforeEval (const std::string &method, const bool expected) const
 Helper for validating steps depending on parameter GENERATE_ALL_POINTS_BEFORE_EVAL. More...
 
void hotRestartBeginHelper ()
 Helpers for hot restart, to be called at the start and end of any override. More...
 
void hotRestartEndHelper ()
 Helpers for hot restart, to be called at the start and end of any override. More...
 
- Protected Attributes inherited from Step
const Step_parentStep
 The parent of this step. More...
 
std::string _name
 The name of this step. More...
 
std::shared_ptr< AllStopReasons_stopReasons
 The stop reasons of an algorithm. More...
 
std::shared_ptr< RunParameters_runParams
 The run parameters that control a step. More...
 
std::shared_ptr< PbParameters_pbParams
 The problem parameters that control a step. More...
 
- Protected Attributes inherited from IterationUtils
EvalPointSet _trialPoints
 The points generated during the start(). Used for run() and postProcessing(). More...
 
size_t _nbEvalPointsThatNeedEval
 
const Step_parentStep
 
SuccessType _success
 Success type of this step. More...
 
Iteration_iterAncestor
 
MegaIteration_megaIterAncestor
 
- Static Protected Attributes inherited from Step
static bool _userInterrupt
 Interrupt NOMAD if Ctrl-C is pressed. More...
 
static bool _userTerminate
 Terminate NOMAD if Ctrl-C is pressed again. More...
 
static StepEndCbFunc _cbIterationEnd
 
static StepEndCbFunc _cbMegaIterationEnd
 
static HotRestartCbFunc _cbHotRestart
 
static bool _showWarnings
 

Detailed Description

Class to perform a Search method using Nelder Mead simplex algorithm.

If Nelder Mead search is enabled (check is done in NMSearchMethod::init), the NMSearchMethod::run function manages the execution (start, run, end) of the NM algorithm.
The new trial points can be generated during a single pass of all Nelder Mead reflective steps (REFLECT, EXPAND, INSIDE_CONTRACTION, OUTSIDE_CONTRACTION) ( generateTrialPoint ) or as a NM optimization.

Definition at line 58 of file NMSearchMethod.hpp.

Constructor & Destructor Documentation

◆ NMSearchMethod()

NMSearchMethod::NMSearchMethod ( const Step parentStep)
inlineexplicit

Constructor.

/param parentStep The parent of this search step – IN.

Definition at line 65 of file NMSearchMethod.hpp.

66  : SearchMethodAlgo(parentStep )
67  {
68  init();
69  }

Member Function Documentation

◆ generateTrialPointsImp()

virtual void NMSearchMethod::generateTrialPointsImp ( )
overrideprivatevirtual

Generate new points (no evaluation)


  • Pure virtual function.

This function must be implemented for algo based search methods that can perform a single iteration for generating points.

  • This function is used only when the option to generate all points before evaluation is enabled, that is the runImp is not called.
  • Evaluations are automatically performed when running SearchMethodSimple::runImp.
    Perform one iteration of all reflective steps (Reflect, Expansion, Inside and Outside Contraction). This is just portion of the NM algorithm without iteration.

Implements SearchMethodAlgo.

◆ init()

void NMSearchMethod::init ( )
private

Helper for constructor.

Test if the NM search is enabled or not. Set the maximum number of trial points.

◆ runImp()

virtual bool NMSearchMethod::runImp ( )
overridevirtual

Execute (start, run, end) of the NM algorithm. Returns a true flag if the algorithm found better point.

Implements SearchMethodAlgo.


The documentation for this class was generated from the following file:
NMSearchMethod::init
void init()
Helper for constructor.
SearchMethodAlgo::SearchMethodAlgo
SearchMethodAlgo(const Step *parentStep)
Constructor.
Definition: SearchMethodAlgo.hpp:63