FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTopareaschedulertask.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2019 Gouvernement du Québec
3
4SPDX-License-Identifier: LiLiQ-R-1.1
5License-Filename: LICENSES/EN/LiLiQ-R11unicode.txt
6*/
7
8#ifndef FMTopareaschedulertask_H_INCLUDED
9#define FMTopareaschedulertask_H_INCLUDED
10
11#include "FMTutility.hpp"
12#include "FMTtask.hpp"
13#include <vector>
14#include <memory>
15#include <string>
16#include <chrono>
17#include <boost/thread.hpp>
18#include "FMToutput.hpp"
19
20namespace Core
21{
22 class FMToutputnode;
23 class FMTconstraint;
24}
25
26
27namespace Models
28{
29 class FMTlpmodel;
30}
31
32namespace Heuristics
33{
34 class FMToperatingareascheme;
35 class FMToperatingareascheduler;
36}
37
39namespace Parallel
40{
41 // DocString: FMTopareaschedulertask
48 {
49 // DocString: FMTopareaschedulertask::generalmutex
51 static boost::mutex generalmutex;
52 // DocString: FMTopareaschedulertask::bestscheduler;
54 std::shared_ptr<Heuristics::FMToperatingareascheduler>bestscheduler;
55 // DocString: FMTopareaschedulertask::actualscheduler
57 std::unique_ptr<Heuristics::FMToperatingareascheduler>actualscheduler;
58 // DocString: FMTopareaschedulertask::solutionlocation
60 static std::string solutionlocation;
61 // DocString: FMTopareaschedulertask::iterations
63 static unsigned int iterations;
64 // DocString: FMTopareaschedulertask::stoptime
66 static std::chrono::time_point<std::chrono::high_resolution_clock>stoptime;
67 // DocString: FMTopareaschedulertask::irelax_objective
69 static double relax_objective;
70 // DocString: FMTopareaschedulertask::outyldname
72 static std::string outyldname;
73 // DocString: FMTopareaschedulertask::basemodel
75 static std::unique_ptr<Models::FMTlpmodel>basemodel;
76 // DocString: FMTopareaschedulertask::lastspawned
78 int lastspawned;
79 // DocString: FMTopareaschedulertask::solveinitialmodel
83 double solveinitialmodel(Models::FMTlpmodel& model) const;
84 // DocString: FMTopareaschedulertask::setinitialscheduler
88 void setinitialscheduler(Models::FMTlpmodel& model,
89 const std::vector<Heuristics::FMToperatingareascheme>& opareas,const Core::FMToutputnode& node);
90 // DocString: FMTopareaschedulertask::getstoppoint
94 std::chrono::time_point<std::chrono::high_resolution_clock>getstoppoint(const double& timegap) const;
95 // DocString: FMTopareaschedulertask::getconstraintssolution
99 void getconstraintssolution(std::vector<Core::FMToutput>& outputs,std::vector<Core::FMTconstraint>& constraints) const;
100 // DocString: FMTopareaschedulertask::writefinalmodel
105 void writefinalmodel() const;
106 // DocString: FMTopareaschedulertask::writesolution
110 void writesolution() const;
111 // DocString: FMTopareaschedulertask::gotinitialsolution
115 bool gotinitialsolution() const;
116 // DocString: FMTopareaschedulertask::evaluateandcopy
121 void evaluateandcopy();
122 // DocString: FMTopareaschedulertask::goodtogo
126 bool goodtogo() const;
127 // DocString: FMTopareaschedulertask::getreturntimefromoutput
132 std::vector<Heuristics::FMToperatingareascheme> getreturntimefromoutput(Models::FMTlpmodel& model,
133 const std::vector<Heuristics::FMToperatingareascheme>& opareas,
134 const Core::FMToutput& output) const;
135 public:
136 // DocString: FMTopareaschedulertask::FMTopareaschedulertask()
141 // DocString: FMTopareaschedulertask::FMTopareaschedulertask(const FMTopareaschedulertask&)
146 // DocString: FMTopareaschedulertask::operator=(const FMTopareaschedulertask&)
151 // DocString: FMTopareaschedulertask::~FMTopareaschedulertask()
155 virtual ~FMTopareaschedulertask()=default;
156 // DocString: FMTopareaschedulertask::clone
160 std::unique_ptr<FMTtask>clone() const;
161 // DocString: FMTopareaschedulertask::FMTopareaschedulertask(...)
169 const std::vector<Heuristics::FMToperatingareascheme>& opareas,
170 const Core::FMToutputnode& node,
171 const std::string& outputlocation,
172 const std::string& outputyieldname,
173 const unsigned int& maxiterations,
174 const double& maxtime,
175 Core::FMToutput returntime_output = Core::FMToutput());
176 // DocString: FMTopareaschedulertask::split
180 virtual std::vector<std::unique_ptr<FMTtask>>split(const unsigned int& numberoftasks) const;
181 // DocString: FMTopareaschedulertask::spawn
185 virtual std::unique_ptr<FMTtask>spawn();
186 // DocString: FMTopareaschedulertask::work
190 virtual void work();
191 // DocString: FMTopareaschedulertask::finalize
195 virtual void finalize();
196 // DocString: FMTopareaschedulertaskk::passinlogger
200 void passinlogger(const std::shared_ptr<Logging::FMTlogger>& logger) override;
201
202 };
203
204}
205
206
207
208#endif
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMToutput.hpp:39
Definition: FMToutputnode.hpp:20
Definition: FMTlpmodel.hpp:57
Definition: FMTopareaschedulertask.hpp:48
virtual std::vector< std::unique_ptr< FMTtask > > split(const unsigned int &numberoftasks) const
void passinlogger(const std::shared_ptr< Logging::FMTlogger > &logger) override
FMTopareaschedulertask(const Models::FMTlpmodel &model, const std::vector< Heuristics::FMToperatingareascheme > &opareas, const Core::FMToutputnode &node, const std::string &outputlocation, const std::string &outputyieldname, const unsigned int &maxiterations, const double &maxtime, Core::FMToutput returntime_output=Core::FMToutput())
std::unique_ptr< FMTtask > clone() const
FMTopareaschedulertask(const FMTopareaschedulertask &rhs)
virtual std::unique_ptr< FMTtask > spawn()
virtual ~FMTopareaschedulertask()=default
Definition: FMTtask.hpp:28
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTaction.hpp:31
Namespace regrouping all tools for solving LP/MIP problems using an heuristic.
Definition: FMTareaparser.hpp:43
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTareaparser.hpp:50
Namespace for parallel tasking may include multithreading / multiprocessing.
Definition: FMTopareaschedulertask.hpp:40