FMT 1.2.0
Forest management tools for forest planning
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Spatial::FMTSolutionTracker Class Reference

Track the constraint values of a spatial solution as line graphs are added to or removed from the solution, per constraint family. More...

#include <FMTSolutionTracker.h>

Inheritance diagram for Spatial::FMTSolutionTracker:
[legend]
Collaboration diagram for Spatial::FMTSolutionTracker:
[legend]

Public Member Functions

 FMTSolutionTracker (const std::vector< size_t > &p_solution, const std::vector< std::vector< size_t > > &p_ConstraintsFamilies, size_t p_NumberOfFamilies)
 Construct a FMTSolutionTracker from a solution and its constraint families.
 
 FMTSolutionTracker ()
 Default constructor for FMTSolutionTracker.
 
 FMTSolutionTracker (const FMTSolutionTracker &p_rhs)=default
 Default copy constructor for FMTSolutionTracker.
 
FMTSolutionTrackeroperator= (const FMTSolutionTracker &p_rhs)=default
 Default copy assignment operator for FMTSolutionTracker.
 
 ~FMTSolutionTracker ()=default
 Default destructor for FMTSolutionTracker.
 
void addToSolution (size_t p_family, std::map< Graph::FMTLineGraph, FMTGraphInfo >::const_iterator p_NewGraph, size_t p_LastGraphId)
 Add a line graph to the solution for a constraint family, updating the tracked constraint values.
 
void removeFromSolution (size_t p_family, std::map< Graph::FMTLineGraph, FMTGraphInfo >::const_iterator p_OldGraph)
 Remove a line graph from the solution for a constraint family, updating the tracked constraint values.
 
const std::vector< double > & getConstraintsValues (size_t p_Constraint) const
 Return the tracked values of a constraint.
 
size_t getNumberOfCells (size_t p_GraphId) const
 Return the number of cells of a graph.
 
size_t size () const
 Return the number of graphs in the solution.
 
void swap (FMTSolutionTracker &p_tracker)
 Swap this FMTSolutionTracker with another one.
 
size_t getNonSpatialCellsCount () const
 Return the number of non spatial cells.
 
void setConstraintValues (const std::vector< std::vector< double > > &p_constraintValues, const std::vector< std::vector< size_t > > &p_ConstraintsFamilies, size_t p_NumberOfFamilies)
 Set the constraint values and families.
 
bool enableTracking ()
 Enable the tracking of the constraint values.
 
void disableTracking ()
 Disable the tracking of the constraint values.
 
bool isTrackingEnable () const
 Return true if the tracking is enabled.
 
- 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)
 

Additional Inherited Members

- 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 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).
 
- 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

Track the constraint values of a spatial solution as line graphs are added to or removed from the solution, per constraint family.

Constructor & Destructor Documentation

◆ FMTSolutionTracker() [1/3]

Spatial::FMTSolutionTracker::FMTSolutionTracker ( const std::vector< size_t > &  p_solution,
const std::vector< std::vector< size_t > > &  p_ConstraintsFamilies,
size_t  p_NumberOfFamilies 
)

Construct a FMTSolutionTracker from a solution and its constraint families.

Parameters
[in]p_solutionthe solution.
[in]p_ConstraintsFamiliesthe constraint families.
[in]p_NumberOfFamiliesthe number of families.

◆ FMTSolutionTracker() [2/3]

Spatial::FMTSolutionTracker::FMTSolutionTracker ( )

Default constructor for FMTSolutionTracker.

◆ FMTSolutionTracker() [3/3]

Spatial::FMTSolutionTracker::FMTSolutionTracker ( const FMTSolutionTracker p_rhs)
default

Default copy constructor for FMTSolutionTracker.

Parameters
[in]p_rhsthe FMTSolutionTracker to copy.

◆ ~FMTSolutionTracker()

Spatial::FMTSolutionTracker::~FMTSolutionTracker ( )
default

Default destructor for FMTSolutionTracker.

Member Function Documentation

◆ addToSolution()

void Spatial::FMTSolutionTracker::addToSolution ( size_t  p_family,
std::map< Graph::FMTLineGraph, FMTGraphInfo >::const_iterator  p_NewGraph,
size_t  p_LastGraphId 
)

Add a line graph to the solution for a constraint family, updating the tracked constraint values.

Parameters
[in]p_familythe constraint family.
[in]p_NewGraphthe new graph.
[in]p_LastGraphIdthe last graph id.

◆ disableTracking()

void Spatial::FMTSolutionTracker::disableTracking ( )

Disable the tracking of the constraint values.

◆ enableTracking()

bool Spatial::FMTSolutionTracker::enableTracking ( )

Enable the tracking of the constraint values.

Returns
true if the tracking is enabled else false.

◆ getConstraintsValues()

const std::vector< double > & Spatial::FMTSolutionTracker::getConstraintsValues ( size_t  p_Constraint) const

Return the tracked values of a constraint.

Parameters
[in]p_Constraintthe constraint index.
Returns
the constraint values.

◆ getNonSpatialCellsCount()

size_t Spatial::FMTSolutionTracker::getNonSpatialCellsCount ( ) const

Return the number of non spatial cells.

Returns
the non spatial cells count.

◆ getNumberOfCells()

size_t Spatial::FMTSolutionTracker::getNumberOfCells ( size_t  p_GraphId) const

Return the number of cells of a graph.

Parameters
[in]p_GraphIdthe graph id.
Returns
the number of cells.

◆ isTrackingEnable()

bool Spatial::FMTSolutionTracker::isTrackingEnable ( ) const

Return true if the tracking is enabled.

Returns
true if the tracking is enabled else false.

◆ operator=()

FMTSolutionTracker & Spatial::FMTSolutionTracker::operator= ( const FMTSolutionTracker p_rhs)
default

Default copy assignment operator for FMTSolutionTracker.

Parameters
[in]p_rhsthe FMTSolutionTracker to copy.
Returns
a reference to this FMTSolutionTracker.

◆ removeFromSolution()

void Spatial::FMTSolutionTracker::removeFromSolution ( size_t  p_family,
std::map< Graph::FMTLineGraph, FMTGraphInfo >::const_iterator  p_OldGraph 
)

Remove a line graph from the solution for a constraint family, updating the tracked constraint values.

Parameters
[in]p_familythe constraint family.
[in]p_OldGraphthe graph to remove.

◆ setConstraintValues()

void Spatial::FMTSolutionTracker::setConstraintValues ( const std::vector< std::vector< double > > &  p_constraintValues,
const std::vector< std::vector< size_t > > &  p_ConstraintsFamilies,
size_t  p_NumberOfFamilies 
)

Set the constraint values and families.

Parameters
[in]p_constraintValuesthe constraint values.
[in]p_ConstraintsFamiliesthe constraint families.
[in]p_NumberOfFamiliesthe number of families.

◆ size()

size_t Spatial::FMTSolutionTracker::size ( ) const

Return the number of graphs in the solution.

Returns
the size of the solution.

◆ swap()

void Spatial::FMTSolutionTracker::swap ( FMTSolutionTracker p_tracker)

Swap this FMTSolutionTracker with another one.

Parameters
[in,out]p_trackerthe FMTSolutionTracker to swap with.

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