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

Operating area scheme giving information about its opening time, green up and return time. More...

#include <FMTOperatingAreaScheme.h>

Inheritance diagram for Heuristics::FMTOperatingAreaScheme:
[legend]
Collaboration diagram for Heuristics::FMTOperatingAreaScheme:
[legend]

Public Member Functions

void setReturnTime (const size_t &minimalreturntime, const size_t &maximalreturntime)
 Set the minimal and maximal return time.
 
double getThreshold () const
 Get the threshold.
 
size_t getOpeningTime () const
 Get the opening time.
 
size_t getMinimalReturnTime () const
 Get the minimal return time.
 
size_t getRepetition () const
 Get the repetition of the pattern.
 
size_t getMaximalReturnTime () const
 Get the maximal return time.
 
bool empty () const
 Check if the operating area is empty, which is possible if there is no potential development to operate.
 
const std::vector< int > & getOpeningBinaries () const
 Return the variable indexes of the binaries of all the potential schemes of the operating area.
 
size_t getStartingPeriod () const
 Return the starting period at which all the schemes of the operating area start.
 
double getBinariesSum (const double *primalsolution) const
 Summarize the value of all the binary variables for all the potential schemes from the primal solution.
 
double getActivitySum (const double *dualsolution) const
 Summarize the value of all the constraints for all the potential schemes from the dual solution.
 
bool isThresholdActivity (const double *dualsolution) const
 Return true if every constraint activity is above the threshold.
 
std::map< int, std::vector< int > > getCommonBinaries (const FMTOperatingAreaScheme &neighbor) const
 Return a map with the binary indexes of this operating area as keys and the binary indexes of the neighbor as elements, using the green up members.
 
size_t getPrimalSolutionIndex (const double *primalsolution) const
 Return the index of the scheme the operating area is bounded to, from the primal solution.
 
bool getDualSolutionIndex (const double *upperbound, size_t &locid) const
 Return the index of the scheme used by the operating area from the rows upper bounds.
 
bool havePotentialSolution (const double *primalsolution) const
 Check if a scheme binary has a value greater than 0 in the primal solution, indicating a potential scheme to choose.
 
bool haveActivitySolution (const double *dualsolution) const
 Check if a set of scheme constraints has an activity value greater than 0 in the dual solution, indicating a potential scheme to choose.
 
bool isAllPrimalBounded (const double *lowerbounds, const double *upperbounds) const
 Return false if any binary lower or upper bound is not set to 1.
 
bool isAllDualBounded (const double *upperbounds) const
 Return false if any constraint upper bound is different from 0.
 
bool isPrimalBounded (const double *lowerbounds, const double *upperbounds) const
 Return true if any binary lower or upper bound is set to 1.
 
bool isDualBounded (const double *upperbounds) const
 Return true if any constraint upper bound is set to 0.
 
std::vector< size_t > getPotentialPrimalSchemes (const double *p_primalsolution, const double *p_lowerbounds, const double *p_upperbounds, const std::vector< FMTOperatingAreaScheme > &p_neighbors) const
 Return the potential scheme indexes from the primal solution, its bounds and the neighboring operating areas, ordered from the most to the least area used but greater than 0.
 
std::vector< size_t > getPotentialDualSchemes (const double *p_dualsolution, const double *p_upperbound, const std::vector< FMTOperatingAreaScheme > &p_neighbors) const
 Return the potential scheme indexes from the dual solution, the rows upper bounds and the neighboring operating areas, ordered from the most to the least area used but greater than 0.
 
void getRessourcesToDelete (std::vector< int > &colstodelete, std::vector< int > &rowstodelete) const
 Push all the variables and constraints of the operating area into the columns and rows to delete vectors.
 
void pushBinaries (std::vector< int > &targets) const
 Push all the binaries into a targets vector.
 
size_t unboundAllPrimalSchemes (std::vector< int > &targets, std::vector< double > &bounds) const
 Push the binary indexes into the targets vector and push 0 and 1 into the bounds.
 
size_t unboundAllDualSchemes (std::vector< int > &targets, std::vector< double > &bounds) const
 Push the constraint indexes into the targets vector, push -inf and the area into the bounds, and return the id of the unbounded scheme.
 
