FMT 0.9.8
Forest management tools for forest planning
Loading...
Searching...
No Matches
FMTschedule.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 FMTschedule_H_INCLUDED
9#define FMTschedule_H_INCLUDED
10
11#include <map>
12#include <vector>
13#include "FMTdevelopment.hpp"
14#include "FMTaction.hpp"
15#include "FMTobject.hpp"
16#include <iterator>
17#include <boost/serialization/export.hpp>
18#include <boost/unordered_set.hpp>
19
20namespace Core
21{
22class FMTconstraint;
23// DocString: FMTschedule
31 {
32 // DocString: FMTschedule::serialize
36 friend class boost::serialization::access;
37 template<class Archive>
38 void serialize(Archive& ar, const unsigned int version)
39 {
40 try {
41 ar & boost::serialization::make_nvp("FMTobject", boost::serialization::base_object<FMTobject>(*this));
42 ar & BOOST_SERIALIZATION_NVP(period);
43 ar & BOOST_SERIALIZATION_NVP(elements);
44 }catch (...)
45 {
46 _exhandler->printexceptions("", "FMTschedule::serialize", __LINE__, __FILE__);
47 }
48 }
49 // DocString: FMTschedule::period
51 int period;
52 // DocString: FMTschedule::uselock
54 bool uselock;
55 // DocString: FMTschedule::elements
58 std::map<FMTaction, std::map<FMTdevelopment, std::vector<double>>> elements;
59 // DocString: FMTschedule::sameelements
63 bool sameelements(const FMTschedule& rhs) const;
64 public:
65 // DocString: FMTschedule(const int&)
69 FMTschedule(const int& lperiod, const FMTobject& obj, const bool& luselock);
70 // DocString: FMTschedule(const int&,std::vector<FMTschedule>&)
74 FMTschedule(const int& lperiod, std::vector<FMTschedule>& schedules);
75 // DocString: FMTschedule(int,std::map<FMTaction,std::map<FMTdevelopment,std::vector<double>>>)
79 FMTschedule(int lperiod, std::map<FMTaction, std::map<FMTdevelopment, std::vector<double>>> mapping);
80 // DocString: FMTschedule(int,const std::map<FMTaction,std::map<FMTdevelopment,std::map<int,double>>>&)
84 FMTschedule(int lperiod, const std::map<FMTaction, std::map<FMTdevelopment, std::map<int,double>>>& mapping);
85 // DocString: FMTschedule()
90 // DocString: ~FMTschedule()
94 ~FMTschedule() = default;
95 // DocString: FMTschedule(const FMTschedule&)
100 // DocString: FMTschedule::operator=
104 FMTschedule& operator = (const FMTschedule& rhs);
105 // DocString: FMTschedule::operator==
109 bool operator == (const FMTschedule& rhs) const;
110 // DocString: FMTschedule::operator!=
114 bool operator != (const FMTschedule& rhs) const;
115 // DocString: FMTschedule::operator+=
119 FMTschedule& operator += (const FMTschedule& rhs);
120 // DocString: FMTschedule::operator+
124 FMTschedule operator + (const FMTschedule& rhs) const;
125 // DocString: FMTschedule::operator std::string
129 operator std::string() const;
130 // DocString: FMTschedule::getperiod
134 inline int getperiod() const
135 {
136 return period;
137 }
138 // DocString: FMTschedule::douselock
142 inline bool douselock() const
143 {
144 return uselock;
145 }
146 // DocString: FMTschedule::setuselock
150 void setuselock(const bool& lock);
151 // DocString: FMTschedule::actionarea
155 double actionarea(const FMTaction& action) const;
156 // DocString: FMTschedule::addevent
160 void addevent(const Core::FMTdevelopment& dev, const double& area, const Core::FMTaction& action);
161 // DocString: FMTschedule::clean
166 void clean();
167 // DocString: FMTschedule::area
171 double area() const;
172 // DocString: FMTschedule::operated
176 bool operated(const FMTaction& action,
177 const FMTdevelopment& developement) const;
178 // DocString: FMTschedule::getoperabilities
182 std::vector<boost::unordered_set<FMTdevelopment>> getoperabilities(const std::vector<FMTaction>& actions) const;
183 // DocString: FMTschedule::sort
187 void sort();
188 // DocString: FMTschedule::empty
192 bool empty() const;
193 // DocString: FMTschedule::size
197 size_t size() const;
198 // DocString: FMTschedule::presolve
204 const std::vector<FMTtheme>& newthemes, const std::vector<FMTaction>&presolvedaction) const;
205 // DocString: FMTschedule::postsolve
210 const std::vector<FMTtheme>& originalbasethemes, const std::vector<FMTaction>&originalbasebaseactions) const;
214 void setperiod(const int& newperiod);
215 // DocString: FMTschedule::getnewschedule
219 FMTschedule getnewschedule(const double& factor) const;
220 // DocString: FMTschedule::isfuturconstraints
224 bool isfuturconstraints(const std::vector<Core::FMTconstraint>& constraints) const;
228 typedef typename std::map<FMTaction, std::map<FMTdevelopment, std::vector<double>>>::value_type value_type;
229 typedef typename std::map<FMTaction, std::map<FMTdevelopment, std::vector<double>>>::iterator iterator;
230 typedef typename std::map<FMTaction, std::map<FMTdevelopment, std::vector<double>>>::const_iterator const_iterator;
231 std::map<FMTdevelopment, std::vector<double>>& operator[](const FMTaction& action);
232 const std::map<FMTdevelopment, std::vector<double>>& at(const FMTaction& action) const;
233 iterator find(const FMTaction& actionkey);
234 const_iterator find(const FMTaction& actionkey) const;
239 };
240
241
242}
243BOOST_CLASS_EXPORT_KEY(Core::FMTschedule)
244#endif // FMTschedule_H_INCLUDED
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTaction.hpp:42
Definition: FMTdevelopment.hpp:44
Definition: FMTmaskfilter.hpp:27
Definition: FMTobject.hpp:50
Definition: FMTschedule.hpp:31
FMTschedule(int lperiod, const std::map< FMTaction, std::map< FMTdevelopment, std::map< int, double > > > &mapping)
const_iterator find(const FMTaction &actionkey) const
std::vector< boost::unordered_set< FMTdevelopment > > getoperabilities(const std::vector< FMTaction > &actions) const
bool douselock() const
Definition: FMTschedule.hpp:142
~FMTschedule()=default
bool empty() const
FMTschedule(int lperiod, std::map< FMTaction, std::map< FMTdevelopment, std::vector< double > > > mapping)
void setperiod(const int &newperiod)
const std::map< FMTdevelopment, std::vector< double > > & at(const FMTaction &action) const
void setuselock(const bool &lock)
std::map< FMTaction, std::map< FMTdevelopment, std::vector< double > > >::value_type value_type
Definition: FMTschedule.hpp:228
iterator find(const FMTaction &actionkey)
double actionarea(const FMTaction &action) const
void addevent(const Core::FMTdevelopment &dev, const double &area, const Core::FMTaction &action)
int getperiod() const
Definition: FMTschedule.hpp:134
bool operated(const FMTaction &action, const FMTdevelopment &developement) const
FMTschedule(const int &lperiod, std::vector< FMTschedule > &schedules)
FMTschedule postsolve(const FMTmaskfilter &filter, const std::vector< FMTtheme > &originalbasethemes, const std::vector< FMTaction > &originalbasebaseactions) const
const_iterator begin() const
std::map< FMTaction, std::map< FMTdevelopment, std::vector< double > > >::const_iterator const_iterator
Definition: FMTschedule.hpp:230
const_iterator end() const
FMTschedule(const int &lperiod, const FMTobject &obj, const bool &luselock)
FMTschedule presolve(const FMTmaskfilter &filter, const std::vector< FMTtheme > &newthemes, const std::vector< FMTaction > &presolvedaction) const
FMTschedule(const FMTschedule &rhs)
iterator begin()
bool isfuturconstraints(const std::vector< Core::FMTconstraint > &constraints) const
std::map< FMTdevelopment, std::vector< double > > & operator[](const FMTaction &action)
size_t size() const
std::map< FMTaction, std::map< FMTdevelopment, std::vector< double > > >::iterator iterator
Definition: FMTschedule.hpp:229
double area() const
FMTschedule getnewschedule(const double &factor) const
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTaction.hpp:31