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

#include <FMTnssmodel.hpp>

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

Public Member Functions

 FMTnssmodel ()
 
 ~FMTnssmodel ()=default
 
 FMTnssmodel (const FMTnssmodel &rhs)
 
FMTnssmodeloperator= (const FMTnssmodel &rhs)=default
 
 FMTnssmodel (const FMTmodel &rhs, unsigned int seed)
 
 FMTnssmodel (FMTnssmodel &&rhs)=default
 
FMTnssmodeloperator= (FMTnssmodel &&rhs)=default
 
void simulate ()
 
virtual std::unique_ptr< FMTmodelpresolve (std::vector< Core::FMTactualdevelopment > optionaldevelopments=std::vector< Core::FMTactualdevelopment >()) const
 
virtual std::unique_ptr< FMTmodelclone () const
 
virtual bool build (std::vector< Core::FMTschedule > schedules=std::vector< Core::FMTschedule >())
 
virtual bool solve ()
 
bool setparameter (const FMTintmodelparameters &key, const int &value) override
 
bool setparameter (const FMTboolmodelparameters &key, const bool &value) override
 
virtual std::unique_ptr< FMTmodelgetcopy (int period=0) const
 
- Public Member Functions inherited from Models::FMTsrmodel
Graph::FMTgraphvertextoyield getGraphVertexToYield () const
 
virtual void postsolve (const FMTmodel &originalbasemodel)
 
void setparallellogger (Logging::FMTlogger &logger) override
 
 FMTsrmodel (const FMTmodel &base, FMTsolverinterface lsolvertype)
 
 FMTsrmodel ()
 
 FMTsrmodel (const FMTsrmodel &rhs)
 
 FMTsrmodel (const FMTmodel &base, const Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties > &lgraph, const FMTlpsolver &lsolver)
 
FMTsrmodeloperator= (const FMTsrmodel &rhs)=default
 
 FMTsrmodel (FMTsrmodel &&rhs)=default
 
FMTsrmodeloperator= (FMTsrmodel &&rhs)=default
 
 ~FMTsrmodel ()=default
 
bool operator== (const FMTsrmodel &rhs) const
 
bool operator!= (const FMTsrmodel &rhs) const
 
bool unboundsolution (int period)
 
bool isperiodbounded (int period) const
 
void cleargraphdevelopements ()
 
void cleargraphcache ()
 
bool setsolution (int period, const Core::FMTschedule &schedule, double tolerance=FMT_DBL_TOLERANCE)
 
bool setsolutionbylp (int period, const Core::FMTschedule &schedule, double tolerance=FMT_DBL_TOLERANCE)
 
bool forcesolution (int period, const Core::FMTschedule &proportionschedulewithlock)
 
Core::FMTschedule getsolution (int period, bool withlock=false) const final
 
Core::FMTschedule getscheduleproportions (int period, bool withlock) const
 
Graph::FMTgraphstats getstats () const
 
virtual std::unique_ptr< FMTmodelgetcopy (int period=0) const
 
virtual std::map< std::string, double > getoutput (const Core::FMToutput &output, int period, Core::FMToutputlevel level=Core::FMToutputlevel::standard) const
 
Graph::FMTgraphstats buildperiod (Core::FMTschedule schedule=Core::FMTschedule(), bool forcepartialbuild=false, int compressageclassoperability=1)
 
int getfirstactiveperiod () const
 
virtual std::vector< Core::FMTactualdevelopmentgetarea (int period=0, bool beforegrowanddeath=false) const override
 
FMTlpsolvergetsolverptr ()
 
const FMTlpsolvergetconstsolverptr () const
 
virtual std::unique_ptr< FMTmodelclone () const override
 
void passinlogger (const std::shared_ptr< Logging::FMTlogger > &logger) override
 
virtual std::unique_ptr< FMTmodelpresolve (std::vector< Core::FMTactualdevelopment > optionaldevelopments=std::vector< Core::FMTactualdevelopment >()) const override
 
