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

#include <FMTsemodel.hpp>

Inheritance diagram for Models::FMTsemodel:
[legend]
Collaboration diagram for Models::FMTsemodel:
[legend]

Public Member Functions

 FMTsemodel ()
 
virtual ~FMTsemodel ()=default
 
 FMTsemodel (const FMTsemodel &rhs)
 
 FMTsemodel (const FMTmodel &rhs, const Spatial::FMTforest &forest)
 
 FMTsemodel (const FMTmodel &rhs)
 
FMTsemodeloperator= (const FMTsemodel &rhs)
 
 FMTsemodel (FMTsemodel &&rhs)=default
 
FMTsemodeloperator= (FMTsemodel &&rhs)=default
 
Spatial::FMTforest getmapping () const
 
Spatial::FMTspatialschedule getspschedule () const
 
std::string getdisturbancestats () const
 
std::vector< Core::FMTschedulegetschedule (bool withlock=false) const
 
bool setinitialmapping (Spatial::FMTforest forest)
 
void LogConstraintsInfeasibilities () const
 
void LogConstraintsFactors () const
 
virtual std::unique_ptr< FMTmodelpresolve (std::vector< Core::FMTactualdevelopment > optionaldevelopments=std::vector< Core::FMTactualdevelopment >()) const
 
virtual void postsolve (const FMTmodel &originalbasemodel)
 
virtual std::map< std::string, double > getoutput (const Core::FMToutput &output, int period, Core::FMToutputlevel level=Core::FMToutputlevel::standard) const
 
virtual Spatial::FMTlayer< double > getspatialoutput (const Core::FMToutput &output, int period) const
 
virtual Core::FMTschedule getsolution (int period, bool withlock=false) const
 
virtual std::unique_ptr< FMTmodelclone () const
 
virtual std::vector< Core::FMTactualdevelopmentgetarea (int period=0, bool beforegrowanddeath=false) const
 
virtual std::unique_ptr< FMTmodelgetcopy (int period=0) const
 
virtual double getobjectivevalue () const
 
- Public Member Functions inherited from Models::FMTmodel
Models::FMTmodel aggregateAllActions (const std::vector< std::string > &p_Aggregates) const
 Aggregate actions together and create en enterly new model with new -actions,transitions,outputs,constraints,yields,lifespan.
 
std::vector< Core::FMTscheduleaggregateSchedules (const std::vector< Core::FMTschedule > &p_schedules) const
 Build new schedule based on p_schedules with the corresponding aggregated actions.
 
virtual void setparallellogger (Logging::FMTlogger &logger)
 
virtual void clearcache ()
 
 FMTmodel (const std::vector< Core::FMTactualdevelopment > &larea, const std::vector< Core::FMTtheme > &lthemes, const std::vector< Core::FMTaction > &lactions, const std::vector< Core::FMTtransition > &ltransitions, const Core::FMTyields &lyields, const Core::FMTlifespans &llifespan, const std::string &lname, const std::vector< Core::FMToutput > &loutputs, std::vector< Core::FMTconstraint > lconstraints=std::vector< Core::FMTconstraint >(), FMTmodelparameters lparameters=FMTmodelparameters())
 
 FMTmodel ()
 
virtual ~FMTmodel ()=default
 
 FMTmodel (FMTmodel &&rhs)=default
 
FMTmodeloperator= (FMTmodel &&rhs)=default
 
virtual std::vector< Core::FMTactualdevelopmentgetarea (int period=0, bool beforegrowanddeath=false) const
 
virtual std::unique_ptr< FMTmodelgetcopy (int period=0) const
 
FMTmodel basepresolve () const
 
Core::FMTmaskfilter getpresolvefilter (const std::vector< Core::FMTtheme > &originalthemes) const
 
Core::FMTmaskfilter getpostsolvefilter (const std::vector< Core::FMTtheme > &originalthemes, const Core::FMTmask &devmask) const
 
Core::FMTmask getselectedmask (const std::vector< Core::FMTtheme > &originalthemes) const
 
virtual std::unique_ptr< FMTmodelpresolve (std::vector< Core::FMTactualdevelopment > optionaldevelopments=std::vector< Core::FMTactualdevelopment >()) const
 
virtual void postsolve (const FMTmodel &originalbasemodel)
 
Core::FMTschedule presolveschedule (const Core::FMTschedule &originalbaseschedule, const FMTmodel &originalbasemodel) const
 
FMTmodelstats getmodelstats () const
 
void cleanactionsntransitions ()
 
std::string getname () const
 
std::vector< Core::FMTthemegetthemes () const
 