size_t boundAllPrimalSchemes (std::vector< int > &targets, std::vector< double > &bounds, double boundvalue=1.0) const
 Push the variable indexes into the targets vector and push the bound value into the bounds.
 
size_t boundAllDualSchemes (std::vector< int > &targets, std::vector< double > &bounds) const
 Push the constraint indexes into the targets vector and push the bound value into the bounds.
 
bool boundPrimalScheme (std::vector< int > &targets, std::vector< double > &bounds, const size_t &schemeid) const
 Push the variable index of a scheme binary into the targets vector and push 1 and 1 into the bounds.
 
bool unboundDualScheme (const double *rowactivities, std::vector< int > &targets, std::vector< double > &bounds, const size_t &schemeid, bool looseset=true) const
 Push the constraints of a scheme into the targets vector with -inf and the area bounds, and push the constraints of the other schemes with 0 and 0 bounds.
 
std::vector< double > getPrimalSolution (const double *primalsolution) const
 Return the yield solution of the primal problem by summing up all the binary variables into a single vector.
 
std::vector< double > getDualSolution (const double *upperbounds, const double *dualsolution, bool &canbreakneighboring) const
 Return the yield solution of the dual problem by setting the selected scheme solution into a vector.
 
std::vector< double > getDualLowerBounds (const double *lowerbounds, const double *upperbounds) const
 Return the lower bounds of the solution for bounding the minimal harvested area.
 
void setConstraints (const std::vector< std::vector< Graph::FMTGraph< Graph::FMTVertexProperties, Graph::FMTEdgeProperties >::FMTvertex_descriptor > > &vertices, const std::vector< Graph::FMTGraph< Graph::FMTVertexProperties, Graph::FMTEdgeProperties >::FMTvertex_descriptor > &totalareavertices, const Graph::FMTGraph< Graph::FMTVertexProperties, Graph::FMTEdgeProperties > &graph, Models::FMTLpSolver &solver, const double *primalsolution, const std::vector< int > &actionIDS)
 Set up the constraints and variables using a matrix build and a primal solution, filling all the matrix element members.
 
 FMTOperatingAreaScheme (const FMTOperatingArea &oparea, const size_t &lopeningtime, const size_t &lreturntime, const size_t &lmaxreturntime, const size_t &lrepetition, const size_t &lgreenup, const size_t &lstartingperiod, double minimalarearatio=0.0)
 Main constructor for FMTOperatingAreaScheme.
 
 FMTOperatingAreaScheme ()=default
 Default constructor for FMTOperatingAreaScheme.
 
 FMTOperatingAreaScheme (const FMTOperatingAreaScheme &rhs)=default
 Copy constructor for FMTOperatingAreaScheme.
 
FMTOperatingAreaSchemeoperator= (const FMTOperatingAreaScheme &rhs)=default
 Copy assignment operator for FMTOperatingAreaScheme.
 
void fillBoundsNVariables (const double *lowerb, const double *upperb, std::vector< int > &constraintstargets, std::vector< double > &bounds) const
 For each scheme constraint, take the constraint bounds of the actual model.
 
bool operator== (const FMTOperatingAreaScheme &rhs) const
 Comparison operator for FMTOperatingAreaScheme.
 
bool operator!= (const FMTOperatingAreaScheme &rhs) const
 Comparison operator for FMTOperatingAreaScheme.
 
 ~FMTOperatingAreaScheme ()=default
 Default destructor for FMTOperatingAreaScheme.
 
FMTOperatingAreaScheme preSolve (const Core::FMTMask &selectedmask, const std::vector< Core::FMTTheme > &presolvedthemes) const
 Return a presolved FMTOperatingAreaScheme using a mask and a subset of the original themes.
 
size_t getNumberOfScheme () const
 Return the number of schemes of the operating area, only usable after schemesToLp has been called.
 
size_t getNumberOfSimpleScheme () const
 Return the number of simple schemes with a fixed return time and opening time.
 
const int & getRejectedNodesCid () const
 Return the constraint id of the rejected nodes.
 
const std::vector< std::vector< int > > & getOpeningConstraints () const
 Return the opening constraints of the operating area.
 
const int & getMaximalSchemesConstraint () const
 Return the constraint id ensuring that only one scheme is chosen.
 
