Antares Xpansion
Investment simulations for Antares studies
Loading...
Searching...
No Matches
BatchCollection.h
1#ifndef SRC_CPP_BENDERS_BENDERS_BY_BATCH_INCLUDE_BATCHCOLLECTION_H_
2#define SRC_CPP_BENDERS_BENDERS_BY_BATCH_INCLUDE_BATCHCOLLECTION_H_
3#include <string>
4#include <vector>
5
6#include <boost/serialization/map.hpp>
7
8#include "antares-xpansion/xpansion_interfaces/ILogger.h"
9
10struct Batch
11{
12 std::vector<std::string> sub_problem_names;
13 unsigned id;
14 friend class boost::serialization::access;
15
16 template<class Archive>
17 void serialize(Archive& ar, [[maybe_unused]] const unsigned int version)
18 {
19 ar & sub_problem_names;
20 ar & id;
21 }
22};
23
25{
26private:
27 std::vector<std::string> sub_problem_names_;
28 size_t sub_problems_number_;
29 size_t batch_size_;
30 std::vector<Batch> batch_collections_;
31 unsigned number_of_batch_;
32 Logger logger_;
33
34public:
35 BatchCollection() = default;
36 BatchCollection(const std::vector<std::string>& sub_problem_names,
37 size_t batch_size,
38 Logger logger);
39 void BuildBatches();
40
41 void SetLogger(Logger logger)
42 {
43 logger_ = std::move(logger);
44 }
45
46 void SetBatchSize(size_t batch_size)
47 {
48 batch_size_ = batch_size;
49 }
50
51 void SetSubProblemNames(const std::vector<std::string>& sub_problem_names)
52 {
53 sub_problem_names_ = sub_problem_names;
54 sub_problems_number_ = sub_problem_names.size();
55 }
56
57 size_t size() const
58 {
59 return batch_collections_.size();
60 }
61
62 std::vector<Batch> BatchCollections() const
63 {
64 return batch_collections_;
65 }
66
67 Batch GetBatchFromId(unsigned batch_id) const
68 {
69 return batch_collections_[batch_id];
70 }
71
72 unsigned NumberOfBatch() const
73 {
74 return number_of_batch_;
75 }
76 friend class boost::serialization::access;
77
78 template<class Archive>
79 void serialize(Archive& ar, [[maybe_unused]] const unsigned int version)
80 {
81 ar & sub_problem_names_;
82 ar & sub_problems_number_;
83 ar & batch_size_;
84 ar & batch_collections_;
85 ar & number_of_batch_;
86 }
87};
88#endif // SRC_CPP_BENDERS_BENDERS_BY_BATCH_INCLUDE_BATCHCOLLECTION_H_
Definition BatchCollection.h:25
Definition BatchCollection.h:11