FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTOutputNode.h
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 FMTOUTPUTNODE_Hm_included
9#define FMTOUTPUTNODE_Hm_included
10
11#include "FMTOutputSource.h"
12#include <map>
13
14#include "FMTutility.h"
15
16namespace Core
17{
18class FMTAction;
19
20// DocString: FMTOutputNode
25 {
26 public:
29 double constant;
30 // DocString: FMTOutputNode()
35 // DocString: FMTOutputNode(const FMTOutputSource&, const FMTOutputSource&, const double&)
42 FMTOutputNode(const FMTOutputSource& lsource, const FMTOutputSource& lfactor, const double& lconstant);
43 // DocString: FMTOutputNode(const FMTOutputNode&)
49 // DocString: FMTLpHeuristic::FMTOutputNode
55 FMTOutputNode(const Core::FMTMask& generalmask,const std::string& actionaggregate);
56 // DocString: FMTOutputNode::hash
61 size_t hash() const;
62 // DocString: FMTOutputNode::hashForValue
67 size_t hashForValue() const;
68 // DocString: FMTOutputNode::allowCashDeduction
73 bool allowCashDeduction() const;
74 // DocString: FMTOutputNode::singlePeriod
79 bool singlePeriod() const;
80 // DocString: FMTOutputNode::multiPeriod
85 bool multiPeriod() const;
86 // DocString: FMTOutputNode::isPastPeriod
91 bool isPastPeriod() const;
92 // DocString: FMTOutputNode::isNull
97 bool isNull() const;
98 // DocString: FMTOutputNode::operator<
104 bool operator < (const FMTOutputNode& rhs) const;
105 // DocString: FMTOutputNode::operator==
111 bool operator == (const FMTOutputNode& rhs) const;
112 // DocString: FMTOutputNode::isSubsetOf(const FMTOutputNode&)
118 bool isSubsetOf(const FMTOutputNode& rhs) const;
119 // DocString: FMTOutputNode::isSubsetOf(const FMTOutputNode&,const std::vector<Core::FMTAction>&)
126 bool isSubsetOf(const FMTOutputNode& rhs,const std::vector<Core::FMTAction>& actions) const;
127 // DocString: FMTOutputNode::isSameButDifferentAction
134 // DocString: FMTOutputNode::getOutputId
139 inline int getOutputId() const
140 {
141 return source.getOutputOrigin();
142 }
143 // DocString: FMTOutputNode::isActionBased
148 inline bool isActionBased() const
149 {
150 return source.isAction();
151 }
152 // DocString: FMTOutputNode::isSameValues
158 bool isSameValues(const FMTOutputNode& rhs) const;
159 // DocString: FMTOutputNode::operator std::string
164 operator std::string() const;
165 // DocString: FMTOutputNode::getHashString
170 std::string getHashString() const;
171 // DocString: FMTOutputNode::getHashMask
177 // DocString: FMTOutputNode::fillHashMaskSpec
182 void fillHashMaskSpec(Core::FMTMask& baseMask) const;
183 // DocString: FMTOutputNode::setPeriod
189 FMTOutputNode setPeriod(int period) const;
190 // DocString: FMTOutputNode::operator=
196 FMTOutputNode& operator = (const FMTOutputNode& rhs);
197 // DocString: FMTOutputNode::setToGraph
205 int setToGraph(std::vector<int>& targetedperiods, int period,int max_period);
206 // DocString: ~FMTOutputNode()
210 ~FMTOutputNode()=default;
211 // DocString: FMTOutputNode::fillUpEquation
219 void fillUpEquation(std::map<std::string,std::vector<std::string>>& allequations,
220 const std::map<std::string, double>& graphvalues,
221 const std::vector<std::string>& equation, const size_t& nodeid) const;
222 };
223
224// DocString: FMTOutputNodeValueComparator
229 {
230 public:
231 // DocString: FMTOutputNodeValueComparator::operator()
238 bool operator()(const FMTOutputNode& node1, const FMTOutputNode& node2) const;
239
240 };
241
242// DocString: FMTOutputNodeOriginComparator
247{
248public:
249 // DocString: FMTOutputNodeOriginComparator::operator()
256 bool operator()(const FMTOutputNode& node1, const FMTOutputNode& node2) const;
257
258};
259
260// DocString: FMTOutputNodeHasher
265 {
266 public:
267 // DocString: FMTOutputNodeHasher::operator()
273 size_t operator()(const FMTOutputNode & node) const;
274 };
275
276
277}
278
279BOOST_CLASS_EXPORT_KEY(Core::FMTOutputNode)
280
281#endif
#define FMTEXPORT
Definition: FMTutility.h:125
Core class holding, as a boost dynamic bitset, which theme attributes are part of a mask.
Definition: FMTMask.h:96
Hasher for output nodes.
Definition: FMTOutputNode.h:265
size_t operator()(const FMTOutputNode &node) const
Return the hash of an output node.
Comparator comparing output nodes by origin.
Definition: FMTOutputNode.h:247
bool operator()(const FMTOutputNode &node1, const FMTOutputNode &node2) const
Compare two output nodes by origin.
Comparator comparing output nodes by value.
Definition: FMTOutputNode.h:229
bool operator()(const FMTOutputNode &node1, const FMTOutputNode &node2) const
Compare two output nodes by value.
Node of an output representing a set of developments in the graph, holding a source,...
Definition: FMTOutputNode.h:25
~FMTOutputNode()=default
Default destructor for FMTOutputNode.
void fillUpEquation(std::map< std::string, std::vector< std::string > > &allequations, const std::map< std::string, double > &graphvalues, const std::vector< std::string > &equation, const size_t &nodeid) const
Fill up the equation of the output node.
FMTOutputNode(const Core::FMTMask &generalmask, const std::string &actionaggregate)
Construct a general node targeting an action name or actions aggregate, for use with the scheduler he...
int getOutputId() const
Return the output id of the output node.
Definition: FMTOutputNode.h:139
bool isPastPeriod() const
Return true if the output node targets a past period.
size_t hashForValue() const
Return the hash of the output node for its value.
bool isSubsetOf(const FMTOutputNode &rhs) const
Return true if this output node is a subset of another.
FMTOutputNode(const FMTOutputNode &rhs)
Copy constructor for FMTOutputNode.
FMTOutputSource factor
Definition: FMTOutputNode.h:28
FMTOutputNode setPeriod(int period) const
Return a copy of the output node set to a given period.
bool allowCashDeduction() const
Return true if the output node allows cache deduction.
bool isSameButDifferentAction(const FMTOutputNode &rhs) const
Return true if this output node is the same as another but with a different action.
bool singlePeriod() const
Return true if the output node covers a single period.
std::string getHashString() const
Return the hash string of the output node.
FMTOutputNode()
Default constructor for FMTOutputNode.
bool isActionBased() const
Return true if the output node is action based.
Definition: FMTOutputNode.h:148
int setToGraph(std::vector< int > &targetedperiods, int period, int max_period)
Set the output node to the graph for the targeted periods.
FMTOutputSource source
Definition: FMTOutputNode.h:27
double constant
Definition: FMTOutputNode.h:29
bool isSubsetOf(const FMTOutputNode &rhs, const std::vector< Core::FMTAction > &actions) const
Return true if this output node is a subset of another considering the actions.
void fillHashMaskSpec(Core::FMTMask &baseMask) const
Fill a base mask with the hash mask specification of the output node.
bool isNull() const
Return true if the output node is null.
FMTOutputNode(const FMTOutputSource &lsource, const FMTOutputSource &lfactor, const double &lconstant)
Construct an output node from a source, a factor and a constant.
bool multiPeriod() const
Return true if the output node covers multiple periods.
Core::FMTMask getHashMask() const
Return the hash mask of the output node.
size_t hash() const
Return the hash of the output node.
bool isSameValues(const FMTOutputNode &rhs) const
Return true if this output node has the same values as another.
Source of an output holding a mask, a target and values, used to compute an output.
Definition: FMTOutputSource.h:44
int getOutputOrigin() const
Return the output origin.
Definition: FMTOutputSource.h:138
bool isAction() const
Return true if the output source is an action.
Definition: FMTOutputSource.h:490
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34