const size_t & getGreenUp () const
 Return the green up.
 
- Public Member Functions inherited from Heuristics::FMTOperatingArea
FMTOperatingAreaoperator+= (const double &value)
 Add area to the operating area.
 
std::vector< Core::FMTMaskgetNeighbors () const
 Return a copy of the neighbors masks of the operating area.
 
double getArea () const
 Get the area of the operating area.
 
double getNeighborsPerimeter () const
 Return the percentage of perimeter the operating area needs to share with another operating area to be considered a neighbor.
 
Core::FMTMask getMask () const
 Return the mask of the operating area.
 
void setNeighbors (const std::vector< Core::FMTMask > &lneighbors)
 Set the neighbors masks of the operating area.
 
 FMTOperatingArea (const Core::FMTMask &lmask, const double &lneighborsperimeter)
 Main constructor for FMTOperatingArea from a mask and a neighbors perimeter.
 
void setArea (const double &newarea)
 Set the area of the operating area.
 
 FMTOperatingArea ()=default
 Default constructor for FMTOperatingArea.
 
 FMTOperatingArea (const FMTOperatingArea &rhs)=default
 Copy constructor for FMTOperatingArea.
 
FMTOperatingAreaoperator= (const FMTOperatingArea &rhs)=default
 Copy assignment operator for FMTOperatingArea.
 
bool operator== (const FMTOperatingArea &rhs) const
 Comparison operator for FMTOperatingArea.
 
bool operator!= (const FMTOperatingArea &rhs) const
 Comparison operator for FMTOperatingArea.
 
virtual ~FMTOperatingArea ()=default
 Default destructor for FMTOperatingArea.
 
FMTOperatingArea preSolveOperatingArea (const Core::FMTMaskFilter &filter, const std::vector< Core::FMTTheme > &presolvedthemes) const
 Return a presolved FMTOperatingArea using a mask filter and a subset of the original themes.
 
FMTOperatingArea postSolveOperatingArea (const Core::FMTMaskFilter &filter, const std::vector< Core::FMTTheme > &basethemes) const
 Return a postsolved FMTOperatingArea using a mask filter and the original themes.
 
- 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)
 

Friends

class boost::serialization::access
 Serialize the FMTOperatingAreaScheme for multiprocessing across multiple cpus (pickle in Python).
 

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.
 
- Protected Attributes inherited from Heuristics::FMTOperatingArea
Core::FMTMask m_mask
 The mask describing the operating area.
 
std::vector< Core::FMTMaskm_neighbors
 Neighbors mask of the operating area.
 
double m_neighborsperimeter
 neighborsperimeter is the ratio a operatingarea needs to share to a other operatingarea to be considered neighbor.
 
double m_area
 The initial area of the operating area used as big M for the MIP.
 
- 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

Operating area scheme giving information about its opening time, green up and return time.

The operating area scheme has to be based on static themes not used within transitions. Multiple potential schedules are generated for the FMTOperatingArea formulated as a heuristic and/or MIP.

Constructor & Destructor Documentation

◆ FMTOperatingAreaScheme() [1/3]

Heuristics::FMTOperatingAreaScheme::FMTOperatingAreaScheme ( const FMTOperatingArea oparea,
const size_t &  lopeningtime,
const size_t &  lreturntime,
const size_t &  lmaxreturntime,
const size_t &  lrepetition,
const size_t &  lgreenup,
const size_t &  lstartingperiod,
double  minimalarearatio = 0.0 
)

Main constructor for FMTOperatingAreaScheme.

Before synchronizing to the solver interface, the user has to provide the green up, return time and other parameters for each operating area.

Parameters
[in]opareathe operating area.
[in]lopeningtimethe opening time.
[in]lreturntimethe return time.
[in]lmaxreturntimethe maximal return time.
[in]lrepetitionthe repetition.
[in]lgreenupthe green up.
[in]lstartingperiodthe starting period.
[in]minimalarearatiothe minimal area ratio needed to open the operating area.

◆ FMTOperatingAreaScheme() [2/3]

Heuristics::FMTOperatingAreaScheme::FMTOperatingAreaScheme ( )
default

Default constructor for FMTOperatingAreaScheme.

◆ FMTOperatingAreaScheme() [3/3]

