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

Base class for the different models in FMT. More...

#include <FMTModel.h>

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

Public Member Functions

double getYieldValue (const std::string &p_mask, const std::string &p_yield, int p_age, int p_period) const
 Get yield value.
 
void setReplicate (size_t p_replicate, int p_ReplanningPeriod)
 Set the constraints to the specified Replanning Period.
 
bool gotReIgnore (const int &p_replanningPeriod) const
 Check if setReIgnore needs to be called.
 
bool gotReplicate (const int &p_replanningPeriod) const
 Check if setReplicate needs to be called.
 
FMTModel buildAction (const std::string &p_actionName, const std::string &p_Targetyield) const
 Build an action based on the positive value of a yield.
 
std::vector< Core::FMTSchedulebuildSchedule (const Core::FMTAction &p_action, const FMTModel &p_BaseModel, const std::string &p_Targetyield, const std::vector< Core::FMTSchedule > &p_schedules) const
 Build a schedule by looking at operability of the actual developments.
 
void pushTheme (const std::string &p_themeName, const std::string &p_yieldName, const std::vector< std::string > &p_attributes)
 Push a new theme and update the whole model with it.
 
Models::FMTModel aggregateAllActions (const std::vector< std::string > &p_Aggregates, std::vector< std::string > p_ActionOrdering) const
 Aggregate actions together and create a new model with new actions, transitions, outputs, constraints, yields and lifespan.
 
Models::FMTModel splitActions (const std::vector< std::string > &p_Actions, const std::vector< std::string > &p_masks) const
 Split actions using the provided masks, new actions are named action_mask and aggregated into the original action name.
 
std::vector< std::string > getSchedulesPriorities (const std::vector< Core::FMTSchedule > &p_schedules) const
 Return the action names in priority of area scheduled.
 
std::vector< Core::FMTScheduleaggregateSchedules (const std::vector< Core::FMTSchedule > &p_schedules) const
 Build a new schedule based on p_schedules with the corresponding aggregated actions.
 
std::vector< Core::FMTSchedulesplitSchedules (const std::vector< Core::FMTSchedule > &p_schedules) const
 Using the actions of the model change the actions of the schedule.
 
virtual void setParallelLogger (Logging::FMTLogger &logger)
 Set a thread owned logger so the solver does not work in concurrency.
 
virtual void clearCache ()
 Clear caching elements to reduce memory usage.
 
 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())
 Main constructor for FMTModel used in Parser::FMTModelParser, constraints and parameters are optional.
 
 FMTModel ()
 Default constructor of FMTModel.
 
virtual ~FMTModel ()=default
 Default virtual destructor of FMTModel.
 
 FMTModel (FMTModel &&rhs)
 Default move constructor for FMTModel.
 
FMTModeloperator= (FMTModel &&rhs)
 Default move assignment for FMTModel.
 
virtual std::vector< Core::FMTActualDevelopmentgetArea (int period=0, bool beforegrowanddeath=false) const
 Get the area of a given period as actual developments.
 
virtual std::unique_ptr< FMTModelgetCopy (int period=0) const
 Return a copy of the FMTModel for the selected period, cleaning the constraints and keeping the objective.
 
FMTModel basePreSolve () const
 Presolve the model using the existing area.
 
Core::FMTMaskFilter getPreSolveFilter (const std::vector< Core::FMTTheme > &originalthemes) const
 Get the preSolve filter.
 
Core::FMTMaskFilter getPostSolveFilter (const std::vector< Core::FMTTheme > &originalthemes, const Core::FMTMask &devmask) const
 Get the postsolve filter used by the preSolve, to turn a presolved mask into a postsolve mask.
 
Core::FMTMask getSelectedMask (const std::vector< Core::FMTTheme > &originalthemes) const
 Get the selection mask needed to preSolve a FMTMask when the model is presolved.
 
virtual std::unique_ptr< FMTModelpreSolve (std::vector< Core::FMTActualDevelopment > optionaldevelopments=std::vector< Core::FMTActualDevelopment >()) const
 Return a new presolved FMTModel using developments and the actual transitions of the model.
 
virtual void postSolve (const FMTModel &originalbasemodel)
 Postsolve the presolved model into the original model.
 
Core::FMTSchedule preSolveSchedule (const Core::FMTSchedule &originalbaseschedule, const FMTModel &originalbasemodel) const
 Return a new schedule with presolved development masks and actions.
 
FMTModelStats getModelStats () const
 Return the statistics of the model such as the number of themes, yields, actions and transitions.
 
void cleanActionsNTransitions ()
 Delete actions that have no defined transition and transitions that have no defined action, then sort them.
 
std::string getName () const
 Return the name of the FMTModel.
 
std::vector< Core::FMTThemegetThemes () const
 Return a copy of the themes of the model.
 
std::vector< Core::FMTActiongetActions () const
 Return a copy of the actions of the model.
 
std::vector< Core::FMTTransitiongetTransitions () const
 Return a copy of the transitions of the model.
 
Core::FMTYields getYields () const
 Return a copy of the yields of the model.
 
Core::FMTLifespans getLifespan () const
 Return a copy of the lifespan of the model.
 
std::vector< Core::FMTOutputgetOutputs () const
 Return a copy of the outputs of the model.
 
std::vector< Core::FMTConstraintgetConstraints () const
 Return a copy of the constraints of the model.
 
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)
 Add one output to the model based only on strings.
 
template<typename T >
void addYieldHandlers (const std::vector< T > &yieldhandlers)
 Add FMTYieldHandler from a vector to the yields.
 
void addYieldHandlersFromPtr (const std::vector< std::unique_ptr< Core::FMTYieldHandler > > &yieldhandlers)
 Add unique pointers of FMTYieldHandler from a vector to the yields.
 
bool operator== (const FMTModel &rhs) const
 Equality comparison operator of FMTModel.
 
bool operator< (const FMTModel &rhs) const
 Less than comparison operator of FMTModel.
 
void setArea (const std::vector< Core::FMTActualDevelopment > &ldevs)
 Setter for the initial actual developments (area section), replacing the originals.
 
void setThemes (const std::vector< Core::FMTTheme > &lthemes)
 Setter for the themes of the model, replacing the originals.
 
void setActions (const std::vector< Core::FMTAction > &lactions)
 Setter for the actions of the model, replacing the originals.
 
void setTransitions (const std::vector< Core::FMTTransition > &ltransitions)
 Setter for the transitions of the model, replacing the originals.
 
void setConstraints (const std::vector< Core::FMTConstraint > &lconstraint)
 Setter for the constraints of the model, replacing the original.
 
void setYields (const Core::FMTYields &lylds)
 Setter for the yields of the model, replacing the original.
 
void setLifespan (const Core::FMTLifespans &llifespan)
 Setter for the lifespan of the model, replacing the original.
 
void setName (const std::string &newname)
 Set the name of the FMTModel.
 
void setOutputs (const std::vector< Core::FMTOutput > &newoutputs)
 Setter for the outputs of the model.
 
