Antares Simulator
Power System Simulator
Dimensions.h
1 /*
2  * Copyright 2007-2025, RTE (https://www.rte-france.com)
3  * See AUTHORS.txt
4  * SPDX-License-Identifier: MPL-2.0
5  * This file is part of Antares-Simulator,
6  * Adequacy and Performance assessment for interconnected energy networks.
7  *
8  * Antares_Simulator is free software: you can redistribute it and/or modify
9  * it under the terms of the Mozilla Public Licence 2.0 as published by
10  * the Mozilla Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Antares_Simulator is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * Mozilla Public Licence 2.0 for more details.
17  *
18  * You should have received a copy of the Mozilla Public Licence 2.0
19  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20  */
21 
22 #pragma once
23 
24 #include <functional>
25 #include <optional>
26 #include <string>
27 
28 #include "MCYearAndTime.h"
29 
31 {
32 class IMipVariable;
33 }
34 
35 namespace Antares::Optimisation
36 {
37 
39 {
40  unsigned int initialTime = 0;
41  unsigned int finalTime = 0;
42 
43  class Iterator final
44  {
45  public:
46  explicit Iterator(unsigned int current);
47  unsigned int operator*() const;
48  Iterator& operator++();
49  bool operator!=(const Iterator& other) const;
50 
51  private:
52  unsigned int current_;
53  };
54 
55  [[nodiscard]] Iterator begin() const
56  {
57  return Iterator(initialTime);
58  }
59 
60  [[nodiscard]] Iterator end() const
61  {
62  return Iterator(finalTime + 1);
63  } // Make it inclusive
64 
65  [[nodiscard]] std::size_t size() const
66  {
67  return finalTime - initialTime + 1;
68  }
69 };
70 
71 class Dimensions final
72 {
73 public:
74  Dimensions() = default;
75  Dimensions(std::optional<IntegerInterval> mcyearInterval,
76  std::optional<IntegerInterval> timeInterval);
77  [[nodiscard]] bool isTimeDependent() const;
78  [[nodiscard]] bool isScenarioDependent() const;
79  [[nodiscard]] IntegerInterval getTimesteps() const;
80  [[nodiscard]] IntegerInterval getScenarioIndices() const;
81  [[nodiscard]] unsigned int getNumberOfTimesteps() const;
82 
83 private:
84  std::optional<IntegerInterval> mcyearInterval;
85  std::optional<IntegerInterval> timeInterval;
86 };
87 
88 // TODO Move me
89 std::string buildVariableName(const std::string& compoId,
90  const std::string& variableId,
91  std::optional<Optimization::MCYearAndTime::MCYear> mcyear,
92  std::optional<unsigned int> timestep);
93 
94 } // namespace Antares::Optimisation
Definition: Dimensions.h:72
Namespace for the classes related to the linear problem API.
Definition: SimulationTableGenerator.h:41
Definition: VariableNode.h:9
Definition: Dimensions.h:39