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

List of specifications dictating the operability of a subset of developments to this action. More...

#include <FMTAction.h>

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

Public Member Functions

FMTActionoperator+= (const FMTAction &OtherAction)
 Append another action to this action; actions need to have the same age reset otherwise an exception is thrown.
 
 FMTAction ()
 Default constructor for FMTAction.
 
virtual ~FMTAction ()=default
 Default virtual destructor for FMTAction.
 
 FMTAction (const std::string &lname)
 Construct an empty action with a given name.
 
 FMTAction (const std::string &lname, const bool &p_lock, const bool &p_reset)
 Construct an empty action with a given name, respect lock and reset age flags.
 
void pushAggregate (const std::string &aggregate)
 Push an aggregate to the aggregates of the action.
 
void pushPartials (const std::string &yield)
 Push a partial yield name to the partials of the action.
 
 FMTAction (const FMTAction &rhs)
 Copy constructor for FMTAction.
 
FMTActionoperator= (const FMTAction &rhs)
 Copy assignment operator for FMTAction.
 
void update () override
 Update the action by setting the bounds and shrinking the list, for optimization.
 
FMTAction preSolve (const FMTMaskFilter &filter, const std::vector< FMTTheme > &originalthemes, std::vector< FMTTheme > &newthemes, bool compressdata=false) const
 Presolve the action by eliminating specifications and presolving the masks; the returned action can be empty.
 
void preSolveRef (const FMTMaskFilter &p_filter, const std::vector< FMTTheme > &p_originalthemes, std::vector< FMTTheme > &p_newthemes, bool p_compressdata=false)
 Presolve the action in place by eliminating specifications and presolving the masks; the action can become empty.
 
const int & getAgeLowerBound () const
 Get the age lower bound for all specifications.
 
const int & getAgeUpperBound () const
 Get the age upper bound for all specifications.
 
const int & getPeriodLowerBound () const
 Get the period lower bound for all specifications.
 
const int & getPeriodUpperBound () const
 Get the period upper bound for all specifications.
 
size_t hash () const
 Return the hash of the action based on its name.
 
std::string getName () const
 Get the name of the action.
 
bool doRespectLock () const
 Return true if the action needs to respect the lock state of the development.
 
bool isResetAge () const
 Return true if the development age is reset to 0 when operated by this action.
 
bool isPartOfASerie () const
 Return true if the action is part of a serie.
 
bool isAllowedInSerie (const std::vector< std::string > &serie) const
 Return true if the serie mask is part of one serie of the action.
 
const FMTSeriegetSerie (const std::vector< std::string > &p_SerieMask) const
 get the serie with the partial mask p_SerieMask
 
const std::vector< FMTSerie > & getSeries () const
 get all series of the actions
 
std::vector< std::string > getSeriesNames () const
 Return the series names of the action.
 
size_t getLargestSerieSize () const
 Return the size of the largest serie of the action.
 
void setSeries (std::vector< Core::FMTSerie > p_series)
 Set the series of the action, checking which ones the action is part of and building them.
 
bool useYield (const std::string &yldname) const
 Return true if the yield is used by the action to set operability.
 
std::vector< std::string > getAggregates () const
 Return the names of the aggregates the action is part of.
 
void setAggregates (const std::vector< std::string > &p_aggregates)
 Set a new vector of aggregates.
 
std::vector< std::string > getPartials () const
 Return the partial yield names of the action.
 
bool operator< (const FMTAction &rhs) const
 Less than comparison operator of FMTAction, testing the action length then the name.
 
bool operator== (const FMTAction &rhs) const
 Equality comparison operator of FMTAction, checking if the actions have the same name.
 
bool operator!= (const FMTAction &rhs) const
 Inequality comparison operator of FMTAction, checking if the actions have a different name.
 
 operator std::string () const
 Convert the action to a string as in a .act file.
 
bool partial (const std::string &yield) const
 Check if the yield needs to be considered as partial for this action.
 
int getGCBMActionId () const
 Return the corresponding GCBM action id.
 
std::string getGCBMActionName () const
 Return the corresponding GCBM action name.
 