bool isValid ()
 Validate the whole FMTModel through themes, actual developments, yields, actions, transitions, outputs and constraints.
 
std::vector< const Core::FMTTheme * > locateStaticThemes (const Core::FMTOutput &output, bool ignoreoutputvariables=false) const
 Return the themes that are not used in the transitions and in a given output (static themes).
 
std::vector< const Core::FMTTheme * > locateStaticThemes (const Core::FMTOutputNode &output, bool ignoreoutputvariables=false) const
 Return the themes that are not used in the transitions and in a given output node (static themes).
 
std::vector< const Core::FMTTheme * > locateDynamicThemes (const Core::FMTOutput &outpu, bool ignoreoutputvariables=false) const
 Return the themes used in the transition scheme.
 
Core::FMTMask getDynamicMask (const Core::FMTOutput &output, bool ignoreoutputvariables=false) const
 Return a mask where static attributes have a value of 0 and dynamic attributes a value of 1.
 
Core::FMTMask getDynamicMask (const Core::FMTOutputNode &node, bool ignoreoutputvariables=false) const
 Return a mask where static attributes have a value of 0 and dynamic attributes a value of 1.
 
virtual Core::FMTMask getStaticMask (const Core::FMTOutputNode &node, bool ignoreoutputvariables=false) const
 Return a mask where static attributes have a value of 1 and dynamic attributes a value of 0.
 
bool isStaticNode (const Core::FMTOutputNode &node, double ratioofset=0.1) const
 Return true if the node can be used in static mask functions.
 
std::vector< const Core::FMTTheme * > locateStaticTransitionsThemes () const
 Return the static themes based on the model transitions.
 
std::vector< const Core::FMTTheme * > locateNodeStaticThemes (const Core::FMTOutputNode &node, bool ignoreoutputvariables=false, std::vector< const Core::FMTTheme * > basethemes=std::vector< const Core::FMTTheme * >()) const
 Return the static themes of a node based on the model transitions.
 
 FMTModel (const FMTModel &rhs)
 Copy constructor of FMTModel.
 
FMTModeloperator= (const FMTModel &rhs)
 Copy assignment of FMTModel.
 
bool empty () const
 Return true if the FMTModel is empty.
 
void push_back (const FMTModel &rhs)
 Append a FMTModel to this FMTModel without overriding the objective of the base model.
 
double getInitialArea () const
 Return the sum of the area of the area vector.
 
void setAreaPeriod (const int &period)
 Change the initial area period to the targeted period.
 
int getAreaPeriod () const
 get the period of the area section.
 
Core::FMTSchedule getPotentialSchedule (std::vector< Core::FMTActualDevelopment > toRemove, std::vector< Core::FMTActualDevelopment > selection, bool withlock=true) const
 Test operability of a selection minus the developments to remove and return a schedule with an area of 1.0 for each operable development.
 
virtual std::vector< Core::FMTConstraintgetReplanningConstraints (const std::string &modeltype, const std::vector< Core::FMTConstraint > &localconstraints, const int &period) const
 Adjust the constraints that need to be set to a value of the global or local model and return all constraints.
 
virtual bool doPlanning (const bool &solve, std::vector< Core::FMTSchedule > schedules=std::vector< Core::FMTSchedule >())
 Build the model and do the initial solve or simulate, using the build and solve overridden functions of the different model types.
 
virtual std::map< std::string, double > getOutput (const Core::FMTOutput &output, int period, Core::FMToutputlevel level=Core::FMToutputlevel::standard) const
 Get the output value of an output for a given period using the spatial solution.
 
virtual Core::FMTSchedule getSolution (int period, bool withlock=false) const
 Get the standard solution for a given period, without the natural growth solution.
 
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
 For each output get a vector of output values from the first period to the last period.
 
virtual std::unique_ptr< FMTModelclone () const
 Get a clone of the FMTModel.
 
virtual bool setParameter (const FMTintmodelparameters &p_key, const int &p_value)
 set int parameters to nss model.
 
virtual bool setParameter (const FMTdblmodelparameters &key, const double &value)
 Setter for double model parameters. See FMTModelParameters.h.
 
virtual bool setParameter (const FMTboolmodelparameters &key, const bool &value)
 Setter for bool model parameters. See FMTModelParameters.h.
 
virtual bool setParameter (const FMTstrmodelparameters &p_key, const std::string &p_value)
 Setter forstr model parameters. See FMTModelParameters.h.
 
int getParameter (const FMTintmodelparameters &key) const
 Getter for int model parameters. See FMTModelParameters.h.
 
double getParameter (const FMTdblmodelparameters &key) const
 Getter for double model parameters. See FMTModelParameters.h.
 
bool getParameter (const FMTboolmodelparameters &key) const
 Getter for bool model parameters. See FMTModelParameters.h.
 
const std::string & getParameter (const FMTstrmodelparameters &p_key) const
 Getter for str model parameters. See FMTModelParameters.h.
 
bool setCompressTime (const int &periodStart, const int &periodStop, const int &value)
 Set the compresstime value for a range of periods. See FMTModelParameters.h.
 
std::vector< int > getCompressTime () const
 Return a vector with the compresstime value for each period, the first period being index 0. See FMTModelParameters.h.
 
std::vector< Core::FMTConstraintgoalConstraints (double penalty=999999) const
 Return all constraints and the objective with goals and penalty.
 
std::vector< Core::FMTConstraintgetTacticalConstraints (double penalty=999999, double scheduleweight=999999, double objective=0, double objectivefactor=1.0) const
 Get the constraints adapted for a tactical model.
 
virtual void showParameters (const bool &showhelp=false) const
 Show the parameter values.
 
virtual bool build (std::vector< Core::FMTSchedule > schedules=std::vector< Core::FMTSchedule >())
 Build the elements needed to solve the model, overridden by each type of model.
 
virtual bool solve ()
 Solve the model, overridden by each type of model.
 
virtual bool isOptimal () const
 Return true if the FMTModel is optimal.
 
virtual double getObjectiveValue () const
 Return the value of the global objective.
 
std::default_random_engine * getGeneratorPtr () const
 Get a pointer to the generator.
 
std::vector< size_t > getStaticTransitionThemes () const
 Locate the static transition themes.
 
virtual bool SupportsMultiThreading () const
 Some solver dont support multithreading.
 
- Public Member Functions inherited from Core::FMTObject
 FMTObject ()
 Default constructor for FMTObject.
 
virtual ~FMTObject ()
 Default virtual destructor for FMTObject.
 
 FMTObject (const std::unique_ptr< Exception::FMTExceptionHandler > exhandler)
 Construct a FMTObject passing in the exception handler of another FMTObject.
 
 FMTObject (const FMTObject &rhs)
 Copy constructor for FMTObject.
 
FMTObjectoperator= (const FMTObject &rhs)
 Copy assignment operator for FMTObject.
 
virtual void passInLogger (const std::unique_ptr< Logging::FMTLogger > &logger)
 Pass in the logger of another FMTObject.
 