std::vector< Core::FMTactiongetactions () const
 
std::vector< Core::FMTtransitiongettransitions () const
 
Core::FMTyields getyields () const
 
Core::FMTlifespans getlifespan () const
 
std::vector< Core::FMToutputgetoutputs () const
 
std::vector< Core::FMTconstraintgetconstraints () const
 
void addoutput (const std::string &name, const std::string &maskstring, Core::FMTotar outputtarget, std::string action=std::string(), std::string yield=std::string(), std::string description=std::string(), int targettheme=-1)
 
template<typename T >
void addyieldhandlers (const std::vector< T > &yieldhandlers)
 
void addyieldhandlersfromptr (const std::vector< std::unique_ptr< Core::FMTyieldhandler > > &yieldhandlers)
 
bool operator== (const FMTmodel &rhs) const
 
bool operator< (const FMTmodel &rhs) const
 
void setarea (const std::vector< Core::FMTactualdevelopment > &ldevs)
 
void setthemes (const std::vector< Core::FMTtheme > &lthemes)
 
void setactions (const std::vector< Core::FMTaction > &lactions)
 
void settransitions (const std::vector< Core::FMTtransition > &ltransitions)
 
void setconstraints (const std::vector< Core::FMTconstraint > &lconstraint)
 
void setyields (const Core::FMTyields &lylds)
 
void setlifespan (const Core::FMTlifespans &llifespan)
 
void setname (const std::string &newname)
 
void setoutputs (const std::vector< Core::FMToutput > &newoutputs)
 
bool isvalid ()
 
std::vector< Core::FMTthemelocatestaticthemes (const Core::FMToutput &output, bool ignoreoutputvariables=false) const
 
std::vector< Core::FMTthemelocatestaticthemes (const Core::FMToutputnode &output, bool ignoreoutputvariables=false) const
 
std::vector< Core::FMTthemelocatedynamicthemes (const Core::FMToutput &outpu, bool ignoreoutputvariables=false) const
 
Core::FMTmask getdynamicmask (const Core::FMToutput &output, bool ignoreoutputvariables=false) const
 
Core::FMTmask getdynamicmask (const Core::FMToutputnode &node, bool ignoreoutputvariables=false) const
 
Core::FMTmask getstaticmask (const Core::FMToutputnode &node, bool ignoreoutputvariables=false) const
 
bool isstaticnode (const Core::FMToutputnode &node, double ratioofset=0.1) const
 
std::vector< Core::FMTthemelocatestatictransitionsthemes () const
 
std::vector< Core::FMTthemelocatenodestaticthemes (const Core::FMToutputnode &node, bool ignoreoutputvariables=false, std::vector< Core::FMTtheme > basethemes=std::vector< Core::FMTtheme >()) const
 
 FMTmodel (const FMTmodel &rhs)
 
FMTmodeloperator= (const FMTmodel &rhs)
 
bool empty () const
 
void push_back (const FMTmodel &rhs)
 
double getinitialarea () const
 
void setareaperiod (const int &period)
 
Core::FMTschedule getpotentialschedule (std::vector< Core::FMTactualdevelopment > toremove, std::vector< Core::FMTactualdevelopment > selection, bool withlock=true) const
 
virtual std::vector< Core::FMTconstraintgetreplanningconstraints (const std::string &modeltype, const std::vector< Core::FMTconstraint > &localconstraints, const int &period) const
 
virtual bool doplanning (const bool &solve, std::vector< Core::FMTschedule > schedules=std::vector< Core::FMTschedule >())
 
virtual std::map< std::string, double > getoutput (const Core::FMToutput &output, int period, Core::FMToutputlevel level=Core::FMToutputlevel::standard) const
 
virtual Core::FMTschedule getsolution (int period, bool withlock=false) const
 
virtual std::map< std::string, std::vector< std::vector< double > > > getoutputsfromperiods (const std::vector< Core::FMToutput > &theoutputs, const int &firstperiod, const int &lastperiod, Core::FMToutputlevel level=Core::FMToutputlevel::standard) const
 
virtual std::unique_ptr< FMTmodelclone () const
 
virtual bool setparameter (const FMTintmodelparameters &key, const int &value)
 
virtual bool setparameter (const FMTdblmodelparameters &key, const double &value)
 
virtual bool setparameter (const FMTboolmodelparameters &key, const bool &value)
 
int getparameter (const FMTintmodelparameters &key) const
 
double getparameter (const FMTdblmodelparameters &key) const
 
bool getparameter (const FMTboolmodelparameters &key) const
 
bool setcompresstime (const int &periodstart, const int &periodstop, const int &value)
 
