![]() |
FMT 1.2.0
Forest management tools for forest planning
|
Class letting the user formulate a constraint in the optimize section or collect data across the graph. More...
#include <FMTOutput.h>
Public Member Functions | |
| FMTOutput () | |
| Default constructor for FMTOutput. | |
| virtual | ~FMTOutput ()=default |
| Default virtual destructor for FMTOutput. | |
| FMTOutput (const std::string &lname, const std::string &ldescription, const std::string &lgroup, const std::vector< FMTOutputSource > &lsources, const std::vector< FMTOperator > &loperators) | |
| Complete constructor from a name, a description, a group, sources and operators. | |
| FMTOutput (const std::string &lname) | |
| Partial constructor from a name only. | |
| FMTOutput (const FMTOutput &rhs) | |
| Copy constructor for FMTOutput. | |
| FMTOutput & | operator= (const FMTOutput &rhs) |
| Copy assignment operator for FMTOutput. | |
| bool | operator== (const FMTOutput &rhs) const |
| Equality comparison operator of FMTOutput, checking if they have the same name. | |
| bool | operator!= (const FMTOutput &rhs) const |
| Inequality comparison operator of FMTOutput, checking if they have a different name. | |
| FMTOutput & | operator+= (const FMTOutput &rhs) |
| Addition assignment operator with another FMTOutput. | |
| FMTOutput & | operator-= (const FMTOutput &rhs) |
| Subtraction assignment operator with another FMTOutput. | |
| FMTOutput & | operator*= (const FMTOutputSource &p_source) |
| FMTOutput multiplication assignment with a simple double to multiply the FMTOutputSource. | |
| FMTOutput & | operator/= (const FMTOutputSource &p_source) |
| FMTOutput division assignment with a source. | |
| operator std::string () const | |
| Convert the output to a readable string as in an output section. | |
| std::string | getName () const |
| Return the name of the output. | |
| std::string | getDescription () const |
| Return the description of the output. | |
| std::string | getGroup () const |
| Return the group of the output. | |
| bool | empty () const |
| Return true if the output has no output source. | |
| size_t | size () const |
| Return the number of output sources of the output. | |
| bool | isLinear () const |
| Return true if the output is linear, with no variable to variable multiplication or division. | |
| bool | canBeNodesOnly () const |
| Return true if the output can be used as nodes only in LP. | |
| bool | isLevel () const |
| Return true if one output source of the output is a level. | |
| bool | isOnlyLevel () const |
| Return true if all output sources of the output are levels. | |
| bool | isConstantLevel () const |
| Return true if all output sources of the output are constant levels. | |
| bool | isConstant () const |
| Return true if all output sources of the output are constants. | |
| double | getConstantValue () const |
| Return the constant value if the output is a single constant. | |
| bool | containsLevel () const |
| Return true if the output contains any level. | |
| double | shuntingYard (const std::vector< double > &sourcevalues, const std::vector< FMTOperator > &simple_operators) const |
| Evaluate the output using the shunting yard algorithm with source values and operators. | |
| FMTOutput | boundTo (const std::vector< FMTTheme > &themes, const FMTPerBounds &bound, const std::string &specialbound, std::string attribute="") const |
| Bound the output to specific period bounds and return the new output, optionally targeting a theme. | |
| std::vector< FMTOutputNode > | getNodes (std::vector< std::string > &equation, double multiplier=1, bool orderbyoutputid=false, int period=1) const |
| Return the output nodes generated from the output sources and operators, optionally multiplied by a factor. | |
| bool | isSinglePeriod () const |
| Return true if the output covers a single period of the graph. | |
| bool | hasAverage () const |
| Return true if the output needs to be averaged. | |
| int | getTargetPeriod () const |
| Return the targeted period of the output if it is single period. | |
| size_t | hash () const |
| Return the hash of the output. | |
| void | setSources (const std::vector< FMTOutputSource > &p_sources) |
| Set new sources for the output. | |
| void | setOperators (const std::vector< FMTOperator > &p_operators) |
| Set new operators for the output. | |
| std::vector< FMTOutputSource > | getSources () const |
| Return a copy of the output sources of the output. | |
| const std::vector< FMTOutputSource > & | getSourcesReference () const |
| Return a const reference to the output sources of the output. | |
| std::vector< FMTOperator > | getOpes () const |
| Return a copy of the operators of the output. | |
| FMTTheme | targetTheme (const std::vector< FMTTheme > &themes) const |
| Return the theme targeted by the output. | |
| int | targetThemeId () const |
| Return the id of the theme targeted by the output. | |
| std::vector< std::string > | getThemeDecomposition (const FMTTheme &theme) const |
| Return all possible attribute values the output can have for the given theme. | |
| std::vector< std::string > | getDecomposition (const std::vector< FMTTheme > &themes) const |
| Return all possible attribute values the output can have if the attribute target is set, else an empty vector. | |
| FMTOutput | intersectWithMask (const Core::FMTMask &mask, const std::vector< Core::FMTTheme > &themes) const |
| Return the output resulting from the intersection of a mask with this output. | |
| FMTMask | getVariableIntersect () const |
| Return the intersected mask of all variables. | |
| FMTMask | getMasksUnion () const |
| get the union of all masks of the sources and factor | |
| std::vector< const Core::FMTTheme * > | getStaticThemes (const std::vector< Core::FMTTheme > &themes, const Core::FMTYields &yields, bool ignoreoutputvariables=false) const |
| Return the static themes of the whole output. | |
| FMTOutput | preSolve (const FMTMaskFilter &filter, const std::vector< FMTTheme > &originalthemes, const std::vector< const FMTTheme * > &selectedthemes, const std::vector< FMTTheme > &newthemes, const std::vector< FMTAction > &actions, const std::vector< bool > &p_valideActions, const FMTYields &yields) const |
| Presolve the output and remove unused output sources. | |
| void | changeSourcesId (const std::set< int > &newoutputsorigin, const std::set< int > &newthemeid) |
| Change the output origin and target theme id of each source with the distance from the beginning of the set, normally used after preSolve. | |
| void | changeSourcesId (const int &outid) |
| Change the output origin of each source, for the optimization parser. | |
| Core::FMTOutput | removeRHSvalue () const |
| Return a new output removing the extra constants from a mix of noded output and constant level. | |
| void | getRHSvalue (const int &period, double &lower, double &upper) const |
| Get the RHS values mixing a level with a variable node for a given period. | |
| void | setPeriod (const int &newPeriod) |
| Set the output sources to a single period. | |
| bool | isActionBased () const |
| Return true if the output contains action nodes. | |
| bool | isVariableSizeOf (const size_t &masksize) const |
| Return true if a variable source has a mask size equal to the given size, or if no source is variable. | |
| bool | isInventory () const |
| Return true if the output contains an inventory. | |
| void | fillFromShuntingYard (const std::vector< std::string >baseeq, std::map< std::string, double > &results, const std::vector< Core::FMTOutputNode > &nodes, std::map< std::string, std::vector< std::string > > &allequations) const |
| Get the values of a non linear output using the shunting yard algorithm. | |
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. | |
| FMTObject & | operator= (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) |
Protected Member Functions | |
| void | _setProportions (std::map< std::string, std::vector< std::string > > &allequations, const std::vector< std::string > &baseequation) const |
| Set the equation proportions for developments, turning numeric entries into proportions. | |
| bool | _isDivision () const |
| Return true if the output contains a division. | |
| void | _replaceDivision (const double &bound) |
| Replace the division with the bound and reverse the denominator. | |
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 | |
| static bool | _isValidAction (const std::string &p_actionOrAggregate, const std::vector< FMTAction > &p_actions, const std::vector< bool > &p_validActions) |
| Return true if an action or aggregate is in the actions. | |
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. | |
Protected Attributes | |
| std::vector< FMTOutputSource > | m_sources |
| outputsources data used to generate outputnodes | |
| std::vector< FMTOperator > | m_operators |
| vector of simple operators like +-*/ | |
| std::string | m_name |
| Sometime output can specify multiple attributes of a given themes. | |
| std::string | m_description |
| This is description of the FMTOutput has seen in the output section. | |
| std::string | m_group |
| This is the group of the output, if empty there's no group. | |
Friends | |
| class | boost::serialization::access |
| Serialize the FMTOutput 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::FMTLogger * | getLogger () |
| get a pointer to the actual logger. | |
| static Exception::FMTExceptionHandler * | getExceptionHandler () |
| 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. | |
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. | |
Class letting the user formulate a constraint in the optimize section or collect data across the graph.
Holds a vector of output sources and operators. Non linear outputs cannot be used in matrix constraint formulation. Outputs have multiple output nodes representing a set of developments in the graph.
| Core::FMTOutput::FMTOutput | ( | ) |
Default constructor for FMTOutput.
|
virtualdefault |
Default virtual destructor for FMTOutput.
| Core::FMTOutput::FMTOutput | ( | const std::string & | lname, |
| const std::string & | ldescription, | ||
| const std::string & | lgroup, | ||
| const std::vector< FMTOutputSource > & | lsources, | ||
| const std::vector< FMTOperator > & | loperators | ||
| ) |
Complete constructor from a name, a description, a group, sources and operators.
| [in] | lname | the name. |
| [in] | ldescription | the description. |
| [in] | lgroup | the group. |
| [in] | lsources | the output sources. |
| [in] | loperators | the operators. |
| Core::FMTOutput::FMTOutput | ( | const std::string & | lname | ) |
Partial constructor from a name only.
| [in] | lname | the name. |
| Core::FMTOutput::FMTOutput | ( | const FMTOutput & | rhs | ) |
|
protected |
Return true if the output contains a division.
|
staticprotected |
Return true if an action or aggregate is in the actions.
| [in] | p_actionOrAggregate | the name or aggregate of the action. |
| [in] | p_actions | the full actions vector. |
| [in] | p_validActions | the validity of the actions. |
|
protected |
Replace the division with the bound and reverse the denominator.
| [in] | bound | the bound. |
|
protected |
Set the equation proportions for developments, turning numeric entries into proportions.
| [in,out] | allequations | the equations. |
| [in] | baseequation | the base equation. |
| FMTOutput Core::FMTOutput::boundTo | ( | const std::vector< FMTTheme > & | themes, |
| const FMTPerBounds & | bound, | ||
| const std::string & | specialbound, | ||
| std::string | attribute = "" |
||
| ) | const |
Bound the output to specific period bounds and return the new output, optionally targeting a theme.
| [in] | themes | the themes. |
| [in] | bound | the period bounds. |
| [in] | specialbound | the special bound. |
| [in] | attribute | the targeted theme attribute. |
| bool Core::FMTOutput::canBeNodesOnly | ( | ) | const |
Return true if the output can be used as nodes only in LP.
| void Core::FMTOutput::changeSourcesId | ( | const int & | outid | ) |
Change the output origin of each source, for the optimization parser.
| [in] | outid | the output origin to set. |
| void Core::FMTOutput::changeSourcesId | ( | const std::set< int > & | newoutputsorigin, |
| const std::set< int > & | newthemeid | ||
| ) |
Change the output origin and target theme id of each source with the distance from the beginning of the set, normally used after preSolve.
| [in] | newoutputsorigin | the new output origins. |
| [in] | newthemeid | the new theme ids. |
| bool Core::FMTOutput::containsLevel | ( | ) | const |
Return true if the output contains any level.
| bool Core::FMTOutput::empty | ( | ) | const |
Return true if the output has no output source.
| void Core::FMTOutput::fillFromShuntingYard | ( | const std::vector< std::string > | baseeq, |
| std::map< std::string, double > & | results, | ||
| const std::vector< Core::FMTOutputNode > & | nodes, | ||
| std::map< std::string, std::vector< std::string > > & | allequations | ||
| ) | const |
Get the values of a non linear output using the shunting yard algorithm.
| [in] | baseeq | the base equation. |
| [in,out] | results | the results. |
| [in] | nodes | the output nodes. |
| [in,out] | allequations | the equations. |
| double Core::FMTOutput::getConstantValue | ( | ) | const |
Return the constant value if the output is a single constant.
| std::vector< std::string > Core::FMTOutput::getDecomposition | ( | const std::vector< FMTTheme > & | themes | ) | const |
Return all possible attribute values the output can have if the attribute target is set, else an empty vector.
| [in] | themes | the model themes. |
|
inline |
Return the description of the output.
|
inline |
Return the group of the output.
| FMTMask Core::FMTOutput::getMasksUnion | ( | ) | const |
get the union of all masks of the sources and factor
|
inline |
Return the name of the output.
| std::vector< FMTOutputNode > Core::FMTOutput::getNodes | ( | std::vector< std::string > & | equation, |
| double | multiplier = 1, |
||
| bool | orderbyoutputid = false, |
||
| int | period = 1 |
||
| ) | const |
Return the output nodes generated from the output sources and operators, optionally multiplied by a factor.
| [in,out] | equation | the equation. |
| [in] | multiplier | the multiplier factor. |
| [in] | orderbyoutputid | if true orders by output id. |
| [in] | period | the period. |
|
inline |
Return a copy of the operators of the output.
| void Core::FMTOutput::getRHSvalue | ( | const int & | period, |
| double & | lower, | ||
| double & | upper | ||
| ) | const |
Get the RHS values mixing a level with a variable node for a given period.
| [in] | period | the period. |
| [out] | lower | the lower value. |
| [out] | upper | the upper value. |
|
inline |
Return a copy of the output sources of the output.
|
inline |
Return a const reference to the output sources of the output.
| std::vector< const Core::FMTTheme * > Core::FMTOutput::getStaticThemes | ( | const std::vector< Core::FMTTheme > & | themes, |
| const Core::FMTYields & | yields, | ||
| bool | ignoreoutputvariables = false |
||
| ) | const |
Return the static themes of the whole output.
| [in] | themes | the themes. |
| [in] | yields | the yields. |
| [in] | ignoreoutputvariables | if true ignores the output variables. |
| int Core::FMTOutput::getTargetPeriod | ( | ) | const |
Return the targeted period of the output if it is single period.
| std::vector< std::string > Core::FMTOutput::getThemeDecomposition | ( | const FMTTheme & | theme | ) | const |
Return all possible attribute values the output can have for the given theme.
| [in] | theme | the theme. |
| FMTMask Core::FMTOutput::getVariableIntersect | ( | ) | const |
Return the intersected mask of all variables.
| bool Core::FMTOutput::hasAverage | ( | ) | const |
Return true if the output needs to be averaged.
| size_t Core::FMTOutput::hash | ( | ) | const |
Return the hash of the output.
| FMTOutput Core::FMTOutput::intersectWithMask | ( | const Core::FMTMask & | mask, |
| const std::vector< Core::FMTTheme > & | themes | ||
| ) | const |
Return the output resulting from the intersection of a mask with this output.
| [in] | mask | the mask. |
| [in] | themes | the themes. |
| bool Core::FMTOutput::isActionBased | ( | ) | const |
Return true if the output contains action nodes.
| bool Core::FMTOutput::isConstant | ( | ) | const |
Return true if all output sources of the output are constants.
| bool Core::FMTOutput::isConstantLevel | ( | ) | const |
Return true if all output sources of the output are constant levels.
| bool Core::FMTOutput::isInventory | ( | ) | const |
Return true if the output contains an inventory.
| bool Core::FMTOutput::isLevel | ( | ) | const |
Return true if one output source of the output is a level.
| bool Core::FMTOutput::isLinear | ( | ) | const |
Return true if the output is linear, with no variable to variable multiplication or division.
| bool Core::FMTOutput::isOnlyLevel | ( | ) | const |
Return true if all output sources of the output are levels.
| bool Core::FMTOutput::isSinglePeriod | ( | ) | const |
Return true if the output covers a single period of the graph.
| bool Core::FMTOutput::isVariableSizeOf | ( | const size_t & | masksize | ) | const |
Return true if a variable source has a mask size equal to the given size, or if no source is variable.
| [in] | masksize | the mask size. |
| Core::FMTOutput::operator std::string | ( | ) | const |
Convert the output to a readable string as in an output section.
| bool Core::FMTOutput::operator!= | ( | const FMTOutput & | rhs | ) | const |
Inequality comparison operator of FMTOutput, checking if they have a different name.
| [in] | rhs | the output to compare with. |
| FMTOutput & Core::FMTOutput::operator*= | ( | const FMTOutputSource & | p_source | ) |
FMTOutput multiplication assignment with a simple double to multiply the FMTOutputSource.
| [in] | p_source | an output source of type value or time yield. |
| FMTOutput & Core::FMTOutput::operator/= | ( | const FMTOutputSource & | p_source | ) |
| bool Core::FMTOutput::operator== | ( | const FMTOutput & | rhs | ) | const |
Equality comparison operator of FMTOutput, checking if they have the same name.
| [in] | rhs | the output to compare with. |
| FMTOutput Core::FMTOutput::preSolve | ( | const FMTMaskFilter & | filter, |
| const std::vector< FMTTheme > & | originalthemes, | ||
| const std::vector< const FMTTheme * > & | selectedthemes, | ||
| const std::vector< FMTTheme > & | newthemes, | ||
| const std::vector< FMTAction > & | actions, | ||
| const std::vector< bool > & | p_valideActions, | ||
| const FMTYields & | yields | ||
| ) | const |
Presolve the output and remove unused output sources.
| [in] | filter | the mask filter. |
| [in] | originalthemes | the original themes. |
| [in] | selectedthemes | the selected themes. |
| [in] | newthemes | the presolved themes. |
| [in] | actions | the actions. |
| [in] | p_valideActions | the valid actions. |
| [in] | yields | the yields. |
| Core::FMTOutput Core::FMTOutput::removeRHSvalue | ( | ) | const |
Return a new output removing the extra constants from a mix of noded output and constant level.
| void Core::FMTOutput::setOperators | ( | const std::vector< FMTOperator > & | p_operators | ) |
Set new operators for the output.
| [in] | p_operators | the operators to set. |
| void Core::FMTOutput::setPeriod | ( | const int & | newPeriod | ) |
Set the output sources to a single period.
| [in] | newPeriod | the period to set. |
| void Core::FMTOutput::setSources | ( | const std::vector< FMTOutputSource > & | p_sources | ) |
Set new sources for the output.
| [in] | p_sources | the sources to set. |
| double Core::FMTOutput::shuntingYard | ( | const std::vector< double > & | sourcevalues, |
| const std::vector< FMTOperator > & | simple_operators | ||
| ) | const |
Evaluate the output using the shunting yard algorithm with source values and operators.
| [in] | sourcevalues | the values of each output source. |
| [in] | simple_operators | the operators. |
| size_t Core::FMTOutput::size | ( | ) | const |
Return the number of output sources of the output.
Return the theme targeted by the output.
| [in] | themes | the model themes. |
|
inline |
Return the id of the theme targeted by the output.
|
friend |
|
protected |
This is description of the FMTOutput has seen in the output section.
|
protected |
This is the group of the output, if empty there's no group.
|
protected |
Sometime output can specify multiple attributes of a given themes.
This is the name of the output
|
protected |
vector of simple operators like +-*/
|
protected |
outputsources data used to generate outputnodes