Heuristics::FMTOperatingAreaScheme::FMTOperatingAreaScheme ( const FMTOperatingAreaScheme rhs)
default

Copy constructor for FMTOperatingAreaScheme.

Parameters
[in]rhsthe FMTOperatingAreaScheme to copy.

◆ ~FMTOperatingAreaScheme()

Heuristics::FMTOperatingAreaScheme::~FMTOperatingAreaScheme ( )
default

Default destructor for FMTOperatingAreaScheme.

Member Function Documentation

◆ boundAllDualSchemes()

size_t Heuristics::FMTOperatingAreaScheme::boundAllDualSchemes ( std::vector< int > &  targets,
std::vector< double > &  bounds 
) const

Push the constraint indexes into the targets vector and push the bound value into the bounds.

Parameters
[in,out]targetsthe targets.
[in,out]boundsthe bounds.
Returns
the number of constraints pushed.

◆ boundAllPrimalSchemes()

size_t Heuristics::FMTOperatingAreaScheme::boundAllPrimalSchemes ( std::vector< int > &  targets,
std::vector< double > &  bounds,
double  boundvalue = 1.0 
) const

Push the variable indexes into the targets vector and push the bound value into the bounds.

Parameters
[in,out]targetsthe targets.
[in,out]boundsthe bounds.
[in]boundvaluethe bound value.
Returns
the number of variables pushed.

◆ boundPrimalScheme()

bool Heuristics::FMTOperatingAreaScheme::boundPrimalScheme ( std::vector< int > &  targets,
std::vector< double > &  bounds,
const size_t &  schemeid 
) const

Push the variable index of a scheme binary into the targets vector and push 1 and 1 into the bounds.

Parameters
[in,out]targetsthe targets.
[in,out]boundsthe bounds.
[in]schemeidthe scheme id.
Returns
true if the scheme is bounded else false.

◆ empty()

bool Heuristics::FMTOperatingAreaScheme::empty ( ) const

Check if the operating area is empty, which is possible if there is no potential development to operate.

Returns
true if the operating area is empty else false.

◆ fillBoundsNVariables()

void Heuristics::FMTOperatingAreaScheme::fillBoundsNVariables ( const double *  lowerb,
const double *  upperb,
std::vector< int > &  constraintstargets,
std::vector< double > &  bounds 
) const

For each scheme constraint, take the constraint bounds of the actual model.

Parameters
[in]lowerbthe lower bounds.
[in]upperbthe upper bounds.
[in,out]constraintstargetsthe constraints targets.
[in,out]boundsthe bounds.

◆ getActivitySum()

double Heuristics::FMTOperatingAreaScheme::getActivitySum ( const double *  dualsolution) const

Summarize the value of all the constraints for all the potential schemes from the dual solution.

Parameters
[in]dualsolutionthe dual solution.
Returns
the sum of the activities.

◆ getBinariesSum()

double Heuristics::FMTOperatingAreaScheme::getBinariesSum ( const double *  primalsolution) const

Summarize the value of all the binary variables for all the potential schemes from the primal solution.

Parameters
[in]primalsolutionthe primal solution.
Returns
the sum of the binaries.

◆ getCommonBinaries()

std::map< int, std::vector< int > > Heuristics::FMTOperatingAreaScheme::getCommonBinaries ( const FMTOperatingAreaScheme neighbor) const

Return a map with the binary indexes of this operating area as keys and the binary indexes of the neighbor as elements, using the green up members.

Used to validate which schemes of an operating area constrain the usage of the schemes of a neighbor.

Parameters
[in]neighborthe neighbor operating area.
Returns
the common binaries.

◆ getDualLowerBounds()

std::vector< double > Heuristics::FMTOperatingAreaScheme::getDualLowerBounds ( const double *  lowerbounds,
const double *  upperbounds 
) const

Return the lower bounds of the solution for bounding the minimal harvested area.

Parameters
[in]lowerboundsthe lower bounds.
[in]upperboundsthe upper bounds.
Returns
the dual lower bounds.

◆ getDualSolution()

std::vector< double > Heuristics::FMTOperatingAreaScheme::getDualSolution ( const double *  upperbounds,
const double *  dualsolution,
bool &  canbreakneighboring 
) const

