FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
Core::FMTSchedule Class Reference

Spatially referenced schedule describing the area of developments for which an action can be operated, usable by FMTLpModel and FMTSesModel. More...

#include <FMTSchedule.h>

Inheritance diagram for Core::FMTSchedule:
[legend]
Collaboration diagram for Core::FMTSchedule:
[legend]

Public Types

typedef std::map< FMTAction, std::map< FMTDevelopment, std::vector< double > > >::value_type value_type
 
typedef std::map< FMTAction, std::map< FMTDevelopment, std::vector< double > > >::iterator iterator
 
typedef std::map< FMTAction, std::map< FMTDevelopment, std::vector< double > > >::const_iterator const_iterator
 

Public Member Functions

 FMTSchedule (const int &lperiod, const FMTObject &obj, const bool &luselock)
 Construct an empty schedule at a given period.
 
 FMTSchedule (const int &lperiod, std::vector< FMTSchedule > &schedules)
 Construct a schedule from multiple schedules at a given period.
 
 FMTSchedule (int lperiod, std::map< FMTAction, std::map< FMTDevelopment, std::vector< double > > > mapping)
 Construct a complete schedule from a period and a mapping.
 
 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.
 
 FMTSchedule ()
 Default constructor for FMTSchedule.
 
 ~FMTSchedule ()=default
 Default destructor for FMTSchedule.
 
 FMTSchedule (const FMTSchedule &rhs)
 Copy constructor for FMTSchedule.
 
FMTScheduleoperator= (const FMTSchedule &rhs)
 Copy assignment operator for FMTSchedule.
 
bool operator== (const FMTSchedule &rhs) const
 Equality comparison operator of FMTSchedule.
 
bool operator!= (const FMTSchedule &rhs) const
 Inequality comparison operator of FMTSchedule.
 
FMTScheduleoperator+= (const FMTSchedule &rhs)
 Append another schedule to this schedule.
 
FMTSchedule operator+ (const FMTSchedule &rhs) const
 Append another schedule to this schedule and return a new one.
 
 operator std::string () const
 Convert the schedule to a string as in a regular schedule file.
 
int getPeriod () const
 Return the period of the schedule.
 
bool doUseLock () const
 Return true if the schedule can contain locked developments.
 
void setUseLock (const bool &lock)
 Mark the schedule as able to contain locked developments.
 
double actionArea (const FMTAction &action) const
 Return the total harvested area of an action in the 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.
 
void clean ()
 Clean the schedule of empty areas after multiple addEvent calls, to be called before using it.
 
double area () const
 Return the total area of the schedule operated by all actions.
 
bool operated (const FMTAction &action, const FMTDevelopment &development) const
 Check if a development has been operated by an action in the schedule.
 
std::vector< boost::unordered_set< FMTDevelopment > > getOperabilities (const std::vector< FMTAction > &actions) const
 Return all operabilities of the schedule in a hash table.
 
void sort ()
 Sort the vector of lock level per area of the schedule.
 
bool empty () const
 Return true if the schedule is empty.
 
size_t size () const
 Return the size of 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.
 
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.
 
void setPeriod (const int &newPeriod)
 Set the period of the schedule and of its developments.
 
FMTSchedule getNewSchedule (const double &factor) const
 Multiply this schedule by a factor and return it.
 
bool isFuturConstraints (const std::vector< Core::FMTConstraint > &constraints) const
 Check if the schedule period will be bounded by new constraints.
 
std::map< FMTDevelopment, std::vector< double > > & operator[] (const FMTAction &action)
 Return a reference to the developments and areas for a given action.
 
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.
 
iterator find (const FMTAction &actionkey)
 Return an iterator to the given action.
 
const_iterator find (const FMTAction &actionkey) const
 Return a const iterator to the given action.
 
iterator begin ()
 Return an iterator to the beginning of the schedule.
 
const_iterator begin () const
 Return a const iterator to the beginning of the schedule.
 
iterator end ()
 Return an iterator to the end of the schedule.
 
const_iterator end () const
 Return a const iterator to the end of the schedule.
 
- Public Member Functions inherited from Core::FMTObject
 FMTObject ()
 Default constructor for FMTObject.
 
virtual ~FMTObject ()
 Default virtual destructor for FMTObject.
 
 FMTObject (const std::unique_ptr< Exception::FMTExceptionHandler > exhandler)
 Construct a FMTObject passing in the exception handler of another FMTObject.
 
 FMTObject (const FMTObject &rhs)
 Copy constructor for FMTObject.
 
