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

#include <FMToperatingareascheme.hpp>

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)
 
double getthreshold () const
 
size_t getopeningtime () const
 
size_t getminimalreturntime () const
 
size_t getrepetition () const
 
size_t getmaximalreturntime () const
 
bool empty () const
 
const std::vector< int > & getopeningbinaries () const
 
size_t getstartingperiod () const
 
double getbinariessum (const double *primalsolution) const
 
double getactivitysum (const double *dualsolution) const
 
bool isthresholdactivity (const double *dualsolution) const
 
std::map< int, std::vector< int > > getcommonbinairies (const FMToperatingareascheme &neighbor) const
 
size_t getprimalsolutionindex (const double *primalsolution) const
 
bool getdualsolutionindex (const double *upperbound, size_t &locid) const
 
bool havepotentialsolution (const double *primalsolution) const
 
bool haveactivitysolution (const double *dualsolution) const
 
bool isallprimalbounded (const double *lowerbounds, const double *upperbounds) const
 
bool isalldualbounded (const double *upperbounds) const
 
bool isprimalbounded (const double *lowerbounds, const double *upperbounds) const
 
bool isdualbounded (const double *upperbounds) const
 
std::vector< size_t > getpotentialprimalschemes (const double *primalsolution, const double *lowerbounds, const double *upperbounds, const std::vector< FMToperatingareascheme > &neighbors) const
 
std::vector< size_t > getpotentialdualschemes (const double *dualsolution, const double *upperbound, const std::vector< FMToperatingareascheme > &neighbors) const
 
void getressourcestodelete (std::vector< int > &colstodelete, std::vector< int > &rowstodelete) const
 
void pushbinaries (std::vector< int > &targets) const
 
size_t unboundallprimalschemes (std::vector< int > &targets, std::vector< double > &bounds) const
 
size_t unboundalldualschemes (std::vector< int > &targets, std::vector< double > &bounds) const
 
size_t boundallprimalschemes (std::vector< int > &targets, std::vector< double > &bounds, double boundvalue=1.0) const
 
size_t boundalldualschemes (std::vector< int > &targets, std::vector< double > &bounds) const
 
bool boundprimalscheme (std::vector< int > &targets, std::vector< double > &bounds, const size_t &schemeid) const
 
bool unbounddualscheme (const double *rowactivities, std::vector< int > &targets, std::vector< double > &bounds, const size_t &schemeid, bool looseset=true) const
 
std::vector< double > getprimalsolution (const double *primalsolution) const
 
std::vector< double > getdualsolution (const double *upperbounds, const double *dualsolution, bool &canbreakneighboring) const
 
std::vector< double > getduallowerbounds (const double *lowerbounds, const double *upperbounds) const
 
void setconstraints (const std::vector< std::vector< Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties >::FMTvertex_descriptor > > &verticies, const std::vector< Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties >::FMTvertex_descriptor > &totalareaverticies, const Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties > &graph, Models::FMTlpsolver &solver, const double *primalsolution, const std::vector< int > &actionIDS)
 
 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)
 
 FMToperatingareascheme ()=default
 
 FMToperatingareascheme (const FMToperatingareascheme &rhs)=default
 
FMToperatingareaschemeoperator= (const FMToperatingareascheme &rhs)=default
 
void fillboundsnvariables (const double *lowerb, const double *upperb, std::vector< int > &constraintstargets, std::vector< double > &bounds) const
 
bool operator== (const FMToperatingareascheme &rhs) const
 
bool operator!= (const FMToperatingareascheme &rhs) const
 
 ~FMToperatingareascheme ()=default
 
FMToperatingareascheme presolve (const Core::FMTmask &selectedmask, const std::vector< Core::FMTtheme > &presolvedthemes) const
 
size_t getnumberofscheme () const
 
size_t getnumberofsimplescheme () const
 
const int & getrejectednodescid () const
 
const std::vector< std::vector< int > > & getopeningconstraints () const
 
const int & getmaximalschemesconstraint () const
 
const size_t & getgreenup () const
 
