7#include <boost/thread/recursive_mutex.hpp>
9#ifndef FMTYIELDMODELDECISIONTREE_Hm_included
10#define FMTYIELDMODELDECISIONTREE_Hm_included
66 std::unique_ptr<FMTYieldModel>
clone()
const;
88 const std::vector<FMTTheme>& newthemes)
const;
97 const std::vector<FMTTheme>& basethemes)
const;
108 mutable boost::recursive_mutex m_mtx;
111 mutable std::map<size_t, std::vector<double>>m_values;
114 std::unique_ptr<FMTOutput> m_reference;
117 std::vector<FMTConstraint>m_nodes;
120 std::vector<double>m_default_values;
123 std::string m_update;
126 const std::string m_JSON_PROP_TREE =
"Tree";
129 const std::string m_JSON_PROP_DECISIONS =
"Decisions";
132 const std::string m_JSON_PROP_REFERENCE =
"Reference";
135 const std::string m_JSON_PROP_DEFAULT =
"Default";
138 const std::string m_JSON_PROP_UPDATE =
"Update";
156 Core::FMTConstraint _buildConstraint(
const std::string& name,
const std::string& yld,
const Core::FMTMask& mask,
const double& lowerbound,
const double& upperbound,
const int& lag)
const;
166 size_t _getADecision(
const std::unique_ptr<Models::FMTModel>& p_naturalGrowth,
167 size_t p_constraint_id,
int p_period,
int p_update)
const;
183 std::unique_ptr<FMTYieldModel> _modify(
const FMTMaskFilter& filter,
184 const std::vector<FMTTheme>& newthemes,
bool preSolve =
true)
const;
Representation of a line in the optimize section, an objective being considered a constraint.
Definition: FMTConstraint.h:52
Filter built from masks used to preSolve and postsolve FMTMask objects.
Definition: FMTMaskFilter.h:31
Core class holding, as a boost dynamic bitset, which theme attributes are part of a mask.
Definition: FMTMask.h:96
Yield model using a decision tree based on the growth outputs of the model to get yield values.
Definition: FMTYieldModelDecisionTree.h:27
virtual std::unique_ptr< FMTYieldModel > preSolve(const FMTMaskFilter &filter, const std::vector< FMTTheme > &newthemes) const
Return a presolved copy of the yield model.
virtual std::unique_ptr< FMTYieldModel > postSolve(const FMTMaskFilter &filter, const std::vector< FMTTheme > &basethemes) const
Return a postsolved copy of the yield model, restoring the original output and constraint masks.
virtual std::vector< std::vector< double > > getPeriodicValues() const
Try to turn the yield model into periodic constant values.
const std::vector< double > predict(const Core::FMTYieldRequest &request) const
Run the decision tree, building a natural growth model if needed, and return the predictions.
~FMTYieldModelDecisionTree()=default
Default destructor for FMTYieldModelDecisionTree.
FMTYieldModelDecisionTree()=default
Default constructor for FMTYieldModelDecisionTree.
static std::string getModelType()
Return the model type of the yield model.
FMTYieldModelDecisionTree(const boost::property_tree::ptree &jsonProps, const std::vector< std::string > &inputYields, const Core::FMTMask &mainmask)
Construct a decision tree yield model from a JSON tree, an input yield name list and the global mask.
FMTYieldModelDecisionTree & operator=(const FMTYieldModelDecisionTree &rhs)=default
Copy assignment operator for FMTYieldModelDecisionTree.
std::unique_ptr< FMTYieldModel > clone() const
clone the yield model.
FMTYieldModelDecisionTree(const FMTYieldModelDecisionTree &rhs)
Copy constructor for FMTYieldModelDecisionTree.
Abstract class to be implemented as a machine learning yield model.
Definition: FMTYieldModel.h:45
Request for yield values using a development and optionally a graph vertex.
Definition: FMTYieldRequest.h:37
Definition: FMTYieldModel.h:30
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTAreaParser.h:54