10#ifndef FMToperatingareascheduler_Hm_included
11#define FMToperatingareascheduler_Hm_included
25#include <boost/serialization/serialization.hpp>
26#include <boost/serialization/nvp.hpp>
27#include <boost/serialization/export.hpp>
32 template<
class T1,
class T2>
44 class FMTTimeYieldHandler;
65 friend class boost::serialization::access;
66 template<
class Archive>
67 void serialize(Archive& ar,
const unsigned int version)
69 ar & boost::serialization::make_nvp(
"lpsolve", boost::serialization::base_object<FMTLpHeuristic>(*
this));
70 ar & BOOST_SERIALIZATION_NVP(operatingareas);
71 ar & BOOST_SERIALIZATION_NVP(adjacencyconstraints);
72 ar & BOOST_SERIALIZATION_NVP(proportionofset);
73 ar & BOOST_SERIALIZATION_NVP(userandomness);
74 ar & BOOST_SERIALIZATION_NVP(useprimal);
78 std::vector<FMTOperatingAreaScheme>operatingareas;
81 std::map<std::pair<Core::FMTMask, Core::FMTMask>, std::vector<int>>adjacencyconstraints;
84 double proportionofset;
108 bool setAdjacencyConstraints();
115 std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator> setDraw();
123 std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator> draw(std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator>& oparea);
133 size_t setBounds(
const std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator>& tobound,
const std::vector<int>& schemestoskip=std::vector<int>(),
bool keeploose=
true);
141 size_t selectScheme(std::vector<size_t>& potentialschemes,
const int& schemetoskip)
const;
154 bool getBounds(
const std::vector<FMTOperatingAreaScheme>::const_iterator& operatingareaiterator,
155 std::vector<int>& targeteditems,std::vector<double>& bounds,
const bool& boundall,
const size_t& schemeid=0,
bool keeploose=
true)
const;
161 void unboundAll(
bool atprimal =
false);
168 void unbound(
const std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator>& tounbound,
bool atprimal =
false);
173 void closePrimalBounds();
178 void setAllInteger();
189 void clearRowCache();
196 std::vector<int> getSolutionIndexes(
const std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator>& opareaits)
const;
202 std::string getThreadId()
const;
208 bool completeInitialSolution();
214 bool gotRejectedNodes()
const;
223 void resetBaseGreedySolution(
const std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator>& selected,
224 const std::vector<int>& oldschemeid,
225 const std::vector<int>& oldconstraints,
226 const std::vector<double>& oldbounds);
235 bool releaseGreedySolution(
const std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator>& selected,
236 std::vector<int>& oldconstraints,
237 std::vector<double>& oldbounds);
245 bool greedyMoveSolution(
const std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator>& selected,
246 const std::vector<int>& oldschemeid);
251 void setForDualInitialSolve();
258 int initialMoveSolution(
const std::vector<std::vector<FMTOperatingAreaScheme>::const_iterator>& selected);
263 void resetBaseInitialSolution();
288 bool branchNBoundSolve() final;
296 bool greedyPass(const
double& initsol, const
unsigned int& iteration) final;
312 void setProportionOfSet(const
double& proportion);
320 std::vector<
Core::FMTTimeYieldHandler> getSolution( const
std::
string& yldname) const;
329 std::vector<
Core::FMTOutput>getLevelSolution(const
std::
string& outputname,const
std::
string& aggregate,
int outputid) const;
345 const
Graph::FMTGraph<
Graph::FMTVertexProperties,
Graph::FMTEdgeProperties>& maingraph,
346 const
Models::FMTModel& model,
347 const
Core::FMTOutputNode& target,
348 Models::FMTLpSolver& basesolve,
size_t lseed = 0,
349 double proportionofset = 0.25,
bool userandomness = false,
bool copysolver = true);
#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
Definition: FMTGraphVertexToYield.h:20
Base class for solving LP and MIP problems using a heuristic, holding a random generator and its own ...
Definition: FMTLpHeuristic.h:34
Heuristic to solve the spatialization problem across a landscape for multiple operating areas.
Definition: FMTOperatingAreaScheduler.h:57
bool initialSolve() final
Solve the heuristic problem until an initial solution is found for each operating area.
bool empty() const
Return true if the operating areas are empty.
double generateInitialProportionOfSet() const
Compute a good proportion of set for the initialSolve, defaulting to 0.25 and decreasing linearly wit...
Operating area scheme giving information about its opening time, green up and return time.
Definition: FMTOperatingAreaScheme.h:42
Base class for the different models in FMT.
Definition: FMTModel.h:62
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34
Definition: FMTAreaParser.h:35
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