- Public Member Functions inherited from Heuristics::FMToperatingarea
FMToperatingareaoperator+= (const double &value)
 
std::vector< Core::FMTmaskgetneighbors () const
 
double getarea () const
 
double getneihgborsperimeter () const
 
Core::FMTmask getmask () const
 
void setneighbors (const std::vector< Core::FMTmask > &lneighbors)
 
 FMToperatingarea (const Core::FMTmask &lmask, const double &lneihgborsperimeter)
 
void setarea (const double &newarea)
 
 FMToperatingarea ()=default
 
 FMToperatingarea (const FMToperatingarea &rhs)=default
 
FMToperatingareaoperator= (const FMToperatingarea &rhs)=default
 
bool operator== (const FMToperatingarea &rhs) const
 
bool operator!= (const FMToperatingarea &rhs) const
 
virtual ~FMToperatingarea ()=default
 
FMToperatingarea presolveoperatingarea (const Core::FMTmaskfilter &filter, const std::vector< Core::FMTtheme > &presolvedthemes) const
 
FMToperatingarea postsolveoperatingarea (const Core::FMTmaskfilter &filter, const std::vector< Core::FMTtheme > &basethemes) const
 

Friends

class boost::serialization::access
 

Additional Inherited Members

- Protected Attributes inherited from Heuristics::FMToperatingarea
Core::FMTmask mask
 The mask describing the operating area.
 
std::vector< Core::FMTmaskneighbors
 Neighbors mask of the operating area.
 
double neihgborsperimeter
 neighborsperimeter is the ratio a operatingarea needs to share to a other operatingarea to be considered neighbor.
 
double _area
 The initial area of the operating area used as big M for the MIP.
 

Detailed Description

FMToperatingareascheme gives informations about a given operating area scheme it's openingtime,greenup,returntime. FMToperatingscheme area have to be based on static themes (not used within transitions). Multiple potential schedules will be 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 FMToperatingareascheme constructor targeting the user. Before synchronizing everything to the solverinterface, the user has to provide to the heuristics all the green-up, returntime etc.... for each operating area. The minimalarearatio is the minimal ratio needed to open the COS... The fullenum is to set the class parameter fullenumeration

◆ FMToperatingareascheme() [2/3]

Heuristics::FMToperatingareascheme::FMToperatingareascheme ( )
default

Default FMToperatingareascheme constructor

◆ FMToperatingareascheme() [3/3]

Heuristics::FMToperatingareascheme::FMToperatingareascheme ( const FMToperatingareascheme rhs)
default

FMToperatingareascheme copy constructor

◆ ~FMToperatingareascheme()

Heuristics::FMToperatingareascheme::~FMToperatingareascheme ( )
default

Default FMToperatingareascheme destructor

Member Function Documentation

◆ boundalldualschemes()

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

Push constraints index into vector (targets) and push (boundvalue ) into (bounds).

◆ boundallprimalschemes()

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

Push variables index into vector (targets) and push (boundvalue ) into (bounds).

◆ boundprimalscheme()

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

Using the scheme binary variable of a given (schemeid) push it's variable index into (targets) and push into (bounds) (1 and 1)

◆ empty()

bool Heuristics::FMToperatingareascheme::empty ( ) const

Check if the operating area is empty can be possible if there's no potential developpement to operate.

◆ fillboundsnvariables()

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

For each scheme consttraints go take the constraints bounds of the actual model.

◆ getactivitysum()

double Heuristics::FMToperatingareascheme::getactivitysum ( const double *  dualsolution) const

Looking at the (dualsolution) we summarize the value of all constraints for all potential schemes.

◆ getbinariessum()

double Heuristics::FMToperatingareascheme::getbinariessum ( const double *  primalsolution) const

Looking at the (primalsolution) we summarize the value of all binary variables for all potential schemes.

◆ getcommonbinairies()

std::map< int, std::vector< int > > Heuristics::FMToperatingareascheme::getcommonbinairies ( const FMToperatingareascheme neighbor) const

Using the greenup data member of each operating area (neighbor and this) we get the map<> key = this binary index and elements are a vector of binary indexes of the neighbor. We need this function to validate which schemes of an operating area is constraining the usage of the schemes of a other (neighbor).