void passInExceptionHandler (const std::unique_ptr< Exception::FMTExceptionHandler > &exhandler)
 Pass in the exception handler of another FMTObject.
 
void redirectLogToFile (const std::string &location)
 Redirect the log to a specific file, appending to it.
 
virtual void setDefaultLogger ()
 Create and set a default logger to the FMTObject.
 
virtual void setQuietLogger ()
 Create and set a quiet logger to the FMTObject.
 
virtual void setTaskLogger ()
 Create and set a task logger to the FMTObject.
 
virtual void setDebugLogger ()
 Create and set a debug logger to the FMTObject.
 
void setDefaultExceptionHandler ()
 Create and set a default exception handler to the FMTObject.
 
void setQuietExceptionHandler ()
 Create and set a quiet exception handler to the FMTObject.
 
void setDebugExceptionHandler ()
 Create and set a debug exception handler to the FMTObject.
 
void setFreeExceptionHandler ()
 Create and set a free exception handler to the FMTObject.
 
void disableNestedExceptions ()
 Disable the nested exception throw of the exception handler.
 
void enableNestedExceptions ()
 Enable the nested exception throw of the exception handler.
 
void setErrorsToWarnings (const std::vector< Exception::FMTexc > &errors)
 Set a list of errors to be cast to warnings on the exception handler.
 
void setMaxWarningsBeforeSilenced (const size_t &maxwarningcount)
 Set the number of warnings raised before being silenced.
 
template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Static Public Member Functions

static Core::FMTAction defaultDeathAction (const Core::FMTLifespans &llifespan, const std::vector< Core::FMTTheme > &lthemes)
 Return the default death action, based on the lifespan and themes, when not specified by the user.
 
static Core::FMTTransition defaultDeathTransition (const Core::FMTLifespans &llifespan, const std::vector< Core::FMTTheme > &lthemes)
 Return the default death transition, based on the lifespan and themes, when not specified by the user.
 
- Static Public Member Functions inherited from Core::FMTObject
static Logging::FMTLoggergetLogger ()
 get a pointer to the actual logger.
 
static Exception::FMTExceptionHandlergetExceptionHandler ()
 get a pointer to the actual exception handler.
 
static std::string getRuntimeLocation ()
 Return the location of the FMT shared library.
 
static unsigned long long getAvailableMemory ()
 Return the available memory in bytes.
 
static void setTerminateStack ()
 will write the stack in the log when terminate called and raise a function failed.
 
static void setAbortStack ()
 will write the stack in the log when abort called with SIGABRT and raise a function failed.
 

Protected Member Functions

void setSeed (const int &p_seed)
 seed the random number generator
 
void setDefaultObjects ()
 Define the default _DEATH action and transition when they are not defined by the user.
 
Core::FMTMask getBaseMask (std::vector< Core::FMTActualDevelopment > optionaldevelopments) const
 Return a mask covering the actual bits used by the FMTModel and the optional developments.
 
std::vector< const Core::FMTTheme * > getStaticPreSolveThemes () const
 Return the themes that are not part of the model, using the transition themes, constraints, actions and yields.
 
void clearActionsCache ()
 Clear the cached actions data.
 
void clearYieldCache ()
 Clear the cached yields data.
 
void clearTransitionCache ()
 Clear the cached transitions data.
 
virtual void swapPtr (std::unique_ptr< FMTModel > &rhs)
 Swap this model for the element at the end of the rhs unique pointer.
 
std::vector< Core::FMTSchedulesetUpSchedulesForBuild (const std::vector< Core::FMTSchedule > &schedules) const
 Prepare the passed schedules for building based on FORCE_PARTIAL_BUILD, always returning a filled vector covering the whole length.
 
bool useActionSerie () const
 Return true if the model makes use of action series.
 
size_t getSeriesMaxSize () const
 Get the maximal serie size for the whole model.
 
- Protected Member Functions inherited from Core::FMTObject
template<class Archive >
void forceSave (Archive &ar, const unsigned int version) const
 Force the serialization to save useful information, which the default FMTObject serialization does not.
 
template<class Archive >
void forceLoad (Archive &ar, const unsigned int version)
 Force the serialization to load useful information, which the default FMTObject serialization does not.
 
void checkSignals () const
 Check if the user has sent a ctrl-c signal using boost::python to FMT.
 
void setCplHandler ()
 Pass the FMT exception handler to the GDAL exception handler (GDAL only).
 

Protected Attributes

std::default_random_engine m_generator
 Random number generator.
 
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

template<class T1 , class T2 >
class Graph::FMTGraph
 
class Graph::FMTLineGraph
 
class Spatial::FMTSpatialSchedule
 
class Spatial::FMTSpatialNodesCache
 
class Spatial::FMTSpatialGraphs
 
class Parser::FMTModelParser
 
class Graph::FMTGraphVertexToYield
 
class boost::serialization::access
 Save function used for serialization to do multiprocessing across multiple cpus (pickle in Python).
 

Additional Inherited Members

- Static Protected Member Functions inherited from Core::FMTObject
static std::chrono::time_point< std::chrono::high_resolution_clock > getClock ()
 Return a clock of the current time.
 
template<class chrono >
static double getDuration (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 Return the time elapsed since a start clock as a double.
 
static std::string getDurationInSeconds (const std::chrono::time_point< std::chrono::high_resolution_clock > &startclock)
 Return the time elapsed since a start clock in seconds as a string.
 
static void _logStack ()
 Log the stack trace...
 
static void _terminate ()
 Raise an error with the boost stacktrace.
 
static void _abort (int p_signal)
 Raise an error with the boost stacktrace on abort.
 
- Static Protected Attributes inherited from Core::FMTObject
static std::unique_ptr< Exception::FMTExceptionHandler_exhandler
 A shared pointer to the exception handler.
 
static std::unique_ptr< Logging::FMTLogger_logger
 A shared pointer to the logger.
 

Detailed Description

Base class for the different models in FMT.

FMTModel is the formulation seen in the Woodstock files of a forest planning problem. FMTLpModel / FMTSaModel / FMTSesModel use the FMTModel protected members to generate the problem based on LP/SA or to simply simulate the FMTModel.

Constructor & Destructor Documentation

◆ FMTModel() [1/4]

Models::FMTModel::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() 
)

Main constructor for FMTModel used in Parser::FMTModelParser, constraints and parameters are optional.

Parameters
[in]lareathe initial actual developments (area section).
[in]lthemesthe model themes.
[in]lactionsthe model actions.
[in]ltransitionsthe model transitions.
[in]lyieldsthe model yields.
[in]llifespanthe model lifespans.
[in]lnamethe model name.
[in]loutputsthe model outputs.
[in]lconstraintsthe model constraints, optional and not needed for FMTSesModel.
[in]lparametersthe model parameters.

◆ FMTModel() [2/4]

Models::FMTModel::FMTModel ( )

Default constructor of FMTModel.

◆ ~FMTModel()

virtual Models::FMTModel::~FMTModel ( )
virtualdefault

