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

#include <FMToperatingareaclusterer.hpp>

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

Public Member Functions

 FMToperatingareaclusterer ()=default
 
 FMToperatingareaclusterer (const Models::FMTsolverinterface &interfacetype, const size_t &lseed, const std::vector< FMToperatingareacluster > &lclusters, int minimalnumberofclusters=-1, int maximalnumberofclusters=-1)
 
 FMToperatingareaclusterer (const FMToperatingareaclusterer &)
 
FMToperatingareaclustereroperator= (const FMToperatingareaclusterer &)=default
 
void setnumberofsimulationpass (const int &pass)
 
 ~FMToperatingareaclusterer ()=default
 
size_t getbinariescount () const
 
bool initialsolve () final
 
bool branchnboundsolve () final
 
std::vector< FMToperatingareaclustergetsolution () const
 
void buildproblem ()
 
- Public Member Functions inherited from Heuristics::FMTlpheuristic
void setgeneratorseed (const size_t &lseed)
 
 FMTlpheuristic (Models::FMTlpsolver &basesolve, size_t lseed=0, bool copysolver=true)
 
 FMTlpheuristic (const Models::FMTsolverinterface &interfacetype, const size_t &lseed)
 
 FMTlpheuristic ()=default
 
 FMTlpheuristic (const FMTlpheuristic &rhs)
 
 FMTlpheuristic (FMTlpheuristic &&rhs)=default
 
FMTlpheuristicoperator= (const FMTlpheuristic &rhs)
 
virtual bool branchnboundsolve ()
 
virtual bool greedypass (const double &initsol, const unsigned int &iteration)
 
virtual void paralleloptimize (const double &initbestsolution, const unsigned int &iterations, const double &maxtime, const std::chrono::steady_clock::time_point &Starttime)
 
virtual ~FMTlpheuristic ()=default
 
- Public Member Functions inherited from Models::FMTlpsolver
void swap (FMTlpsolver &rhs)
 
void passinlogger (const std::shared_ptr< Logging::FMTlogger > &logger) override
 
void unmarkHotStart ()
 
bool stockresolve ()
 
 FMTlpsolver ()
 
virtual ~FMTlpsolver ()=default
 
 FMTlpsolver (const FMTlpsolver &rhs)
 
 FMTlpsolver (FMTlpsolver &&rhs)=default
 
FMTlpsolveroperator= (const FMTlpsolver &rhs)
 
FMTlpsolveroperator= (FMTlpsolver &&rhs)=default
 
 FMTlpsolver (FMTsolverinterface lsolvertype)
 
bool operator== (const FMTlpsolver &rhs) const
 
bool operator!= (const FMTlpsolver &rhs) const
 
virtual bool resolve ()
 
virtual bool initialsolve ()
 
void setnumberofthreads (const size_t &nthread)
 
void setMIPgaptolerance (const double &gap)
 
void setoptimizerMAXtime (const double &time)
 
void MIPparameters ()
 
double getObjValue () const
 
int getiterationcount () const
 
void passinsolver (const FMTlpsolver &solver)
 
void passinmessagehandler (Logging::FMTlogger &logger)
 
void setsolvertype (FMTsolverinterface &lsolvertype) const
 
bool gotlicense () const
 
std::string getsolvername () const
 
int getNumCols () const
 
int getNumRows () const
 
const double * getObjCoefficients () const
 
const double * getColLower () const
 
const double * getColUpper () const
 
const double * getColSolution () const
 
const double * getRowPrice () const
 
const double * getRowActivity () const
 
const double * getRowUpper () const
 
const double * getRowLower () const
 
int getrow (int whichRow, double &rowLower, double &rowUpper, std::vector< int > &indices, std::vector< double > &elements) const
 
int getcol (int whichCol, double &colLower, double &colUpper, double &objectiveValue, std::vector< int > &indices, std::vector< double > &elements) const
 
double getObjSense () const
 
void setObjective (const double *objectivevalues)
 
void setObjSense (const double &newsense)
 
void addRow (int numberInRow, const int *columns, const double *elements, double rowLower=-std::numeric_limits< double >::max(), double rowUpper=std::numeric_limits< double >::max())
 
void addCol (int numberInColumn, const int *rows, const double *elements, double columnLower=0.0, double columnUpper=std::numeric_limits< double >::max(), double objectiveValue=0.0)
 
void addRows (const int numrows, const int *rowStarts, const int *columns, const double *elements, const double *rowlb, const double *rowub)
 
void addCols (const int numcols, const int *columnStarts, const int *rows, const double *elements, const double *collb, const double *colub, const double *obj)
 
bool isProvenOptimal () const
 
void deleteRow (const int &rowindex)
 
void deleteCol (const int &colindex)
 
void deleteRows (int numberofrows, const int *rowindexes)
 
void deleteCols (int numberofcols, const int *colindexes)
 
void setColSolution (const double *newsolution)
 
void setRowPrice (const double *rowprice)
 
void setColSetBounds (const int *indexFirst, const int *indexLast, const double *boundlist)
 
void setRowSetBounds (const int *indexFirst, const int *indexLast, const double *boundlist)
 
void setInteger (const int &colindex)
 
void setInteger (const int *indices, int len)
 
void setcolname (const std::string &name, const int &columnid) const
 
void setrowname (const std::string &name, const int &rowid) const
 