std::vector< int > getcompresstime () const
 
std::vector< Core::FMTconstraintgoalconstraints (double penalty=999999) const
 
std::vector< Core::FMTconstraintgettacticalconstraints (double penalty=999999, double scheduleweight=999999, double objective=0, double objectivefactor=1.0) const
 
virtual void showparameters (const bool &showhelp=false) const
 
virtual bool build (std::vector< Core::FMTschedule > schedules=std::vector< Core::FMTschedule >())
 
virtual bool solve ()
 
virtual bool isoptimal () const
 
virtual double getobjectivevalue () 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 Attributes

Spatial::FMTspatialschedule solution
 Contains the builded spatialsolution latest or best one.
 
- Protected Attributes inherited from Models::FMTmodel
FMTmodelparameters parameters
 
std::vector< Core::FMTactualdevelopmentarea
 Actualdevelopments for period 0, seen in the area section or the shapefile/raster.
 
std::vector< Core::FMTthemethemes
 Model themes of the landscape section file.
 
std::vector< Core::FMTactionactions
 Model actions from the action file and also the _death action.
 
std::vector< Core::FMTtransitiontransitions
 Model transitions from the transition file and also the _death transition.
 
Core::FMTyields yields
 Yields data comming from the yield file.
 
Core::FMTlifespans lifespan
 lifespan data comming from the lifespan file
 
std::vector< Core::FMToutputoutputs
 Outputs comming from the ouput file.
 
std::vector< Core::FMTconstraintconstraints
 Outputs comming from the optimization file.
 
std::string name
 The name of the Model (name of the .pri file without extension)
 
std::vector< size_t > statictransitionthemes
 The location of the themes static from transitions.
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Static Public Member Functions inherited from Models::FMTmodel
static Core::FMTaction defaultdeathaction (const Core::FMTlifespans &llifespan, const std::vector< Core::FMTtheme > &lthemes)
 
static Core::FMTtransition defaultdeathtransition (const Core::FMTlifespans &llifespan, const std::vector< Core::FMTtheme > &lthemes)
 
- Static Public Member Functions inherited from Core::FMTobject
static std::string getruntimelocation ()
 
static unsigned long long getavailablememory ()
 
- Protected Member Functions inherited from Models::FMTmodel
void setdefaultobjects ()
 
Core::FMTmask getbasemask (std::vector< Core::FMTactualdevelopment > optionaldevelopments) const
 
std::vector< size_t > getstatictransitionthemes () const
 
std::vector< Core::FMTthemegetstaticpresolvethemes () const
 
void clearactionscache ()
 
void clearyieldcache ()
 
void cleartransitioncache ()
 
virtual void swap_ptr (const std::unique_ptr< FMTmodel > &rhs)
 
std::vector< Core::FMTschedulesetupschedulesforbuild (const std::vector< Core::FMTschedule > &schedules) const
 
bool useactionserie () const
 
size_t getseriesmaxsize () const
 
- 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 ()
 
- 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

This model is an abstract class for spatialy explicit model. It's the parent of FMTsesmodel and FMTsamodel. It contains a spatialschedule (the best solution) in case of optimization or the latest solution in term of simulation.

Constructor & Destructor Documentation

◆ FMTsemodel() [1/5]

Models::FMTsemodel::FMTsemodel ( )

Default constructor of FMTsemodel

◆ ~FMTsemodel()

virtual Models::FMTsemodel::~FMTsemodel ( )
virtualdefault

Default destructor of FMTsemodel

◆ FMTsemodel() [2/5]

Models::FMTsemodel::FMTsemodel ( const FMTsemodel rhs)

Copy constructor of FMTsemodel

◆ FMTsemodel() [3/5]

Models::FMTsemodel::FMTsemodel ( const FMTmodel rhs,
const Spatial::FMTforest forest 
)

Parent constructor for FMTsemodel (easiest way to get information from a FMTmodel) and with an FMTforest.

◆ FMTsemodel() [4/5]

Models::FMTsemodel::FMTsemodel ( const FMTmodel rhs)

Parent constructor for FMTsemodel (easiest way to get information from a FMTmodel)

◆ FMTsemodel() [5/5]

Models::FMTsemodel::FMTsemodel ( FMTsemodel &&  rhs)
default

Default move constructor for FMTsemodel.

Member Function Documentation

◆ clone()

virtual std::unique_ptr< FMTmodel > Models::FMTsemodel::clone ( ) const
virtual

Get a clone of the FMTsemodel

Reimplemented from Models::FMTmodel.

Reimplemented in Models::FMTsesmodel, and Models::FMTsamodel.

◆ getarea()

virtual std::vector< Core::FMTactualdevelopment > Models::FMTsemodel::getarea ( int  period = 0,
bool  beforegrowanddeath = false 
) const
virtual

Get area with spatialschedule

Reimplemented from Models::FMTmodel.

◆ getcopy()

virtual std::unique_ptr< FMTmodel > Models::FMTsemodel::getcopy ( int  period = 0) const
virtual

This function returns a copy of the FMTmodel of the selected period. The function is going to clean the FMTconstraints and keep the objective.

Reimplemented from Models::FMTmodel.

Reimplemented in Models::FMTsamodel, and Models::FMTsesmodel.

◆ getdisturbancestats()

std::string Models::FMTsemodel::getdisturbancestats ( ) const

Getter returning a string of patch stats (area,perimeter ....) that are ine the disturbances stack.

◆ getmapping()

Spatial::FMTforest Models::FMTsemodel::getmapping ( ) const

Getter returning a copy the actual spatial forest stades of each FMTdevelopement (map).

◆ getobjectivevalue()

virtual double Models::FMTsemodel::getobjectivevalue ( ) const
virtual

Return the value of the globalobjective of the actual solution

Reimplemented from Models::FMTmodel.

◆ getoutput()

virtual std::map< std::string, double > Models::FMTsemodel::getoutput ( const Core::FMToutput output,
int  period,
Core::FMToutputlevel  level = Core::FMToutputlevel::standard 
) const
virtual

Get the output value of a output for a given period using the spatial solution. the map key returned consist of output name if level == FMToutputlevel::standard || level == FMToutputlevel::totalonly, or developement name if level == FMToutputlevel::developpement

Reimplemented from Models::FMTmodel.

◆ getschedule()

std::vector< Core::FMTschedule > Models::FMTsemodel::getschedule ( bool  withlock = false) const

Getter returning a copy of the operated schedules of the FMTsemodel. The operated schedule can differ from the potential schedule provided by the user in the function greedyreferencedbuild(). Which we call spatialisation impact.

◆ getsolution()

virtual Core::FMTschedule Models::FMTsemodel::getsolution ( int  period,
bool  withlock = false 
) const
virtual

Get the standard solution for a given period (FMTschedule dont have natural growth solution included). If with lock is true then the schedule will contain locked developement.

Reimplemented from Models::FMTmodel.

◆ getspatialoutput()

virtual Spatial::FMTlayer< double > Models::FMTsemodel::getspatialoutput ( const Core::FMToutput output,
int  period 
) const
virtual

Get the spatial output value based on the spatial solution.

◆ getspschedule()

Spatial::FMTspatialschedule Models::FMTsemodel::getspschedule ( ) const
inline

Getter returning a copy of the spatially explicit solution.

◆ LogConstraintsFactors()

void Models::FMTsemodel::LogConstraintsFactors ( ) const

Log the constraints factors

◆ LogConstraintsInfeasibilities()

void Models::FMTsemodel::LogConstraintsInfeasibilities ( ) const

Log the constraints infeasibilities spatial or not spatial

◆ operator=() [1/2]

FMTsemodel & Models::FMTsemodel::operator= ( const FMTsemodel rhs)

Copy assignment of FMTsemodel

◆ operator=() [2/2]

FMTsemodel & Models::FMTsemodel::operator= ( FMTsemodel &&  rhs)
default

Default move assignment for FMTsemodel.

◆ postsolve()

virtual void Models::FMTsemodel::postsolve ( const FMTmodel originalbasemodel)
virtual

Using the original FMTmodel it postsolve the actual ses model to turn it back into a complete model with all themes, actions and outputs of the original not presolved model.

Reimplemented from Models::FMTmodel.

◆ presolve()

virtual std::unique_ptr< FMTmodel > Models::FMTsemodel::presolve ( std::vector< Core::FMTactualdevelopment optionaldevelopments = std::vector< Core::FMTactualdevelopment >()) const
virtual

Presolve the semodel to get a more simple model call original presolve() and presolve the FMTforest map and the spatial acitons.

Reimplemented from Models::FMTmodel.

Reimplemented in Models::FMTsamodel, and Models::FMTsesmodel.

◆ setinitialmapping()

bool Models::FMTsemodel::setinitialmapping ( Spatial::FMTforest  forest)

Setter of the initial forest state (spatial map of FMTdevelopment) Has to be set before greedyreferencedbuild() is called.

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

◆ solution

Spatial::FMTspatialschedule Models::FMTsemodel::solution
protected

Contains the builded spatialsolution latest or best one.


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