FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTlinegraph.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 FMTLINEGRAPH_H
9#define FMTLINEGRAPH_H
10
11#include "FMTgraph.hpp"
12#include <boost/serialization/export.hpp>
13
14namespace Spatial
15{
16 class FMTeventcontainer;
17}
18
19namespace Graph
20{
21// DocString: FMTlinegraph
29class FMTEXPORT FMTlinegraph : public FMTgraph<FMTbasevertexproperties,FMTbaseedgeproperties>
30{
31 friend class boost::serialization::access;
32 template<class Archive>
33 void serialize(Archive& ar, const unsigned int version)
34 {
35 ar & boost::serialization::make_nvp("Graph::FMTgraph<Graph::FMTbasevertexproperties,Graph::FMTbaseedgeproperties>",boost::serialization::base_object<FMTgraph<FMTbasevertexproperties, FMTbaseedgeproperties>>(*this));
36
37 }
38 // DocString: FMTlinegraph::isanyactionofedge
42 bool isanyactionofedge(const FMTbaseedgeproperties& edgeproperty,const std::unordered_set<int>& actions) const;
43 // DocString: FMTlinegraph::isanyvertexusage
47 bool isanyvertexusage(const FMTbasevertexproperties& vertexproperty, const Core::FMToutputsource& source, const Core::FMTyields& yields) const;
48 public:
49 // DocString: FMTlinegraph()
54 // DocString: ~FMTlinegraph()
58 ~FMTlinegraph()=default;
59 // DocString: FMTlinegraph(const FMTgraphbuild)
63 FMTlinegraph(const FMTgraphbuild lbuildtype);
64 // DocString: FMTlinegraph(const FMTlinegraph&)
69 // DocString: FMTlinegraph(const FMTgraph<FMTbasevertexproperties, FMTbaseedgeproperties>&)
74 // DocString: FMTlinegraph::operator=
78 FMTlinegraph& operator = (const FMTlinegraph& rhs);
79 // DocString: FMTlinegraph::operator=
84 // DocString: FMTlinegraph::newperiod
88 //void newperiod();
89 // DocString: FMTlinegraph::setaction
93 void setaction( FMTvertex_descriptor active,const int& actionID,
94 const std::vector<Core::FMTdevelopmentpath>& paths);
95 // DocString: FMTlinegraph::operate
99 size_t operate( const Core::FMTaction& action, const int& action_id, const Core::FMTtransition& transition,
100 const Core::FMTyields& ylds, const std::vector<Core::FMTtheme>& themes);
101 // DocString: FMTlinegraph::grow
105 void grow();
106 // DocString: FMTlinegraph::getactivevertex
111 // DocString: FMTlinegraph::getlastactionid
115 int getlastactionid(const int& period)const;
116 // DocString: FMTlinegraph::getperiodactionids
120 std::vector<int> getperiodactionids(const int& period)const;
121 // DocString: FMTlinegraph::getperiodpredictors
125 std::vector<FMTpredictor>getperiodpredictors(const int& period, const Models::FMTmodel& model, const std::vector<std::string>& yieldnames,bool periodonevalues =false,bool withGCBMid = true) const;
126 // DocString: FMTlinegraph::getinedgeactionid
131 // DocString: FMTlinegraph::getperiodstartdev
135 const Core::FMTdevelopment& getperiodstartdev(const int& period) const;
136 // DocString: FMTlinegraph::getperiodstopdev
140 const Core::FMTdevelopment& getperiodstopdev(const int& period) const;
141 // DocString: FMTlinegraph::randomoperate
145 int randomoperate(const std::vector<int>& operables, const Models::FMTmodel& model,
146 FMTvertex_descriptor& front_vertex, std::default_random_engine& generator,
147 const Core::FMTdevelopment& active_development,bool dontchoosegrow=false);
148 // DocString: FMTlinegraph::randombuildperiod
153 std::vector<int> randombuildperiod(const Models::FMTmodel& model,std::default_random_engine& generator,
154 boost::unordered_map<Core::FMTdevelopment, std::vector<int>>& operability,
155 bool dontchoosegrow=false);
156 // DocString: FMTlinegraph::clearfromperiod
161 FMTgraphstats clearfromperiod(const int& period,bool updatedevelopments=false);
162 // DocString: FMTlinegraph::partialcopy
166 FMTlinegraph partialcopy(const int& period) const;
167 // DocString: FMTlinegraph::getactions
172 std::vector<std::vector<bool>>getactions(const Models::FMTmodel& model,const int& fromperiod,
173 std::map<Core::FMTdevelopment, std::vector<bool>>& operability) const;
174 // DocString: FMTlinegraph::getbasedevelopment
179 // DocString: FMTlinegraph::getbasehash
183 size_t getbasehash(const Core::FMTmask& dynamicmask) const;
184 // DocString:FMTlinegraph::getbasestr
188 std::string getbasestr(const Core::FMTmask& dynamicmask) const;
189 // DocString: FMTlinegraph::getbasemask
193 Core::FMTmask getbasemask(const Core::FMTmask& dynamicmask) const;
194 // DocString: FMTlinegraph::getbasemask
198 size_t getedgeshash(const int& maximalperiod,bool& gotthewhole) const;
199 // DocString: FMTlinegraph::getedgesstr
203 std::string getedgesstr(const int& maximalperiod, bool& gotthewhole) const;
204 // DocString: FMTlinegraph::filledgesmask
208 void filledgesmask(Core::FMTmask& mask, const int& maximalperiod) const;
209 // DocString: FMTlinegraph::stringforconstraint
213 bool stringforconstraint(std::string& value, const int& stop, const Core::FMTmask& dynamicmask) const;
214 // DocString: FMTlinegraph::hashforconstraint
218 bool hashforconstraint(size_t& hashvalue,const int& stop,const Core::FMTmask& dynamicmask) const;
219 // DocString: FMTlinegraph::isonlygrow
223 bool isonlygrow(int period=0) const;
224 // DocString:FMTlinegraph::addfromevents
228 //void addfromevents(const Spatial::FMTcoordinate& localisation,const Models::FMTmodel& model, Spatial::FMTeventcontainer& events) const;
229 // DocString: FMTlinegraph::ismovable
233 bool ismovable(const std::vector<const Core::FMTaction*>& actions,
234 const Core::FMTyields& yields, const int& period, boost::unordered_map<Core::FMTdevelopment, bool>*operability =nullptr) const;
235 // DocString: FMTlinegraph::operator==
239 bool operator == (const FMTlinegraph& rhs) const;
240 // DocString: FMTlinegraph::clearnodecache
245 // DocString: FMTlinegraph::anyusageof
249 std::vector<int> anyusageof(Core::FMToutputnode output_node, const Models::FMTmodel& model, const int& startingperiod) const;
250
251
252};
253}
254
255BOOST_CLASS_EXPORT_KEY(Graph::FMTlinegraph)
256
257#endif // FMTLINEGRAPH_H
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTaction.hpp:42
Definition: FMTdevelopment.hpp:44
Definition: FMTmask.hpp:96
Definition: FMToutputnode.hpp:20
Definition: FMToutputsource.hpp:40
Definition: FMTtransition.hpp:37
Definition: FMTyields.hpp:40
Definition: FMTbaseedgeproperties.hpp:26
Definition: FMTbasevertexproperties.hpp:23
Definition: FMTgraph.hpp:78
boost::graph_traits< FMTadjacency_list >::vertex_descriptor FMTvertex_descriptor
Definition: FMTgraph.hpp:110
Definition: FMTgraphstats.hpp:28
Definition: FMTlinegraph.hpp:30
bool stringforconstraint(std::string &value, const int &stop, const Core::FMTmask &dynamicmask) const
void filledgesmask(Core::FMTmask &mask, const int &maximalperiod) const
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)
bool hashforconstraint(size_t &hashvalue, const int &stop, const Core::FMTmask &dynamicmask) const
bool ismovable(const std::vector< const Core::FMTaction * > &actions, const Core::FMTyields &yields, const int &period, boost::unordered_map< Core::FMTdevelopment, bool > *operability=nullptr) const
const Core::FMTdevelopment & getbasedevelopment() const
size_t getbasehash(const Core::FMTmask &dynamicmask) const
std::string getedgesstr(const int &maximalperiod, bool &gotthewhole) const
int randomoperate(const std::vector< int > &operables, const Models::FMTmodel &model, FMTvertex_descriptor &front_vertex, std::default_random_engine &generator, const Core::FMTdevelopment &active_development, bool dontchoosegrow=false)
FMTgraphstats clearfromperiod(const int &period, bool updatedevelopments=false)
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)
~FMTlinegraph()=default
FMTlinegraph(const FMTlinegraph &rhs)
size_t getedgeshash(const int &maximalperiod, bool &gotthewhole) const
std::vector< int > getperiodactionids(const int &period) const
const Core::FMTdevelopment & getperiodstartdev(const int &period) const
std::vector< int > anyusageof(Core::FMToutputnode output_node, const Models::FMTmodel &model, const int &startingperiod) const
void setaction(FMTvertex_descriptor active, const int &actionID, const std::vector< Core::FMTdevelopmentpath > &paths)
FMTvertex_descriptor getactivevertex() const
int getlastactionid(const int &period) const
Core::FMTmask getbasemask(const Core::FMTmask &dynamicmask) const
FMTlinegraph(const FMTgraphbuild lbuildtype)
int getinedgeactionid(const FMTvertex_descriptor &vdesc) const
bool isonlygrow(int period=0) const
std::vector< std::vector< bool > > getactions(const Models::FMTmodel &model, const int &fromperiod, std::map< Core::FMTdevelopment, std::vector< bool > > &operability) const
FMTlinegraph(const FMTgraph< FMTbasevertexproperties, FMTbaseedgeproperties > &rhs)
const Core::FMTdevelopment & getperiodstopdev(const int &period) const
std::vector< FMTpredictor > getperiodpredictors(const int &period, const Models::FMTmodel &model, const std::vector< std::string > &yieldnames, bool periodonevalues=false, bool withGCBMid=true) const
std::string getbasestr(const Core::FMTmask &dynamicmask) const
FMTlinegraph partialcopy(const int &period) const
Definition: FMTmodel.hpp:60
Namespace for using/building unidirectional graphs in FMT.
Definition: FMTareaparser.hpp:31
FMTgraphbuild
Definition: FMTgraph.hpp:67
The spatial namespace provides classes for spatialy explicit simulation/optimization based on raster ...
Definition: FMTareaparser.hpp:36