8#ifndef PYEXPORTMODEL_H_INCLUDED
9#define PYEXPORTMODEL_H_INCLUDED
21#include "boost/python.hpp"
25BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(greedyreferencebuild_overloads,greedyreferencebuild, 2, 4)
26BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(buildperiod_overloads, buildperiod, 0, 3)
27BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(get_outputs_overloads, get_outputs, 0, 1)
28BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getsolution_overloads, getsolution, 1, 2)
29BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getLPoutputoverloads, getoutput, 2, 3)
30BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getschedulesoverloads, getschedule, 0, 1)
31BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getpotentialscheduleoverloads, getpotentialschedule,2,3)
32BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(warmup_overloads, warmup, 2, 4)
33BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(evaluate_overloads, evaluate, 1, 2)
34BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getoperatingareaschedulerheuristics_overloads, getoperatingareaschedulerheuristics,2, 4)
35BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getoperatingareaclustererheuristics_overloads,getoperatingareaclustererheuristics,4,7)
36BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getareavariabilities_overloads, getareavariabilities,2,3)
37BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(boundsolution_overloads, boundsolution, 1, 2)
38BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(eraseperiod_overloads, eraseperiod,0,1)
39BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setsolution_overloads,setsolution, 2, 3)
40BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setsolutionbylp_overloads,setsolutionbylp, 2, 3)
41BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(addscheduletoobjective_overloads, addscheduletoobjective, 1, 2)
42BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getarea_overloads, getarea, 0, 2)
43BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(doplanning_overloads,doplanning,1,2)
44BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(showparameters_overloads,showparameters,0,1)
45BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(eraseconstraint_overloads,eraseconstraint,1, 2)
49 namespace bp = boost::python;
50 bp::object ModelsModule(bp::handle<>(bp::borrowed(PyImport_AddModule(
"FMT.Models"))));
51 bp::scope().attr(
"Models") = ModelsModule;
52 bp::scope ModelsModule_scope = ModelsModule;
53 bp::scope().attr(
"__doc__") =
".. module:: Model\n"
55 " :platform: Unix, Windows\n"
56 " :synopsis: Module used to generate all kind of Models (M2/M3).\n"
60 bp::class_<Models::FMTmodel, bp::bases<Core::FMTobject>>(
"FMTmodel",
"@DocString(FMTmodel)")
61 .def_pickle(FMT_pickle_suite<Models::FMTmodel>())
62 .def(bp::init<Models::FMTmodel>())
64 "@DocString(FMTmodel::getyields)")
66 "@DocString(FMTmodel::setyields)")
68 "@DocString(FMTmodel::setlifespan)")
69 .def(
"addageyieldhandlers", &Models::FMTmodel::addyieldhandlers<Core::FMTageyieldhandler>,
70 "@DocString(FMTmodel::addyieldhandlers)")
71 .def(
"addtimeyieldhandlers", &Models::FMTmodel::addyieldhandlers<Core::FMTtimeyieldhandler>,
72 "@DocString(FMTmodel::addyieldhandlers)")
74 "@DocString(FMTmodel::getname)")
75 .def(
"getarea",&
Models::FMTmodel::getarea, getarea_overloads(bp::args(
"period",
"beforegrowanddeath"),
"@DocString(FMTmodel::getarea)"))
77 "@DocString(FMTmodel::setarea)")
79 "@DocString(FMTmodel::getthemes)")
81 "@DocString(FMTmodel::setthemes)")
83 "@DocString(FMTmodel::getactions)")
85 "@DocString(FMTmodel::setactions)")
87 "@DocString(FMTmodel::getoutputs)")
89 "@DocString(FMTmodel::setoutputs)")
91 "@DocString(FMTmodel::getconstraints)")
93 "@DocString(FMTmodel::setconstraints)")
95 "@DocString(FMTmodel::gettransitions)")
97 "@DocString(FMTmodel::settransitions)")
99 "@DocString(FMTmodel::setname)")
101 "@DocString(FMTmodel::setareaperiod)")
103 "@DocString(FMTmodel::getlifespan)")
105 "@DocString(FMTmodel::isvalid)")
107 "@DocString(FMTmodel::clearcache)")
109 "@DocString(FMTmodel::getselectedmask)")
111 "@DocString(FMTmodel::getpostsolvefilter)")
113 "@DocString(FMTmodel::basepresolve)")
115 "@DocString(FMTmodel::isoptimal)")
117 "@DocString(FMTmodel::getobjectivevalue)")
119 getpotentialscheduleoverloads(bp::args(
"toremove",
"selection",
"withlock"),
"@DocString(FMTmodel::getpotentialschedule)"))
122 "@DocString(FMTmodel::setparameter(const FMTintmodelparameters,const int&))")
124 "@DocString(FMTmodel::setparameter(const FMTdblmodelparameters,const double))")
126 "@DocString(FMTmodel::setparameter(const FMTboolmodelparameters,const bool))")
128 "@DocString(FMTmodel::getparameter(const FMTintmodelparameters))")
130 "@DocString(FMTmodel::getparameter(const FMTdblmodelparameters))")
132 "@DocString(FMTmodel::getparameter(const FMTboolmodelparameters))")
134 "@DocString(FMTmodel::setcompresstime)")
136 "@DocString(FMTmodel::getcompresstime)")
138 showparameters_overloads(bp::args(
"showhelp"),
"@DocString(FMTmodel::showparameters)"))
140 doplanning_overloads(bp::args(
"solve"),
"@DocString(FMTmodel::doplanning)"))
142 getsolution_overloads(bp::args(
"period",
"withlock"),
"@DocString(FMTmodel::getsolution)"))
144 getLPoutputoverloads(bp::args(
"output",
"period",
"level"),
"@DocString(FMTsemodel::getoutput)"));
146 define_pylist<Models::FMTmodel>();
150 bp::to_python_converter<std::map<std::string, double>, MapToDict<std::string, double>>();
152 bp::class_<Models::FMTsemodel, bp::bases<Models::FMTmodel>>(
"FMTsemodel",
"@DocString(FMTsemodel)")
153 .def(bp::init<Models::FMTmodel>())
154 .def_pickle(FMT_pickle_suite<Models::FMTsemodel>())
156 "@DocString(FMTsemodel::getmapping)")
158 "@DocString(FMTsemodel::setinitialmapping)")
160 getschedulesoverloads(bp::args(
"withlock"),
"@DocString(FMTsemodel::getschedule)"))
162 "@DocString(FMTsemodel::getdisturbancestats)")
164 "@DocString(FMTsemodel::getspatialoutput)")
172 "@DocString(FMTsemodel::getspschedule)");
174 define_pylist<Models::FMTsemodel>();
177 bp::class_<Models::FMTsesmodel, bp::bases<Models::FMTsemodel>>(
"FMTsesmodel",
"@DocString(FMTsesmodel)")
178 .def(bp::init<Models::FMTmodel>())
179 .def_pickle(FMT_pickle_suite<Models::FMTsesmodel>())
181 greedyreferencebuild_overloads(bp::args(
"schedule",
"numberofiterations",
"seed",
"tolerance"),
"@DocString(FMTsesmodel::greedyreferencebuild)"));
183 define_pylist<Models::FMTsesmodel>();
185 bp::enum_<Models::FMTintmodelparameters>(
"FMTintmodelparameters")
193 define_pylist<Models::FMTintmodelparameters>();
195 bp::enum_<Models::FMTdblmodelparameters>(
"FMTdblmodelparameters")
199 define_pylist<Models::FMTdblmodelparameters>();
201 bp::enum_<Models::FMTboolmodelparameters>(
"FMTboolmodelparameters")
209 define_pylist<Models::FMTboolmodelparameters>();
215 bp::enum_<Models::FMTsolverinterface>(
"FMTsolverinterface")
223 define_pylist<Models::FMTsolverinterface>();
225 bp::class_<Models::FMTlpsolver>(
"FMTlpolver",
"@DocString(FMTlpsolver)")
226 .def(bp::init<Models::FMTsolverinterface>())
228 "@DocString(FMTlpsolver::isProvenOptimal)")
230 "@DocString(FMTlpsolver::getObjValue)")
232 "@DocString(FMTlpsolver::getObjSense)")
234 "@DocString(FMTlpsolver::setnumberofthreads)")
236 "@DocString(FMTlpsolver::setMIPgaptolerance)")
238 "@DocString(FMTlpsolver::setoptimizerMAXtime)")
240 "@DocString(FMTlpsolver::writeLP)")
242 "@DocString(FMTlpsolver::writeMPS)");
244 bp::class_<Models::FMTsrmodel, bp::bases<Models::FMTmodel>>(
"FMTsrmodel",
"@DocString(FMTsrmodel)")
245 .def_pickle(FMT_pickle_suite<Models::FMTsrmodel>())
246 .def(
"buildperiod", &
Models::FMTsrmodel::buildperiod, buildperiod_overloads(bp::args(
"schedule",
"forcepartialbuild",
"compressageclass"),
"@DocString(FMTsrmodel::buildperiod)"))
249 setsolution_overloads(bp::args(
"period",
"schedule",
"tolerance"),
"@DocString(FMTsrmodel::setsolution)"))
252 setsolutionbylp_overloads(bp::args(
"period",
"schedule",
"tolerance"),
"@DocString(FMTsrmodel::setsolutionbylp)"))
255 "@DocString(FMTsrmodel::cleargraphdevelopements)")
257 "@DocString(FMTsrmodel::getstats)")
259 "@DocString(FMTsrmodel::getavailablesolverinterface)").staticmethod(
"getavailablesolverinterface")
261 "@DocString(FMTsrmodel::getscheduleproportions)");
263 define_pylist<Models::FMTsrmodel>();
265 bp::class_<Models::FMTnssmodel, bp::bases<Models::FMTsrmodel>>(
"FMTnssmodel",
"@DocString(FMTnssmodel)")
266 .def(bp::init<Models::FMTmodel, unsigned int>())
267 .def(bp::init<Models::FMTnssmodel>())
268 .def_pickle(FMT_pickle_suite<Models::FMTnssmodel>())
271 define_pylist<Models::FMTnssmodel>();
274 bp::class_<Models::FMTlpmodel, bp::bases<Models::FMTsrmodel>>(
"FMTlpmodel",
"@DocString(FMTlpmodel)")
275 .def(bp::init<Models::FMTmodel, Models::FMTsolverinterface>())
276 .def(bp::init<Models::FMTlpmodel>())
277 .def_pickle(FMT_pickle_suite<Models::FMTlpmodel>())
282 "@DocString(FMTlpmodel::setobjective)")
284 "@DocString(FMTlpmodel::clearcache)")
286 "@DocString(FMTlpmodel::clearconstraintlocation)")
288 "@DocString(FMTlpmodel::setstrictlypositivesoutputsmatrix)")
290 "@DocString(FMTlpmodel::setconstraint)")
292 eraseconstraint_overloads(bp::args(
"constraint",
"period"),
"@DocString(FMTlpmodel::eraseconstraint)"))
294 eraseperiod_overloads(bp::args(
"constraintsonly"),
"@DocString(FMTlpmodel::eraseperiod)"))
296 "@DocString(FMTlpmodel::resolve)")
298 "@DocString(FMTlpmodel::initialsolve)")
299 .def(
"__eq__", &Models::FMTlpmodel::operator ==,
300 "@DocString(FMTlpmodel::operator==)")
301 .def(
"__ne__", &Models::FMTlpmodel::operator !=,
302 "@DocString(FMTlpmodel::operator!=)")
305 "@DocString(FMTlpmodel::getObjValue)")
306 .def(
"getlocalconstraints",
308 "@DocString(FMTlpmodel::getreplanningconstraints)")
311 "@DocString(FMTlpmodel::writeLP)")
312 .def(
"getoperatingareaschedulerheuristics", &
Models::FMTlpmodel::getoperatingareaschedulerheuristics, getoperatingareaschedulerheuristics_overloads(bp::args(
"opareas",
"node",
"numberofheuristics",
"copysolver",
"updatematrixname"),
"@DocString(FMTlpmodel::getoperatingareaschedulerheuristics)"))
313 .def(
"getoperatingareaclustererheuristics", &
Models::FMTlpmodel::getoperatingareaclustererheuristics, getoperatingareaclustererheuristics_overloads(bp::args(
"opareas",
"statisticoutput",
"areaoutput",
"period",
"numberofheuristics"),
"@DocString(FMTlpmodel::getoperatingareaschedulerheuristics)"))
315 .def(
"getareavariabilities", &
Models::FMTlpmodel::getareavariabilities, getareavariabilities_overloads(bp::args(
"outputs",
"globalmask",
"tolerance"),
"@DocString(FMTlpmodel::getareavariabilities)"))
320 define_pylist<Models::FMTlpmodel>();
326 bp::class_<Models::FMTsamodel, bp::bases<Models::FMTsemodel>>(
"FMTsamodel",
"@DocString(FMTsamodel)")
327 .def(bp::init<Models::FMTmodel>())
328 .def(bp::init<Models::FMTsamodel>())
330 "@DocString(FMTsamodel::initialsolve)");
332 define_pylist<Models::FMTsamodel>();
Graph::FMTgraphstats eraseconstraint(const Core::FMTconstraint &constraint, int period=-1)
void clearconstraintlocation()
Graph::FMTgraphstats eraseperiod(bool constraintsonly=false)
Graph::FMTgraphstats setconstraint(const Core::FMTconstraint &constraint)
void writeLP(const std::string &location)
Graph::FMTgraphstats setobjective(const Core::FMTconstraint &objective)
void setstrictlypositivesoutputsmatrix()
std::map< std::string, std::vector< double > > getvariabilities(const std::vector< Core::FMToutput > &outputs, const int &periodstart, const int &periodstop)
double getObjValue() const
std::vector< Heuristics::FMToperatingareascheduler > getoperatingareaschedulerheuristics(const std::vector< Heuristics::FMToperatingareascheme > &opareas, const Core::FMToutputnode &node, size_t numberofheuristics=1, bool copysolver=true)
std::vector< Heuristics::FMToperatingareaclusterer > getoperatingareaclustererheuristics(const std::vector< Heuristics::FMToperatingareacluster > &clusters, const Core::FMToutput &statisticoutput, const Core::FMToutput &areaoutput, const int &period, size_t numberofheuristics=1, int minimalnumberofclusters=-1, int maximalnumberofclusters=-1) const
std::map< std::string, std::vector< double > > getareavariabilities(const std::vector< Core::FMToutput > &localoutputs, const std::vector< Core::FMTmask > &globalmasks, std::vector< double > tolerances=std::vector< double >()) const
void addscheduletoobjective(const Core::FMTschedule &schedule, double weight=1000)
virtual std::vector< Core::FMTconstraint > getreplanningconstraints(const std::string &modeltype, const std::vector< Core::FMTconstraint > &localconstraints, const int &period) const
bool isProvenOptimal() const
void setMIPgaptolerance(const double &gap)
double getObjValue() const
void setoptimizerMAXtime(const double &time)
void writeLP(const std::string &location) const
double getObjSense() const
void setnumberofthreads(const size_t &nthread)
void writeMPS(const std::string &location) const
Definition: FMTmodel.hpp:60
void setname(const std::string &newname)
virtual void clearcache()
std::vector< int > getcompresstime() const
void setyields(const Core::FMTyields &lylds)
virtual Core::FMTschedule getsolution(int period, bool withlock=false) const
Core::FMTlifespans getlifespan() const
Definition: FMTmodel.hpp:233
virtual bool setparameter(const FMTintmodelparameters &key, const int &value)
void setconstraints(const std::vector< Core::FMTconstraint > &lconstraint)
std::string getname() const
Definition: FMTmodel.hpp:193
void setarea(const std::vector< Core::FMTactualdevelopment > &ldevs)
std::vector< Core::FMToutput > getoutputs() const
Definition: FMTmodel.hpp:241
Core::FMTyields getyields() const
Definition: FMTmodel.hpp:225
virtual bool isoptimal() const
std::vector< Core::FMTtransition > gettransitions() const
Definition: FMTmodel.hpp:217
virtual void showparameters(const bool &showhelp=false) const
Core::FMTmaskfilter getpostsolvefilter(const std::vector< Core::FMTtheme > &originalthemes, const Core::FMTmask &devmask) const
std::vector< Core::FMTaction > getactions() const
Definition: FMTmodel.hpp:209
std::vector< Core::FMTtheme > getthemes() const
Definition: FMTmodel.hpp:201
virtual std::vector< Core::FMTactualdevelopment > getarea(int period=0, bool beforegrowanddeath=false) const
bool setcompresstime(const int &periodstart, const int &periodstop, const int &value)
void setareaperiod(const int &period)
void setlifespan(const Core::FMTlifespans &llifespan)
void settransitions(const std::vector< Core::FMTtransition > <ransitions)
void setoutputs(const std::vector< Core::FMToutput > &newoutputs)
int getparameter(const FMTintmodelparameters &key) const
void setactions(const std::vector< Core::FMTaction > &lactions)
virtual bool doplanning(const bool &solve, std::vector< Core::FMTschedule > schedules=std::vector< Core::FMTschedule >())
virtual double getobjectivevalue() const
FMTmodel basepresolve() const
Core::FMTschedule getpotentialschedule(std::vector< Core::FMTactualdevelopment > toremove, std::vector< Core::FMTactualdevelopment > selection, bool withlock=true) const
void setthemes(const std::vector< Core::FMTtheme > <hemes)
Core::FMTmask getselectedmask(const std::vector< Core::FMTtheme > &originalthemes) const
std::vector< Core::FMTconstraint > getconstraints() const
Definition: FMTmodel.hpp:249
virtual std::map< std::string, double > getoutput(const Core::FMToutput &output, int period, Core::FMToutputlevel level=Core::FMToutputlevel::standard) const
virtual Spatial::FMTlayer< double > getspatialoutput(const Core::FMToutput &output, int period) const
std::string getdisturbancestats() const
std::vector< Core::FMTschedule > getschedule(bool withlock=false) const
Spatial::FMTspatialschedule getspschedule() const
Definition: FMTsemodel.hpp:100
Spatial::FMTforest getmapping() const
bool setinitialmapping(Spatial::FMTforest forest)
std::map< std::string, double > greedyreferencebuild(const Core::FMTschedule &schedule, const size_t &randomiterations, unsigned int seed=0, double tolerance=FMT_DBL_TOLERANCE)
bool setsolutionbylp(int period, const Core::FMTschedule &schedule, double tolerance=FMT_DBL_TOLERANCE)
Graph::FMTgraphstats buildperiod(Core::FMTschedule schedule=Core::FMTschedule(), bool forcepartialbuild=false, int compressageclassoperability=1)
Graph::FMTgraphstats getstats() const
static std::vector< Models::FMTsolverinterface > getavailablesolverinterface()
Core::FMTschedule getscheduleproportions(int period, bool withlock) const
void cleargraphdevelopements()
bool forcesolution(int period, const Core::FMTschedule &proportionschedulewithlock)
bool setsolution(int period, const Core::FMTschedule &schedule, double tolerance=FMT_DBL_TOLERANCE)
FMTdblmodelparameters
Definition: FMTmodelparameters.hpp:37
@ TOLERANCE
Definition: FMTmodelparameters.hpp:38
@ GOALING_SCHEDULE_WEIGHT
Definition: FMTmodelparameters.hpp:39
FMTintmodelparameters
Definition: FMTmodelparameters.hpp:24
@ LENGTH
Definition: FMTmodelparameters.hpp:25
@ SEED
Definition: FMTmodelparameters.hpp:26
@ MATRIX_TYPE
Definition: FMTmodelparameters.hpp:30
@ NUMBER_OF_THREADS
Definition: FMTmodelparameters.hpp:29
@ PRESOLVE_ITERATIONS
Definition: FMTmodelparameters.hpp:28
@ NUMBER_OF_ITERATIONS
Definition: FMTmodelparameters.hpp:27
FMTboolmodelparameters
Definition: FMTmodelparameters.hpp:45
@ DEBUG_MATRIX
Definition: FMTmodelparameters.hpp:51
@ SHOW_LOCK_IN_SCHEDULES
Definition: FMTmodelparameters.hpp:49
@ PRESOLVE_CAN_REMOVE_STATIC_THEMES
Definition: FMTmodelparameters.hpp:50
@ STRICTLY_POSITIVE
Definition: FMTmodelparameters.hpp:47
@ FORCE_PARTIAL_BUILD
Definition: FMTmodelparameters.hpp:46
@ POSTSOLVE
Definition: FMTmodelparameters.hpp:48
Definition: PYdefinitions.hpp:14
void exportModel()
Definition: PYexportModel.hpp:47