Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
OutputWriter.h
1
2#pragma once
3#include <filesystem>
4#include <memory>
5#include <string>
6#include <vector>
7
8namespace Output {
9
10// string constantes
11const std::string ANTARES_C("antares"), VERSION_C("version"),
12 ANTARES_XPANSION_C("antares_xpansion"), BEGIN_C("begin"), END_C("end"),
13 RUN_DURATION_C("run_duration"), MASTER_DURATION_C("master_duration"),
14 SUBPROBLEM_DURATION_C("subproblem_duration"), ITERATIONS_C("iterations"),
15 BEST_UB_C("best_ub"), CANDIDATES_C("candidates"), INVEST_C("invest"),
16 MAX_C("max"), MIN_C("min"), NAME_C("name"),
17 INVESTMENT_COST_C("investment_cost"), LB_C("lb"),
18 OPERATIONAL_COST_C("operational_cost"), OPTIMALITY_GAP_C("optimality_gap"),
19 OVERALL_COST_C("overall_cost"), RELATIVE_GAP_C("relative_gap"), UB_C("ub"),
20 NBWEEKS_C("nbWeeks"), OPTIONS_C("options"), SOLUTION_C("solution"),
21 OUTER_LOOP_SOLUTION_C("security criterion solution"),
22 ITERATION_C("iteration"), PROBLEM_STATUS_C("problem_status"),
23 OPTIMAL_C("OPTIMAL"), LIMIT_REACHED_C("limit reached"), ERROR_C("ERROR"),
24 VALUES_C("values"), STOPPING_CRITERION_C("stopping_criterion"),
25 MASTER_NAME_C("MASTER_NAME"), LOG_LEVEL_C("LOG_LEVEL"),
26 SOLVER_NAME_C("SOLVER_NAME"), PROBLEMNAME_C("problem_name"),
27 PROBLEMPATH_C("problem_path"),
28 CUMULATIVE_NUMBER_OF_SUBPROBLEM_RESOLVED_C(
29 "cumulative_number_of_subproblem_resolutions"),
30 PROBLEM_FORMAT_C{"PROBLEM_FORMAT"}
31;
33 std::string name;
34 double invest;
35 double min;
36 double max;
37};
38typedef std::vector<CandidateData> CandidatesVec;
39struct Iteration {
40 double master_duration;
41 double subproblem_duration;
42 double lb;
43 double ub;
44 double best_ub;
45 double optimality_gap;
46 double relative_gap;
47 double investment_cost;
48 double operational_cost;
49 double overall_cost;
50 CandidatesVec candidates;
51 int cumulative_number_of_subproblem_resolved;
52};
53typedef std::vector<Iteration> Iterations;
61 Iteration solution;
62 int nbWeeks_p;
63 int best_it;
64 std::string problem_status;
65 std::string stopping_criterion;
66};
78 int nbWeeks_p;
79 double elapsed_time;
80 Iterations iters;
81 SolutionData solution_data;
82};
84 std::string name;
85 std::filesystem::path path;
86 std::string status;
87};
94 public:
98 virtual ~OutputWriter() = default;
99
105 virtual void update_solution(const SolutionData &solution_data) = 0;
106
110 virtual void dump() = 0;
111
115 virtual void initialize() = 0;
116
117 virtual void end_writing(const IterationsData &iterations_data) = 0;
118
119 virtual void write_solver_name(const std::string &solver_name) = 0;
120 virtual void write_master_name(const std::string &master_name) = 0;
121 virtual void write_log_level(const int log_level) = 0;
122 virtual void write_solution(const SolutionData &solution) = 0;
123 virtual void write_iteration(const Iteration &iteration_data,
124 const size_t iteration_num) = 0;
125 virtual void updateBeginTime() = 0;
126 virtual void updateEndTime() = 0;
127 virtual void write_nbweeks(const int nb_weeks) = 0;
128 virtual void write_duration(const double duration) = 0;
129 virtual std::string solution_status() const = 0;
130 virtual void WriteProblem(const ProblemData &problem_data) = 0;
131 virtual void WriteProblemFormat(const std::string format) = 0;
132};
133} // namespace Output
134using Writer = std::shared_ptr<Output::OutputWriter>;
OutputWriter class to describe the execuion session of an antares xpansion optimization in a log file...
Definition OutputWriter.h:93
virtual void initialize()=0
initialize outputs
virtual void update_solution(const SolutionData &solution_data)=0
saves some entries to be later written to the json file
virtual ~OutputWriter()=default
destructor of class OutputWriter
virtual void dump()=0
write the log data into a file
Definition OutputWriter.h:32
Definition OutputWriter.h:39
struct containing some entries to be later written to the json file
Definition OutputWriter.h:77
Definition OutputWriter.h:83
struct saves some entries to be later written to the json file
Definition OutputWriter.h:60