◆ getduallowerbounds()

std::vector< double > Heuristics::FMToperatingareascheme::getduallowerbounds ( const double *  lowerbounds,
const double *  upperbounds 
) const

Gets the lowerbounds of the solution for bounding the minimal harvested area.

◆ getdualsolution()

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

Gets the yield solution of the dual problem using (dualsolution) it set the selected scheme solution into a vector of double.

◆ getdualsolutionindex()

bool Heuristics::FMToperatingareascheme::getdualsolutionindex ( const double *  upperbound,
size_t &  locid 
) const

This function gets the index of the scheme used (locid) by the operating area using the (rows upperbound), is no scheme index is found the function returns false.

◆ getgreenup()

const size_t & Heuristics::FMToperatingareascheme::getgreenup ( ) const
inline

◆ getmaximalreturntime()

size_t Heuristics::FMToperatingareascheme::getmaximalreturntime ( ) const

Get the maximal return time.

◆ getmaximalschemesconstraint()

const int & Heuristics::FMToperatingareascheme::getmaximalschemesconstraint ( ) const

◆ getminimalreturntime()

size_t Heuristics::FMToperatingareascheme::getminimalreturntime ( ) const

Get the minimal return time.

◆ getnumberofscheme()

size_t Heuristics::FMToperatingareascheme::getnumberofscheme ( ) const

Return the number of scheme for the OA. Can only be used if schemestoLP has been set called...

◆ getnumberofsimplescheme()

size_t Heuristics::FMToperatingareascheme::getnumberofsimplescheme ( ) const

Return the number of simple scheme with fixed returntime + openingtime

◆ getopeningbinaries()

const std::vector< int > & Heuristics::FMToperatingareascheme::getopeningbinaries ( ) const

Getter returning variables index of the binaries of all potential schemes of the operatingarea.

◆ getopeningconstraints()

const std::vector< std::vector< int > > & Heuristics::FMToperatingareascheme::getopeningconstraints ( ) const

◆ getopeningtime()

size_t Heuristics::FMToperatingareascheme::getopeningtime ( ) const

Get the opening time

◆ getpotentialdualschemes()

std::vector< size_t > Heuristics::FMToperatingareascheme::getpotentialdualschemes ( const double *  dualsolution,
const double *  upperbound,
const std::vector< FMToperatingareascheme > &  neighbors 
) const

Using the (dualsolution), rows (upperbounds) and the neighboring operating area, this function get the potential sheme indexes. The order begin with the scheme with more area used to the scehme with the less area used but > 0.

◆ getpotentialprimalschemes()

std::vector< size_t > Heuristics::FMToperatingareascheme::getpotentialprimalschemes ( const double *  primalsolution,
const double *  lowerbounds,
const double *  upperbounds,
const std::vector< FMToperatingareascheme > &  neighbors 
) const

Using the (primalsolution), variables (lowerbounds)(upperbounds) and the neighboring operating area, this function get the potential sheme indexes. The order begin with the scheme with more area used to the scehme with the less area used but > 0.

◆ getprimalsolution()

std::vector< double > Heuristics::FMToperatingareascheme::getprimalsolution ( const double *  primalsolution) const

Gets the yield solution of the primal problem using (primalsolution) it sums up all binary variables into a single vector of double.

◆ getprimalsolutionindex()

size_t Heuristics::FMToperatingareascheme::getprimalsolutionindex ( const double *  primalsolution) const

Only when a operating area is bounded to a given scheme we can use this function that gets the index of the bounded scheme looking at the (primalsolution)

◆ getrejectednodescid()

const int & Heuristics::FMToperatingareascheme::getrejectednodescid ( ) const

◆ getrepetition()

size_t Heuristics::FMToperatingareascheme::getrepetition ( ) const

Get the repetition of the pattern.

◆ getressourcestodelete()

void Heuristics::FMToperatingareascheme::getressourcestodelete ( std::vector< int > &  colstodelete,
std::vector< int > &  rowstodelete 
) const

