Antares Simulator
Power System Simulator
Loading...
Searching...
No Matches
LpsFromAntares.h
1
2/*
3 * Copyright 2007-2024, RTE (https://www.rte-france.com)
4 * See AUTHORS.txt
5 * SPDX-License-Identifier: MPL-2.0
6 * This file is part of Antares-Simulator,
7 * Adequacy and Performance assessment for interconnected energy networks.
8 *
9 * Antares_Simulator is free software: you can redistribute it and/or modify
10 * it under the terms of the Mozilla Public Licence 2.0 as published by
11 * the Mozilla Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * Antares_Simulator is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * Mozilla Public Licence 2.0 for more details.
18 *
19 * You should have received a copy of the Mozilla Public Licence 2.0
20 * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
21 */
22
23#pragma once
24#include <array>
25#include <map>
26#include <memory>
27#include <string>
28#include <vector>
29
30namespace Antares::Solver
31{
32
38{
39 unsigned int year = 0;
40 unsigned int week = 0;
41 // Order of comparison is order of member declaration
42 auto operator<=>(const WeeklyProblemId& other) const = default;
43};
44
45// Type de données inutile car les matrices de tous les pbs Weekly sont
46// identiques. Cela pourra changer à l'avenir si des coefficients de contraintes
47// couplantes peuvent varier au cours du temps (ex: rendement d'une pompe à
48// chaleur qui varie selon la température, FlowBased ?, etc)
55{
56 unsigned VariablesCount = 0; // Mathématiquement : Nb colonnes de la matrice,
57 // Informatiquement = TypeDeVariable.size()
58 unsigned ConstraintesCount = 0; // Mathématiqument : Nb lignes de la matrice,
59 // Informatiquement = Mdeb.size()
60 unsigned CoeffCount = 0; // Mathématiquement : Nb coeffs non nuls de la
61 // matrice, Informatiquement = Nbterm.size() =
62 // IndicesColonnes.size()=
63 // CoefficientsDeLaMatriceDesContraintes.size()
64
65 std::vector<unsigned> VariablesType; // Variables entières ou biniaires
66 std::vector<unsigned> Mdeb; // Indique dans les indices dans le vecteur IndicesColonnes qui
67 // correspondent au début de chaque ligne. Ex : Mdeb[3] = 8 et
68 // Mdeb[4] = 13 -> Les termes IndicesColonnes[8] à
69 // IndicesColonnes[12] correspondent à des Id de colonnes de la
70 // ligne 3 de la matrice (en supposant que les lignes sont indexées
71 // à partir de 0)
72 std::vector<unsigned> NotNullTermCount; // Nombre de termes non nuls sur chaque ligne.
73 // Inutile car NbTerm[i] = Mdeb[i+1] - Mdeb[i]
74 std::vector<unsigned> ColumnIndexes; // Id des colonnes des termes de
75 // CoefficientsDeLaMatriceDesContraintes : Ex
76 // IndicesColonnes[3] = 8 ->
77 // CoefficientsDeLaMatriceDesContraintes[8] donne la
78 // valeur du terme de la colonne 8, et de la ligne i où
79 // i est tel que Mdeb[i] <= 3 < Mdeb[i+1]
80 std::vector<double> ConstraintsMatrixCoeff; // Coefficients de la matrice
81
82 std::vector<std::string> VariablesMeaning;
83 std::vector<std::string> ConstraintsMeaning;
84
85 auto operator<=>(const ConstantDataFromAntares& other) const = default;
86};
87
93{
94 std::vector<char> Direction; // Sens de la contrainte : < ou > ou =, taille =
95 // NombreDeContraintes
96 std::vector<double> Xmax; // Borne max des variables de la semaine
97 // considérée, taille = NombreDeVariables
98 std::vector<double> Xmin; // Borne min des variables de la semaine
99 // considérée, taille = NombreDeVariables
100 std::vector<double> LinearCost; // Coefficients du vecteur de coût de la fonction objectif,
101 // taille = NombreDeVariables
102 std::vector<double> RHS; // Vecteur des second membre des contraintes, taille =
103 // NombreDeContraintes
104 std::string name;
105
106 std::vector<std::string> variables;
107 std::vector<std::string> constraints;
108
109 auto operator<=>(const WeeklyDataFromAntares& other) const = default;
110};
111
112using WeeklyDataByYearWeek = std::map<WeeklyProblemId, WeeklyDataFromAntares>;
113
120{
121public:
122 /*
123 * @brief Checks if the LpsFromAntares object is empty.
124 * Emptiness is defined by either the constant data or the weekly data being empty.
125 */
126 bool empty() const;
127 /*
128 * @brief Replaces the constant data in the LpsFromAntares object.
129 * Copy happens
130 */
131 void setConstantData(const ConstantDataFromAntares& data);
132 /*
133 * @brief Adds weekly data to the LpsFromAntares object.
134 */
135 void addWeeklyData(WeeklyProblemId id, const WeeklyDataFromAntares& data);
136 /*
137 * @brief Retrieves weekly data from the LpsFromAntares object.
138 */
139 const WeeklyDataFromAntares& weeklyData(WeeklyProblemId id) const;
140 /*
141 * @brief Retrieves the number of weeks in the LpsFromAntares object.
142 */
143 [[nodiscard]] size_t weekCount() const noexcept;
144
145 ConstantDataFromAntares constantProblemData;
146 WeeklyDataByYearWeek weeklyProblems;
147};
148
149} // namespace Antares::Solver
The LpsFromAntares class is used to manage the constant and weekly data for Antares problems.
Definition LpsFromAntares.h:120
The ConstantDataFromAntares class is used to store constant data across all weeks of Antares problems...
Definition LpsFromAntares.h:55
The WeeklyDataFromAntares class is used to store weekly data for an Antares Problem.
Definition LpsFromAntares.h:93
The WeeklyProblemId struct is used to identify a weekly problem by year and week.
Definition LpsFromAntares.h:38