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

#include <FMTlpmodel.hpp>

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

Public Member Functions

void clearcache ()
 
void clearconstraintlocation ()
 
 FMTlpmodel (const FMTmodel &base, FMTsolverinterface lsolvertype)
 
 FMTlpmodel ()
 
 FMTlpmodel (const FMTmodel &base, const Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties > &lgraph, const FMTlpsolver &lsolver, const std::vector< std::unordered_map< std::string, std::vector< std::vector< int > > > > &lelements)
 
 FMTlpmodel (const FMTlpmodel &rhs)
 
bool initialsolve ()
 
 FMTlpmodel (FMTlpmodel &&rhs)=default
 
FMTlpmodeloperator= (FMTlpmodel &&rhs)=default
 
void setstrictlypositivesoutputsmatrix ()
 
virtual std::map< std::string, double > getoutput (const Core::FMToutput &output, int period, Core::FMToutputlevel level=Core::FMToutputlevel::standard) const
 
virtual std::vector< Core::FMTconstraintgetreplanningconstraints (const std::string &modeltype, const std::vector< Core::FMTconstraint > &localconstraints, const int &period) const
 
void addscheduletoobjective (const Core::FMTschedule &schedule, double weight=1000)
 
bool operator== (const FMTlpmodel &rhs) const
 
bool operator!= (const FMTlpmodel &rhs) const
 
Graph::FMTgraphstats setobjective (const Core::FMTconstraint &objective)
 
Graph::FMTgraphstats setconstraint (const Core::FMTconstraint &constraint)
 
Graph::FMTgraphstats eraseconstraint (const Core::FMTconstraint &constraint, int period=-1)
 
std::map< std::string, std::vector< double > > getvariabilities (const std::vector< Core::FMToutput > &outputs, const int &periodstart, const int &periodstop)
 
FMTlpmodel getmodelfromproportions (const std::vector< Core::FMTmask > &globalmasks, std::vector< double > tolerances) const
 
std::map< std::string, std::vector< double > > getareavariabilities (const std::vector< Core::FMToutput > &localoutputs, const std::vector< Core::FMTmask > &globalmasks, std::vector< double > tolerances=std::vector< double >()) const
 
Graph::FMTgraphstats eraseperiod (bool constraintsonly=false)
 
std::vector< Heuristics::FMToperatingareaschedulergetoperatingareaschedulerheuristics (const std::vector< Heuristics::FMToperatingareascheme > &opareas, const Core::FMToutputnode &node, size_t numberofheuristics=1, bool copysolver=true)
 
std::vector< Heuristics::FMToperatingareaclusterergetoperatingareaclustererheuristics (const std::vector< Heuristics::FMToperatingareacluster > &clusters, const Core::FMToutput &statisticoutput, const Core::FMToutput &areaoutput, const int &period, size_t numberofheuristics=1, int minimalnumberofclusters=-1, int maximalnumberofclusters=-1) const
 
bool resolve ()
 
FMTlpmodeloperator= (const FMTlpmodel &rhs)
 
 ~FMTlpmodel ()=default
 
FMTlpmodel getlocalmodel (FMTmodel localmodel=FMTmodel(), int period=0) const
 
double getObjValue () const
 
void writeLP (const std::string &location)
 
void writeMPS (const std::string &location)
 
virtual std::unique_ptr< FMTmodelclone () const
 
virtual std::unique_ptr< FMTmodelpresolve (std::vector< Core::FMTactualdevelopment > optionaldevelopments=std::vector< Core::FMTactualdevelopment >()) const
 
virtual bool build (std::vector< Core::FMTschedule > schedules=std::vector< Core::FMTschedule >())
 
virtual bool solve ()
 
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

This model is a type III LP forest planning model. The graph is divided per period. This model is made for replanning and simple forest planning LP optimization. It makes heavy use of FMTgraph for building the matrix. FMTgraph being based on a list structure FMTlpmodel can easely be extended (by the back) using the function buildperiod() or shrinked (by the front) using the function eraseperiod. The matrix is held within the solverinterface pointer.

Constructor & Destructor Documentation

◆ FMTlpmodel() [1/5]

Models::FMTlpmodel::FMTlpmodel ( const FMTmodel base,
FMTsolverinterface  lsolvertype 
)

Main constructor used to build FMTlpmodel using it's base class and to let the user choose the solvertype (CLP,MOSEK,GUROBI,CPLEX) see FMTsolverinterface.h for more information about the supported solvertype.

◆ FMTlpmodel() [2/5]

Models::FMTlpmodel::FMTlpmodel ( )

Default constructor of FMTlpmodel

◆ FMTlpmodel() [3/5]

