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

#include <FMTsesmodel.hpp>

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

Public Member Functions

 FMTsesmodel ()
 
 ~FMTsesmodel ()=default
 
 FMTsesmodel (const FMTsesmodel &rhs)
 
 FMTsesmodel (const FMTmodel &rhs)
 
 FMTsesmodel (const FMTmodel &rhs, const Spatial::FMTforest &forest)
 
FMTsesmodeloperator= (const FMTsesmodel &rhs)
 
 FMTsesmodel (FMTsesmodel &&rhs)=default
 
FMTsesmodeloperator= (FMTsesmodel &&rhs)=default
 
std::string getdisturbancestats () const
 
std::map< std::string, double > greedyreferencebuild (const Core::FMTschedule &schedule, const size_t &randomiterations, unsigned int seed=0, double tolerance=FMT_DBL_TOLERANCE)
 
virtual std::unique_ptr< FMTmodelclone () const
 
virtual bool build (std::vector< Core::FMTschedule > schedules=std::vector< Core::FMTschedule >())
 
virtual bool solve ()
 
virtual std::unique_ptr< FMTmodelpresolve (std::vector< Core::FMTactualdevelopment > optionaldevelopments=std::vector< Core::FMTactualdevelopment >()) const
 
virtual std::unique_ptr< FMTmodelgetcopy (int period=0) const
 
- Public Member Functions inherited from Models::FMTsemodel
 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)
 

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)
 
- Protected Attributes inherited from Models::FMTsemodel
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.
 
- 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 a spatialy explicit simulation (ses) model. It uses simple cellular automaton to spatialy simulate FMTactions on a raster stack for a given planning horizon following an harvest schedule. The FMTaction ordering is realy important because the simulator will attend to place the first action of the list on the map and so on.

Constructor & Destructor Documentation

◆ FMTsesmodel() [1/5]

Models::FMTsesmodel::FMTsesmodel ( )

Default constructor of FMTsesmodel

◆ ~FMTsesmodel()

Models::FMTsesmodel::~FMTsesmodel ( )
default

Default destructor of FMTsesmodel

◆ FMTsesmodel() [2/5]

Models::FMTsesmodel::FMTsesmodel ( const FMTsesmodel rhs)

Copy constructor of FMTsesmodel

◆ FMTsesmodel() [3/5]

Models::FMTsesmodel::FMTsesmodel ( const FMTmodel rhs)

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

◆ FMTsesmodel() [4/5]

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

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

◆ FMTsesmodel() [5/5]

Models::FMTsesmodel::FMTsesmodel ( FMTsesmodel &&  rhs)
default

Default move constructor for FMTsesmodel.

Member Function Documentation

◆ build()

virtual bool Models::FMTsesmodel::build ( std::vector< Core::FMTschedule schedules = std::vector< Core::FMTschedule >())
virtual

This function will use the function greedyreferencebuild over the number of period set as LENGTH in model parameters.

Reimplemented from Models::FMTmodel.

◆ clone()

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

Get a clone of the FMTsesmodel

Reimplemented from Models::FMTsemodel.

◆ getcopy()

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

This function returns a copy of the FMTmodel of the selected period. If period = 0 it returns the FMTmodel::getcopy if period > 0 then it returns a copy of the FMTmodel based on the developements of the FMTgraph of the FMTlpmodel. Need to have a builded graph with a solution to use this function.

Reimplemented from Models::FMTsemodel.

◆ getdisturbancestats()

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

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

◆ greedyreferencebuild()

std::map< std::string, double > Models::FMTsesmodel::greedyreferencebuild ( const Core::FMTschedule schedule,
const size_t &  randomiterations,
unsigned int  seed = 0,
double  tolerance = FMT_DBL_TOLERANCE 
)

This function call multiple time the function FMTspatialschedule::referencebuild function to find the best possible spatialisation for a given schedule using random draw. It uses a schedule of actions (schedule) on the actual spatialy explicit forest. The user can also set the seed to get different solutions from the simulator.

◆ operator=() [1/2]

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

Copy assignment of FMTsesmodel

◆ operator=() [2/2]

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

Default move assignment for FMTsesmodel.

◆ presolve()

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

This function use a vector of developments and the actual transitions of the model and return new unique pointer to presolved FMTmodel. The function can reduce the number of global themes/actions/transitions/yields/lifespans/outputs/constraints data if the model is badly formulated.

Reimplemented from Models::FMTsemodel.

◆ solve()

virtual bool Models::FMTsesmodel::solve ( )
inlinevirtual

There is no solve since it's only a simulation. The build phase simulate over the LENGTH given in model parameters.

Reimplemented from Models::FMTmodel.

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)


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