8#ifndef PYEXPORTHEURISTICS_H_INCLUDED
9#define PYEXPORTHEURISTICS_H_INCLUDED
20#include "boost/python.hpp"
27 namespace bp = boost::python;
28 bp::object HeuristicsModule(bp::handle<>(bp::borrowed(PyImport_AddModule(
"FMT.Heuristics"))));
29 bp::scope().attr(
"Heuristics") = HeuristicsModule;
30 bp::scope HeuristicsModule_scope = HeuristicsModule;
31 bp::scope().attr(
"__doc__") =
".. module:: Heuristics\n"
33 " :platform: Unix, Windows\n"
34 " :synopsis: Module used for Heuristics.\n"
47 bp::class_<Heuristics::FMTOperatingArea>(
"FMToperatingarea",
"@DocString(FMTOperatingArea)")
48 .def(bp::init<const Core::FMTMask&, const double&>())
49 .def_pickle(FMT_pickle_suite<Heuristics::FMTOperatingArea>())
51 "@DocString(FMTOperatingArea::getneighbors)")
53 "@DocString(FMTOperatingArea::setneighbors)")
55 "@DocString(FMTOperatingArea::getmask)")
57 "@DocString(FMTOperatingArea::getneihgborsperimeter)");
59 definePyList<Heuristics::FMTOperatingArea>();
61 bp::class_<Heuristics::FMTOperatingAreaScheme,bp::bases<Heuristics::FMTOperatingArea>>(
"FMToperatingareascheme",
"@DocString(FMTOperatingAreaScheme)")
63 const size_t&,
const size_t&,
const size_t&,
const size_t&,
double>())
65 "@DocString(FMTOperatingAreaScheme::preSolve)");
67 definePyList<Heuristics::FMTOperatingAreaScheme>();
69 bp::class_<Heuristics::FMTOperatingAreaClusterBinary,bp::bases<Heuristics::FMTOperatingArea>>(
"FMToperatingareaclusterbinary",
"@DocString(FMTOperatingAreaClusterBinary)");
71 definePyList<Heuristics::FMTOperatingAreaClusterBinary>();
73 bp::class_<Heuristics::FMTOperatingAreaCluster>(
"FMToperatingareacluster",
"@DocString(FMTOperatingAreaCluster)")
74 .def(bp::init<const Heuristics::FMTOperatingAreaCluster&,const double&, const double&>())
76 "@DocString(FMTOperatingAreaCluster::getfilteredcluster)")
78 "@DocString(FMTOperatingAreaCluster::getallmasks)")
80 "@DocString(FMTOperatingAreaCluster::getcentroid)")
82 "@DocString(FMTOperatingAreaCluster::setminimalarea)")
84 "@DocString(FMTOperatingAreaCluster::setmaximalarea)");
86 definePyList<Heuristics::FMTOperatingAreaCluster>();
88 bp::class_<Heuristics::FMTLpHeuristic, bp::bases<Core::FMTObject, Models::FMTLpSolver>>(
"FMTlpheuristic",
"@DocString(Heuristics::FMTLpHeuristic)");
90 bp::class_<Heuristics::FMTOperatingAreaClusterer, bp::bases<Heuristics::FMTLpHeuristic>>(
"Heuristics::FMToperatingareaclusterer",
"@DocString(FMTOperatingAreaClusterer)")
92 "@DocString(FMTOperatingAreaClusterer::initialsolve)")
94 "@DocString(FMTOperatingAreaClusterer::branchnboundsolve)")
96 "@DocString(FMTOperatingAreaClusterer::setnumberofsimulationpass)")
98 "@DocString(FMTOperatingAreaClusterer::getsolution)");
100 definePyList<Heuristics::FMTOperatingAreaClusterer>();
102 bp::class_<Heuristics::FMTOperatingAreaScheduler, bp::bases<Heuristics::FMTLpHeuristic>>(
"Heuristics::FMToperatingareascheduler",
"@DocString(FMTOperatingAreaScheduler)")
104 "@DocString(FMTOperatingAreaScheduler::initialsolve)")
106 "@DocString(FMTOperatingAreaScheduler::branchnboundsolve)")
108 "@DocString(FMToperatingareaheuristic::getsolution)")
110 "@DocString(FMTOperatingAreaScheduler::setasprimal)")
112 "@DocString(FMTOperatingAreaScheduler::setproportionofset)");
114 definePyList<Heuristics::FMTOperatingAreaScheduler>();
FMTOperatingAreaClusterBinary getCentroid() const
Return the centroid binary of the cluster.
Definition: FMTOperatingAreaCluster.h:80
void setMinimalArea(const double &newminimalarea)
Set the minimal area of the cluster.
FMTOperatingAreaCluster getFilteredCluster(const Core::FMTMask &filterMask) const
Return a cluster with the binaries not falling in a mask definition removed, which can reduce the num...
void setMaximalArea(const double &newmaximalarea)
Set the potential maximal area of the cluster.
std::vector< Core::FMTMask > getAllMasks() const
Return all the masks contained by the cluster, including the operating area centroid.
std::vector< FMTOperatingAreaCluster > getSolution() const
Return the clustering solution with cleaned operating clusters.
void setNumberOfSimulationPass(const int &pass)
Set the number of passes made by the heuristic to get a better objective or a feasible solution durin...
bool initialSolve() final
Solve the heuristic problem using the fire spread heuristic to get a good initial clustering solution...
bool branchNBoundSolve() final
Solve the problem using branch and bound on the primal formulation, using the heuristic solution as a...
void setAsPrimal()
Set the primal member to true.
bool branchNBoundSolve() final
Solve the problem using branch and bound on the primal formulation, using the heuristic solution as a...
bool initialSolve() final
Solve the heuristic problem until an initial solution is found for each operating area.
void setProportionOfSet(const double &proportion)
Set the allowed proportion of operating area status change before resolving the problem.
std::vector< Core::FMTTimeYieldHandler > getSolution(const std::string &yldname) const
Return the actual solution as a vector of time yield handlers, one per operating area.
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.
Operating area giving information about its mask, neighbors and neighbors perimeter.
Definition: FMTOperatingArea.h:29
double getNeighborsPerimeter() const
Return the percentage of perimeter the operating area needs to share with another operating area to b...
std::vector< Core::FMTMask > getNeighbors() const
Return a copy of the neighbors masks of the operating area.
void setNeighbors(const std::vector< Core::FMTMask > &lneighbors)
Set the neighbors masks of the operating area.
Core::FMTMask getMask() const
Return the mask of the operating area.
Definition: PYdefinitions.h:14
void exportHeuristics()
Definition: PYexportHeuristics.h:25