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 <boost/serialization/map.hpp>
4#include <string>
5#include <vector>
6
7#include "antares-xpansion/xpansion_interfaces/ILogger.h"
8
9struct Batch {
10 std::vector<std::string> sub_problem_names;
11 unsigned id;
12 friend class boost::serialization::access;
13 template <class Archive>
14 void serialize(Archive &ar, [[maybe_unused]] const unsigned int version) {
15 ar &sub_problem_names;
16 ar &id;
17 }
18};
20 private:
21 std::vector<std::string> sub_problem_names_;
22 size_t sub_problems_number_;
23 size_t batch_size_;
24 std::vector<Batch> batch_collections_;
25 unsigned number_of_batch_;
26 Logger logger_;
27
28 public:
29 BatchCollection() = default;
30 BatchCollection(const std::vector<std::string> &sub_problem_names,
31 size_t batch_size, Logger logger);
32 void BuildBatches();
33
34 void SetLogger(Logger logger) { logger_ = std::move(logger); }
35 void SetBatchSize(size_t batch_size) { batch_size_ = batch_size; }
36 void SetSubProblemNames(const std::vector<std::string> &sub_problem_names) {
37 sub_problem_names_ = sub_problem_names;
38 sub_problems_number_ = sub_problem_names.size();
39 }
40 size_t size() const { return batch_collections_.size(); }
41 std::vector<Batch> BatchCollections() const { return batch_collections_; }
42 Batch GetBatchFromId(unsigned batch_id) const {
43 return batch_collections_[batch_id];
44 }
45 unsigned NumberOfBatch() const { return number_of_batch_; }
46 friend class boost::serialization::access;
47 template <class Archive>
48 void serialize(Archive &ar, [[maybe_unused]] const unsigned int version) {
49 ar &sub_problem_names_;
50 ar &sub_problems_number_;
51 ar &batch_size_;
52 ar &batch_collections_;
53 ar &number_of_batch_;
54 }
55};
56#endif // SRC_CPP_BENDERS_BENDERS_BY_BATCH_INCLUDE_BATCHCOLLECTION_H_
Definition BatchCollection.h:19
Definition BatchCollection.h:9