NOMAD Source  Version 4.0.0 Beta
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MegaSearchPoll.hpp
Go to the documentation of this file.
1 #ifndef __NOMAD400_MEGASEARCHPOLL__
2 #define __NOMAD400_MEGASEARCHPOLL__
3 
4 #include "../../Algos/Mads/MadsIteration.hpp"
5 #include "../../Algos/Mads/MadsIterationUtils.hpp"
6 
7 #include "../../nomad_nsbegin.hpp"
8 
9 /// Class for the mega search and poll of MADS
10 /**
11  Calling the start function generates search and poll trial points at the same time before starting evaluation.
12  Calling the run function starts the evaluaions.
13  The postprocessing is performed when calling the end funcion.
14  */
15 class MegaSearchPoll: public Step , public MadsIterationUtils
16 {
17 private:
18  /**
19  Hash table to remember which iteration generated this point.
20  I tried working around it, but in the end it is easier to just
21  remember the iteration.
22  Mutable because it is updated in generateTrialPoints().
23  */
24  mutable std::map<EvalPoint, std::shared_ptr<MadsIteration>, EvalPointCompare> _iterForPoint;
25 
26 public:
27  /// Constructor
28  /**
29  \param parentStep The parent of this step
30  */
31  explicit MegaSearchPoll(const Step* parentStep )
32  : Step( parentStep ),
33  MadsIterationUtils( parentStep ),
35  {
36  init();
37  }
38 
39  // Destructor
41  {
42  _iterForPoint.clear();
43  }
44 
45  /// Generate the trial poins for the search and poll steps.
46  /**
47  Calls for ::generateTrialPoints.
48  */
49  virtual void start() override;
50 
51  ///Start evaluations
52  virtual bool run() override;
53 
54  /**
55  Call for postprocessing: computation of a new hMax and update of the barrier.
56  */
57  virtual void end() override ;
58 
59  /**
60  Get which iteration generated a point. This is used by evaluator control interface. Having the iteration, gives access to the mesh and some of its attributes.
61  */
62  const std::shared_ptr<MadsIteration> getIterForPoint(const EvalPoint& point) const;
63 
64 private:
65  void init();
66 
67  /// Generate new points to evaluate
68  /**
69  The trial points are produced using poll and search. The duplicates are removed and they are merged all together.
70  */
71  void generateTrialPoints() override ;
72 
73 
74 };
75 
76 #include "../../nomad_nsend.hpp"
77 
78 #endif // __NOMAD400_MEGASEARCHPOLL__
const std::shared_ptr< MadsIteration > getIterForPoint(const EvalPoint &point) const
Class for the mega search and poll of MADS.
virtual void start() override
Generate the trial poins for the search and poll steps.
Class of utils for MADS iterations.
std::map< EvalPoint, std::shared_ptr< MadsIteration >, EvalPointCompare > _iterForPoint
virtual bool run() override
Start evaluations.
virtual void end() override
void generateTrialPoints() override
Generate new points to evaluate.
Class for eval point compare.
Definition: EvalPoint.hpp:296
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
MegaSearchPoll(const Step *parentStep)
Constructor.