Default virtual destructor of FMTModel.

◆ FMTModel() [3/4]

Models::FMTModel::FMTModel ( FMTModel &&  rhs)

Default move constructor for FMTModel.

Parameters
[in,out]rhsthe FMTModel to move from.

◆ FMTModel() [4/4]

Models::FMTModel::FMTModel ( const FMTModel rhs)

Copy constructor of FMTModel.

Parameters
[in]rhsthe FMTModel to copy.

Member Function Documentation

◆ addOutput()

void Models::FMTModel::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 
)

Add one output to the model based only on strings.

Parameters
[in]namethe output name.
[in]maskstringthe mask string (? ? ?).
[in]outputtargetthe type of output created.
[in]actionthe targeted action string.
[in]yieldthe targeted yield string.
[in]descriptionthe description of the output.
[in]targetThemethe targeted theme index.

◆ addYieldHandlers()

template<typename T >
void Models::FMTModel::addYieldHandlers ( const std::vector< T > &  yieldhandlers)
inline

Add FMTYieldHandler from a vector to the yields.

Can only be used for FMTAgeYieldHandler and FMTTimeYieldHandler. FMTModelYieldHandler or FMTcomplexyieldhandler must be added in the .yld file to parse with the model.

Template Parameters
Tthe yield handler type.
Parameters
[in]yieldhandlersthe yield handlers to add.

◆ addYieldHandlersFromPtr()

void Models::FMTModel::addYieldHandlersFromPtr ( const std::vector< std::unique_ptr< Core::FMTYieldHandler > > &  yieldhandlers)

Add unique pointers of FMTYieldHandler from a vector to the yields.

Parameters
[in]yieldhandlersthe yield handlers to add.

◆ aggregateAllActions()

Models::FMTModel Models::FMTModel::aggregateAllActions ( const std::vector< std::string > &  p_Aggregates,
std::vector< std::string >  p_ActionOrdering 
) const

Aggregate actions together and create a new model with new actions, transitions, outputs, constraints, yields and lifespan.

Parameters
[in]p_Aggregatesthe action aggregates we want to merge together.
[in]p_ActionOrderingthe order used for the hierarchy of actions, if empty uses the order of the actual actions.
Returns
a newly created model with aggregated actions.

◆ aggregateSchedules()

std::vector< Core::FMTSchedule > Models::FMTModel::aggregateSchedules ( const std::vector< Core::FMTSchedule > &  p_schedules) const

Build a new schedule based on p_schedules with the corresponding aggregated actions.

Parameters
[in]p_schedulesthe schedules of the original model.
Returns
newly created schedules with aggregated actions.

◆ basePreSolve()

FMTModel Models::FMTModel::basePreSolve ( ) const

Presolve the model using the existing area.

Can reduce the number of global themes, actions, transitions, yields, lifespans, outputs and constraints if the model is badly formulated.

Returns
the presolved FMTModel.

◆ build()

virtual bool Models::FMTModel::build ( std::vector< Core::FMTSchedule schedules = std::vector<Core::FMTSchedule>())
inlinevirtual

Build the elements needed to solve the model, overridden by each type of model.

Parameters
[in]schedulesthe schedules used to build the model.
Returns
true if the build succeeded else false.

Reimplemented in Models::FMTLpModel, Models::FMTNssModel, Models::FMTSaModel, and Models::FMTSesModel.

◆ buildAction()

FMTModel Models::FMTModel::buildAction ( const std::string &  p_actionName,
const std::string &  p_Targetyield 
) const

Build an action based on the positive value of a yield.

Parameters
[in]p_actionNamethe name of the action to create.
[in]p_Targetyieldthe yield to look for positive value.
Returns
a valid FMTModel.

◆ buildSchedule()

std::vector< Core::FMTSchedule > Models::FMTModel::buildSchedule ( const Core::FMTAction p_action,
const FMTModel p_BaseModel,
const std::string &  p_Targetyield,
const std::vector< Core::FMTSchedule > &  p_schedules 
) const

Build a schedule by looking at operability of the actual developments.

Parameters
[in]p_actionthe action we want to build a schedule for.
[in]p_BaseModelthe base model.
[in]p_Targetyieldthe yield name to look for.
[in]p_schedulesthe non extended schedule we want to build on.
Returns
a complete schedule of the length of the model with actual developments.

◆ cleanActionsNTransitions()

void Models::FMTModel::cleanActionsNTransitions ( )

Delete actions that have no defined transition and transitions that have no defined action, then sort them.

◆ clearActionsCache()

void Models::FMTModel::clearActionsCache ( )
protected

Clear the cached actions data.

◆ clearCache()

virtual void Models::FMTModel::clearCache ( )
virtual

Clear caching elements to reduce memory usage.

Reimplemented in Models::FMTLpModel.

◆ clearTransitionCache()

void Models::FMTModel::clearTransitionCache ( )
protected

Clear the cached transitions data.

◆ clearYieldCache()

void Models::FMTModel::clearYieldCache ( )
protected

Clear the cached yields data.

◆ clone()

virtual std::unique_ptr< FMTModel > Models::FMTModel::clone ( ) const
virtual

Get a clone of the FMTModel.

Returns
a unique pointer to the cloned FMTModel.

Reimplemented in Models::FMTLpModel, Models::FMTNssModel, Models::FMTSeModel, Models::FMTSesModel, Models::FMTSaModel, and Models::FMTSrModel.

◆ defaultDeathAction()

static Core::FMTAction Models::FMTModel::defaultDeathAction ( const Core::FMTLifespans llifespan,
const std::vector< Core::FMTTheme > &  lthemes 
)
static

Return the default death action, based on the lifespan and themes, when not specified by the user.

Parameters
[in]llifespanthe lifespan data.
[in]lthemesthe model themes.
Returns
the default death action.

◆ defaultDeathTransition()

static Core::FMTTransition Models::FMTModel::defaultDeathTransition ( const Core::FMTLifespans llifespan,
const std::vector< Core::FMTTheme > &  lthemes 
)
static

Return the default death transition, based on the lifespan and themes, when not specified by the user.

Parameters
[in]llifespanthe lifespan data.
[in]lthemesthe model themes.
Returns
the default death transition.

◆ doPlanning()

virtual bool Models::FMTModel::doPlanning ( const bool &  solve,
std::vector< Core::FMTSchedule schedules = std::vector< Core::FMTSchedule >() 
)
virtual

Build the model and do the initial solve or simulate, using the build and solve overridden functions of the different model types.

Parameters
[in]solveif true solves the model, otherwise simulates it.
[in]schedulesthe schedules used to build the model.
Returns
true if the planning succeeded else false.

◆ empty()

bool Models::FMTModel::empty ( ) const

Return true if the FMTModel is empty.

Returns
true if the model is empty else false.

◆ getActions()

std::vector< Core::FMTAction > Models::FMTModel::getActions ( ) const
inline

Return a copy of the actions of the model.

Returns
the model actions.

◆ getArea()