std::vector< Core::FMTActionsplit (const std::vector< Core::FMTMask > &p_mask, const std::vector< Core::FMTTheme > &p_themes) const
 Split the action into different actions using the masks.
 
bool notUse () const
 Check if all specs are period lower == 0 and upper == 0.
 
bool isPartOf (const std::string &p_name) const
 Check if action is part of action name or aggregate.
 
bool isInSeries () const
 return true if you find this action first in a serie
 

Protected Member Functions

void _setBounds ()
 Set the age and period bounds member data by iterating on the specifications, for optimization.
 
std::vector< std::string > _getGCBMActionDef () const
 Return the corresponding GCBM action definition.
 

Protected Attributes

std::vector< std::string > m_aggregates
 An action can be part of a aggregate so this data member gets the name of all aggregate the action is being part of.
 
std::vector< std::string > m_partials
 Keeps the yields name for determining the amount of wood harvested in case of partial cut.
 
int m_agelowerbound
 
int m_ageupperbound
 
int m_periodlowerbound
 
int m_periodupperbound
 
std::string m_name
 The name of the action.
 
bool m_lock
 If lock is true the action is not _lockexempt when false the action is _LOCKEXEMPT.
 
bool m_reset
 If reset is true then the action is age reset Y else the action doen't reset age.
 
std::vector< FMTSeriem_series
 The action series that the action is part of.
 
bool m_InSerie
 True if the actions is in a serie.
 

Friends

class FMTActionComparator
 
class boost::serialization::access
 Serialize the FMTAction through its base FMTList<FMTSpec> for multiprocessing across multiple cpus (pickle in Python).
 

Detailed Description

List of specifications dictating the operability of a subset of developments to this action.

The operability testing for a given action is done in the FMTDevelopment class.

Constructor & Destructor Documentation

◆ FMTAction() [1/4]

Core::FMTAction::FMTAction ( )

Default constructor for FMTAction.

◆ ~FMTAction()

virtual Core::FMTAction::~FMTAction ( )
virtualdefault

Default virtual destructor for FMTAction.

◆ FMTAction() [2/4]

Core::FMTAction::FMTAction ( const std::string &  lname)

Construct an empty action with a given name.

Parameters
[in]lnamethe name of the action.

◆ FMTAction() [3/4]

Core::FMTAction::FMTAction ( const std::string &  lname,
const bool &  p_lock,
const bool &  p_reset 
)

Construct an empty action with a given name, respect lock and reset age flags.

Parameters
[in]lnamethe name of the action.
[in]p_lockif true the action respects the lock.
[in]p_resetif true the action resets the age.

◆ FMTAction() [4/4]

Core::FMTAction::FMTAction ( const FMTAction rhs)

Copy constructor for FMTAction.

Parameters
[in]rhsthe FMTAction to copy.

Member Function Documentation

◆ _getGCBMActionDef()

std::vector< std::string > Core::FMTAction::_getGCBMActionDef ( ) const
protected

Return the corresponding GCBM action definition.

Returns
the GCBM action definition.

◆ _setBounds()

void Core::FMTAction::_setBounds ( )
protected

Set the age and period bounds member data by iterating on the specifications, for optimization.

◆ doRespectLock()

bool Core::FMTAction::doRespectLock ( ) const
inline

Return true if the action needs to respect the lock state of the development.

Returns
true if the action respects the lock else false.

◆ getAgeLowerBound()

const int & Core::FMTAction::getAgeLowerBound ( ) const
inline

Get the age lower bound for all specifications.

Returns
the age lower bound.

◆ getAgeUpperBound()

const int & Core::FMTAction::getAgeUpperBound ( ) const
inline

Get the age upper bound for all specifications.

Returns
the age upper bound.

◆ getAggregates()

std::vector< std::string > Core::FMTAction::getAggregates ( ) const

Return the names of the aggregates the action is part of.

Returns
the aggregates of the action.

◆ getGCBMActionId()

int Core::FMTAction::getGCBMActionId ( ) const

Return the corresponding GCBM action id.

Returns
the GCBM action id.

◆ getGCBMActionName()

std::string Core::FMTAction::getGCBMActionName ( ) const

