9#ifndef FMTlpmodel_H_INCLUDED
10#define FMTlpmodel_H_INCLUDED
13#include <boost/serialization/export.hpp>
14#include <boost/serialization/split_member.hpp>
15#include <boost/serialization/unordered_map.hpp>
16#include <boost/serialization/vector.hpp>
21 class FMToperatingareascheduler;
22 class FMToperatingareaclusterer;
23 class FMToperatingareacluster;
24 class FMToperatingareascheme;
62 friend class boost::serialization::access;
63 template<
class Archive>
64 void save(Archive& ar,
const unsigned int version)
const
66 ar& boost::serialization::make_nvp(
"model", boost::serialization::base_object<FMTsrmodel>(*
this));
67 ar& BOOST_SERIALIZATION_NVP(elements);
69 template<
class Archive>
70 void load(Archive& ar,
const unsigned int version)
72 ar& boost::serialization::make_nvp(
"model", boost::serialization::base_object<FMTsrmodel>(*
this));
73 ar& BOOST_SERIALIZATION_NVP(elements);
77 std::vector<std::unordered_map<std::string,
78 std::vector<std::vector<int>>>>elements;
85 const std::vector<Heuristics::FMToperatingareacluster>& initialcluster,
88 const int& period,
int minimalnumberofclusters = -1,
int maximalnumberofclusters = -1)
const;
96 const FMTmatrixelement& element_type,
const std::map<int, double>& indexes,
98 double lowerbound = std::numeric_limits<double>::min(),
99 double upperbound = std::numeric_limits<double>::max());
104 bool getgoals(
const std::vector<std::string>& goalsnames, std::map<int,double>& index,
const double& sense)
const;
109 int getlevelfromlevelname(
const std::string& variable_level,
int period,
116 int getsetlevel(
const Core::FMTconstraint& constraint,
const std::string& variable_level,
int period);
122 std::vector<std::vector<int>>getmatrixelement(
const Core::FMTconstraint& constraint,
int period)
const;
127 void locatelevels(
const std::vector<Core::FMToutputnode>& nodes,
int period, std::map<int, double>& variables,
const Core::FMTconstraint& constraint,
double multiplier = 1);
134 std::vector<std::map<int, double>> locatenodes(
const std::vector<Core::FMToutputnode>& nodes,
int period, std::map<int, double>& variables,
double multiplier = 1)
const;
141 void updatematrixelements(std::vector<int>& matrixelements,
const std::vector<int>& deletedelements)
const;
147 void updateconstraintsmapping(
const std::vector<int>& Dvariables,
const std::vector<int>& Dconstraints);
155 bool updatematrixngraph(
bool updategraph =
true);
166 const FMTmatrixelement& element_type,
int period)
const;
176 bool issamematrixelement(
const int& matrixindex,
const FMTmatrixelement& element_type,
177 const double& lowerb,
const double& upperb,
const std::map<int, double>& variables)
const;
183 std::vector<int>setobjectivebounds(
bool dolower =
true,
bool doupper =
true,
double tolerance =
FMT_DBL_TOLERANCE);
188 void updatematrixnaming();
193 void updategeneralconstraintsnaming(std::vector<std::string>& colnames,
194 std::vector<std::string>& rownames)
const;
199 bool setpositiveoutputsinmatrix(
const Core::FMTconstraint& constraint,
const std::vector<std::map<int, double>>& strictlypositivesoutputs,
int period);
200 virtual void swap_ptr(
const std::unique_ptr<FMTmodel>& rhs);
205 FMTlpmodel(
const FMTsrmodel& rhs);
210 bool trysetsolution(
const std::vector<Core::FMTschedule>& schedules);
238 const FMTlpsolver& lsolver,
const std::vector<std::unordered_map<std::string,std::vector<std::vector<int>>>>& lelements);
282 virtual std::vector<Core::FMTconstraint>
getreplanningconstraints(
const std::string& modeltype,
const std::vector<Core::FMTconstraint>& localconstraints,
const int& period)
const;
327 std::map<std::string, std::vector<double>>
getvariabilities(
const std::vector<Core::FMToutput>& outputs,
328 const int& periodstart,
const int& periodstop);
335 std::vector<double> tolerances)
const;
342 std::map<std::string, std::vector<double>>
getareavariabilities(
const std::vector<Core::FMToutput>& localoutputs,
343 const std::vector<Core::FMTmask>& globalmasks,
344 std::vector<double> tolerances = std::vector<double>())
const;
361 size_t numberofheuristics=1,
362 bool copysolver=
true);
373 size_t numberofheuristics=1,
374 int minimalnumberofclusters = -1,
375 int maximalnumberofclusters = -1)
const;
421 virtual std::unique_ptr<FMTmodel>
clone()
const;
427 virtual std::unique_ptr<FMTmodel>
presolve(std::vector<Core::FMTactualdevelopment> optionaldevelopments = std::vector<Core::FMTactualdevelopment>())
const;
435 virtual bool build(std::vector<Core::FMTschedule> schedules=std::vector<Core::FMTschedule>());
448 virtual std::unique_ptr<FMTmodel>
getcopy(
int period = 0)
const;
#define FMT_DBL_TOLERANCE
Definition: FMTutility.hpp:11
#define FMTEXPORT
Definition: FMTutility.hpp:92
Definition: FMTconstraint.hpp:54
Definition: FMToutput.hpp:39
Definition: FMToutputnode.hpp:20
Definition: FMTschedule.hpp:31
Definition: FMTgraph.hpp:78
Definition: FMTgraphstats.hpp:28
Definition: FMToperatingareaclusterer.hpp:30
Definition: FMTlpmodel.hpp:57
void writeMPS(const std::string &location)
FMTlpmodel(const FMTmodel &base, FMTsolverinterface lsolvertype)
FMTlpmodel(const FMTlpmodel &rhs)
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)
virtual std::unique_ptr< FMTmodel > getcopy(int period=0) const
FMTlpmodel getlocalmodel(FMTmodel localmodel=FMTmodel(), int period=0) const
void writeLP(const std::string &location)
virtual bool build(std::vector< Core::FMTschedule > schedules=std::vector< Core::FMTschedule >())
FMTlpmodel(const FMTmodel &base, const Graph::FMTgraph< Graph::FMTvertexproperties, Graph::FMTedgeproperties > &lgraph, const FMTlpsolver &lsolver, const std::vector< std::unordered_map< std::string, std::vector< std::vector< int > > > > &lelements)
Graph::FMTgraphstats setobjective(const Core::FMTconstraint &objective)
void setstrictlypositivesoutputsmatrix()
virtual std::unique_ptr< FMTmodel > presolve(std::vector< Core::FMTactualdevelopment > optionaldevelopments=std::vector< Core::FMTactualdevelopment >()) const
virtual std::map< std::string, double > getoutput(const Core::FMToutput &output, int period, Core::FMToutputlevel level=Core::FMToutputlevel::standard) const
std::map< std::string, std::vector< double > > getvariabilities(const std::vector< Core::FMToutput > &outputs, const int &periodstart, const int &periodstop)
double getObjValue() const
FMTlpmodel(FMTlpmodel &&rhs)=default
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::unique_ptr< FMTmodel > clone() const
FMTlpmodel getmodelfromproportions(const std::vector< Core::FMTmask > &globalmasks, std::vector< double > tolerances) const
virtual std::vector< Core::FMTconstraint > getreplanningconstraints(const std::string &modeltype, const std::vector< Core::FMTconstraint > &localconstraints, const int &period) const
Definition: FMTlpsolver.hpp:39
Definition: FMTmodel.hpp:60
Definition: FMTsrmodel.hpp:44
FMToutputlevel
Definition: FMTutility.hpp:17
@ standard
Definition: FMTutility.hpp:18
Namespace regrouping all tools for solving LP/MIP problems using an heuristic.
Definition: FMTareaparser.hpp:43
Namespace containing all enumerator and classes used to construct or manipulate the different type of...
Definition: FMTareaparser.hpp:50
FMTmatrixelement
Definition: FMTlpmodel.hpp:36
@ nr_items
Definition: FMTlpmodel.hpp:42
@ strictlypositive
Definition: FMTlpmodel.hpp:41
@ goalvariable
Definition: FMTlpmodel.hpp:37
@ objectivevariable
Definition: FMTlpmodel.hpp:39
@ levelvariable
Definition: FMTlpmodel.hpp:38
@ constraint
Definition: FMTlpmodel.hpp:40
FMTsolverinterface
Definition: FMTsolverinterface.hpp:21