FMT 0.9.8
Forest management tools for forest planning
|
#include <FMToutput.hpp>
Public Member Functions | |
FMToutput () | |
virtual | ~FMToutput ()=default |
FMToutput (const std::string &lname, const std::string &ldescription, const std::string &lgroup, const std::vector< FMToutputsource > &lsources, const std::vector< FMToperator > &loperators) | |
FMToutput (const std::string &lname) | |
FMToutput (const FMToutput &rhs) | |
FMToutput & | operator= (const FMToutput &rhs) |
bool | operator== (const FMToutput &rhs) const |
bool | operator!= (const FMToutput &rhs) const |
FMToutput & | operator+= (const FMToutput &rhs) |
FMToutput & | operator-= (const FMToutput &rhs) |
FMToutput & | operator*= (const double &rhs) |
FMToutput & | operator/= (const double &rhs) |
operator std::string () const | |
std::string | getname () const |
std::string | getdescription () const |
std::string | getgroup () const |
bool | empty () const |
size_t | size () const |
bool | islinear () const |
bool | canbenodesonly () const |
bool | islevel () const |
bool | isonlylevel () const |
bool | isconstantlevel () const |
bool | isconstant () const |
double | getconstantvalue () const |
bool | containslevel () const |
double | shuntingyard (const std::vector< double > &sourcevalues, const std::vector< FMToperator > &simple_operators) const |
FMToutput | boundto (const std::vector< FMTtheme > &themes, const FMTperbounds &bound, const std::string &specialbound, std::string attribute="") const |
std::vector< FMToutputnode > | getnodes (std::vector< std::string > &equation, double multiplier=1, bool orderbyoutputid=false, int period=1) const |
bool | issingleperiod () const |
bool | hasaverage () const |
int | gettargetperiod () const |
size_t | hash () const |
void | setsources (const std::vector< FMToutputsource > &p_sources) |
set new sources for this output | |
std::vector< FMToutputsource > | getsources () const |
const std::vector< FMToutputsource > & | getsourcesreference () const |
std::vector< FMToperator > | getopes () const |
FMTtheme | targettheme (const std::vector< FMTtheme > &themes) const |
int | targetthemeid () const |
std::vector< std::string > | getthemedecomposition (const FMTtheme &theme) const |
std::vector< std::string > | getdecomposition (const std::vector< FMTtheme > &themes) const |
FMToutput | intersectwithmask (const Core::FMTmask &mask, const std::vector< Core::FMTtheme > &themes) const |
FMTmask | getvariableintersect () const |
std::vector< Core::FMTtheme > | getstaticthemes (const std::vector< Core::FMTtheme > &themes, const Core::FMTyields &yields, bool ignoreoutputvariables=false) const |
FMToutput | presolve (const FMTmaskfilter &filter, const std::vector< FMTtheme > &originalthemes, const std::vector< FMTtheme > &selectedthemes, const std::vector< FMTtheme > &newthemes, const std::vector< FMTaction > &actions, const FMTyields &yields) const |
void | changesourcesid (const std::set< int > &newoutputsorigin, const std::set< int > &newthemeid) |
void | changesourcesid (const int &outid) |
Core::FMToutput | removeRHSvalue () const |
void | getRHSvalue (const int &period, double &lower, double &upper) const |
void | setperiod (const int &newperiod) |
bool | isactionbased () const |
bool | isvariablesizeof (const size_t &masksize) const |
bool | isinventory () const |
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 |
Public Member Functions inherited from Core::FMTobject | |
FMTobject () | |
virtual | ~FMTobject () |
FMTobject (const std::shared_ptr< Exception::FMTexceptionhandler > exhandler) | |
FMTobject (const FMTobject &rhs) | |
FMTobject & | operator= (const FMTobject &rhs) |
virtual void | passinlogger (const std::shared_ptr< Logging::FMTlogger > &logger) |
void | passinexceptionhandler (const std::shared_ptr< Exception::FMTexceptionhandler > &exhandler) |
void | redirectlogtofile (const std::string &location) |
virtual void | setdefaultlogger () |
virtual void | setquietlogger () |
virtual void | settasklogger () |
virtual void | setdebuglogger () |
void | setdefaultexceptionhandler () |
void | setquietexceptionhandler () |
void | setdebugexceptionhandler () |
void | setfreeexceptionhandler () |
void | disablenestedexceptions () |
void | enablenestedexceptions () |
void | seterrorstowarnings (const std::vector< Exception::FMTexc > &errors) |
void | setmaxwarningsbeforesilenced (const size_t &maxwarningcount) |
Protected Member Functions | |
void | setproportions (std::map< std::string, std::vector< std::string > > &allequations, const std::vector< std::string > &baseequation) const |
bool | isdivision () const |
void | replacedivision (const double &bound) |
Protected Member Functions inherited from Core::FMTobject | |
template<class Archive > | |
void | forcesave (Archive &ar, const unsigned int version) const |
template<class Archive > | |
void | forceload (Archive &ar, const unsigned int version) |
void | checksignals () const |
void | setCPLhandler () |
Protected Attributes | |
std::vector< FMToutputsource > | sources |
outputsources data used to generate outputnodes | |
std::vector< FMToperator > | operators |
vector of simple operators like +-*/ | |
std::string | name |
Sometime output can specify multiple attributes of a given themes. | |
std::string | description |
This is description of the FMToutput has seen in the output section. | |
std::string | group |
This is the group of the output, if empty there's no group. | |
Friends | |
class | boost::serialization::access |
Additional Inherited Members | |
Static Public Member Functions inherited from Core::FMTobject | |
static std::string | getruntimelocation () |
static unsigned long long | getavailablememory () |
Static Protected Member Functions inherited from Core::FMTobject | |
static std::chrono::time_point< std::chrono::high_resolution_clock > | getclock () |
template<class chrono > | |
static double | getduration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock) |
static std::string | getdurationinseconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock) |
Static Protected Attributes inherited from Core::FMTobject | |
static std::shared_ptr< Exception::FMTexceptionhandler > | _exhandler |
A shared pointer to the exception handler. | |
static std::shared_ptr< Logging::FMTlogger > | _logger |
A shared pointer to the logger. | |
FMToutput let the user formulate constraint in the optimize section or just collect data across the FMTgraph. FMToutput hold a vector of outputsources and operators. Outputs that are non linear cannot be used into matrix constraints formulation. Outputs have multiple outputs node representing a set of FMTdevelopment in the FMTgraph. Each FMTdevelopement can be part of one FMToutput.
Core::FMToutput::FMToutput | ( | ) |
Default constructor for FMToutput
|
virtualdefault |
Default 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 | ||
) |
Constructor for FMToutput for a complete construction for (name) (description), theme_target,sources and operators.
Core::FMToutput::FMToutput | ( | const std::string & | lname | ) |
Partial constructor for FMToutput with only name
FMToutput Core::FMToutput::boundto | ( | const std::vector< FMTtheme > & | themes, |
const FMTperbounds & | bound, | ||
const std::string & | specialbound, | ||
std::string | attribute = "" |
||
) | const |
Bound a output to specific periods bounds (for FMTconstraint) and return the new generated output. Can also modify a given targeted themes target (mask) of the new ouput.
bool Core::FMToutput::canbenodesonly | ( | ) | const |
If the output can be used as nodes only so in LP it will return true. It has to be linear and dont have -+ of level or timeyield or constant.
void Core::FMToutput::changesourcesid | ( | const int & | outid | ) |
Change outputorigin for the optimizationparser
void Core::FMToutput::changesourcesid | ( | const std::set< int > & | newoutputsorigin, |
const std::set< int > & | newthemeid | ||
) |
Change outputorigin and targetthemeid of each source with the distance from the begining of the set corresponding to the old outputorigin and themeid. Every output origin in the sources must be in the set. Normally used after presolve when some output are removed. Could also be overided with map.
bool Core::FMToutput::containslevel | ( | ) | const |
Check if the FMToutput contains any one level.
bool Core::FMToutput::empty | ( | ) | const |
Returns true if the FMToutput is empty and has no outputsource.
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 |
If the output is non linear you need to use this function to get values.
double Core::FMToutput::getconstantvalue | ( | ) | const |
Get the constant value if the FMToutput is just one constant.
std::vector< std::string > Core::FMToutput::getdecomposition | ( | const std::vector< FMTtheme > & | themes | ) | const |
Returns all possible attribute values the FMToutput can have if the attribute_target != -1 else returns a empty vector, based on the model (themes).
|
inline |
Getter for the FMToutput description.
|
inline |
Getter for the group of the output
|
inline |
Getter for the FMToutput name.
std::vector< FMToutputnode > Core::FMToutput::getnodes | ( | std::vector< std::string > & | equation, |
double | multiplier = 1 , |
||
bool | orderbyoutputid = false , |
||
int | period = 1 |
||
) | const |
This function returns a vector of FMToutputnode generated from the outputnodesource and FMToperators for the FMTouput, a multiplier can be added to multiply all the nodesource with a factor.
|
inline |
Getter for the FMToperator of the FMToutput.
void Core::FMToutput::getRHSvalue | ( | const int & | period, |
double & | lower, | ||
double & | upper | ||
) | const |
Get the RHSvalues is mix a level with a variable node for a given period.
|
inline |
Getter for the vector of FMToutputsource of the FMToutput.
|
inline |
Getter for the vector of FMToutputsource of the FMToutput.
std::vector< Core::FMTtheme > Core::FMToutput::getstaticthemes | ( | const std::vector< Core::FMTtheme > & | themes, |
const Core::FMTyields & | yields, | ||
bool | ignoreoutputvariables = false |
||
) | const |
Returns the static themes of the whole output.
int Core::FMToutput::gettargetperiod | ( | ) | const |
If single period is true then it will return the targeted period of the FMTouput.
std::vector< std::string > Core::FMToutput::getthemedecomposition | ( | const FMTtheme & | theme | ) | const |
Returns all possible attribute values the FMToutput can for the specified theme based on the model (themes).
FMTmask Core::FMToutput::getvariableintersect | ( | ) | const |
Returns the intersected FMTmask of all variables
bool Core::FMToutput::hasaverage | ( | ) | const |
Returns true if the output needs to be averaged.
size_t Core::FMToutput::hash | ( | ) | const |
Hashing fuction for FMToutput.
FMToutput Core::FMToutput::intersectwithmask | ( | const Core::FMTmask & | mask, |
const std::vector< Core::FMTtheme > & | themes | ||
) | const |
Returns the intersected FMToutput resulting from the mask intersection with this output.
bool Core::FMToutput::isactionbased | ( | ) | const |
Returns true if the output constaints action nodes
bool Core::FMToutput::isconstant | ( | ) | const |
Returns true if all outputsources of the FMToutput are constants.
bool Core::FMToutput::isconstantlevel | ( | ) | const |
Returns true if all outputsources of the FMToutput are constant level
|
protected |
Return true if output contains division
bool Core::FMToutput::isinventory | ( | ) | const |
Returns true if contains inventory
bool Core::FMToutput::islevel | ( | ) | const |
Returns true if one outputsources of the FMToutput is a level.
bool Core::FMToutput::islinear | ( | ) | const |
Check if the FMToutput is linear no variable to variable multiplication or division. Only Linear output can be added to a linear programming matrix.
bool Core::FMToutput::isonlylevel | ( | ) | const |
Returns true if all outputsources of the FMToutput are level.
bool Core::FMToutput::issingleperiod | ( | ) | const |
bool Core::FMToutput::isvariablesizeof | ( | const size_t & | masksize | ) | const |
If one source is variable and masksize == source.getmask will return true else return false. Will return true if no sources are variable.
Core::FMToutput::operator std::string | ( | ) | const |
Convert the FMToutput into a readable string like in a output section.
bool Core::FMToutput::operator!= | ( | const FMToutput & | rhs | ) | const |
FMToutput & Core::FMToutput::operator*= | ( | const double & | rhs | ) |
FMToutput multiplication assignment with a simple double to multiply the FMToutputsource factors with a double.
FMToutput & Core::FMToutput::operator/= | ( | const double & | rhs | ) |
FMToutput division assignment with a simple double to divise the FMToutputsource factors with a double.
bool Core::FMToutput::operator== | ( | const FMToutput & | rhs | ) | const |
FMToutput Core::FMToutput::presolve | ( | const FMTmaskfilter & | filter, |
const std::vector< FMTtheme > & | originalthemes, | ||
const std::vector< FMTtheme > & | selectedthemes, | ||
const std::vector< FMTtheme > & | newthemes, | ||
const std::vector< FMTaction > & | actions, | ||
const FMTyields & | yields | ||
) | const |
Presolve the FMToutput and remove unused outputsource base on a (basemask), original themes (originalthemes) presolved themes (newthemes) and presolved actions vector (actions) and a presolved yields section (yields).
Core::FMToutput Core::FMToutput::removeRHSvalue | ( | ) | const |
It has to be a mix between noded output and constant level. It will also produce a new output and remove the extra constants.
|
protected |
Replace the division with the bound and reverse the denominator
void Core::FMToutput::setperiod | ( | const int & | newperiod | ) |
Set the outputsource to one period.
|
protected |
Set equations proportions for developpements....when original entry is numeric turn it into proportion.
void Core::FMToutput::setsources | ( | const std::vector< FMToutputsource > & | p_sources | ) |
set new sources for this output
p_sources | is the newly sources to set. |
double Core::FMToutput::shuntingyard | ( | const std::vector< double > & | sourcevalues, |
const std::vector< FMToperator > & | simple_operators | ||
) | const |
Call shuntingyard using a vector of value for each outputsource and a vector of operators.
size_t Core::FMToutput::size | ( | ) | const |
Returns the number of outputsource that the output contains.
|
inline |
Getter for the targeted theme id.
|
friend |
serialize function is for serialization, used to do multiprocessing across multiple cpus (pickle in Pyhton)
|
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