NOMAD Source  Version 4.0.0 Beta
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PhaseOne.hpp
Go to the documentation of this file.
1 #ifndef __NOMAD400_PHASE_ONE__
2 #define __NOMAD400_PHASE_ONE__
3 
4 #include "../../Eval/EvalPoint.hpp"
5 
6 #include "../../Algos/Mads/Mads.hpp"
7 
8 #include "../../Algos/AlgoStopReasons.hpp"
9 
10 #include "../../nomad_nsbegin.hpp"
11 
12 // Class for phase one search of MADS to satisfy Extreme Barrier constraints.
13 class PhaseOne: public Algorithm
14 {
15 private:
16 
17 
18  std::shared_ptr<Mads> _mads;
19  std::shared_ptr<AlgoStopReasons<MadsStopType>> _madsStopReasons;
20 
21 
22  // BB_OUTPUT_TYPE parameter used for this Phase One.
23  // Used to recompute h values at the end of Phase One.
24  // Since the recompute methods are static, this member
25  // needs to be static.
27 
28 public:
29  /// Constructor
30  /**
31  \param parentStep The parent of this step
32  */
33  explicit PhaseOne(const Step* parentStep,
34  std::shared_ptr<AlgoStopReasons<PhaseOneStopType>> stopReasons,
35  const std::shared_ptr<RunParameters>& runParams,
36  const std::shared_ptr<PbParameters>& refPbParams)
37  : Algorithm(parentStep, stopReasons, runParams, std::make_shared<PbParameters>(*refPbParams)),
38  _mads(nullptr)
39  {
40  init();
41  }
42  ~PhaseOne() {}
43 
44  static void setBBOutputTypes(const BBOutputTypeList& bboutputtypes) { _bboutputtypes = bboutputtypes; }
45 
46  virtual void start() override;
47  virtual bool run() override;
48  virtual void end() override;
49 
50  virtual void readInformationForHotRestart() override;
51 
52 private:
53  /// Helper for constructor
54  void init();
55 
56  /*------------------------*/
57  /* Private helper methods */
58  /*------------------------*/
59  // These functions are called by Cache::processOnAllPoints().
60  // This is why they need to be static.
61  static void recomputeH(EvalPoint& evalPoint);
62  static void recomputeHPB(EvalPoint& evalPoint);
63 
64 };
65 
66 #include "../../nomad_nsend.hpp"
67 
68 #endif // __NOMAD400_PHASE_ONE__
std::vector< BBOutputType > BBOutputTypeList
Definition for the list of blackbox output types.
virtual void readInformationForHotRestart() override
Helper for start() when doing a hot restart.
virtual void end() override
End step of the algorithm.
static void recomputeH(EvalPoint &evalPoint)
~PhaseOne()
Definition: PhaseOne.hpp:42
static BBOutputTypeList _bboutputtypes
Definition: PhaseOne.hpp:26
std::shared_ptr< Mads > _mads
Definition: PhaseOne.hpp:18
PhaseOne(const Step *parentStep, std::shared_ptr< AlgoStopReasons< PhaseOneStopType >> stopReasons, const std::shared_ptr< RunParameters > &runParams, const std::shared_ptr< PbParameters > &refPbParams)
Constructor.
Definition: PhaseOne.hpp:33
static void setBBOutputTypes(const BBOutputTypeList &bboutputtypes)
Definition: PhaseOne.hpp:44
std::shared_ptr< AlgoStopReasons< MadsStopType > > _madsStopReasons
Definition: PhaseOne.hpp:19
virtual bool run() override
Run algorithm execution for single-objective.
virtual void start() override
Start step of the algorithm.
static void recomputeHPB(EvalPoint &evalPoint)
Template class for algorithm stop reasons.
Generic class for any direct search optimizer algorithm.
Definition: Algorithm.hpp:28
void init()
Helper for constructor.
Base class of all types of steps (Iteration, Termination, Initialization, Poll, Mads,...).
Definition: Step.hpp:24
Class for the representation of an evaluation point.
Definition: EvalPoint.hpp:29