Return the yield solution of the dual problem by setting the selected scheme solution into a vector.

Parameters
[in]upperboundsthe upper bounds.
[in]dualsolutionthe dual solution.
[out]canbreakneighboringtrue if the neighboring can be broken.
Returns
the dual yield solution.

◆ getDualSolutionIndex()

bool Heuristics::FMTOperatingAreaScheme::getDualSolutionIndex ( const double *  upperbound,
size_t &  locid 
) const

Return the index of the scheme used by the operating area from the rows upper bounds.

Parameters
[in]upperboundthe rows upper bounds.
[out]locidthe scheme index.
Returns
true if a scheme index is found else false.

◆ getGreenUp()

const size_t & Heuristics::FMTOperatingAreaScheme::getGreenUp ( ) const
inline

Return the green up.

Returns
the green up.

◆ getMaximalReturnTime()

size_t Heuristics::FMTOperatingAreaScheme::getMaximalReturnTime ( ) const

Get the maximal return time.

Returns
the maximal return time.

◆ getMaximalSchemesConstraint()

const int & Heuristics::FMTOperatingAreaScheme::getMaximalSchemesConstraint ( ) const

Return the constraint id ensuring that only one scheme is chosen.

Returns
the maximal schemes constraint id.

◆ getMinimalReturnTime()

size_t Heuristics::FMTOperatingAreaScheme::getMinimalReturnTime ( ) const

Get the minimal return time.

Returns
the minimal return time.

◆ getNumberOfScheme()

size_t Heuristics::FMTOperatingAreaScheme::getNumberOfScheme ( ) const

Return the number of schemes of the operating area, only usable after schemesToLp has been called.

Returns
the number of schemes.

◆ getNumberOfSimpleScheme()

size_t Heuristics::FMTOperatingAreaScheme::getNumberOfSimpleScheme ( ) const

Return the number of simple schemes with a fixed return time and opening time.

Returns
the number of simple schemes.

◆ getOpeningBinaries()

const std::vector< int > & Heuristics::FMTOperatingAreaScheme::getOpeningBinaries ( ) const

Return the variable indexes of the binaries of all the potential schemes of the operating area.

Returns
the opening binaries.

◆ getOpeningConstraints()

const std::vector< std::vector< int > > & Heuristics::FMTOperatingAreaScheme::getOpeningConstraints ( ) const

Return the opening constraints of the operating area.

Returns
the opening constraints.

◆ getOpeningTime()

size_t Heuristics::FMTOperatingAreaScheme::getOpeningTime ( ) const

Get the opening time.

Returns
the opening time.

◆ getPotentialDualSchemes()

std::vector< size_t > Heuristics::FMTOperatingAreaScheme::getPotentialDualSchemes ( const double *  p_dualsolution,
const double *  p_upperbound,
const std::vector< FMTOperatingAreaScheme > &  p_neighbors 
) const

Return the potential scheme indexes from the dual solution, the rows upper bounds and the neighboring operating areas, ordered from the most to the least area used but greater than 0.

Parameters
[in]p_dualsolutionthe dual solution.
[in]p_upperboundthe rows upper bounds.
[in]p_neighborsthe neighboring operating areas.
Returns
the potential dual scheme indexes.

◆ getPotentialPrimalSchemes()

std::vector< size_t > Heuristics::FMTOperatingAreaScheme::getPotentialPrimalSchemes ( const double *  p_primalsolution,
const double *  p_lowerbounds,
const double *  p_upperbounds,
const std::vector< FMTOperatingAreaScheme > &  p_neighbors 
) const

Return the potential scheme indexes from the primal solution, its bounds and the neighboring operating areas, ordered from the most to the least area used but greater than 0.

Parameters
[in]p_primalsolutionthe primal solution.
[in]p_lowerboundsthe lower bounds.
[in]p_upperboundsthe upper bounds.
[in]p_neighborsthe neighboring operating areas.
Returns
the potential primal scheme indexes.

◆ getPrimalSolution()

std::vector< double > Heuristics::FMTOperatingAreaScheme::getPrimalSolution ( const double *  primalsolution) const

Return the yield solution of the primal problem by summing up all the binary variables into a single vector.

Parameters
[in]primalsolutionthe primal solution.
Returns
the primal yield solution.

