8#ifndef FMTSEM_Hm_included
9#define FMTSEM_Hm_included
13#include <boost/serialization/vector.hpp>
14#include <boost/serialization/serialization.hpp>
15#include <boost/serialization/nvp.hpp>
16#include <boost/serialization/export.hpp>
84 return m_BestSolution;
98 std::vector<Core::FMTSchedule>
getSchedule(
bool withlock=
false)
const;
123 std::vector<Core::FMTActualDevelopment> optionaldevelopments = std::vector<Core::FMTActualDevelopment>())
const;
164 virtual std::unique_ptr<FMTModel>
clone()
const;
172 virtual std::vector<Core::FMTActualDevelopment>
getArea(
int period = 0,
bool beforegrowanddeath =
false)
const;
179 virtual std::unique_ptr<FMTModel>
getCopy(
int period = 0)
const;
194 bool withlock =
false)
const;
206 double& p_Objective,
double& p_PrimalInFeasibility,
207 bool withsense =
true,
bool withfactorization =
false,
bool withspatial =
true)
const;
267 const size_t& randomiterations,
268 unsigned int seed = 0,
270 bool log =
true)
const;
294 friend class boost::serialization::access;
295 template<
class Archive>
296 void serialize(Archive& ar,
const unsigned int version)
298 ar& boost::serialization::make_nvp(
"model", boost::serialization::base_object<FMTModel>(*
this));
306 virtual void swapPtr(std::unique_ptr<FMTModel>& rhs);
318 void _buildGraphs(
double p_cellSize);
343 double _getConstraintNumerator(
size_t p_constraint)
const;
344 static const double MAX_FACTOR;
#define FMT_DBL_TOLERANCE
Definition: FMTutility.h:11
#define FMTEXPORT
Definition: FMTutility.h:125
Class letting the user formulate a constraint in the optimize section or collect data across the grap...
Definition: FMTOutput.h:37
Spatially referenced schedule describing the area of developments for which an action can be operated...
Definition: FMTSchedule.h:29
Base class for the different models in FMT.
Definition: FMTModel.h:62
Abstract class for spatially explicit models, parent of FMTSesModel and FMTSaModel.
Definition: FMTSeModel.h:33
double _getGlobalObjective(const Spatial::FMTSpatialSchedule &p_Schedule) const
Return the global objective of a spatial schedule.
std::vector< Core::FMTSchedule > getSchedule(bool withlock=false) const
Return a copy of the operated schedules of the model, which can differ from the potential schedule.
Spatial::FMTSpatialSchedule m_BestSolution
Contains the builded spatialsolution latest or best one.
Definition: FMTSeModel.h:219
virtual double getObjectiveValue() const
Return the global objective value of the actual solution.
virtual std::vector< Core::FMTActualDevelopment > getArea(int period=0, bool beforegrowanddeath=false) const
Get the area of a period based on the solution.
FMTSeModel(const FMTModel &rhs)
Construct a FMTSeModel from a model.
FMTSeModel(const FMTModel &rhs, const Spatial::FMTForest &forest)
Construct a FMTSeModel from a model and a forest.
Spatial::FMTSpatialSchedule _getNewSolution(const Spatial::FMTSpatialSchedule &p_FromSolution) const
Return a new solution from an existing one.
std::string getDisturbanceStats() const
Return a string of patch statistics (area, perimeter) of the disturbances stack.
virtual std::map< std::string, double > getOutput(const Core::FMTOutput &output, int period, Core::FMToutputlevel level=Core::FMToutputlevel::standard) const
Get the output value for a period using the spatial solution.
virtual Core::FMTSchedule getSolution(int period, bool withlock=false) const
Get the standard solution for a period, without the natural growth solution.
virtual std::unique_ptr< FMTModel > clone() const
Get a clone of the FMTSeModel.
Spatial::FMTSpatialGraphs m_SpatialGraphs
Contains all the SpatialGraphs.
Definition: FMTSeModel.h:222
void getSolutionStatus(const Spatial::FMTSpatialSchedule &p_SpatialSchedule, double &p_Objective, double &p_PrimalInFeasibility, bool withsense=true, bool withfactorization=false, bool withspatial=true) const
Get the status of a spatial solution.
double getConstraintEvaluation(size_t p_Constraint) const
Evaluate a constraint with the actual solution.
std::map< std::string, double > greedyReferenceBuild(Spatial::FMTSpatialSchedule &p_SpatialSchedule, const Core::FMTSchedule &schedule, const size_t &randomiterations, unsigned int seed=0, double tolerance=FMT_DBL_TOLERANCE, bool log=true) const
Find the best spatialization for a schedule using random draws.
Spatial::FMTForest getMapping() const
Return a copy of the actual spatial forest state of each development.
virtual std::unique_ptr< FMTModel > preSolve(std::vector< Core::FMTActualDevelopment > optionaldevelopments=std::vector< Core::FMTActualDevelopment >()) const
Return a presolved copy of the model, presolving the forest map and the spatial actions.
std::vector< double > _getConstraintsValues(const Spatial::FMTSpatialSchedule &p_SpatialSchedule) const
Return the constraint values of a spatial schedule.
FMTSeModel()
Default constructor for FMTSeModel.
void _doRefactorization(Spatial::FMTSpatialSchedule &p_SpatialSchedule) const
Refactorize a spatial schedule.
bool setInitialMapping(const Spatial::FMTForest &forest)
Set the initial forest state, to be set before greedyReferenceBuild is called.
virtual Spatial::FMTLayer< double > getSpatialOutput(const Core::FMTOutput &output, int period) const
Get the spatial output value based on the spatial solution.
virtual void postSolve(const FMTModel &originalbasemodel)
Postsolve the model back into a complete model using the original model.
std::vector< Core::FMTSchedule > getSchedules(const Spatial::FMTSpatialSchedule &p_SpatialSchedule, bool withlock=false) const
Get the schedules of a spatial solution.
FMTSeModel(const FMTSeModel &rhs)
Copy constructor for FMTSeModel.
virtual std::unique_ptr< FMTModel > getCopy(int period=0) const
Return a copy of the model for a period, cleaning the constraints and keeping the objective.
double _getConstraintFactor(size_t p_constraint, double p_GrossValue) const
Return the factor of a constraint for a gross value.
void logConstraintsFactors() const
Log the constraint factors.
virtual ~FMTSeModel()=default
Default virtual destructor for FMTSeModel.
bool _isValidFactor(double p_GrossValue) const
Return true if a gross value is a valid factor.
Spatial::FMTSpatialSchedule getSpSchedule() const
Return a copy of the spatially explicit solution.
Definition: FMTSeModel.h:82
void logConstraintsInfeasibilities() const
Log the constraint infeasibilities, spatial or not.
Spatially referenced layer of Core::FMTDevelopment representing the forest.
Definition: FMTForest.h:33
Definition: FMTParser.h:54
Container of the line graphs of a spatially explicit model, organized by constraint family,...
Definition: FMTSpatialGraphs.h:52
Map containing a line graph for each cell, representing the stand, the action and the transition at e...
Definition: FMTSpatialSchedule.h:50
FMToutputlevel
Enumerator describing the level of detail of an output (standard, total only, development).
Definition: FMTutility.h:22
@ standard
Definition: FMTutility.h:23
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTAreaParser.h:54
Definition: FMTAreaParser.h:40