8#ifndef FMTschedule_Hm_included
9#define FMTschedule_Hm_included
17#include <boost/serialization/export.hpp>
18#include <boost/unordered_set.hpp>
45 FMTSchedule(
const int& lperiod, std::vector<FMTSchedule>& schedules);
116 operator std::string()
const;
182 std::vector<boost::unordered_set<FMTDevelopment>>
getOperabilities(
const std::vector<FMTAction>& actions)
const;
209 const std::vector<FMTTheme>& newthemes,
const std::vector<FMTAction>&presolvedaction)
const;
219 const std::vector<FMTTheme>& originalbasethemes,
const std::vector<FMTAction>&originalbasebaseactions)
const;
243 typedef typename std::map<FMTAction, std::map<FMTDevelopment, std::vector<double>>>::value_type
value_type;
244 typedef typename std::map<FMTAction, std::map<FMTDevelopment, std::vector<double>>>::iterator
iterator;
245 typedef typename std::map<FMTAction, std::map<FMTDevelopment, std::vector<double>>>::const_iterator
const_iterator;
259 const std::map<FMTDevelopment, std::vector<double>>&
at(
const FMTAction& action)
const;
306 friend class boost::serialization::access;
307 template<
class Archive>
308 void serialize(Archive& ar,
const unsigned int version)
311 ar& boost::serialization::make_nvp(
"FMTobject", boost::serialization::base_object<FMTObject>(*
this));
312 ar& boost::serialization::make_nvp(
"period", m_period);
313 ar& boost::serialization::make_nvp(
"elements", m_elements);
317 _exhandler->printExceptions(
"",
"FMTSchedule::serialize", __LINE__, __FILE__);
329 std::map<FMTAction, std::map<FMTDevelopment, std::vector<double>>> m_elements;
336 bool _sameElements(
const FMTSchedule& rhs)
const;
#define FMTEXPORT
Definition: FMTutility.h:125
List of specifications dictating the operability of a subset of developments to this action.
Definition: FMTAction.h:43
Base class of FMTActualDevelopment and FMTFuturDevelopment representing a forest stand.
Definition: FMTDevelopment.h:44
Filter built from masks used to preSolve and postsolve FMTMask objects.
Definition: FMTMaskFilter.h:31
Base class of multiple FMT classes holding a shared exception handler pointer and logger.
Definition: FMTObject.h:49
Spatially referenced schedule describing the area of developments for which an action can be operated...
Definition: FMTSchedule.h:29
std::map< FMTAction, std::map< FMTDevelopment, std::vector< double > > >::iterator iterator
Definition: FMTSchedule.h:244
iterator find(const FMTAction &actionkey)
Return an iterator to the given action.
void sort()
Sort the vector of lock level per area of the schedule.
bool doUseLock() const
Return true if the schedule can contain locked developments.
Definition: FMTSchedule.h:131
bool operated(const FMTAction &action, const FMTDevelopment &development) const
Check if a development has been operated by an action in the schedule.
const_iterator find(const FMTAction &actionkey) const
Return a const iterator to the given action.
iterator end()
Return an iterator to the end of the schedule.
const std::map< FMTDevelopment, std::vector< double > > & at(const FMTAction &action) const
Return a const reference to the developments and areas for a given action.
std::map< FMTAction, std::map< FMTDevelopment, std::vector< double > > >::const_iterator const_iterator
Definition: FMTSchedule.h:245
size_t size() const
Return the size of the schedule.
iterator begin()
Return an iterator to the beginning of the schedule.
void setUseLock(const bool &lock)
Mark the schedule as able to contain locked developments.
FMTSchedule(const FMTSchedule &rhs)
Copy constructor for FMTSchedule.
~FMTSchedule()=default
Default destructor for FMTSchedule.
FMTSchedule()
Default constructor for FMTSchedule.
bool isFuturConstraints(const std::vector< Core::FMTConstraint > &constraints) const
Check if the schedule period will be bounded by new constraints.
std::vector< boost::unordered_set< FMTDevelopment > > getOperabilities(const std::vector< FMTAction > &actions) const
Return all operabilities of the schedule in a hash table.
FMTSchedule(const int &lperiod, std::vector< FMTSchedule > &schedules)
Construct a schedule from multiple schedules at a given period.
const_iterator begin() const
Return a const iterator to the beginning of the schedule.
double actionArea(const FMTAction &action) const
Return the total harvested area of an action in the schedule.
FMTSchedule preSolve(const FMTMaskFilter &filter, const std::vector< FMTTheme > &newthemes, const std::vector< FMTAction > &presolvedaction) const
Presolve the schedule, potentially returning an empty schedule.
void addEvent(const Core::FMTDevelopment &dev, const double &area, const Core::FMTAction &action)
Add a new event to the schedule from a development, an area and an action.
const_iterator end() const
Return a const iterator to the end of the schedule.
std::map< FMTAction, std::map< FMTDevelopment, std::vector< double > > >::value_type value_type
Definition: FMTSchedule.h:243
FMTSchedule(const int &lperiod, const FMTObject &obj, const bool &luselock)
Construct an empty schedule at a given period.
std::map< FMTDevelopment, std::vector< double > > & operator[](const FMTAction &action)
Return a reference to the developments and areas for a given action.
void setPeriod(const int &newPeriod)
Set the period of the schedule and of its developments.
double area() const
Return the total area of the schedule operated by all actions.
bool empty() const
Return true if the schedule is empty.
void clean()
Clean the schedule of empty areas after multiple addEvent calls, to be called before using it.
FMTSchedule postSolve(const FMTMaskFilter &filter, const std::vector< FMTTheme > &originalbasethemes, const std::vector< FMTAction > &originalbasebaseactions) const
Postsolve the schedule using the original themes and actions.
FMTSchedule getNewSchedule(const double &factor) const
Multiply this schedule by a factor and return it.
FMTSchedule(int lperiod, const std::map< FMTAction, std::map< FMTDevelopment, std::map< int, double > > > &mapping)
Construct a schedule from a period and a lock based mapping, when a schedule is parsed.
int getPeriod() const
Return the period of the schedule.
Definition: FMTSchedule.h:122
FMTSchedule(int lperiod, std::map< FMTAction, std::map< FMTDevelopment, std::vector< double > > > mapping)
Construct a complete schedule from a period and a mapping.
The Core namespace provides classes for simulating stands/strata growth/harvest through time.
Definition: FMTAction.h:34