NOMAD Source  Version 4.0.0 Beta
LH.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_LH__
47 #define __NOMAD400_LH__
48 
49 #include "../../Algos/Algorithm.hpp"
50 #include "../../Algos/AlgoStopReasons.hpp"
51 #include "../../Algos/IterationUtils.hpp"
52 
53 #include "../../nomad_nsbegin.hpp"
54 
55 /// Class for Latin Hypercube algorithm sampling.
56 /**
57  Generate the trial points using LHS and evaluate them.
58  \todo Complete documentation
59  */
60 class LH: public Algorithm, public IterationUtils
61 {
62 
63 public:
64  /// Constructor
65  explicit LH(const Step* parentStep,
66  std::shared_ptr<AlgoStopReasons<LHStopType>> stopReasons,
67  const std::shared_ptr<RunParameters>& runParams,
68  const std::shared_ptr<PbParameters>& pbParams)
69  : Algorithm(parentStep, stopReasons, runParams, pbParams),
70  IterationUtils(this)
71  {
72  init();
73  }
74 
75  /// Destructor
76  virtual ~LH() {}
77 
78 
79  virtual void readInformationForHotRestart() override {}
80 
81 private:
82  /// Helper for constructor
83  void init();
84 
85  /// Implementation for start task.
86  /**
87  Call LH::generateTrialPoints
88  */
89  virtual void startImp() override;
90 
91  /// Implementation for run tasks.
92  /**
93  Evaluation of the trial points
94 
95  \return \c true a better point has been obtained, \c false otherwise.
96  */
97  virtual bool runImp() override;
98 
99  /// Implementation for end task.
100  /**
101  Clean-up evaluation queue.
102  */
103  virtual void endImp() override;
104 
105  /**
106  \copydoc IterationUtils::generateTrialPoints \n
107  \note For LH, the generation of points uses LHS for sampling with the problem's bounds and X0.
108  */
109  void generateTrialPoints() override;
110 
111 };
112 
113 #include "../../nomad_nsend.hpp"
114 
115 #endif // __NOMAD400_LH__
LH::generateTrialPoints
void generateTrialPoints() override
Generate the trial points of an algorithm iteration before evaluation.
LH
Class for Latin Hypercube algorithm sampling.
Definition: LH.hpp:60
LH::~LH
virtual ~LH()
Destructor.
Definition: LH.hpp:76
Algorithm
Generic class for any direct search optimizer algorithm.
Definition: Algorithm.hpp:68
Step
Base class of all types of steps (Iteration, Termination, Initialization, Poll, Mads,...
Definition: Step.hpp:68
LH::endImp
virtual void endImp() override
Implementation for end task.
LH::init
void init()
Helper for constructor.
IterationUtils
Class of utils (attributes and helper functions) for some phases of an algorithm that involve Iterati...
Definition: IterationUtils.hpp:64
AlgoStopReasons
Template class for algorithm stop reasons.
Definition: AlgoStopReasons.hpp:65
LH::LH
LH(const Step *parentStep, std::shared_ptr< AlgoStopReasons< LHStopType >> stopReasons, const std::shared_ptr< RunParameters > &runParams, const std::shared_ptr< PbParameters > &pbParams)
Constructor.
Definition: LH.hpp:65
LH::runImp
virtual bool runImp() override
Implementation for run tasks.
LH::startImp
virtual void startImp() override
Implementation for start task.
LH::readInformationForHotRestart
virtual void readInformationForHotRestart() override
Helper for start() when doing a hot restart.
Definition: LH.hpp:79