◆ getPrimalSolutionIndex()

size_t Heuristics::FMTOperatingAreaScheme::getPrimalSolutionIndex ( const double *  primalsolution) const

Return the index of the scheme the operating area is bounded to, from the primal solution.

Parameters
[in]primalsolutionthe primal solution.
Returns
the bounded scheme index.

◆ getRejectedNodesCid()

const int & Heuristics::FMTOperatingAreaScheme::getRejectedNodesCid ( ) const

Return the constraint id of the rejected nodes.

Returns
the rejected nodes constraint id.

◆ getRepetition()

size_t Heuristics::FMTOperatingAreaScheme::getRepetition ( ) const

Get the repetition of the pattern.

Returns
the repetition.

◆ getRessourcesToDelete()

void Heuristics::FMTOperatingAreaScheme::getRessourcesToDelete ( std::vector< int > &  colstodelete,
std::vector< int > &  rowstodelete 
) const

Push all the variables and constraints of the operating area into the columns and rows to delete vectors.

Parameters
[in,out]colstodeletethe columns to delete.
[in,out]rowstodeletethe rows to delete.

◆ getStartingPeriod()

size_t Heuristics::FMTOperatingAreaScheme::getStartingPeriod ( ) const

Return the starting period at which all the schemes of the operating area start.

Returns
the starting period.

◆ getThreshold()

double Heuristics::FMTOperatingAreaScheme::getThreshold ( ) const

Get the threshold.

Returns
the threshold.

◆ haveActivitySolution()

bool Heuristics::FMTOperatingAreaScheme::haveActivitySolution ( const double *  dualsolution) const

Check if a set of scheme constraints has an activity value greater than 0 in the dual solution, indicating a potential scheme to choose.

Parameters
[in]dualsolutionthe dual solution.
Returns
true if there is a potential dual scheme else false.

◆ havePotentialSolution()

bool Heuristics::FMTOperatingAreaScheme::havePotentialSolution ( const double *  primalsolution) const

Check if a scheme binary has a value greater than 0 in the primal solution, indicating a potential scheme to choose.

Parameters
[in]primalsolutionthe primal solution.
Returns
true if there is a potential primal scheme else false.

◆ isAllDualBounded()

bool Heuristics::FMTOperatingAreaScheme::isAllDualBounded ( const double *  upperbounds) const

Return false if any constraint upper bound is different from 0.

Parameters
[in]upperboundsthe upper bounds.
Returns
true if all the constraints are bounded to 0 else false.

◆ isAllPrimalBounded()

bool Heuristics::FMTOperatingAreaScheme::isAllPrimalBounded ( const double *  lowerbounds,
const double *  upperbounds 
) const

Return false if any binary lower or upper bound is not set to 1.

Parameters
[in]lowerboundsthe lower bounds.
[in]upperboundsthe upper bounds.
Returns
true if all the binaries are bounded to 1 else false.

◆ isDualBounded()

bool Heuristics::FMTOperatingAreaScheme::isDualBounded ( const double *  upperbounds) const

Return true if any constraint upper bound is set to 0.

Parameters
[in]upperboundsthe upper bounds.
Returns
true if a constraint is bounded to 0 else false.

◆ isPrimalBounded()

bool Heuristics::FMTOperatingAreaScheme::isPrimalBounded ( const double *  lowerbounds,
const double *  upperbounds 
) const

Return true if any binary lower or upper bound is set to 1.

Parameters
[in]lowerboundsthe lower bounds.
[in]upperboundsthe upper bounds.
Returns
true if a binary is bounded to 1 else false.

◆ isThresholdActivity()

bool Heuristics::FMTOperatingAreaScheme::isThresholdActivity ( const double *  dualsolution) const

Return true if every constraint activity is above the threshold.

Parameters
[in]dualsolutionthe dual solution.
Returns
true if every activity is above the threshold else false.

◆ operator!=()

bool Heuristics::FMTOperatingAreaScheme::operator!= ( const FMTOperatingAreaScheme rhs) const

Comparison operator for FMTOperatingAreaScheme.

Parameters
[in]rhsthe FMTOperatingAreaScheme to compare to.
Returns
true if both operating area schemes are different else false.

◆ operator=()

