Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
LinkProblemsGenerator.h
1#pragma once
2
3#include <filesystem>
4#include <memory>
5#include <mutex>
6#include <utility>
7
8#include "antares-xpansion/helpers/ArchiveReader.h"
9#include "antares-xpansion/helpers/ArchiveWriter.h"
10#include "antares-xpansion/helpers/FileInBuffer.h"
11#include "antares-xpansion/lpnamer/helper/ProblemGenerationLogger.h"
12#include "antares-xpansion/lpnamer/input_reader/MpsTxtWriter.h"
13#include "antares-xpansion/lpnamer/input_reader/VariableFileReader.h"
14#include "antares-xpansion/lpnamer/problem_modifier/IProblemProviderPort.h"
15#include "antares-xpansion/lpnamer/problem_modifier/IProblemVariablesProviderPort.h"
16#include "antares-xpansion/lpnamer/problem_modifier/IProblemWriter.h"
17#include "antares-xpansion/lpnamer/problem_modifier/ProblemModifier.h"
18#include "antares-xpansion/multisolver_interface/SolverAbstract.h"
19#include "antares-xpansion/multisolver_interface/SolverConfig.h"
20#include "antares-xpansion/xpansion_interfaces/StringManip.h"
21
22const std::string CANDIDATES_INI{"candidates.ini"};
23const std::string STRUCTURE_FILE{"structure.txt"};
24const std::string STUDY_FILE{"study.antares"};
25using CandidateNameAndProblemName = std::pair<std::string, std::string>;
26using ColId = unsigned int;
27using Couplings = std::map<CandidateNameAndProblemName, ColId>;
28
30 public:
32 std::filesystem::path& lpDir, const std::vector<ActiveLink>& links,
33 SolverConfig solver_config,
34 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger,
35 SolverLogManager& solver_log_manager, bool rename_problems)
36 : _links(links),
37 solver_config_(std::move(solver_config)),
38 lpDir_(lpDir),
39 logger_(std::move(logger)),
40 rename_problems_(rename_problems),
41 solver_log_manager_(solver_log_manager) {}
42
43 void treatloop(const std::filesystem::path& root, Couplings& couplings,
44 const std::vector<ProblemData>& mps_list,
45 IProblemWriter* writer);
46 void treat(const std::string& problem_name, Couplings& couplings,
47 Problem* problem, IProblemVariablesProviderPort* variable_provider,
48 IProblemWriter* writer);
49 void treat(const std::string& problem_name, Couplings& couplings,
50 IProblemProviderPort* problem_provider,
51 IProblemVariablesProviderPort* variable_provider,
52 IProblemWriter* writer);
53
54 private:
55 const std::vector<ActiveLink>& _links;
56 SolverConfig solver_config_;
57 std::filesystem::path lpDir_ = "";
58 std::shared_ptr<ProblemGenerationLog::ProblemGenerationLogger> logger_;
59 mutable std::mutex coupling_mutex_;
60 bool rename_problems_ = false;
61 SolverLogManager& solver_log_manager_;
62};
Definition IProblemProviderPort.h:9
Definition IProblemVariablesProviderPort.h:19
Definition IProblemWriter.h:8
Definition LinkProblemsGenerator.h:29
Decorator to the SolverAbstract class.
Definition Problem.h:15
Class to store the configuration of a solver Invariant: name is lowercase.
Definition SolverConfig.h:11
Definition SolverAbstract.h:16