Models::FMTlpmodel::FMTlpmodel ( const FMTmodel base,
const Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties > &  lgraph,
const FMTlpsolver lsolver,
const std::vector< std::unordered_map< std::string, std::vector< std::vector< int > > > > &  lelements 
)

Constructor of FMTlpmodel mainly use in postsolve to pass each attributes of the class.

◆ FMTlpmodel() [4/5]

Models::FMTlpmodel::FMTlpmodel ( const FMTlpmodel rhs)

Copy constructor of FMTlpmodel

◆ FMTlpmodel() [5/5]

Models::FMTlpmodel::FMTlpmodel ( FMTlpmodel &&  rhs)
default

Default move constructor for FMTlpmodel.

◆ ~FMTlpmodel()

Models::FMTlpmodel::~FMTlpmodel ( )
default

Default destructor of FMTlpmodel

Member Function Documentation

◆ addscheduletoobjective()

void Models::FMTlpmodel::addscheduletoobjective ( const Core::FMTschedule schedule,
double  weight = 1000 
)

This function will addup weight to the objective function for a given schedule.

◆ build()

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

This function build the graph and setsolution if (schedules) are passed to the function. If FORCE_PARTIAL_BUILD is set at true and (schedules) are passed to the function, only a partial graph will be build for the number of period corresponding to schedules passed.

It will be possible in the futur to have a mix in fullgraph and schedulegraph, but now its not implemented

Reimplemented from Models::FMTmodel.

◆ clearcache()

void Models::FMTlpmodel::clearcache ( )
virtual

Remove cache to release memory.

Reimplemented from Models::FMTmodel.

◆ clearconstraintlocation()

void Models::FMTlpmodel::clearconstraintlocation ( )

Clear the localisation in the matrix...if you do that you break the relation between the FMTmodel constraints and the matrix contraints.

◆ clone()

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

Get a clone of the FMTlpmodel

Reimplemented from Models::FMTsrmodel.

◆ eraseconstraint()

Graph::FMTgraphstats Models::FMTlpmodel::eraseconstraint ( const Core::FMTconstraint constraint,
int  period = -1 
)

Erase a constraint for a given period in the matrix and in the model elements. If period == -1 then it will erase the constraint for the whole horizon else it will only erase the constraint for the specified period.

◆ eraseperiod()

Graph::FMTgraphstats Models::FMTlpmodel::eraseperiod ( bool  constraintsonly = false)

When doing replanning or simply model update the user may want to delete the first period (front) of the graph and the matrix to get a FMTmodel - first period. The planning length will be shrinked to originalsize - 1.

◆ getareavariabilities()

std::map< std::string, std::vector< double > > Models::FMTlpmodel::getareavariabilities ( const std::vector< Core::FMToutput > &  localoutputs,
const std::vector< Core::FMTmask > &  globalmasks,
std::vector< double >  tolerances = std::vector< double >() 
) const

Sometime it is usefull to know what is the impact on some outputs of changing a set of developements of the area of the model for a given global mask. This function uses the globalmasks has target and returns the change in outputs resulting from a variation > 0 or < 0, will generate no map key if infeasible.

◆ getcopy()

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

◆ getlocalmodel()

FMTlpmodel Models::FMTlpmodel::getlocalmodel ( FMTmodel  localmodel = FMTmodel(),
int  period = 0 
) const

This fonction is based on model hierarchy. The *this FMTlpmodel is considered has the general parent model the localmodel if not empty is considered one part of the child model. The function is going to append the child model to the subset of the general model generated by the selected period. Need to have a builded graph with a solution to use this function. The returned model wont be solved nor builded.

◆ getmodelfromproportions()

FMTlpmodel Models::FMTlpmodel::getmodelfromproportions ( const std::vector< Core::FMTmask > &  globalmasks,
std::vector< double >  tolerances 
) const

Will returns a new FMTlpmodel with changes in the initial area based on the tolerances of each globalmasks provided in the tolerances vector tolerance > 0 = increase in area, tolerance < 0 = decrease in area.

◆ getObjValue()

double Models::FMTlpmodel::getObjValue ( ) const

Get the objective value of the solved matrix.

◆ getoperatingareaclustererheuristics()

std::vector< Heuristics::FMToperatingareaclusterer > Models::FMTlpmodel::getoperatingareaclustererheuristics ( const std::vector< Heuristics::FMToperatingareacluster > &  clusters,
const Core::FMToutput statisticoutput,
const Core::FMToutput areaoutput,
const int &  period,
size_t  numberofheuristics = 1,
int  minimalnumberofclusters = -1,
int  maximalnumberofclusters = -1 
) const