bool boundsolution (int period, double tolerance=FMT_DBL_TOLERANCE)
 
bool setparameter (const FMTintmodelparameters &key, const int &value) override
 
bool setparameter (const FMTboolmodelparameters &key, const bool &value) override
 
Graph::FMTgraphstats getgraphstats () const
 
std::set< Core::FMTSeriegetrorations (const Core::FMTmask &mask, const std::string &aggregate) const
 
virtual bool isoptimal () const
 
virtual double getobjectivevalue () const
 
std::vector< const Core::FMTdevelopment * > getnochoice (const Core::FMTmask &base_mask) 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::FMTsrmodel
static std::vector< Models::FMTsolverinterfacegetavailablesolverinterface ()
 
- 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::FMTsrmodel
bool summarize (const std::map< int, double > &variables, std::vector< int > &sumvariables, std::vector< double > &sumcoefficiants) const
 
Graph::FMTgraphstats initializematrix ()
 
Graph::FMTgraphstats updatematrix (const Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties >::FMTvertex_pair &targets, const Graph::FMTgraphstats &newstats)
 
size_t getgraphsize () const
 
void postsolvegraph (const FMTmodel &originalbasemodel)
 
- 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::FMTsrmodel
Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgepropertiesgraph
 graph holding the FMTdevelopments for all the periods.
 
FMTlpsolver solver
 The lpsolver.
 
- 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

FMTnssmodel stands for non spatial simulation model. This model is mainly used to simulate stochastics actions during the local replanning phase. Before using any kind of spatialy explicit model sometime using a simple non spatial model can help to understand the basic idea of simulation.

Constructor & Destructor Documentation

◆ FMTnssmodel() [1/4]

Models::FMTnssmodel::FMTnssmodel ( )

Default constructor of FMTnssmodel.

◆ ~FMTnssmodel()

Models::FMTnssmodel::~FMTnssmodel ( )
default

Default destructor of FMTnssmodel.

◆ FMTnssmodel() [2/4]

Models::FMTnssmodel::FMTnssmodel ( const FMTnssmodel rhs)

Default copy constructor of FMTnssmodel.

◆ FMTnssmodel() [3/4]

Models::FMTnssmodel::FMTnssmodel ( const FMTmodel rhs,
unsigned int  seed 
)

Constructor for FMTnssmodel taking a FMTmodel and a seed to initialize the random number generator.

◆ FMTnssmodel() [4/4]

Models::FMTnssmodel::FMTnssmodel ( FMTnssmodel &&  rhs)
default

Default move constructor for FMTnssmodel.

Member Function Documentation

◆ build()

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

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

Reimplemented from Models::FMTmodel.

◆ clone()

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

Get a clone of the FMTnssmodel

Reimplemented from Models::FMTsrmodel.

◆ getcopy()

virtual std::unique_ptr< FMTmodel > Models::FMTnssmodel::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::FMTsrmodel.

◆ operator=() [1/2]

FMTnssmodel & Models::FMTnssmodel::operator= ( const FMTnssmodel rhs)
default

Default copy assignment of MTnssmodel.

◆ operator=() [2/2]

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

Default move assignment for FMTnssmodel.

◆ presolve()

virtual std::unique_ptr< FMTmodel > Models::FMTnssmodel::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::FMTsrmodel.

◆ setparameter() [1/2]

bool Models::FMTnssmodel::setparameter ( const FMTboolmodelparameters key,
const bool &  value 
)
overridevirtual

Override setter for boolmodelparameters.

Reimplemented from Models::FMTmodel.

◆ setparameter() [2/2]

bool Models::FMTnssmodel::setparameter ( const FMTintmodelparameters key,
const int &  value 
)
overridevirtual

Override setter for intmodelparameters.

Reimplemented from Models::FMTmodel.

◆ simulate()

void Models::FMTnssmodel::simulate ( )

This function do a non spatial simulation based on the area constraints in the optimize section.

◆ solve()

virtual bool Models::FMTnssmodel::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

Save 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: