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 =
16 std::tuple<std::filesystem::path, std::filesystem::path,
17 std::filesystem::path>;
18
19// dict to associate YearAndWeek --> MpsVariableConstraintsFiles
20using YearWeekAndFilesDict = std::map<YearAndWeek, MpsVariableConstraintsFiles>;
21
23 ProblemData(const std::string& problem_mps, const std::string& variables_txt)
24 : _problem_mps(problem_mps), _variables_txt(variables_txt) {}
25 std::string _problem_mps;
26 std::string _variables_txt;
27};
28
30 public:
31 explicit FilesMapper(std::filesystem::path antares_archive_path,
32 std::filesystem::path simulation_dir = {})
33 : antares_archive_path_(std::move(antares_archive_path)),
34 simulation_dir_(std::move(simulation_dir)) {}
35 YearWeekAndFilesDict FilesMap() {
36 FillMap();
37 return year_week_and_files_dict_;
38 }
39 std::vector<ProblemData> MpsAndVariablesFilesVect();
40
41 private:
42 YearWeekAndFilesDict year_week_and_files_dict_;
43 std::filesystem::path antares_archive_path_;
44 std::filesystem::path simulation_dir_;
45 void FillMap();
46 void FillMapWithMpsFiles(const std::vector<std::filesystem::path>& mps_files);
47 void FillMapWithVariablesFiles(
48 const std::vector<std::filesystem::path>& variables_files);
49 void FillMapWithConstraintsFiles(
50 const std::vector<std::filesystem::path>& variables_files);
51 YearAndWeek YearAndWeekFromFileName(
52 const std::filesystem::path& file_name) const;
53 void FillMapFiles();
54 void FillMapZip();
55};
56#endif // SRC_CPP_LPNAMER_INPUTREADER_MPSTXTWRITER_H
Definition MpsTxtWriter.h:29
Definition MpsTxtWriter.h:22