void writeLP (const std::string &location) const
 
void writeMPS (const std::string &location) const
 
void branchAndBound ()
 
void enablematrixcaching ()
 
void disablematrixcaching ()
 
FMTsolverinterface getsolvertype () const
 
void synchronize ()
 
void sortdeletedcache ()
 
const std::vector< int > & getcachedeletedconstraints () const
 
const std::vector< int > & getcachedeletedvariables () const
 
std::string lowernuppertostr (const double &lower, const double &upper) const
 
std::string getcacheelements () const
 
void updaterowsandcolsnames (bool shortformat=true)
 
std::string getmskerrordesc (int error) 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 Core::FMTobject
static std::string getruntimelocation ()
 
static unsigned long long getavailablememory ()
 
- Protected Member Functions inherited from Models::FMTlpsolver
bool canupdatesource () const
 
std::shared_ptr< OsiSolverInterface > buildsolverinterface (const FMTsolverinterface &lsolvertype) const
 
std::shared_ptr< OsiSolverInterface > copysolverinterface (const std::shared_ptr< OsiSolverInterface > &solver_ptr, const FMTsolverinterface &lsolvertype) const
 
void clearrowcache ()
 
const CoinPackedMatrix * getMatrixByRow () const
 
const CoinPackedMatrix * getMatrixByCol () 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 Heuristics::FMTlpheuristic
std::default_random_engine generator
 std random number generator of the heuristic each heuristic has it's own generator to generate different solution
 
size_t seed
 The random engine seed need to be a data member when serializing the class.
 
bool usingsolvercopy
 If true the heuristic will work from it's own copy of solverinterface, else it's going to work on the FMTlpmodel solverinterface.
 
- Protected Attributes inherited from Models::FMTlpsolver
FMTmatrixbuild matrixcache
 The matrix cache follow the constraints or variables that need to be added or removed to the problem.
 
FMTsolverinterface solvertype
 Solver type used maybe usefull for initialsolve or resolve to know what solver we are using to speed-up the process.
 
- 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

FMToperatingareaclusterer is made to do spatial clustering of operatingarea across a defined landscape from a shapefile. You can define the minimal and maximal area of the resulting clusters and minimize the heteroginity of a given statistic output of the whole clustered map. The initialsolve will attend to find a good initialsolution then the user could try to get an optimal solution with the branchandbound().

Constructor & Destructor Documentation

◆ FMToperatingareaclusterer() [1/3]

Heuristics::FMToperatingareaclusterer::FMToperatingareaclusterer ( )
default

Default constructor for FMToperatingareaclusterer.

◆ FMToperatingareaclusterer() [2/3]

Heuristics::FMToperatingareaclusterer::FMToperatingareaclusterer ( const Models::FMTsolverinterface interfacetype,
const size_t &  lseed,
const std::vector< FMToperatingareacluster > &  lclusters,
int  minimalnumberofclusters = -1,
int  maximalnumberofclusters = -1 
)

Constructor for FMToperatingareaclusterer taking a solver (interfacetype) a seed (lseed) an a vector of (clusters) to aggregate.

◆ FMToperatingareaclusterer() [3/3]

Heuristics::FMToperatingareaclusterer::FMToperatingareaclusterer ( const FMToperatingareaclusterer )

Default copy constructor for FMToperatingareaclusterer.

◆ ~FMToperatingareaclusterer()

Heuristics::FMToperatingareaclusterer::~FMToperatingareaclusterer ( )
default

Default destructor for FMToperatingareaclusterer.

Member Function Documentation

◆ branchnboundsolve()

bool Heuristics::FMToperatingareaclusterer::branchnboundsolve ( )
finalvirtual

Solve problem using Branch and bound on the primal formulation. If the function is called after a call to initialsolve() it's going to use the heuristic solution has a starting MIP solution, if not it's going to directly use the BnB on the formulated problem.

Reimplemented from Heuristics::FMTlpheuristic.

◆ buildproblem()

void Heuristics::FMToperatingareaclusterer::buildproblem ( )

This function build the whole problem by calling in this order buildclustersvariable,addobjective,addlinksrows,addforcingrows,addareaconstraints. to generate a complete formulation for minimizing the heterogenity.

◆ getbinariescount()

size_t Heuristics::FMToperatingareaclusterer::getbinariescount ( ) const

Get number of binaries in the whole problem.

◆ getsolution()

std::vector< FMToperatingareacluster > Heuristics::FMToperatingareaclusterer::getsolution ( ) const

Returns the clustering solution with cleaned operatingclusters, the user can then use the solution.

◆ initialsolve()

bool Heuristics::FMToperatingareaclusterer::initialsolve ( )
finalvirtual

Solve the heuristic problem using the original heuristic resolving the problem till finding a initial solution for each operating area.The fire spread heuristic will try to get a good initial clustering solution.

Reimplemented from Models::FMTlpsolver.

◆ operator=()

FMToperatingareaclusterer & Heuristics::FMToperatingareaclusterer::operator= ( const FMToperatingareaclusterer )
default

Default copy assignement for FMToperatingareaclusterer.

◆ setnumberofsimulationpass()

void Heuristics::FMToperatingareaclusterer::setnumberofsimulationpass ( const int &  pass)

Sets the number of pass that will be made in the heuristics. It's the number of try made to get a better objective and/or a feasible solution value during the initialsolve phase.

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

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