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

#include <FMToutput.hpp>

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

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)
 
FMToutputoperator= (const FMToutput &rhs)
 
bool operator== (const FMToutput &rhs) const
 
bool operator!= (const FMToutput &rhs) const
 
FMToutputoperator+= (const FMToutput &rhs)
 
FMToutputoperator-= (const FMToutput &rhs)
 
FMToutputoperator*= (const double &rhs)
 
FMToutputoperator/= (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< FMToutputnodegetnodes (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< FMToutputsourcegetsources () const
 
const std::vector< FMToutputsource > & getsourcesreference () const
 
std::vector< FMToperatorgetopes () 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::FMTthemegetstaticthemes (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)
 
FMTobjectoperator= (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< FMToutputsourcesources
 outputsources data used to generate outputnodes
 
std::vector< FMToperatoroperators
 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FMToutput() [1/4]

Core::FMToutput::FMToutput ( )

Default constructor for FMToutput

◆ ~FMToutput()

virtual Core::FMToutput::~FMToutput ( )
virtualdefault

Default destructor for FMToutput

◆ FMToutput() [2/4]

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.

◆ FMToutput() [3/4]

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

Partial constructor for FMToutput with only name

◆ FMToutput() [4/4]

Core::FMToutput::FMToutput ( const FMToutput rhs)

FMToutput copy constructor

Member Function Documentation

◆ boundto()

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.

◆ canbenodesonly()

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.

◆ changesourcesid() [1/2]

void Core::FMToutput::changesourcesid ( const int &  outid)

Change outputorigin for the optimizationparser

◆ changesourcesid() [2/2]

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.

◆ containslevel()

bool Core::FMToutput::containslevel ( ) const

Check if the FMToutput contains any one level.

◆ empty()

bool Core::FMToutput::empty ( ) const

Returns true if the FMToutput is empty and has no outputsource.

◆ fillfromshuntingyard()

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.

◆ getconstantvalue()

double Core::FMToutput::getconstantvalue ( ) const

Get the constant value if the FMToutput is just one constant.

◆ getdecomposition()

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).

◆ getdescription()

std::string Core::FMToutput::getdescription ( ) const
inline

Getter for the FMToutput description.

◆ getgroup()

std::string Core::FMToutput::getgroup ( ) const
inline

Getter for the group of the output

◆ getname()

std::string Core::FMToutput::getname ( ) const
inline

Getter for the FMToutput name.

◆ getnodes()

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.

◆ getopes()

std::vector< FMToperator > Core::FMToutput::getopes ( ) const
inline

Getter for the FMToperator of the FMToutput.

◆ getRHSvalue()

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.

◆ getsources()

std::vector< FMToutputsource > Core::FMToutput::getsources ( ) const
inline

Getter for the vector of FMToutputsource of the FMToutput.

◆ getsourcesreference()

const std::vector< FMToutputsource > & Core::FMToutput::getsourcesreference ( ) const
inline

Getter for the vector of FMToutputsource of the FMToutput.

◆ getstaticthemes()

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.

◆ gettargetperiod()

int Core::FMToutput::gettargetperiod ( ) const

If single period is true then it will return the targeted period of the FMTouput.

◆ getthemedecomposition()

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).

◆ getvariableintersect()

FMTmask Core::FMToutput::getvariableintersect ( ) const

Returns the intersected FMTmask of all variables

◆ hasaverage()

bool Core::FMToutput::hasaverage ( ) const

Returns true if the output needs to be averaged.

◆ hash()

size_t Core::FMToutput::hash ( ) const

Hashing fuction for FMToutput.

◆ intersectwithmask()

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.

◆ isactionbased()

bool Core::FMToutput::isactionbased ( ) const

Returns true if the output constaints action nodes

◆ isconstant()

bool Core::FMToutput::isconstant ( ) const

Returns true if all outputsources of the FMToutput are constants.

◆ isconstantlevel()

bool Core::FMToutput::isconstantlevel ( ) const

Returns true if all outputsources of the FMToutput are constant level

◆ isdivision()

bool Core::FMToutput::isdivision ( ) const
protected

Return true if output contains division

◆ isinventory()

bool Core::FMToutput::isinventory ( ) const

Returns true if contains inventory

◆ islevel()

bool Core::FMToutput::islevel ( ) const

Returns true if one outputsources of the FMToutput is a level.

◆ islinear()

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.

◆ isonlylevel()

bool Core::FMToutput::isonlylevel ( ) const

Returns true if all outputsources of the FMToutput are level.

◆ issingleperiod()

bool Core::FMToutput::issingleperiod ( ) const

Returns true if the FMToutput cover only one single period of the FMTgraph, false if the FMToutput covers multiple periods.

◆ isvariablesizeof()

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.

◆ operator std::string()

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

Convert the FMToutput into a readable string like in a output section.

◆ operator!=()

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

FMToutput non equality operator check if FMToutput (rhs) have not the same name.

◆ operator*=()

FMToutput & Core::FMToutput::operator*= ( const double &  rhs)

FMToutput multiplication assignment with a simple double to multiply the FMToutputsource factors with a double.

◆ operator+=()

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

FMToutput addition assignment with an other FMToutput (rhs)

◆ operator-=()

FMToutput & Core::FMToutput::operator-= ( const FMToutput rhs)

FMToutput substraction assignment with an other FMToutput (rhs)

◆ operator/=()

FMToutput & Core::FMToutput::operator/= ( const double &  rhs)

FMToutput division assignment with a simple double to divise the FMToutputsource factors with a double.

◆ operator=()

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

Copy assignement of FMToutput

◆ operator==()

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

FMToutput equality operator check if FMToutput (rhs) have the same name.

◆ presolve()

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).

◆ removeRHSvalue()

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.

◆ replacedivision()

void Core::FMToutput::replacedivision ( const double &  bound)
protected

Replace the division with the bound and reverse the denominator

◆ setperiod()

void Core::FMToutput::setperiod ( const int &  newperiod)

Set the outputsource to one period.

◆ setproportions()

void Core::FMToutput::setproportions ( std::map< std::string, std::vector< std::string > > &  allequations,
const std::vector< std::string > &  baseequation 
) const
protected

Set equations proportions for developpements....when original entry is numeric turn it into proportion.

◆ setsources()

void Core::FMToutput::setsources ( const std::vector< FMToutputsource > &  p_sources)

set new sources for this output

Parameters
p_sourcesis the newly sources to set.

◆ shuntingyard()

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()

size_t Core::FMToutput::size ( ) const

Returns the number of outputsource that the output contains.

◆ targettheme()

FMTtheme Core::FMToutput::targettheme ( const std::vector< FMTtheme > &  themes) const

If theme_target is not equal to -1 then the FMToutput can target a given theme given all the model themes this function returns the FMToutput targeted theme.

◆ targetthemeid()

int Core::FMToutput::targetthemeid ( ) const
inline

Getter for the targeted theme id.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

serialize function is for serialization, used to do multiprocessing across multiple cpus (pickle in Pyhton)

Member Data Documentation

◆ description

std::string Core::FMToutput::description
protected

This is description of the FMToutput has seen in the output section.

◆ group

std::string Core::FMToutput::group
protected

This is the group of the output, if empty there's no group.

◆ name

std::string Core::FMToutput::name
protected

Sometime output can specify multiple attributes of a given themes.

This is the name of the output

◆ operators

std::vector<FMToperator> Core::FMToutput::operators
protected

vector of simple operators like +-*‍/

◆ sources

std::vector<FMToutputsource> Core::FMToutput::sources
protected

outputsources data used to generate outputnodes


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