NOMAD Source  Version 4.0.0 Beta
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MadsIteration.hpp
Go to the documentation of this file.
1 #ifndef __NOMAD400_MADSITERATION__
2 #define __NOMAD400_MADSITERATION__
3 
4 #include "../../Algos/Iteration.hpp"
5 
6 #include "../../nomad_nsbegin.hpp"
7 
8 /// Class for MADS iteration
9 /**
10  A MADS iteration consists of a Search step followed by a Poll step depending on the stop reasons and successes.
11  */
12 class MadsIteration: public Iteration
13 {
14 private:
15 
16  const std::shared_ptr<EvalPoint> _frameCenter; ///< Used by ::getFrameCenter()
17 
18  const std::shared_ptr<MeshBase> _mesh; ///< Used by ::getMesh()
19 
20  /// Helper for constructor
21  void init ();
22 
23 public:
24  /// Constructor
25  /**
26  \param parentStep The parent of this step -- \b IN.
27  \param frameCenter Frame center of this iteration -- \b IN.
28  \param k The iteration number -- \b IN.
29  \param mesh The mesh of the iteration -- \b IN.
30  */
31  explicit MadsIteration(const Step *parentStep,
32  const std::shared_ptr<EvalPoint> &frameCenter,
33  const size_t k,
34  const std::shared_ptr<MeshBase> mesh)
35  : Iteration(parentStep ,k ),
36  _frameCenter(frameCenter),
37  _mesh(mesh)
38  {
39  init();
40  }
41 
42 
43  /// Destructor
44  /**
45  When iteration is done, Flush prints output queue.
46  */
47  virtual ~MadsIteration()
48  {
50  }
51 
52  /**
53  Run a MADS iteration: a Search step followed by a Poll step depending on the stop reasons and successes.
54  */
55  virtual bool run() override ;
56 
57  // Gets/Sets
58 
59  /**
60  The Mads algorithm iteration possesses a mesh, unlike the base iteration that has none.
61  \remark Used by Step::getIterationMesh() to pass the mesh whenever needed
62  */
63  const std::shared_ptr<MeshBase> getMesh() const override { return _mesh; }
64 
65  /**
66  The Mads algorithm iteration possesses a frame center, unlike the base iteration that has none.
67  \remark Used by Step::getIterationFrameCenter() to pass the mesh whenever needed
68  */
69  const std::shared_ptr<EvalPoint> getFrameCenter() const override { return _frameCenter; }
70 
71 
72 };
73 
74 #include "../../nomad_nsend.hpp"
75 
76 #endif // __NOMAD400_MADSITERATION__
virtual bool run() override
virtual ~MadsIteration()
Destructor.
const std::shared_ptr< EvalPoint > getFrameCenter() const override
void init()
Helper for constructor.
const std::shared_ptr< MeshBase > _mesh
 Used by ::getMesh()
Class for MADS iteration.
const std::shared_ptr< MeshBase > getMesh() const override
MadsIteration(const Step *parentStep, const std::shared_ptr< EvalPoint > &frameCenter, const size_t k, const std::shared_ptr< MeshBase > mesh)
Constructor.
const std::shared_ptr< EvalPoint > _frameCenter
 Used by ::getFrameCenter()
Class for iteration of an Algorithm.
Definition: Iteration.hpp:12
Base class of all types of steps (Iteration, Termination, Initialization, Poll, Mads,...).
Definition: Step.hpp:24
static void Flush()
Definition: OutputQueue.hpp:74