Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
WeightsFileWriter.h
1#ifndef SRC_CPP_LPNAMER_INPUTREADER_YEARLYWEIGHTSWRITER_H
2#define SRC_CPP_LPNAMER_INPUTREADER_YEARLYWEIGHTSWRITER_H
3#include <antares-xpansion/lpnamer/model/Problem.h>
4#include <filesystem>
5#include <map>
6#include <vector>
7
8#include "MpsTxtWriter.h"
9#include "antares-xpansion/lpnamer/helper/ProblemGenerationLogger.h"
10
12{
13public:
14 explicit YearlyWeightsWriter(
15 const std::filesystem::path& xpansion_output_dir,
16 const std::vector<double>& weights_vector,
17 const std::filesystem::path& output_file,
18 const std::vector<int>& active_years,
19 const std::string& solver_name,
20 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger);
21
22 void CreateWeightFile(
23 const std::vector<std::pair<std::shared_ptr<Problem>, ProblemData>>& problems_and_data);
24
25 class McYearNotInActiveYearsListError: public LogUtils::XpansionError<std::runtime_error>
26 {
27 using LogUtils::XpansionError<std::runtime_error>::XpansionError;
28 };
29
30private:
31 std::filesystem::path xpansion_output_dir_;
32 std::filesystem::path xpansion_lp_dir_ = "";
33 std::filesystem::path antares_archive_path_;
34 const std::string LP_DIR = "lp";
35 std::map<std::filesystem::path, double> problem_filename_to_weight_ = {};
36 std::vector<double> weights_vector_;
37 std::filesystem::path output_file_;
38 std::vector<int> active_years_;
39 std::string solver_name_;
40 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger_;
41 void FillMpsWeightsMap(
42 const std::vector<std::pair<std::shared_ptr<Problem>, ProblemData>>& problems_and_data);
43 int GetYearFromMpsName(const std::string& file_name) const;
44 void DumpMpsWeightsToFile() const;
45};
46#endif // SRC_CPP_LPNAMER_INPUTREADER_YEARLYWEIGHTSWRITER_H
Definition WeightsFileWriter.h:12
Definition MpsTxtWriter.h:22