#ifndef CINSTANCE_H #define CINSTANCE_H /** @author Antoine Rozenknop */ #include "../params/cparams.h" #include "indices.h" #include "ctype1.h" #include "ctype2.h" #include "cconstraint.h" #include #include #include class CInstance{ public: /** * lecture de l'instance à partir du fichier de données */ static void lire(const CParams & params); /** * Produit une analyse des données pour observation */ static void analyse(); private: static CParams m_params ; /* Main Information section */ static timestep_t m_T ; // number of timesteps static week_t m_H ; // number of weeks static campaign_t m_K ; // number of campaigns static scenario_t m_S ; // number of scenarios static double m_epsilon ; // value_of_epsilon static powerplants1_t m_J ; // number of powerplants of type 1 static powerplants2_t m_I ; // number of powerplants of type 2 static std::vector m_M ; // number of constraints of type i (13 <= i <= 21) static std::vector m_D ; // durations : length of timesteps t (t <= T) static std::vector > m_DEM ; //demand[s][t] static std::vector > m_EDEM ; //energy_demand[s][t] /* Power plants section */ static std::vector m_types1 ; // centrales de type 1 static std::vector m_types2 ; // centrales de type 2 /* Constraints section */ public: //modif Guillaume & Daniel static std::vector m_constraints13 ; static std::vector m_constraints14 ; static std::vector m_constraints15 ; static std::vector m_constraints16 ; static std::vector m_constraints17 ; static std::vector m_constraints18 ; static std::vector m_constraints19 ; static std::vector m_constraints20 ; static std::vector m_constraints21 ; /** * fonctions d'accès recommandées pour éviter les erreurs * d'inversion d'indices */ public: // number of timesteps static inline const timestep_t T() {return m_T;} ; // number of weeks static inline const week_t & H() {return m_H;} ; // number of campaigns static inline const campaign_t K() {return m_K;} ; // number of scenarios static inline const scenario_t S() {return m_S;} ; static inline const double & epsilon() { return m_epsilon; } // number of powerplants of type 1 static inline const powerplants1_t J() { return m_J; } ; // number of powerplants of type 2 static inline const powerplants2_t I() { return m_I; } ; static inline double & DEM(timestep_t t, scenario_t s) {return CInstance::m_DEM[s][t];} static inline double & EDEM(timestep_t t, scenario_t s) {return CInstance::m_EDEM[s][t];} static inline std::vector & DEM( scenario_t s) { return m_DEM[s];} static inline std::vector & EDEM( scenario_t s) { return m_EDEM[s];} static inline int & D(timestep_t t) { return m_D[t]; } static inline size_t & M(constraint_t c) { return m_M[c]; } static inline CType1 & type1(powerplants1_t j) { return m_types1[j]; } static inline CType2 & type2(powerplants2_t i) { return m_types2[i]; } static inline CParams & params() { return m_params; } static CConstraint * constraint(constraint_t type, size_t index); }; /// number of timesteps inline const timestep_t T() {return CInstance::T();} ; /// number of weeks inline const week_t & H() {return CInstance::H();} ; /// conversion inline timestep_t week2timestep(week_t h) { return (timestep_t) (h*T()/H()); } /// number of campaigns inline const campaign_t K() {return CInstance::K();} ; /// number of scenarios inline const scenario_t S() {return CInstance::S();} ; /// number of powerplants of type 1 inline const powerplants1_t J() { return CInstance::J(); } ; /// number of powerplants of type 2 inline const powerplants2_t I() { return CInstance::I(); } ; /** * powerplant de type 1 * @param j numéro de la centrale * @return la centrale de numéro j */ inline CType1 & type1(powerplants1_t j) { return CInstance::type1(j); } /** * powerplant de type 2 * @param i numéro de la centrale * @return la centrale de numéro i */ inline CType2 & type2(powerplants2_t i) { return CInstance::type2(i); } /** * DEM * @param t timestep * @param s scenario * @return demande */ inline const double & DEM(timestep_t t, scenario_t s) {return CInstance::DEM(t,s);} /** * EDEM : energie demandée sur un pas de temps = DEM * Dt * @param t timestep * @param s scenario * @return demande */ inline const double & EDEM(timestep_t t, scenario_t s) {return CInstance::EDEM(t,s);} /** * D * @param t timestep * @return durée du pas de temps (en heures) */ inline const int & D() {return CInstance::D((timestep_t)0);} /** * EMAX : max energy of type1 powerplant j for timestep t and scenario s * @param j numéro de centrale de type 1 * @param t pas de temps * @param s scénario * @return */ inline const double & EMAX(powerplants1_t j, timestep_t t, scenario_t s) { return type1(j).EMAX(t,s); } /** * PMIN(j,t,s) : min energy of type1 powerplant j for timestep t and scenario s * @param j numéro de centrale de type 1 * @param t pas de temps * @param s scénario * @return */ inline const double & EMIN(powerplants1_t j, timestep_t t, scenario_t s) { return type1(j).EMIN(t,s); } /** * C(j,t,s) : proportional production cost of type1 powerplant j for timestep t and scenario s * @param j numéro de centrale de type 1 * @param t pas de temps * @param s scénario * @return */ inline const double & C (powerplants1_t j, timestep_t t, scenario_t s) { return type1(j).C(t,s); } /** * XI(i) : initial fuel stock x(i,0,s) for any s * @param i * @return */ inline const double & XI (powerplants2_t i) { return type2(i).XI; } /** * DA : length of outage of cycle k in weeks * @param i powerplant index * @param k cycle index * @return */ inline const wlen_t DA (powerplants2_t i, campaign_t k) { return (wlen_t) type2(i).DA(k); } /** * MMAX: maximum modulation over the production campaign of cycle k * @param i powerplant index * @param k cycle index * @return */ inline const double & MMAX(powerplants2_t i, campaign_t k) { return type2(i).MMAX(k) ; } /** * RMAX: maximum load of fuel provided during the outage of cycle k * @param i powerplant index * @param k cycle index * @return */ inline const double & RMAX(powerplants2_t i, campaign_t k) { return type2(i).RMAX(k); } /** * RMIN: minimum load of fuel provided during the outage of cycle k * @param i powerplant index * @param k cycle index * @return */ inline const double & RMIN(powerplants2_t i, campaign_t k) { return type2(i).RMIN(k); } /** * Q: refueling coefficient during the outage of cycle k * @param i powerplant index * @param k cycle index * @return */ inline const double & Q (powerplants2_t i, campaign_t k) { return type2(i).Q(k); } /** * PMAX: maximum power during time step t (see constraints [CT5][CT6]) * @param i powerplant index * @param t time step index * @return */ inline const double & PMAX(powerplants2_t i, timestep_t t) { return type2(i).PMAX(t); } /** * EMAX: maximum energy during time step t (see constraints [CT5][CT6]) * @param i powerplant index * @param t time step index * @return */ inline const double & EMAX(powerplants2_t i, timestep_t t) { return type2(i).EMAX(t); } /** * BO : bound on stock of fuel that activates the constraint of imposition of power profile during * cycle k (see constraint [CT5][CT6]) * @param i powerplant index * @param k cycle index * @return */ inline const double & BO (powerplants2_t i, campaign_t k) { return type2(i).BO(k); } /** * PB(i,k) : imposed decreasing production profile during the production campaign of cycle k * (piece-wise linear concave function dependent on the level of fuel) (see constraint [CT6]) * @param i powerplant index * @param k cycle index * @return */ inline const CProfile & PB (powerplants2_t i, campaign_t k) { return type2(i).PB(k); } /** * ε : tolerance for tracking of the imposed decreasing production profile (see constraint [CT6]) * @return */ inline const double & epsilon() { return CInstance::epsilon(); } /** * SMAXi,k : maximum bound on stock of fuel during production campaign of cycle k (see constraint * [CT11]) * @param i powerplant index * @param k cycle index * @return */ inline const double & SMAX(powerplants2_t i, campaign_t k) { return type2(i).SMAX(k); } /** * AMAXi,k : maximum bound on stock of fuel at the time of outage of cycle k. (see constraint * [CT11]) * NB: these parameters have the following property : SMAXi,k > AMAXi,k > BOi,k > 0 * @param i powerplant index * @param k cycle index * @return */ inline const double & AMAX(powerplants2_t i, campaign_t k) { return type2(i).AMAX(k); } /** * C(i,k) : proportional cost of fuel during cycle k * @param i powerplant index * @param k cycle index * @return */ inline const double C (powerplants2_t i, campaign_t k) { return k==-1 ? 0 : k==K_Tp1 ? type2(i).CiTp1 : type2(i).C(k); } /** * C(i,T+1) : proportional cost of fuel at the end of the time horizon [T,T+1] * @param i powerplant index * @return */ inline const double & CiTp1( powerplants2_t i) { return type2(i).CiTp1; } /** * TO(i,k) : first possible week of the start of an outage (i.e. decoupling) * @param i powerplant index * @param k cycle index * @return */ inline const week_t & TO( powerplants2_t i, campaign_t k ) {return CInstance::type2(i).TO(k) ;} /** * TA(i,k) : last possible week of the start of an outage (i.e. decoupling) * @param i powerplant index * @param k cycle index * @return */ inline const week_t & TA( powerplants2_t i, campaign_t k ) {return CInstance::type2(i).TA(k) ;} inline vector< CConstraint * > & constraints( powerplants2_t i, int type ) { return type2(i).m_constraints[type]; } /// durée minimale en semaines pour vider la centrale sur BO à partir d'une semaine fixée inline wlen_t longueur_BO( powerplants2_t i, campaign_t k, double fuel, week_t debut ) { return type2(i).longueur_BO( k, fuel, debut) ; } /// production sur BO sur une durée fixée, partant d'une semaine fixée inline double PB ( powerplants2_t i, campaign_t k, double fuel, week_t h1, wlen_t duree ) { return type2(i).PB(k,fuel,h1,duree) ; } /// production min sur BO sur une durée fixée, partant d'une semaine fixée inline CIntervallesBO PBlimits ( powerplants2_t i, campaign_t k, week_t h1, wlen_t duree, CIntervallesBO limits) { return type2(i).PBlimits(k,h1,duree,limits) ; } #endif