FMTObjectoperator= (const FMTObject &rhs)
 Copy assignment operator for FMTObject.
 
virtual void passInLogger (const std::unique_ptr< Logging::FMTLogger > &logger)
 Pass in the logger of another FMTObject.
 
void passInExceptionHandler (const std::unique_ptr< Exception::FMTExceptionHandler > &exhandler)
 Pass in the exception handler of another FMTObject.
 
void redirectLogToFile (const std::string &location)
 Redirect the log to a specific file, appending to it.
 
virtual void setDefaultLogger ()
 Create and set a default logger to the FMTObject.
 
virtual void setQuietLogger ()
 Create and set a quiet logger to the FMTObject.
 
virtual void setTaskLogger ()
 Create and set a task logger to the FMTObject.
 
virtual void setDebugLogger ()
 Create and set a debug logger to the FMTObject.
 
void setDefaultExceptionHandler ()
 Create and set a default exception handler to the FMTObject.
 
void setQuietExceptionHandler ()
 Create and set a quiet exception handler to the FMTObject.
 
void setDebugExceptionHandler ()
 Create and set a debug exception handler to the FMTObject.
 
void setFreeExceptionHandler ()
 Create and set a free exception handler to the FMTObject.
 
void disableNestedExceptions ()
 Disable the nested exception throw of the exception handler.
 
void enableNestedExceptions ()
 Enable the nested exception throw of the exception handler.
 
void setErrorsToWarnings (const std::vector< Exception::FMTexc > &errors)
 Set a list of errors to be cast to warnings on the exception handler.
 
void setMaxWarningsBeforeSilenced (const size_t &maxwarningcount)
 Set the number of warnings raised before being silenced.
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Friends

class boost::serialization::access
 Serialize the FMTSchedule through its base FMTObject for multiprocessing across multiple cpus (pickle in Python).
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::FMTObject
static Logging::FMTLoggergetLogger ()
 get a pointer to the actual logger.
 
static Exception::FMTExceptionHandlergetExceptionHandler ()
 get a pointer to the actual exception handler.
 
static std::string getRuntimeLocation ()
 Return the location of the FMT shared library.
 
static unsigned long long getAvailableMemory ()
 Return the available memory in bytes.
 
static void setTerminateStack ()
 will write the stack in the log when terminate called and raise a function failed.
 
static void setAbortStack ()
 will write the stack in the log when abort called with SIGABRT and raise a function failed.
 
- Protected Member Functions inherited from Core::FMTObject
template<class Archive >
void forceSave (Archive &ar, const unsigned int version) const
 Force the serialization to save useful information, which the default FMTObject serialization does not.
 
template<class Archive >
void forceLoad (Archive &ar, const unsigned int version)
 Force the serialization to load useful information, which the default FMTObject serialization does not.
 
void checkSignals () const
 Check if the user has sent a ctrl-c signal using boost::python to FMT.
 
void setCplHandler ()
 Pass the FMT exception handler to the GDAL exception handler (GDAL only).
 
- Static Protected Member Functions inherited from Core::FMTObject
static std::chrono::time_point< std::chrono::high_resolution_clock > getClock ()
 Return a clock of the current time.
 
template<class chrono >
static double getDuration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 Return the time elapsed since a start clock as a double.
 
static std::string getDurationInSeconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 Return the time elapsed since a start clock in seconds as a string.
 
static void _logStack ()
 Log the stack trace...
 
static void _terminate ()
 Raise an error with the boost stacktrace.
 
static void _abort (int p_signal)
 Raise an error with the boost stacktrace on abort.
 
- Static Protected Attributes inherited from Core::FMTObject
static std::unique_ptr< Exception::FMTExceptionHandler_exhandler
 A shared pointer to the exception handler.
 
static std::unique_ptr< Logging::FMTLogger_logger
 A shared pointer to the logger.
 

Detailed Description

Spatially referenced schedule describing the area of developments for which an action can be operated, usable by FMTLpModel and FMTSesModel.

The vector represents the lock level: position 0 is lock level 0, position 1 is lock level 1, and so on.

Member Typedef Documentation

◆ const_iterator

typedef std::map<FMTAction,std::map<FMTDevelopment,std::vector<double>>>::const_iterator Core::FMTSchedule::const_iterator

◆ iterator

typedef std::map<FMTAction,std::map<FMTDevelopment,std::vector<double>>>::iterator Core::FMTSchedule::iterator

◆ value_type

typedef std::map<FMTAction,std::map<FMTDevelopment,std::vector<double>>>::value_type Core::FMTSchedule::value_type

Functions that make sure the FMTSchedule acts like a std c++ container

Constructor & Destructor Documentation

◆ FMTSchedule() [1/6]

Core::FMTSchedule::FMTSchedule ( const int &  lperiod,
const FMTObject obj,
const bool &  luselock 
)

Construct an empty schedule at a given period.

Parameters
[in]lperiodthe period.
[in]objthe object to copy the handlers from.
[in]luselockif true the schedule can contain locked developments.

◆ FMTSchedule() [2/6]

Core::FMTSchedule::FMTSchedule ( const int &  lperiod,
std::vector< FMTSchedule > &  schedules 
)

Construct a schedule from multiple schedules at a given period.

Parameters
[in]lperiodthe period.
[in]schedulesthe schedules to combine.

◆ FMTSchedule() [3/6]

Core::FMTSchedule::FMTSchedule ( int  lperiod,
std::map< FMTAction, std::map< FMTDevelopment, std::vector< double > > >  mapping 
)

Construct a complete schedule from a period and a mapping.

Parameters
[in]lperiodthe period.
[in]mappingthe mapping of actions to developments and areas.

◆ FMTSchedule() [4/6]

Core::FMTSchedule::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.

Parameters
[in]lperiodthe period.
[in]mappingthe lock based mapping.

◆ FMTSchedule() [5/6]

Core::FMTSchedule::FMTSchedule ( )

Default constructor for FMTSchedule.

◆ ~FMTSchedule()

Core::FMTSchedule::~FMTSchedule ( )
default

Default destructor for FMTSchedule.

◆ FMTSchedule() [6/6]

Core::FMTSchedule::FMTSchedule ( const FMTSchedule rhs)

Copy constructor for FMTSchedule.

Parameters
[in]rhsthe FMTSchedule to copy.

Member Function Documentation

◆ actionArea()

double Core::FMTSchedule::actionArea ( const FMTAction action) const

Return the total harvested area of an action in the schedule.

Parameters
[in]actionthe action.
Returns
the total harvested area of the action.

◆ addEvent()

void Core::FMTSchedule::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.

Parameters
[in]devthe development.
[in]areathe area.
[in]actionthe action.

◆ area()

double Core::FMTSchedule::area ( ) const

Return the total area of the schedule operated by all actions.

Returns
the total area of the schedule.

◆ at()

const std::map< FMTDevelopment, std::vector< double > > & Core::FMTSchedule::at ( const FMTAction action) const

Return a const reference to the developments and areas for a given action.

Parameters
[in]actionthe action.
Returns
a const reference to the map of developments to areas.

◆ begin() [1/2]

iterator Core::FMTSchedule::begin ( )

Return an iterator to the beginning of the schedule.

Returns
an iterator to the beginning.

◆ begin() [2/2]

const_iterator Core::FMTSchedule::begin ( ) const

Return a const iterator to the beginning of the schedule.

Returns
a const iterator to the beginning.

◆ clean()

void Core::FMTSchedule::clean ( )

Clean the schedule of empty areas after multiple addEvent calls, to be called before using it.

◆ doUseLock()

bool Core::FMTSchedule::doUseLock ( ) const
inline

Return true if the schedule can contain locked developments.

Returns
true if the schedule uses lock else false.

◆ empty()

bool Core::FMTSchedule::empty ( ) const

Return true if the schedule is empty.

Returns
true if the schedule is empty else false.

◆ end() [1/2]

iterator Core::FMTSchedule::end ( )

Return an iterator to the end of the schedule.

Returns
an iterator to the end.

◆ end() [2/2]

const_iterator Core::FMTSchedule::end ( ) const

Return a const iterator to the end of the schedule.

Returns
a const iterator to the end.

◆ find() [1/2]

iterator Core::FMTSchedule::find ( const FMTAction actionkey)

Return an iterator to the given action.

Parameters
[in]actionkeythe action.
Returns
an iterator to the action.

◆ find() [2/2]

const_iterator Core::FMTSchedule::find ( const FMTAction actionkey) const

Return a const iterator to the given action.

Parameters
[in]actionkeythe action.
Returns
a const iterator to the action.

◆ getNewSchedule()

FMTSchedule Core::FMTSchedule::getNewSchedule ( const double &  factor) const