virtual std::vector< Core::FMTActualDevelopment > Models::FMTModel::getArea ( int  period = 0,
bool  beforegrowanddeath = false 
) const
virtual

Get the area of a given period as actual developments.

Parameters
[in]periodthe period to get the area from.
[in]beforegrowanddeathif true returns the developments before growth and death to the next period.
Returns
the actual developments of the requested period.

Reimplemented in Models::FMTSeModel, and Models::FMTSrModel.

◆ getAreaPeriod()

int Models::FMTModel::getAreaPeriod ( ) const

get the period of the area section.

Returns
the period of the first dev of the area.

◆ getBaseMask()

Core::FMTMask Models::FMTModel::getBaseMask ( std::vector< Core::FMTActualDevelopment optionaldevelopments) const
protected

Return a mask covering the actual bits used by the FMTModel and the optional developments.

Parameters
[in]optionaldevelopmentsthe optional developments to cover.
Returns
the base mask.

◆ getCompressTime()

std::vector< int > Models::FMTModel::getCompressTime ( ) const

Return a vector with the compresstime value for each period, the first period being index 0. See FMTModelParameters.h.

Returns
the compresstime values per period.

◆ getConstraints()

std::vector< Core::FMTConstraint > Models::FMTModel::getConstraints ( ) const
inline

Return a copy of the constraints of the model.

Returns
the model constraints.

◆ getCopy()

virtual std::unique_ptr< FMTModel > Models::FMTModel::getCopy ( int  period = 0) const
virtual

Return a copy of the FMTModel for the selected period, cleaning the constraints and keeping the objective.

Parameters
[in]periodthe period to copy.
Returns
a unique pointer to the copied FMTModel.

Reimplemented in Models::FMTLpModel, Models::FMTNssModel, Models::FMTSaModel, Models::FMTSeModel, Models::FMTSesModel, and Models::FMTSrModel.

◆ getDynamicMask() [1/2]

Core::FMTMask Models::FMTModel::getDynamicMask ( const Core::FMTOutput output,
bool  ignoreoutputvariables = false 
) const

Return a mask where static attributes have a value of 0 and dynamic attributes a value of 1.

Parameters
[in]outputthe output to look into.
[in]ignoreoutputvariablesif true ignores the output variables.
Returns
the dynamic mask.

◆ getDynamicMask() [2/2]

Core::FMTMask Models::FMTModel::getDynamicMask ( const Core::FMTOutputNode node,
bool  ignoreoutputvariables = false 
) const

Return a mask where static attributes have a value of 0 and dynamic attributes a value of 1.

Parameters
[in]nodethe output node to look into.
[in]ignoreoutputvariablesif true ignores the output variables.
Returns
the dynamic mask.

◆ getGeneratorPtr()

std::default_random_engine * Models::FMTModel::getGeneratorPtr ( ) const

Get a pointer to the generator.

Returns
a pointer to the generator or a nullptr;

◆ getInitialArea()

double Models::FMTModel::getInitialArea ( ) const

Return the sum of the area of the area vector.

Returns
the total initial area.

◆ getLifespan()

Core::FMTLifespans Models::FMTModel::getLifespan ( ) const
inline

Return a copy of the lifespan of the model.

Returns
the model lifespan.

◆ getModelStats()

FMTModelStats Models::FMTModel::getModelStats ( ) const

Return the statistics of the model such as the number of themes, yields, actions and transitions.

Returns
the model statistics.

◆ getName()

std::string Models::FMTModel::getName ( ) const
inline

Return the name of the FMTModel.

Returns
the model name.

◆ getObjectiveValue()

virtual double Models::FMTModel::getObjectiveValue ( ) const
virtual

Return the value of the global objective.

Returns
the objective value.

Reimplemented in Models::FMTSeModel, and Models::FMTSrModel.

◆ getOutput()

virtual std::map< std::string, double > Models::FMTModel::getOutput ( const Core::FMTOutput output,
int  period,
Core::FMToutputlevel  level = Core::FMToutputlevel::standard 
) const
virtual

Get the output value of an output for a given period using the spatial solution.

The map key is the output name when level is standard or totalonly, or the development name when level is developpement.

Parameters
[in]outputthe output to evaluate.
[in]periodthe period to evaluate.
[in]levelthe output level of detail.
Returns
a map of output or development names to their values.

Reimplemented in Models::FMTLpModel, Models::FMTSeModel, and Models::FMTSrModel.

◆ getOutputs()

std::vector< Core::FMTOutput > Models::FMTModel::getOutputs ( ) const
inline

Return a copy of the outputs of the model.

Returns
the model outputs.

◆ getOutputsFromPeriods()

virtual std::map< std::string, std::vector< std::vector< double > > > Models::FMTModel::getOutputsFromPeriods ( const std::vector< Core::FMTOutput > &  theoutputs,
const int &  firstPeriod,
const int &  lastPeriod,
Core::FMToutputlevel  level = Core::FMToutputlevel::standard 
) const
virtual

For each output get a vector of output values from the first period to the last period.

Parameters
[in]theoutputsthe outputs to evaluate.
[in]firstPeriodthe first period.
[in]lastPeriodthe last period.
[in]levelthe output level of detail.
Returns
a map of output names to their values per period.

◆ getParameter() [1/4]

bool Models::FMTModel::getParameter ( const FMTboolmodelparameters key) const

Getter for bool model parameters. See FMTModelParameters.h.

Parameters
[in]keythe parameter key.
Returns
the parameter value.

◆ getParameter() [2/4]

double Models::FMTModel::getParameter ( const FMTdblmodelparameters key) const

Getter for double model parameters. See FMTModelParameters.h.

Parameters
[in]keythe parameter key.
Returns
the parameter value.

◆ getParameter() [3/4]

int Models::FMTModel::getParameter ( const FMTintmodelparameters key) const

Getter for int model parameters. See FMTModelParameters.h.

Parameters
[in]keythe parameter key.
Returns
the parameter value.

◆ getParameter() [4/4]

const std::string & Models::FMTModel::getParameter ( const FMTstrmodelparameters p_key) const

Getter for str model parameters. See FMTModelParameters.h.

Parameters
[in]p_keythe parameter key.
Returns
the parameter value.

◆ getPostSolveFilter()

Core::FMTMaskFilter Models::FMTModel::getPostSolveFilter ( const std::vector< Core::FMTTheme > &  originalthemes,
const Core::FMTMask devmask 
) const

Get the postsolve filter used by the preSolve, to turn a presolved mask into a postsolve mask.

Parameters
[in]originalthemesthe original themes of the model.
[in]devmaskthe development mask.
Returns
the postsolve mask filter.

◆ getPotentialSchedule()

Core::FMTSchedule Models::FMTModel::getPotentialSchedule ( std::vector< Core::FMTActualDevelopment toRemove,
std::vector< Core::FMTActualDevelopment selection,
bool  withlock = true 
) const

Test operability of a selection minus the developments to remove and return a schedule with an area of 1.0 for each operable development.

