10#include <boost/serialization/serialization.hpp>
11#include <boost/serialization/nvp.hpp>
12#include <boost/serialization/export.hpp>
13#include <boost/serialization/vector.hpp>
18#ifndef FMToperatingareaclusterer_Hm_included
19#define FMToperatingareaclusterer_Hm_included
45 const size_t& p_seed,
const std::vector<FMTOperatingAreaCluster>& p_clusters,
46 int p_minimalnumberofclusters = -1,
int p_maximalnumberofclusters = -1);
86 bool branchNBoundSolve() final;
100 friend class
boost::serialization::access;
108 template<class Archive>
109 void serialize(Archive& ar, const
unsigned int version)
111 ar & boost::serialization::make_nvp(
"FMTlpheuristic", boost::serialization::base_object<FMTLpHeuristic>(*
this));
112 ar & boost::serialization::make_nvp(
"clusters", m_clusters);
113 ar & boost::serialization::make_nvp(
"numberofsimulationpass", m_numberofsimulationpass);
120 std::vector<FMTOperatingAreaCluster>m_clusters;
123 int m_numberofsimulationpass;
126 int m_minimalnumberofclusters;
129 int m_maximalnumberofclusters;
138 std::map<Core::FMTMask,std::vector<FMTOperatingAreaClusterBinary>>_getAllBinaries()
const;
144 double _calculateTotalArea()
const;
150 inline const double& _getTotalArea()
const
162 void _addMaxMinObjective(
const FMTOperatingAreaCluster& cluster,
const FMTOperatingAreaClusterBinary& binary,
163 const std::vector<FMTOperatingAreaClusterBinary>& binaries,
164 const int& clusterid);
169 void _buildClustersVariables();
174 void _addObjective();
179 void _addLinksRows();
184 void _addForcingRows();
189 void _addNumberOfClusterRows();
194 void _addAreaConstraints();
200 void _setAllInteger();
208 double _getSpreadProbability(
const std::vector<FMTOperatingAreaClusterBinary>& incluster,
const FMTOperatingAreaClusterBinary& target)
const;
217 bool _spread(
const FMTOperatingAreaCluster& ignition,std::vector<FMTOperatingAreaClusterBinary>& assigned);
224 double _getTargetedOperatingAreaSize(
const FMTOperatingAreaCluster& target);
233 bool _isValidarea(
const FMTOperatingAreaCluster& cluster,
234 const double& area,
const size_t& actives)
const;
245 std::vector<int>_getBinariesVariables()
const;
#define FMTEXPORT
Definition: FMTutility.h:125
Base class for solving LP and MIP problems using a heuristic, holding a random generator and its own ...
Definition: FMTLpHeuristic.h:34
Potential cluster of multiple operating areas.
Definition: FMTOperatingAreaCluster.h:27
Heuristic to do spatial clustering of operating areas across a landscape from a shapefile.
Definition: FMTOperatingAreaClusterer.h:28
~FMTOperatingAreaClusterer()=default
Default destructor for FMTOperatingAreaClusterer.
FMTOperatingAreaClusterer(const FMTOperatingAreaClusterer &)
Default copy constructor for FMTOperatingAreaClusterer.
FMTOperatingAreaClusterer(const Models::FMTSolverInterface &p_interfacetype, const size_t &p_seed, const std::vector< FMTOperatingAreaCluster > &p_clusters, int p_minimalnumberofclusters=-1, int p_maximalnumberofclusters=-1)
Construct a FMTOperatingAreaClusterer from a solver interface, a seed and a vector of clusters to agg...
FMTOperatingAreaClusterer()=default
Default constructor for FMTOperatingAreaClusterer.
void setNumberOfSimulationPass(const int &pass)
Set the number of passes made by the heuristic to get a better objective or a feasible solution durin...
size_t getBinariesCount() const
Get the number of binaries in the whole problem.
bool initialSolve() final
Solve the heuristic problem using the fire spread heuristic to get a good initial clustering solution...
Namespace regrouping all tools for solving LP/MIP problems using an heuristic.
Definition: FMTAreaParser.h:47
FMTSolverInterface
Enumerator used to specify the solver to use when solving the FMTLpModel.
Definition: FMTsolverinterface.h:21
Definition: FMTAction.h:463