Multiply this schedule by a factor and return it.

Parameters
[in]factorthe factor.
Returns
the multiplied schedule.

◆ getOperabilities()

std::vector< boost::unordered_set< FMTDevelopment > > Core::FMTSchedule::getOperabilities ( const std::vector< FMTAction > &  actions) const

Return all operabilities of the schedule in a hash table.

Parameters
[in]actionsthe actions.
Returns
the operabilities of the schedule.

◆ getPeriod()

int Core::FMTSchedule::getPeriod ( ) const
inline

Return the period of the schedule.

Returns
the period of the schedule.

◆ isFuturConstraints()

bool Core::FMTSchedule::isFuturConstraints ( const std::vector< Core::FMTConstraint > &  constraints) const

Check if the schedule period will be bounded by new constraints.

Parameters
[in]constraintsthe constraints.
Returns
true if the schedule has future constraints else false.

◆ operated()

bool Core::FMTSchedule::operated ( const FMTAction action,
const FMTDevelopment development 
) const

Check if a development has been operated by an action in the schedule.

Parameters
[in]actionthe action.
[in]developmentthe development.
Returns
true if the development has been operated else false.

◆ operator std::string()

Core::FMTSchedule::operator std::string ( ) const

Convert the schedule to a string as in a regular schedule file.

Returns
the string representation of the schedule.

◆ operator!=()

bool Core::FMTSchedule::operator!= ( const FMTSchedule rhs) const

Inequality comparison operator of FMTSchedule.

Parameters
[in]rhsthe schedule to compare with.
Returns
true if both schedules are different else false.

◆ operator+()

FMTSchedule Core::FMTSchedule::operator+ ( const FMTSchedule rhs) const

Append another schedule to this schedule and return a new one.

Parameters
[in]rhsthe schedule to append.
Returns
the resulting schedule.

◆ operator+=()

FMTSchedule & Core::FMTSchedule::operator+= ( const FMTSchedule rhs)

Append another schedule to this schedule.

Parameters
[in]rhsthe schedule to append.
Returns
a reference to this FMTSchedule.

◆ operator=()

FMTSchedule & Core::FMTSchedule::operator= ( const FMTSchedule rhs)

Copy assignment operator for FMTSchedule.

Parameters
[in]rhsthe FMTSchedule to copy.
Returns
a reference to this FMTSchedule.

◆ operator==()

bool Core::FMTSchedule::operator== ( const FMTSchedule rhs) const

Equality comparison operator of FMTSchedule.

Parameters
[in]rhsthe schedule to compare with.
Returns
true if both schedules are equal else false.

◆ operator[]()

std::map< FMTDevelopment, std::vector< double > > & Core::FMTSchedule::operator[] ( const FMTAction action)

Return a reference to the developments and areas for a given action.

Parameters
[in]actionthe action.
Returns
a reference to the map of developments to areas.

◆ postSolve()

FMTSchedule Core::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.

Parameters
[in]filterthe mask filter.
[in]originalbasethemesthe original themes.
[in]originalbasebaseactionsthe original actions.
Returns
the postsolved schedule.

◆ preSolve()

FMTSchedule Core::FMTSchedule::preSolve ( const FMTMaskFilter filter,
const std::vector< FMTTheme > &  newthemes,
const std::vector< FMTAction > &  presolvedaction 
) const

Presolve the schedule, potentially returning an empty schedule.

Parameters
[in]filterthe mask filter.
[in]newthemesthe presolved themes.
[in]presolvedactionthe presolved actions.
Returns
the presolved schedule.

◆ setPeriod()

void Core::FMTSchedule::setPeriod ( const int &  newPeriod)

Set the period of the schedule and of its developments.

Parameters
[in]newPeriodthe period to set.

◆ setUseLock()

void Core::FMTSchedule::setUseLock ( const bool &  lock)

Mark the schedule as able to contain locked developments.

Parameters
[in]lockif true the schedule can contain locked developments.

◆ size()

size_t Core::FMTSchedule::size ( ) const

Return the size of the schedule.

Returns
the size of the schedule.

◆ sort()

void Core::FMTSchedule::sort ( )

Sort the vector of lock level per area of the schedule.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialize the FMTSchedule through its base FMTObject for multiprocessing across multiple cpus (pickle in Python).

Template Parameters
Archivethe archive type.
Parameters
[in,out]arthe archive to serialize to or from.
[in]versionthe serialization version.

The documentation for this class was generated from the following file: