FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTnssmodel.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 FMTNSSMODEL_H
9#define FMTNSSMODEL_H
10
11#ifdef FMTWITHOSI
12
13#include "FMTsrmodel.hpp"
14#include <sstream>
15#include <boost/serialization/serialization.hpp>
16#include <boost/serialization/nvp.hpp>
17#include <boost/serialization/split_member.hpp>
18#include <boost/serialization/export.hpp>
19#include <random>
20
21
22namespace Models
23{
24 // DocString: FMTnssmodel
31 {
32 // DocString: FMTnssmodel::save
36 friend class boost::serialization::access;
37 template<class Archive>
38 void save(Archive& ar, const unsigned int version) const
39 {
40 ar & boost::serialization::make_nvp("model", boost::serialization::base_object<FMTsrmodel>(*this));
41 std::stringstream basegenerator;
42 basegenerator << generator;
43 const std::string basegeneratorstring(basegenerator.str());
44 ar & BOOST_SERIALIZATION_NVP(basegeneratorstring);
45
46 }
47 // DocString: FMTnssmodel::load
51 template<class Archive>
52 void load(Archive& ar, const unsigned int version)
53 {
54 ar & boost::serialization::make_nvp("model", boost::serialization::base_object<FMTsrmodel>(*this));
55 std::string basegeneratorstring;
56 ar & BOOST_SERIALIZATION_NVP(basegeneratorstring);
57 std::stringstream(basegeneratorstring) >> generator;
58
59 }
60 BOOST_SERIALIZATION_SPLIT_MEMBER()
61 // DocString: FMTnssmodel::generator
63 std::default_random_engine generator;
64 // DocString: FMTnssmodel::constraintstotarget
68 std::vector<const Core::FMToutput*> constraintstotarget(std::vector<double>& targets,const int& period);
69 // DocString: FMTnssmodel::getoperabilities
73 std::vector<std::pair<size_t, const Core::FMTaction*>> getoperabilities(const Core::FMTactualdevelopment& development,
74 std::vector<std::vector<const Core::FMTaction*>> targets,
75 const std::vector<const Core::FMToutput*>& alloutputs) const;
76 // DocString: FMTnssmodel::etactionstargets
80 std::vector<std::vector<const Core::FMTaction*>> getactionstargets(const std::vector<const Core::FMToutput*>& alloutputs) const;
81 // DocString: FMTnssmodel::operate
85 std::vector<Core::FMTdevelopmentpath> operate(const Core::FMTactualdevelopment& development,const double& areatarget,const Core::FMTaction* target,Core::FMTschedule& schedule) const;
86 // DocString: FMTnssmodel::updatearea
90 void updatearea(std::vector<Core::FMTactualdevelopment>& basearea, std::vector<Core::FMTactualdevelopment>::iterator developmentit,const std::vector<Core::FMTdevelopmentpath>& paths, const double& operatedarea);
91 // DocString: FMTnssmodel::updateareatargets
95 void updateareatargets(const double& areaoperated,const size_t& outtarget,
96 std::vector<const Core::FMToutput*>& alloutputs,std::vector<double>& targets,
97 std::vector<std::vector<const Core::FMTaction*>>& actiontargets) const;
98 virtual void swap_ptr(const std::unique_ptr<FMTmodel>& rhs);
99 // DocString: FMTnssmodel(const FMTsrmodel&,unsigned int)
103 FMTnssmodel(const FMTsrmodel& rhs, unsigned int seed);
104 public:
105 // DocString: FMTnssmodel()
110 // DocString: ~FMTnssmodel()
114 ~FMTnssmodel()=default;
115 // DocString: FMTnssmodel(const FMTnssmodel&)
120 // DocString: FMTnssmodel::operator=
124 FMTnssmodel& operator=(const FMTnssmodel& rhs) = default;
125 // DocString: FMTnssmodel(const FMTmodel&,unsigned int)
129 FMTnssmodel(const FMTmodel& rhs, unsigned int seed);
130
131 // DocString: FMTnssmodel(FMTnssmodel&&)
135 FMTnssmodel(FMTnssmodel&& rhs)=default;
136 // DocString: FMTnssmodel::operator=(FMTnssmodel&& rhs)
140 FMTnssmodel& operator =(FMTnssmodel&& rhs) =default;
141 // DocString: FMTnssmodel::simulate
145 void simulate();
146 // DocString: FMTnssmodel::presolve
151 virtual std::unique_ptr<FMTmodel>presolve(std::vector<Core::FMTactualdevelopment> optionaldevelopments = std::vector<Core::FMTactualdevelopment>()) const;
152 // DocString: FMTnssmodel::clone
156 virtual std::unique_ptr<FMTmodel>clone() const;
157 // DocString: FMTmodel::build
161 virtual bool build(std::vector<Core::FMTschedule> schedules=std::vector<Core::FMTschedule>());
162 // DocString: FMTmodel::solve
166 virtual bool solve()
167 {
168 return true;
169 }
170 // DocString: FMTnssmodel::setparameter(const FMTintmodelparameters, const int)
174 bool setparameter(const FMTintmodelparameters& key, const int& value) override;
175 // DocString: FMTnssmodel::setparameter(const FMTboolmodelparameters, const bool)
179 bool setparameter(const FMTboolmodelparameters& key, const bool& value) override;
180 // DocString: FMTnssmodel::getcopy
187 virtual std::unique_ptr<FMTmodel> getcopy(int period = 0) const;
188 };
189}
190
191BOOST_CLASS_EXPORT_KEY(Models::FMTnssmodel)
192#endif
193#endif
194
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTmodel.hpp:60
Definition: FMTnssmodel.hpp:31
virtual std::unique_ptr< FMTmodel > getcopy(int period=0) const
bool setparameter(const FMTboolmodelparameters &key, const bool &value) override
bool setparameter(const FMTintmodelparameters &key, const int &value) override
Definition: FMTsrmodel.hpp:44
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTaction.hpp:31
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTareaparser.hpp:50
FMTintmodelparameters
Definition: FMTmodelparameters.hpp:24
FMTboolmodelparameters
Definition: FMTmodelparameters.hpp:45