Return the corresponding GCBM action name.

Returns
the GCBM action name.

◆ getLargestSerieSize()

size_t Core::FMTAction::getLargestSerieSize ( ) const

Return the size of the largest serie of the action.

Returns
the size of the largest serie.

◆ getName()

std::string Core::FMTAction::getName ( ) const
inline

Get the name of the action.

Returns
the name of the action.

◆ getPartials()

std::vector< std::string > Core::FMTAction::getPartials ( ) const

Return the partial yield names of the action.

Returns
the partials of the action.

◆ getPeriodLowerBound()

const int & Core::FMTAction::getPeriodLowerBound ( ) const
inline

Get the period lower bound for all specifications.

Returns
the period lower bound.

◆ getPeriodUpperBound()

const int & Core::FMTAction::getPeriodUpperBound ( ) const
inline

Get the period upper bound for all specifications.

Returns
the period upper bound.

◆ getSerie()

const FMTSerie * Core::FMTAction::getSerie ( const std::vector< std::string > &  p_SerieMask) const

get the serie with the partial mask p_SerieMask

Parameters
[in]p_SerieMaskthe partial serie mask
Returns
pointer to valid serie

◆ getSeries()

const std::vector< FMTSerie > & Core::FMTAction::getSeries ( ) const

get all series of the actions

Returns
vector of series

◆ getSeriesNames()

std::vector< std::string > Core::FMTAction::getSeriesNames ( ) const

Return the series names of the action.

Returns
the series names.

◆ hash()

size_t Core::FMTAction::hash ( ) const
inline

Return the hash of the action based on its name.

Returns
the hash value.

◆ isAllowedInSerie()

bool Core::FMTAction::isAllowedInSerie ( const std::vector< std::string > &  serie) const

Return true if the serie mask is part of one serie of the action.

Parameters
[in]seriethe serie mask.
Returns
true if the serie is allowed else false.

◆ isInSeries()

bool Core::FMTAction::isInSeries ( ) const

return true if you find this action first in a serie

Returns
true if first else false

◆ isPartOf()

bool Core::FMTAction::isPartOf ( const std::string &  p_name) const

Check if action is part of action name or aggregate.

Parameters
[in]p_nameaction name or aggregate.
Returns
true if is part else false.

◆ isPartOfASerie()

bool Core::FMTAction::isPartOfASerie ( ) const
inline

Return true if the action is part of a serie.

Returns
true if the action is part of a serie else false.

◆ isResetAge()

bool Core::FMTAction::isResetAge ( ) const
inline

Return true if the development age is reset to 0 when operated by this action.

Returns
true if the action resets the age else false.

◆ notUse()

bool Core::FMTAction::notUse ( ) const

Check if all specs are period lower == 0 and upper == 0.

Returns
true if not use else false.

◆ operator std::string()

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

Convert the action to a string as in a .act file.

Returns
the string representation of the action.

◆ operator!=()

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

Inequality comparison operator of FMTAction, checking if the actions have a different name.

Parameters
[in]rhsthe action to compare with.
Returns
true if both actions have a different name else false.

◆ operator+=()

FMTAction & Core::FMTAction::operator+= ( const FMTAction OtherAction)

Append another action to this action; actions need to have the same age reset otherwise an exception is thrown.

Parameters
[in]OtherActionthe other action to append to this one.
Returns
a reference to this appended action.

◆ operator<()

bool Core::FMTAction::operator< ( const FMTAction rhs) const

Less than comparison operator of FMTAction, testing the action length then the name.

Parameters
[in]rhsthe action to compare with.
Returns
true if this action is less than rhs else false.

◆ operator=()

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

Copy assignment operator for FMTAction.

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

◆ operator==()

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

Equality comparison operator of FMTAction, checking if the actions have the same name.

Parameters
[in]rhsthe action to compare with.
Returns
true if both actions have the same name else false.

◆ partial()

bool Core::FMTAction::partial ( const std::string &  yield) const

Check if the yield needs to be considered as partial for this action.

Parameters
[in]yieldthe yield name.
Returns
true if the yield is partial else false.

◆ preSolve()

