8#ifndef FMTopareaschedulertask_Hm_included
9#define FMTopareaschedulertask_Hm_included
17#include <boost/thread.hpp>
34 class FMTOperatingAreaScheme;
35 class FMTOperatingAreaScheduler;
50 static boost::mutex generalmutex;
53 std::shared_ptr<Heuristics::FMTOperatingAreaScheduler>bestscheduler;
56 std::unique_ptr<Heuristics::FMTOperatingAreaScheduler>actualscheduler;
59 static std::string solutionlocation;
62 static unsigned int iterations;
65 static std::chrono::time_point<std::chrono::high_resolution_clock>stoptime;
68 static double relax_objective;
71 static std::string outyldname;
74 static std::unique_ptr<Models::FMTLpModel>basemodel;
93 const std::vector<Heuristics::FMTOperatingAreaScheme>& opareas,
const Core::FMTOutputNode& node);
100 std::chrono::time_point<std::chrono::high_resolution_clock>getStopPoint(
const int& timegap)
const;
107 void getConstraintsSolution(std::vector<Core::FMTOutput>& outputs,std::vector<Core::FMTConstraint>& constraints)
const;
112 void writeFinalModel()
const;
117 void writeSolution()
const;
123 bool gotInitialSolution()
const;
128 void evaluateAndCopy();
134 bool goodToGo()
const;
143 std::vector<Heuristics::FMTOperatingAreaScheme> getReturnTimeFromOutput(
Models::FMTLpModel& model,
144 const std::vector<Heuristics::FMTOperatingAreaScheme>& opareas,
175 std::unique_ptr<FMTTask>
clone()
const;
190 const std::vector<Heuristics::FMTOperatingAreaScheme>& opareas,
192 const std::string& outputlocation,
193 const std::string& outputyieldname,
194 const unsigned int& maxiterations,
203 virtual std::vector<std::unique_ptr<FMTTask>>
split(
const unsigned int& numberoftasks)
const;
209 virtual std::unique_ptr<FMTTask>
spawn();
225 void passInLogger(
const std::unique_ptr<Logging::FMTLogger>& logger)
override;
#define FMTEXPORT
Definition: FMTutility.h:125
Node of an output representing a set of developments in the graph, holding a source,...
Definition: FMTOutputNode.h:25
Class letting the user formulate a constraint in the optimize section or collect data across the grap...
Definition: FMTOutput.h:37
Type III LP forest planning model, with the graph divided per period.
Definition: FMTLpModel.h:54
Task to find a suboptimal schedule for the operating areas of a FMTLpModel.
Definition: FMTOpAreaSchedulerTask.h:47
virtual ~FMTOpAreaSchedulerTask()=default
Destructor for FMTOpAreaSchedulerTask, taking care of writing the solution.
void passInLogger(const std::unique_ptr< Logging::FMTLogger > &logger) override
Pass in the logger.
virtual std::unique_ptr< FMTTask > spawn()
Spawn a minimal task from the master task.
bool SupportsMultiThreading() const override
Check if the task support multithreading.
std::unique_ptr< FMTTask > clone() const
Clone function for FMTOpAreaSchedulerTask.
FMTOpAreaSchedulerTask(const FMTOpAreaSchedulerTask &rhs)
Default copy constructor for FMTOpAreaSchedulerTask.
virtual void finalize()
Write the solution at finalization.
virtual void work()
Main function doing the operating area scheduling task.
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 int &maxtime, Core::FMTOutput returntime_output=Core::FMTOutput())
Construct a FMTOpAreaSchedulerTask from a model, calling doPlanning on it and obtaining the operating...
virtual std::vector< std::unique_ptr< FMTTask > > split(const unsigned int &numberoftasks) const
Split the main task into multiple operating area scheduler tasks.
FMTOpAreaSchedulerTask()=default
Default constructor for FMTOpAreaSchedulerTask.
Task for parallel jobs.
Definition: FMTTask.h:27
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34
Namespace regrouping all tools for solving LP/MIP problems using an heuristic.
Definition: FMTAreaParser.h:47
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTAreaParser.h:54
Namespace for parallel tasking may include multithreading / multiprocessing.
Definition: FMTOpAreaSchedulerTask.h:40