Push all the variables of this operating area to the (colstodelete) vector and push all the co of this operating area to the (colstodelete) vector and

◆ getstartingperiod()

size_t Heuristics::FMToperatingareascheme::getstartingperiod ( ) const

Getter returning starting period at which all schemes of the operating area starts.

◆ getthreshold()

double Heuristics::FMToperatingareascheme::getthreshold ( ) const

Get the threshold

◆ haveactivitysolution()

bool Heuristics::FMToperatingareascheme::haveactivitysolution ( const double *  dualsolution) const

Checks if by any chance we have a set of scheme constraint with a activity value > 0 using the (dualsolution) indicating that there's a potential scheme to choose for dual.

◆ havepotentialsolution()

bool Heuristics::FMToperatingareascheme::havepotentialsolution ( const double *  primalsolution) const

Checks if by any chance we have a scheme binary with a value > 0 using the (primalsolution) indicating that there's a potential scheme to choose for primal.

◆ isalldualbounded()

bool Heuristics::FMToperatingareascheme::isalldualbounded ( const double *  upperbounds) const

Will return false if any constraint (upperbounds) is different from 0.

◆ isallprimalbounded()

bool Heuristics::FMToperatingareascheme::isallprimalbounded ( const double *  lowerbounds,
const double *  upperbounds 
) const

Will return false if any binary (lowerbounds) or (upperbounds) is not set to 1.

◆ isdualbounded()

bool Heuristics::FMToperatingareascheme::isdualbounded ( const double *  upperbounds) const

Will return true if any constraints (upperbounds) is set to 0.

◆ isprimalbounded()

bool Heuristics::FMToperatingareascheme::isprimalbounded ( const double *  lowerbounds,
const double *  upperbounds 
) const

Will return true if any binary (lowerbounds) or (upperbounds) is set to 1.

◆ isthresholdactivity()

bool Heuristics::FMToperatingareascheme::isthresholdactivity ( const double *  dualsolution) const

Will return true if every constraint has above threshold

◆ operator!=()

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

Comparison operator of FMToperatingareascheme

◆ operator=()

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

FMToperatingareascheme copy assignment

◆ operator==()

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

Comparison operator of FMToperatingareascheme

◆ presolve()

FMToperatingareascheme Heuristics::FMToperatingareascheme::presolve ( const Core::FMTmask selectedmask,
const std::vector< Core::FMTtheme > &  presolvedthemes 
) const

Using a FMTmask (selectedmask) and a subset of the original FMTthemes used to construct the FMTmask, it returns a presolved FMTmask with potentialy less data.

◆ pushbinaries()

void Heuristics::FMToperatingareascheme::pushbinaries ( std::vector< int > &  targets) const

Push all all binaries to a vector<> (targets)

◆ setconstraints()

void Heuristics::FMToperatingareascheme::setconstraints ( const std::vector< std::vector< Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties >::FMTvertex_descriptor > > &  verticies,
const std::vector< Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties >::FMTvertex_descriptor > &  totalareaverticies,
const Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties > &  graph,
Models::FMTlpsolver solver,
const double *  primalsolution,
const std::vector< int > &  actionIDS 
)

Main function setting up constraints and variables using a (matrixbuild) and a primal solution. This function will fill-up all data member related to matrix elements (constraints and variables). The user has to synchronize matrixbuild to the matrix after iterating on all operatingarea.

◆ setreturntime()

void Heuristics::FMToperatingareascheme::setreturntime ( const size_t &  minimalreturntime,
const size_t &  maximalreturntime 
)

Set the minimal and maximal return time.

◆ unboundalldualschemes()

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

Push constraints index into vector (targets) and push into (bounds) -inf and _area and return the id of the scheme unbounded

◆ unboundallprimalschemes()

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

Push binary index into vector (targets) and push into (bounds) 0 and 1.

◆ unbounddualscheme()

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

Using the constraints of a given (schemeid) push it's constraints index into (targets) and push into (bounds) (-inf and _area) and for all other constraints from the other schemes push them into (targets) and push into (bounds) (0 and 0)

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

serialize 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: