Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
MpsTxtWriter.h
1#ifndef SRC_CPP_LPNAMER_INPUTREADER_MPSTXTWRITER_H
2#define SRC_CPP_LPNAMER_INPUTREADER_MPSTXTWRITER_H
3#include <cstdlib>
4#include <filesystem>
5#include <map>
6#include <tuple>
7#include <utility>
8#include <vector>
9
10#include "antares-xpansion/xpansion_interfaces/StringManip.h"
11
12// a pair to hold double key (year and week)
13using YearAndWeek = std::pair<int, int>;
14// a tuple to hold files (mps, variable, constraints)
15using MpsVariableConstraintsFiles = std::
16 tuple<std::filesystem::path, std::filesystem::path, std::filesystem::path>;
17
18// dict to associate YearAndWeek --> MpsVariableConstraintsFiles
19using YearWeekAndFilesDict = std::map<YearAndWeek, MpsVariableConstraintsFiles>;
20
22{
23 ProblemData(const std::string& problem_filename, const std::string& variables_txt):
24 _problem_filename(problem_filename),
25 _variables_txt(variables_txt)
26 {
27 }
28
29 std::string _problem_filename;
30 std::string _variables_txt;
31};
32
34{
35public:
36 explicit FilesMapper(std::filesystem::path antares_archive_path,
37 std::filesystem::path simulation_dir = {}):
38 antares_archive_path_(std::move(antares_archive_path)),
39 simulation_dir_(std::move(simulation_dir))
40 {
41 }
42
43 YearWeekAndFilesDict FilesMap()
44 {
45 FillMap();
46 return year_week_and_files_dict_;
47 }
48
49 std::vector<ProblemData> MpsAndVariablesFilesVect();
50
51private:
52 YearWeekAndFilesDict year_week_and_files_dict_;
53 std::filesystem::path antares_archive_path_;
54 std::filesystem::path simulation_dir_;
55 void FillMap();
56 void FillMapWithMpsFiles(const std::vector<std::filesystem::path>& mps_files);
57 void FillMapWithVariablesFiles(const std::vector<std::filesystem::path>& variables_files);
58 void FillMapWithConstraintsFiles(const std::vector<std::filesystem::path>& variables_files);
59 YearAndWeek YearAndWeekFromFileName(const std::filesystem::path& file_name) const;
60 void FillMapFiles();
61 void FillMapZip();
62};
63#endif // SRC_CPP_LPNAMER_INPUTREADER_MPSTXTWRITER_H
Definition MpsTxtWriter.h:34
Definition MpsTxtWriter.h:22