FMTOperatingAreaScheme & Heuristics::FMTOperatingAreaScheme::operator= ( const FMTOperatingAreaScheme rhs)
default

Copy assignment operator for FMTOperatingAreaScheme.

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

◆ operator==()

bool Heuristics::FMTOperatingAreaScheme::operator== ( const FMTOperatingAreaScheme rhs) const

Comparison operator for FMTOperatingAreaScheme.

Parameters
[in]rhsthe FMTOperatingAreaScheme to compare to.
Returns
true if both operating area schemes are equal else false.

◆ preSolve()

FMTOperatingAreaScheme Heuristics::FMTOperatingAreaScheme::preSolve ( const Core::FMTMask selectedmask,
const std::vector< Core::FMTTheme > &  presolvedthemes 
) const

Return a presolved FMTOperatingAreaScheme using a mask and a subset of the original themes.

Parameters
[in]selectedmaskthe selected mask.
[in]presolvedthemesthe presolved themes.
Returns
the presolved operating area scheme.

◆ pushBinaries()

void Heuristics::FMTOperatingAreaScheme::pushBinaries ( std::vector< int > &  targets) const

Push all the binaries into a targets vector.

Parameters
[in,out]targetsthe targets.

◆ setConstraints()

void Heuristics::FMTOperatingAreaScheme::setConstraints ( const std::vector< std::vector< Graph::FMTGraph< Graph::FMTVertexProperties, Graph::FMTEdgeProperties >::FMTvertex_descriptor > > &  vertices,
const std::vector< Graph::FMTGraph< Graph::FMTVertexProperties, Graph::FMTEdgeProperties >::FMTvertex_descriptor > &  totalareavertices,
const Graph::FMTGraph< Graph::FMTVertexProperties, Graph::FMTEdgeProperties > &  graph,
Models::FMTLpSolver solver,
const double *  primalsolution,
const std::vector< int > &  actionIDS 
)

Set up the constraints and variables using a matrix build and a primal solution, filling all the matrix element members.

The user has to synchronize the matrix build to the matrix after iterating on all the operating areas.

Parameters
[in]verticesthe vertices.
[in]totalareaverticesthe initial vertices.
[in]graphthe graph.
[in,out]solverthe solver.
[in]primalsolutionthe primal solution.
[in]actionIDSthe action ids.

◆ setReturnTime()

void Heuristics::FMTOperatingAreaScheme::setReturnTime ( const size_t &  minimalreturntime,
const size_t &  maximalreturntime 
)

Set the minimal and maximal return time.

Parameters
[in]minimalreturntimethe minimal return time.
[in]maximalreturntimethe maximal return time.

◆ unboundAllDualSchemes()

size_t Heuristics::FMTOperatingAreaScheme::unboundAllDualSchemes ( std::vector< int > &  targets,
std::vector< double > &  bounds 
) const

Push the constraint indexes into the targets vector, push -inf and the area into the bounds, and return the id of the unbounded scheme.

Parameters
[in,out]targetsthe targets.
[in,out]boundsthe bounds.
Returns
the unbounded scheme id.

◆ unboundAllPrimalSchemes()

size_t Heuristics::FMTOperatingAreaScheme::unboundAllPrimalSchemes ( std::vector< int > &  targets,
std::vector< double > &  bounds 
) const

Push the binary indexes into the targets vector and push 0 and 1 into the bounds.

Parameters
[in,out]targetsthe targets.
[in,out]boundsthe bounds.
Returns
the number of binaries pushed.

◆ unboundDualScheme()

bool Heuristics::FMTOperatingAreaScheme::unboundDualScheme ( const double *  rowactivities,
std::vector< int > &  targets,
std::vector< double > &  bounds,
const size_t &  schemeid,
bool  looseset = true 
) const

Push the constraints of a scheme into the targets vector with -inf and the area bounds, and push the constraints of the other schemes with 0 and 0 bounds.

Parameters
[in]rowactivitiesthe row activities.
[in,out]targetsthe targets.
[in,out]boundsthe bounds.
[in]schemeidthe scheme id.
[in]loosesetif true uses a loose set.
Returns
true if the scheme is unbounded else false.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Serialize the FMTOperatingAreaScheme for multiprocessing across multiple cpus (pickle in Python).

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

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