Parameters
[in]toRemovethe developments to remove from the selection.
[in]selectionthe developments to test.
[in]withlockif true keeps the locked developments.
Returns
a schedule containing the operable developments.

◆ getPreSolveFilter()

Core::FMTMaskFilter Models::FMTModel::getPreSolveFilter ( const std::vector< Core::FMTTheme > &  originalthemes) const

Get the preSolve filter.

Parameters
[in]originalthemesthe original themes of the model.
Returns
the preSolve mask filter.

◆ getReplanningConstraints()

virtual std::vector< Core::FMTConstraint > Models::FMTModel::getReplanningConstraints ( const std::string &  modeltype,
const std::vector< Core::FMTConstraint > &  localconstraints,
const int &  period 
) const
virtual

Adjust the constraints that need to be set to a value of the global or local model and return all constraints.

Parameters
[in]modeltypethe type of the model.
[in]localconstraintsthe local constraints.
[in]periodthe replanning period.
Returns
the adjusted replanning constraints.

Reimplemented in Models::FMTLpModel.

◆ getSchedulesPriorities()

std::vector< std::string > Models::FMTModel::getSchedulesPriorities ( const std::vector< Core::FMTSchedule > &  p_schedules) const

Return the action names in priority of area scheduled.

Parameters
[in]p_schedulesthe schedules to look at.
Returns
a vector of action names.

◆ getSelectedMask()

Core::FMTMask Models::FMTModel::getSelectedMask ( const std::vector< Core::FMTTheme > &  originalthemes) const

Get the selection mask needed to preSolve a FMTMask when the model is presolved.

Parameters
[in]originalthemesthe original themes of the model.
Returns
the selection mask.

◆ getSeriesMaxSize()

size_t Models::FMTModel::getSeriesMaxSize ( ) const
protected

Get the maximal serie size for the whole model.

Returns
the maximal serie size.

◆ getSolution()

virtual Core::FMTSchedule Models::FMTModel::getSolution ( int  period,
bool  withlock = false 
) const
virtual

Get the standard solution for a given period, without the natural growth solution.

Parameters
[in]periodthe period to get the solution from.
[in]withlockif true the schedule contains the locked developments.
Returns
the solution schedule.

Reimplemented in Models::FMTSeModel, and Models::FMTSrModel.

◆ getStaticMask()

virtual Core::FMTMask Models::FMTModel::getStaticMask ( const Core::FMTOutputNode node,
bool  ignoreoutputvariables = false 
) const
virtual

Return a mask where static attributes have a value of 1 and dynamic attributes a value of 0.

Parameters
[in]nodethe output node to look into.
[in]ignoreoutputvariablesif true ignores the output variables.
Returns
the static mask.

◆ getStaticPreSolveThemes()

std::vector< const Core::FMTTheme * > Models::FMTModel::getStaticPreSolveThemes ( ) const
protected

Return the themes that are not part of the model, using the transition themes, constraints, actions and yields.

Returns
the static preSolve themes.

◆ getStaticTransitionThemes()

std::vector< size_t > Models::FMTModel::getStaticTransitionThemes ( ) const

Locate the static transition themes.

Returns
the indexes of the static transition themes.

◆ getTacticalConstraints()

std::vector< Core::FMTConstraint > Models::FMTModel::getTacticalConstraints ( double  penalty = 999999,
double  scheduleweight = 999999,
double  objective = 0,
double  objectivefactor = 1.0 
) const

Get the constraints adapted for a tactical model.

Parameters
[in]penaltythe penalty applied to the goals.
[in]scheduleweightthe weight of the schedule.
[in]objectivethe objective value.
[in]objectivefactorthe objective factor.
Returns
the tactical constraints.

◆ getThemes()

std::vector< Core::FMTTheme > Models::FMTModel::getThemes ( ) const
inline

Return a copy of the themes of the model.

Returns
the model themes.

◆ getTransitions()

std::vector< Core::FMTTransition > Models::FMTModel::getTransitions ( ) const
inline

Return a copy of the transitions of the model.

Returns
the model transitions.

◆ getYields()

Core::FMTYields Models::FMTModel::getYields ( ) const
inline

Return a copy of the yields of the model.

Returns
the model yields.

◆ getYieldValue()

double Models::FMTModel::getYieldValue ( const std::string &  p_mask,
const std::string &  p_yield,
int  p_age,
int  p_period 
) const

Get yield value.

Parameters
[in]p_maskmask in string format
[in]p_yieldthe yield name.
[in]p_ageDevelopment age
[in]p_periodDevelopment period
Returns
the yield value.

◆ goalConstraints()

std::vector< Core::FMTConstraint > Models::FMTModel::goalConstraints ( double  penalty = 999999) const

Return all constraints and the objective with goals and penalty.

Parameters
[in]penaltythe penalty applied to the goals.
Returns
the goal constraints.

◆ gotReIgnore()

bool Models::FMTModel::gotReIgnore ( const int &  p_replanningPeriod) const

Check if setReIgnore needs to be called.

Parameters
[in]p_replanningPeriodthe replanning period to check.
Returns
true if reignore is set else false.

◆ gotReplicate()

bool Models::FMTModel::gotReplicate ( const int &  p_replanningPeriod) const

Check if setReplicate needs to be called.

Parameters
[in]p_replanningPeriodthe replanning period to check.
Returns
true if replicate is set else false.

◆ isOptimal()

virtual bool Models::FMTModel::isOptimal ( ) const
virtual

Return true if the FMTModel is optimal.

Returns
true if the model is optimal else false.

Reimplemented in Models::FMTSrModel.

◆ isStaticNode()

bool Models::FMTModel::isStaticNode ( const Core::FMTOutputNode node,
double  ratioofset = 0.1 
) const

Return true if the node can be used in static mask functions.

The higher the ratio of set the more likely this function returns true.

Parameters
[in]nodethe output node to check.
[in]ratioofsetthe ratio of set threshold.
Returns
true if the node is static else false.

◆ isValid()

bool Models::FMTModel::isValid ( )

Validate the whole FMTModel through themes, actual developments, yields, actions, transitions, outputs and constraints.

Returns
true if the model is valid else false.

◆ locateDynamicThemes()

std::vector< const Core::FMTTheme * > Models::FMTModel::locateDynamicThemes ( const Core::FMTOutput outpu,
bool  ignoreoutputvariables = false 
) const

Return the themes used in the transition scheme.

Parameters
[in]outputhe output to look into.
[in]ignoreoutputvariablesif true ignores the output variables.
Returns
the dynamic themes.

◆ locateNodeStaticThemes()

std::vector< const Core::FMTTheme * > Models::FMTModel::locateNodeStaticThemes ( const Core::FMTOutputNode node,
bool  ignoreoutputvariables = false,
std::vector< const Core::FMTTheme * >  basethemes = std::vector< const Core::FMTTheme * >() 
) const

Return the static themes of a node based on the model transitions.

Parameters
[in]nodethe output node to look into.
[in]ignoreoutputvariablesif true ignores the output variables.
[in]basethemesoptional base themes to start from.
Returns
the static themes of the node.