Using multiple operating areas this function generates multiples heuristics for solving the operating area clustering problem. The user can decide to change some parameters of heuristics that are in the vectors.The FMTlpmodel has to be solved so the heuristic can use the value of the (output) of a given (period) has a statistic to perform clustering.

◆ getoperatingareaschedulerheuristics()

std::vector< Heuristics::FMToperatingareascheduler > Models::FMTlpmodel::getoperatingareaschedulerheuristics ( const std::vector< Heuristics::FMToperatingareascheme > &  opareas,
const Core::FMToutputnode node,
size_t  numberofheuristics = 1,
bool  copysolver = true 
)

Using multiple operating areas and a simple output node a MIP formulation (using the BFECopt heuristic) is done using the matrix of the FMTlpmodel. The matrix can be copied within the operatingareaheuristic or directly uses the matrix of the FMTlpmodel (if numberofheuristics == 1 and copysolver == true). The user can than decide to change some parameters of heuristics that are in the vectors.

◆ getoutput()

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

Get the output value of a output for a given period using the solution of the matrix. the map key returned consist of output name if level == FMToutputlevel::standard || level == FMToutputlevel::totalonly, or developement name if level == FMToutputlevel::developpement, this function can also return the value of a variable output.

Reimplemented from Models::FMTsrmodel.

◆ getreplanningconstraints()

virtual std::vector< Core::FMTconstraint > Models::FMTlpmodel::getreplanningconstraints ( const std::string &  modeltype,
const std::vector< Core::FMTconstraint > &  localconstraints,
const int &  period 
) const
virtual

During replaning some local/global constraints need to be ajusted to the global model. The function will take a vector of local/global constraint and ajust the bounds using the solution of this global/local model.

Reimplemented from Models::FMTmodel.

◆ getvariabilities()

std::map< std::string, std::vector< double > > Models::FMTlpmodel::getvariabilities ( const std::vector< Core::FMToutput > &  outputs,
const int &  periodstart,
const int &  periodstop 
)

Get the variability of multiple outputs for a given tolerance(see modelparameters) for each period between (periodstart) and (periodstop). Need to call this function after initialsolve. The actual objective function is transform to a constraint and then each output are minimized and maximized to get their actual range for each period. the returned map key are the name of the output plus UB for upper bound (maximization) and LB for lower bound (minimization). This function do a lot of resolve.

◆ initialsolve()

bool Models::FMTlpmodel::initialsolve ( )

Cold start of the LPsolve of a simple LP model. By default initialsolve will call solverinterface->initialsolve() but using the FMTsolverinterface enum this function will try to use the best solver parameters for a Type III Forest planning model. For all solvers interior point is considered the best algorith.

◆ operator!=()

bool Models::FMTlpmodel::operator!= ( const FMTlpmodel rhs) const

Comparison operator of FMTlpmodel

◆ operator=() [1/2]

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

Copy assignment of FMTlpmodel

◆ operator=() [2/2]

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

Default move assignment for FMTlpmodel.

◆ operator==()

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

Comparison operator of FMTlpmodel

◆ presolve()

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

◆ resolve()

bool Models::FMTlpmodel::resolve ( )

By default call solverinterface->resolve() when some changes are done to the model. The user dont necessery need the call initialsolve every time the matrix has changed a call to resolve maybe enought.

◆ setconstraint()

Graph::FMTgraphstats Models::FMTlpmodel::setconstraint ( const Core::FMTconstraint constraint)

This function set a constraint in the matrix for the whole planning horizon (graph length). If the function is recalled if the constraint already exist in the matrix in wont be replaced. Can be called after calling builperiod in replanning.

◆ setobjective()

Graph::FMTgraphstats Models::FMTlpmodel::setobjective ( const Core::FMTconstraint objective)

This function set the objective of the matrix for the whole planning horizon (graph length). Note that the objective function is always the firts constraint in the constraints vector of a FMTmodel. If a objective was already set before it will replace it when calling this function.

◆ setstrictlypositivesoutputsmatrix()

void Models::FMTlpmodel::setstrictlypositivesoutputsmatrix ( )

To set the model parameter STRICTLY_POSITIVE at true.

◆ solve()

virtual bool Models::FMTlpmodel::solve ( )
virtual

This function call initialsolve on the solver.

Reimplemented from Models::FMTmodel.

◆ writeLP()

void Models::FMTlpmodel::writeLP ( const std::string &  location)

Write the solverinterface matrix to a file (location) using the lp formulation.

◆ writeMPS()

void Models::FMTlpmodel::writeMPS ( const std::string &  location)

Write the solverinterface matrix to a file (location) using the MPS formulation.

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: