11#include "FMTGraph.hpp"
12#include <boost/serialization/export.hpp>
16 class FMTEventContainer;
90 void setAction( FMTvertex_descriptor active,
const int& actionID,
91 const std::vector<Core::FMTDevelopmentPath>& paths);
103 const Core::FMTYields& ylds,
const std::vector<Core::FMTTheme>& themes);
141 std::vector<FMTPredictor>
getPeriodPredictors(
const int& period,
const Models::FMTModel& model,
const std::vector<std::string>& yieldnames,
bool periodonevalues =
false,
bool withGCBMid =
true)
const;
174 bool dontchoosegrow=
false);
234 std::string
getEdgesStr(
const int& maximalperiod,
bool& gotthewhole)
const;
317 bool isNotDead(FMTvertex_descriptor p_Descriptor,int8_t p_DeathId)
const;
345 friend class boost::serialization::access;
353 template<
class Archive>
354 void serialize(Archive& ar,
const unsigned int version)
366 bool isAnyActionOfEdge(
const FMTBaseEdgeProperties& edgeproperty,
const std::unordered_set<int>& actions)
const;
387 int _randomOperate(
const std::vector<int>& operables,
const Models::FMTModel& model,
388 FMTvertex_descriptor& front_vertex, std::default_random_engine& generator,
#define FMTEXPORT
Definition: FMTutility.h:125
List of specifications dictating the operability of a subset of developments to this action.
Definition: FMTAction.h:43
Child class of FMTDevelopment representing an actual forest stand, holding the area of the stand.
Definition: FMTActualDevelopment.h:24
Base class of FMTActualDevelopment and FMTFuturDevelopment representing a forest stand.
Definition: FMTDevelopment.h:44
Core class holding, as a boost dynamic bitset, which theme attributes are part of a mask.
Definition: FMTMask.h:96
Node of an output representing a set of developments in the graph, holding a source,...
Definition: FMTOutputNode.h:25
Source of an output holding a mask, a target and values, used to compute an output.
Definition: FMTOutputSource.h:44
List of FMTFork describing the transition of an action, disturbing a development to generate new deve...
Definition: FMTTransition.h:35
FMTList containing multiple yield handlers as seen in the yield section, holding the information rela...
Definition: FMTYields.h:44
Base edge properties of a FMTGraph, holding the action of the edge.
Definition: FMTBaseEdgeProperties.h:31
Definition: FMTBaseVertexProperties.h:33
Definition: FMTGraphVertexToYield.h:20
Simple graph where each action generates a single new vertex (0-—0-—0-—0), used with FMTLayer to simu...
Definition: FMTLineGraph.h:27
const Core::FMTDevelopment & getBaseDevelopment() const
Return a reference to the first development of the graph.
void clearNodeCache()
Clear the node cache used when getting outputs of the line graph.
FMTLineGraph(size_t p_LengthReserve, const Core::FMTActualDevelopment &p_dev)
Construct a FMTLineGraph from a base development, reserving memory for a given length.
FMTLineGraph()
Default constructor for FMTLineGraph.
bool isNotDead(FMTvertex_descriptor p_Descriptor, int8_t p_DeathId) const
Return true if a vertex descriptor did not get the death action.
bool stringForConstraint(std::string &value, const int &stop, const Core::FMTMask &dynamicmask) const
Fill a string used for the uniqueness of the line graph.
bool isMovable(const Models::FMTModel &p_model, const int &period, boost::unordered_map< Core::FMTDevelopment, std::vector< int > > &p_operability) const
Add actions (edges) and vertices to the graph based on an event.
void grow(int p_Length=1)
Grow the last active vertex of the line graph, generating a new edge and vertex.
bool hashForConstraint(size_t &hashvalue, const int &stop, const Core::FMTMask &dynamicmask) const
Fill a hash used for the uniqueness of the line graph.
std::string getEdgesStr(const int &maximalperiod, bool &gotthewhole) const
Return a string representing the edges of the line graph from period 0 to a maximal period.
std::vector< int > anyUsageOf(Core::FMTOutputNode output_node, const Models::FMTModel &model, const int &startingperiod) const
Return the periods at which the vertices fall within an output node description.
std::vector< int > randomBuildPeriod(const Models::FMTModel &model, std::default_random_engine &generator, boost::unordered_map< Core::FMTDevelopment, std::vector< int > > &operability, bool dontchoosegrow=false)
Randomly operate the active vertex to completely build the active period of the graph.
Core::FMTMask getBaseMask(const Core::FMTMask &dynamicmask) const
Return a filtered mask of the starting development mask of the line graph based on a dynamic mask fil...
FMTLineGraph(const FMTGraph< FMTBaseVertexProperties, FMTBaseEdgeProperties > &rhs)
Construct a FMTLineGraph from its parent FMTGraph.
void setBaseMask(Core::FMTMask &p_dynamicmask, const int &p_period) const
Set the base mask to the dynamic mask by intersection for a period.
FMTLineGraph(size_t p_LengthReserve)
Construct a FMTLineGraph reserving memory for a given length.
int getInEdgeActionId(const FMTvertex_descriptor &vdesc) const
Return the in edge action id of a vertex.
~FMTLineGraph()=default
Default destructor for FMTLineGraph.
void fillEdgesMask(Core::FMTMask &mask, const int &maximalperiod) const
Fill a unique mask based on the edges from period 0 to a maximal period.
FMTvertex_descriptor getActiveVertex() const
Return the last active vertex of the graph.
int getLastActionId(const int &period) const
Return the action id of the last edge of a period.
std::vector< int > getPeriodActionIds(const int &period, bool p_ordered=true) const
Return the action ids of every action done in a period, in order.
std::vector< FMTPredictor > getPeriodPredictors(const int &period, const Models::FMTModel &model, const std::vector< std::string > &yieldnames, bool periodonevalues=false, bool withGCBMid=true) const
Return the predictors of a period.
bool isLessPeriod(const FMTLineGraph &rhs) const
Return true if the other graph is the same graph with one less period.
bool isSameBase(const FMTLineGraph &rhs) const
Return true if the other graph has the same base development.
size_t getEdgesHash(const int &maximalperiod, bool &gotthewhole) const
Return a hash of the edges of the line graph from period 0 to a maximal period.
bool isOnlyGrow(int period=0) const
Return true if the graph is never operated by any action.
size_t getBaseHash(const Core::FMTMask &dynamicmask) const
Return a hash of the starting development of the line graph based on a dynamic mask filter.
const Core::FMTDevelopment & getPeriodStartDev(const int &period) const
Return a reference to the first development (vertex) of a period.
size_t operate(const Core::FMTAction &action, const int &action_id, const Core::FMTTransition &transition, const Core::FMTYields &ylds, const std::vector< Core::FMTTheme > &themes)
Operate the last active vertex and return the length of the generated development path.
std::vector< std::vector< bool > > getActions(const Models::FMTModel &model, const int &fromperiod, std::map< Core::FMTDevelopment, std::vector< bool > > &operability) const
Return, starting from a period, a vector of booleans per period indicating whether each action is ope...
std::string getBaseStr(const Core::FMTMask &dynamicmask) const
Return a string of the starting development of the line graph based on a dynamic mask filter.
static const std::vector< int > & getSetOperability(const Core::FMTDevelopment &p_development, const Models::FMTModel &p_model, boost::unordered_map< Core::FMTDevelopment, std::vector< int > > &p_Cache)
Return the operable action ids of a development, computing and caching them if needed.
const Core::FMTDevelopment & getPeriodStopDev(const int &period) const
Return a reference to the last development (vertex) of a period.
void setAction(FMTvertex_descriptor active, const int &actionID, const std::vector< Core::FMTDevelopmentPath > &paths)
Generate a new period container at the end of the line graph.
FMTLineGraph(const FMTLineGraph &rhs)
Copy constructor for FMTLineGraph.
Base class for the different models in FMT.
Definition: FMTModel.h:62
Definition: FMTAreaParser.h:35
Definition: FMTAreaParser.h:40