FMTAction Core::FMTAction::preSolve ( const FMTMaskFilter filter,
const std::vector< FMTTheme > &  originalthemes,
std::vector< FMTTheme > &  newthemes,
bool  compressdata = false 
) const

Presolve the action by eliminating specifications and presolving the masks; the returned action can be empty.

Parameters
[in]filterthe mask filter.
[in]originalthemesthe original themes.
[in,out]newthemesthe presolved themes.
[in]compressdataif true compresses the data.
Returns
the presolved action.

◆ preSolveRef()

void Core::FMTAction::preSolveRef ( const FMTMaskFilter p_filter,
const std::vector< FMTTheme > &  p_originalthemes,
std::vector< FMTTheme > &  p_newthemes,
bool  p_compressdata = false 
)

Presolve the action in place by eliminating specifications and presolving the masks; the action can become empty.

Parameters
[in]p_filterthe mask filter.
[in]p_originalthemesthe original themes.
[in,out]p_newthemesthe presolved themes.
[in]p_compressdataif true compresses the data.

◆ pushAggregate()

void Core::FMTAction::pushAggregate ( const std::string &  aggregate)

Push an aggregate to the aggregates of the action.

Parameters
[in]aggregatethe aggregate to push.

◆ pushPartials()

void Core::FMTAction::pushPartials ( const std::string &  yield)

Push a partial yield name to the partials of the action.

Parameters
[in]yieldthe partial yield name to push.

◆ setAggregates()

void Core::FMTAction::setAggregates ( const std::vector< std::string > &  p_aggregates)

Set a new vector of aggregates.

Parameters
[in]p_aggregatesthe vector of aggregates to set.

◆ setSeries()

void Core::FMTAction::setSeries ( std::vector< Core::FMTSerie p_series)

Set the series of the action, checking which ones the action is part of and building them.

Parameters
[in]p_seriesthe series to set.

◆ split()

std::vector< Core::FMTAction > Core::FMTAction::split ( const std::vector< Core::FMTMask > &  p_mask,
const std::vector< Core::FMTTheme > &  p_themes 
) const

Split the action into different actions using the masks.

Parameters
[in]p_maskthe masks used to split the action.
[in]p_themesthe themes to generate the masks.
Returns
the actions resulting from the split.

◆ update()

void Core::FMTAction::update ( )
override

Update the action by setting the bounds and shrinking the list, for optimization.

◆ useYield()

bool Core::FMTAction::useYield ( const std::string &  yldname) const

Return true if the yield is used by the action to set operability.

Parameters
[in]yldnamethe yield name.
Returns
true if the yield is used else false.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialize the FMTAction through its base FMTList<FMTSpec> 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.

◆ FMTActionComparator

friend class FMTActionComparator
friend

Member Data Documentation

◆ m_agelowerbound

int Core::FMTAction::m_agelowerbound
protected

Those data members are for optimization only, the class determine within which bounds the aciton can take place for a given development.

◆ m_ageupperbound

int Core::FMTAction::m_ageupperbound
protected

◆ m_aggregates

std::vector<std::string> Core::FMTAction::m_aggregates
protected

An action can be part of a aggregate so this data member gets the name of all aggregate the action is being part of.

◆ m_InSerie

bool Core::FMTAction::m_InSerie
protected

True if the actions is in a serie.

◆ m_lock

bool Core::FMTAction::m_lock
protected

If lock is true the action is not _lockexempt when false the action is _LOCKEXEMPT.

◆ m_name

std::string Core::FMTAction::m_name
protected

The name of the action.

◆ m_partials

std::vector<std::string> Core::FMTAction::m_partials
protected

Keeps the yields name for determining the amount of wood harvested in case of partial cut.

◆ m_periodlowerbound

int Core::FMTAction::m_periodlowerbound
protected

◆ m_periodupperbound

int Core::FMTAction::m_periodupperbound
protected

◆ m_reset

bool Core::FMTAction::m_reset
protected

If reset is true then the action is age reset Y else the action doen't reset age.

◆ m_series

std::vector<FMTSerie> Core::FMTAction::m_series
protected

The action series that the action is part of.


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