◆ locateStaticThemes() [1/2]

std::vector< const Core::FMTTheme * > Models::FMTModel::locateStaticThemes ( const Core::FMTOutput output,
bool  ignoreoutputvariables = false 
) const

Return the themes that are not used in the transitions and in a given output (static themes).

Parameters
[in]outputthe output to look into.
[in]ignoreoutputvariablesif true ignores the output variables.
Returns
the static themes.

◆ locateStaticThemes() [2/2]

std::vector< const Core::FMTTheme * > Models::FMTModel::locateStaticThemes ( const Core::FMTOutputNode output,
bool  ignoreoutputvariables = false 
) const

Return the themes that are not used in the transitions and in a given output node (static themes).

Parameters
[in]outputthe output node to look into.
[in]ignoreoutputvariablesif true ignores the output variables.
Returns
the static themes.

◆ locateStaticTransitionsThemes()

std::vector< const Core::FMTTheme * > Models::FMTModel::locateStaticTransitionsThemes ( ) const

Return the static themes based on the model transitions.

Returns
the static transition themes.

◆ operator<()

bool Models::FMTModel::operator< ( const FMTModel rhs) const

Less than comparison operator of FMTModel.

Parameters
[in]rhsthe FMTModel to compare with.
Returns
true if this model is less than rhs else false.

◆ operator=() [1/2]

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

Copy assignment of FMTModel.

Parameters
[in]rhsthe FMTModel to copy.
Returns
a reference to this FMTModel.

◆ operator=() [2/2]

FMTModel & Models::FMTModel::operator= ( FMTModel &&  rhs)

Default move assignment for FMTModel.

Parameters
[in,out]rhsthe FMTModel to move from.
Returns
a reference to this FMTModel.

◆ operator==()

bool Models::FMTModel::operator== ( const FMTModel rhs) const

Equality comparison operator of FMTModel.

Parameters
[in]rhsthe FMTModel to compare with.
Returns
true if both models are equal else false.

◆ postSolve()

virtual void Models::FMTModel::postSolve ( const FMTModel originalbasemodel)
virtual

Postsolve the presolved model into the original model.

Parameters
[in]originalbasemodelthe original base model.

Reimplemented in Models::FMTSeModel, and Models::FMTSrModel.

◆ preSolve()

virtual std::unique_ptr< FMTModel > Models::FMTModel::preSolve ( std::vector< Core::FMTActualDevelopment optionaldevelopments = std::vector< Core::FMTActualDevelopment >()) const
virtual

Return a new presolved FMTModel using developments and the actual transitions of the model.

Can reduce the number of global themes, actions, transitions, yields, lifespans, outputs and constraints if the model is badly formulated.

Parameters
[in]optionaldevelopmentsoptional developments to preSolve on.
Returns
a unique pointer to the presolved FMTModel.

Reimplemented in Models::FMTLpModel, Models::FMTNssModel, Models::FMTSaModel, Models::FMTSeModel, Models::FMTSesModel, and Models::FMTSrModel.

◆ preSolveSchedule()

Core::FMTSchedule Models::FMTModel::preSolveSchedule ( const Core::FMTSchedule originalbaseschedule,
const FMTModel originalbasemodel 
) const

Return a new schedule with presolved development masks and actions.

Parameters
[in]originalbaseschedulethe original (not presolved) schedule.
[in]originalbasemodelthe original (not presolved) model.
Returns
the presolved schedule.

◆ push_back()

void Models::FMTModel::push_back ( const FMTModel rhs)

Append a FMTModel to this FMTModel without overriding the objective of the base model.

Parameters
[in]rhsthe FMTModel to append.

◆ pushTheme()

void Models::FMTModel::pushTheme ( const std::string &  p_themeName,
const std::string &  p_yieldName,
const std::vector< std::string > &  p_attributes 
)

Push a new theme and update the whole model with it.

Parameters
[in]p_themeNamethe name of the theme to push.
[in]p_yieldNamethe yield used for SBW.
[in]p_attributesthe attributes of the theme, will be the default of every mask.

◆ setActions()

void Models::FMTModel::setActions ( const std::vector< Core::FMTAction > &  lactions)

Setter for the actions of the model, replacing the originals.

Parameters
[in]lactionsthe actions to set.

◆ setArea()

void Models::FMTModel::setArea ( const std::vector< Core::FMTActualDevelopment > &  ldevs)

Setter for the initial actual developments (area section), replacing the originals.

Also checks if the actual development lifespan is shorter than the lock, raising FMTdeathwithlock, and reduces the locks accordingly if the error is set to warning.

Parameters
[in]ldevsthe actual developments to set.

◆ setAreaPeriod()

void Models::FMTModel::setAreaPeriod ( const int &  period)

Change the initial area period to the targeted period.

Parameters
[in]periodthe new area period.

◆ setCompressTime()

bool Models::FMTModel::setCompressTime ( const int &  periodStart,
const int &  periodStop,
const int &  value 
)

Set the compresstime value for a range of periods. See FMTModelParameters.h.

Parameters
[in]periodStartthe first period of the range.
[in]periodStopthe last period of the range.
[in]valuethe compresstime value to set.
Returns
true if the value is set else false.

◆ setConstraints()

void Models::FMTModel::setConstraints ( const std::vector< Core::FMTConstraint > &  lconstraint)

Setter for the constraints of the model, replacing the original.

Parameters
[in]lconstraintthe constraints to set.

◆ setDefaultObjects()

void Models::FMTModel::setDefaultObjects ( )
protected

Define the default _DEATH action and transition when they are not defined by the user.

◆ setLifespan()

void Models::FMTModel::setLifespan ( const Core::FMTLifespans llifespan)

Setter for the lifespan of the model, replacing the original.

Parameters
[in]llifespanthe lifespan to set.

◆ setName()

void Models::FMTModel::setName ( const std::string &  newname)

Set the name of the FMTModel.

Parameters
[in]newnamethe new model name.

◆ setOutputs()

void Models::FMTModel::setOutputs ( const std::vector< Core::FMTOutput > &  newoutputs)

Setter for the outputs of the model.

Parameters
[in]newoutputsthe outputs to set.

◆ setParallelLogger()

virtual void Models::FMTModel::setParallelLogger ( Logging::FMTLogger logger)
virtual

Set a thread owned logger so the solver does not work in concurrency.

Parameters
[in,out]loggerthe logger owned by the thread to pass to the solver.

Reimplemented in Models::FMTSrModel.

◆ setParameter() [1/4]

virtual bool Models::FMTModel::setParameter ( const FMTboolmodelparameters key,
const bool &  value 
)
virtual

Setter for bool model parameters. See FMTModelParameters.h.

Parameters
[in]keythe parameter key.
[in]valuethe value to set.
Returns
true if the parameter is set else false.

Reimplemented in Models::FMTNssModel, and Models::FMTSrModel.

◆ setParameter() [2/4]

