NOMAD Source  Version 4.0.0 Beta
NM.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------------*/
2 /* NOMAD - Nonlinear Optimization by Mesh Adaptive Direct Search - */
3 /* */
4 /* NOMAD - Version 4.0.0 has been created by */
5 /* Viviane Rochon Montplaisir - Polytechnique Montreal */
6 /* Christophe Tribes - Polytechnique Montreal */
7 /* */
8 /* The copyright of NOMAD - version 4.0.0 is owned by */
9 /* Charles Audet - Polytechnique Montreal */
10 /* Sebastien Le Digabel - Polytechnique Montreal */
11 /* Viviane Rochon Montplaisir - Polytechnique Montreal */
12 /* Christophe Tribes - Polytechnique Montreal */
13 /* */
14 /* NOMAD v4 has been funded by Rio Tinto, Hydro-Québec, NSERC (Natural */
15 /* Sciences and Engineering Research Council of Canada), InnovÉÉ (Innovation */
16 /* en Énergie Électrique) and IVADO (The Institute for Data Valorization) */
17 /* */
18 /* NOMAD v3 was created and developed by Charles Audet, Sebastien Le Digabel, */
19 /* Christophe Tribes and Viviane Rochon Montplaisir and was funded by AFOSR */
20 /* and Exxon Mobil. */
21 /* */
22 /* NOMAD v1 and v2 were created and developed by Mark Abramson, Charles Audet, */
23 /* Gilles Couture, and John E. Dennis Jr., and were funded by AFOSR and */
24 /* Exxon Mobil. */
25 /* */
26 /* Contact information: */
27 /* Polytechnique Montreal - GERAD */
28 /* C.P. 6079, Succ. Centre-ville, Montreal (Quebec) H3C 3A7 Canada */
29 /* e-mail: nomad@gerad.ca */
30 /* */
31 /* This program is free software: you can redistribute it and/or modify it */
32 /* under the terms of the GNU Lesser General Public License as published by */
33 /* the Free Software Foundation, either version 3 of the License, or (at your */
34 /* option) any later version. */
35 /* */
36 /* This program is distributed in the hope that it will be useful, but WITHOUT */
37 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
38 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License */
39 /* for more details. */
40 /* */
41 /* You should have received a copy of the GNU Lesser General Public License */
42 /* along with this program. If not, see <http://www.gnu.org/licenses/>. */
43 /* */
44 /* You can find information on the NOMAD software at www.gerad.ca/nomad */
45 /*---------------------------------------------------------------------------------*/
46 #ifndef __NOMAD400_NM__
47 #define __NOMAD400_NM__
48 
49 
50 #include "../../Algos/Algorithm.hpp"
51 #include "../../Algos/AlgoStopReasons.hpp"
52 
53 #include "../../nomad_nsbegin.hpp"
54 
55 /// Class implementing Nelder Mead non-linear simplex algorithm for constrained problems.
56 /**
57  See the NM-Mads paper: https://link.springer.com/article/10.1007/s10589-018-0016-0 for details.
58  */
59 class NM: public Algorithm
60 {
61 public:
62  /// Constructor
63  /**
64  \param parentStep The parent of this Step -- \b IN.
65  \param stopReasons The stop reasons for NM -- \b IN.
66  \param runParams The run parameters that control NM -- \b IN.
67  \param pbParams The problem parameters that control NM -- \b IN.
68  */
69  explicit NM(const Step* parentStep,
70  std::shared_ptr<AlgoStopReasons<NMStopType>> stopReasons,
71  const std::shared_ptr<RunParameters>& runParams,
72  const std::shared_ptr<PbParameters>& pbParams)
73  : Algorithm(parentStep, stopReasons, runParams, pbParams)
74  {
75  init();
76  }
77 
78  /// Destructor
79  virtual ~NM() {}
80 
81  virtual void readInformationForHotRestart() override ;
82 
83 private:
84  /// Helper for constructor
85  void init();
86 
87  /// Implementation for run tasks.
88  /**
89  - Algorithm execution for single-objective.
90  - Loop on NMMegaIteration (start, run, end) until a stop reason to terminate is obtained.
91  - Update the succes type
92  - Perform Termination tasks (start, run, end)
93  - Update the SearchMethod success type with best success found.
94  \return \c true
95  */
96  virtual bool runImp() override;
97 
98  /// Implementation for start tasks.
99  /**
100  - Set the stop reason to STARTED
101  - Reset sub-algorithm counter
102  - Perform Initialization tasks (start, run, end)
103  */
104  virtual void startImp() override;
105 
106  virtual void endImp() override;
107 
108 };
109 
110 #include "../../nomad_nsend.hpp"
111 
112 #endif // __NOMAD400_NM__
Algorithm
Generic class for any direct search optimizer algorithm.
Definition: Algorithm.hpp:68
NM::NM
NM(const Step *parentStep, std::shared_ptr< AlgoStopReasons< NMStopType >> stopReasons, const std::shared_ptr< RunParameters > &runParams, const std::shared_ptr< PbParameters > &pbParams)
Constructor.
Definition: NM.hpp:69
NM::readInformationForHotRestart
virtual void readInformationForHotRestart() override
Helper for start() when doing a hot restart.
Step
Base class of all types of steps (Iteration, Termination, Initialization, Poll, Mads,...
Definition: Step.hpp:68
AlgoStopReasons< NMStopType >
NM::startImp
virtual void startImp() override
Implementation for start tasks.
NM
Class implementing Nelder Mead non-linear simplex algorithm for constrained problems.
Definition: NM.hpp:59
NM::init
void init()
Helper for constructor.
NM::runImp
virtual bool runImp() override
Implementation for run tasks.
NM::~NM
virtual ~NM()
Destructor.
Definition: NM.hpp:79
NM::endImp
virtual void endImp() override
Default implementation of the end tasks of an algorithm.