virtual bool Models::FMTModel::setParameter ( const FMTdblmodelparameters key,
const double &  value 
)
virtual

Setter for double model parameters. See FMTModelParameters.h.

Parameters
[in]keythe parameter key.
[in]valuethe value to set.
Returns
true if the parameter is set else false.

◆ setParameter() [3/4]

virtual bool Models::FMTModel::setParameter ( const FMTintmodelparameters p_key,
const int &  p_value 
)
virtual

set int parameters to nss model.

Parameters
[in]p_keythe int key to change.
[in]p_valueto set to the p_key.
Returns
true if the parameter is set.

Reimplemented in Models::FMTSrModel, and Models::FMTNssModel.

◆ setParameter() [4/4]

virtual bool Models::FMTModel::setParameter ( const FMTstrmodelparameters p_key,
const std::string &  p_value 
)
virtual

Setter forstr model parameters. See FMTModelParameters.h.

Parameters
[in]p_keythe enum key of the parameter.
[in]p_valuethe value of the parameter.
Returns
true if parameter set else false.

◆ setReplicate()

void Models::FMTModel::setReplicate ( size_t  p_replicate,
int  p_ReplanningPeriod 
)

Set the constraints to the specified Replanning Period.

Parameters
[in]p_replicatethe replicate of the replanning task
[in]p_ReplanningPeriodthe replanning period.

◆ setSeed()

void Models::FMTModel::setSeed ( const int &  p_seed)
protected

seed the random number generator

Parameters
[in]p_seedthe seed.

◆ setThemes()

void Models::FMTModel::setThemes ( const std::vector< Core::FMTTheme > &  lthemes)

Setter for the themes of the model, replacing the originals.

Parameters
[in]lthemesthe themes to set.

◆ setTransitions()

void Models::FMTModel::setTransitions ( const std::vector< Core::FMTTransition > &  ltransitions)

Setter for the transitions of the model, replacing the originals.

Parameters
[in]ltransitionsthe transitions to set.

◆ setUpSchedulesForBuild()

std::vector< Core::FMTSchedule > Models::FMTModel::setUpSchedulesForBuild ( const std::vector< Core::FMTSchedule > &  schedules) const
protected

Prepare the passed schedules for building based on FORCE_PARTIAL_BUILD, always returning a filled vector covering the whole length.

Parameters
[in]schedulesthe schedules to prepare.
Returns
the prepared schedules.

◆ setYields()

void Models::FMTModel::setYields ( const Core::FMTYields lylds)

Setter for the yields of the model, replacing the original.

Parameters
[in]lyldsthe yields to set.

◆ showParameters()

virtual void Models::FMTModel::showParameters ( const bool &  showhelp = false) const
virtual

Show the parameter values.

Parameters
[in]showhelpif true shows a brief description of each parameter.

◆ solve()

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

Solve the model, overridden by each type of model.

Returns
true if the solve succeeded else false.

Reimplemented in Models::FMTLpModel, Models::FMTNssModel, Models::FMTSaModel, and Models::FMTSesModel.

◆ splitActions()

Models::FMTModel Models::FMTModel::splitActions ( const std::vector< std::string > &  p_Actions,
const std::vector< std::string > &  p_masks 
) const

Split actions using the provided masks, new actions are named action_mask and aggregated into the original action name.

Parameters
[in]p_Actionsthe actions that you want to split.
[in]p_masksthe masks you want to use to split the actions.
Returns
a newly created model with split actions.

◆ splitSchedules()

std::vector< Core::FMTSchedule > Models::FMTModel::splitSchedules ( const std::vector< Core::FMTSchedule > &  p_schedules) const

Using the actions of the model change the actions of the schedule.

Parameters
[in]p_schedulesthe schedules of the original model.
Returns
newly created schedules with split actions.

◆ SupportsMultiThreading()

virtual bool Models::FMTModel::SupportsMultiThreading ( ) const
virtual

Some solver dont support multithreading.

Returns
true if it support else false

Reimplemented in Models::FMTSrModel.

◆ swapPtr()

virtual void Models::FMTModel::swapPtr ( std::unique_ptr< FMTModel > &  rhs)
protectedvirtual

Swap this model for the element at the end of the rhs unique pointer.

Parameters
[in,out]rhsthe unique pointer to swap with.

Reimplemented in Models::FMTSaModel.

◆ useActionSerie()

bool Models::FMTModel::useActionSerie ( ) const
protected

Return true if the model makes use of action series.

Returns
true if the model uses action series else false.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Save function used for serialization to do multiprocessing across multiple cpus (pickle in Python).

Template Parameters
Archivethe archive type.
Parameters
[in,out]arthe archive to save to.
[in]versionthe serialization version.

◆ Graph::FMTGraph

template<class T1 , class T2 >
friend class Graph::FMTGraph
friend

◆ Graph::FMTGraphVertexToYield

friend class Graph::FMTGraphVertexToYield
friend

◆ Graph::FMTLineGraph

friend class Graph::FMTLineGraph
friend

◆ Parser::FMTModelParser

friend class Parser::FMTModelParser
friend

◆ Spatial::FMTSpatialGraphs

friend class Spatial::FMTSpatialGraphs
friend

◆ Spatial::FMTSpatialNodesCache

friend class Spatial::FMTSpatialNodesCache
friend

◆ Spatial::FMTSpatialSchedule

friend class Spatial::FMTSpatialSchedule
friend

Member Data Documentation

◆ actions

std::vector<Core::FMTAction> Models::FMTModel::actions
protected

Model actions from the action file and also the _death action.

◆ area

std::vector<Core::FMTActualDevelopment> Models::FMTModel::area
protected

Actualdevelopments for period 0, seen in the area section or the shapefile/raster.

◆ constraints

std::vector<Core::FMTConstraint> Models::FMTModel::constraints
protected

Outputs comming from the optimization file.

◆ lifespan

Core::FMTLifespans Models::FMTModel::lifespan
protected

lifespan data comming from the lifespan file

◆ m_generator

std::default_random_engine Models::FMTModel::m_generator
mutableprotected

Random number generator.

◆ name

std::string Models::FMTModel::name
protected

The name of the Model (name of the .pri file without extension)

◆ outputs

std::vector<Core::FMTOutput> Models::FMTModel::outputs
protected

Outputs comming from the ouput file.

◆ parameters

FMTModelParameters Models::FMTModel::parameters
protected

Parameters needed for the function doPlanning by the different types of FMTModel. See FMTModelParameters for detail description or use FMTModel::showParameters(true) to see your parameters and a brief description.

◆ statictransitionthemes

std::vector<size_t> Models::FMTModel::statictransitionthemes
protected

The location of the themes static from transitions.

◆ themes

std::vector<Core::FMTTheme> Models::FMTModel::themes
protected

Model themes of the landscape section file.

◆ transitions

std::vector<Core::FMTTransition> Models::FMTModel::transitions
protected

Model transitions from the transition file and also the _death transition.

◆ yields

Core::FMTYields Models::FMTModel::yields
protected

Yields data comming from the yield file.


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