AutoPas  3.0.0
Loading...
Searching...
No Matches
EvidenceCollection.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <map>
10#include <optional>
11#include <string>
12#include <tuple>
13#include <vector>
14
18
19namespace autopas {
20
25 public:
30 // Calculate the effective measurement for an average iteration
31 EFFECTIVE,
32 // Evidence of only the traversal measurement.
33 TRAVERSAL,
34 // Evidence of the rebuild + traversal measurement for a single iteration where a rebuild actually occurred.
35 TOTAL
36 };
37
38 EvidenceCollection() = default;
39
45 void addEvidence(const Configuration &configuration, const Evidence &evidence);
46
52 [[nodiscard]] const std::vector<Evidence> *getEvidence(const Configuration &configuration) const;
53
59 Evidence &modifyLastEvidence(const Configuration &configuration);
60
67 [[nodiscard]] std::tuple<Configuration, Evidence> getBestConfigForContainerAndCSF(ContainerOption containerOption,
68 double cellSizeFactor) const;
69
74 [[nodiscard]] std::tuple<Configuration, Evidence> getBestConfigWithRebuild() const;
75
84 [[nodiscard]] std::tuple<Configuration, Evidence> getOptimalConfiguration(
85 size_t tuningPhase, EvidenceMode mode = EFFECTIVE,
86 std::optional<ContainerOption> containerConstraint = std::nullopt,
87 std::optional<double> csfConstraint = std::nullopt) const;
88
94 [[nodiscard]] std::tuple<Configuration, Evidence> getLatestOptimalConfiguration() const;
95
101 [[nodiscard]] bool empty(std::optional<size_t> tuningPhase = std::nullopt) const;
102
103 private:
108 std::map<Configuration, std::vector<Evidence>> _evidenceMap{};
109
114 size_t _latestTuningPhase{0};
115};
116
123 switch (mode) {
124 case EvidenceCollection::EFFECTIVE:
125 return "Effective";
126 case EvidenceCollection::TRAVERSAL:
127 return "Traversal";
128 case EvidenceCollection::TOTAL:
129 return "Total";
130 default:
131 return "UnknownEvidenceMode";
132 }
133}
134
135} // namespace autopas
Class containing multiple options that form an algorithm configuration for the pairwise iteration.
Definition: Configuration.h:26
Class to manage all evidence.
Definition: EvidenceCollection.h:24
bool empty(std::optional< size_t > tuningPhase=std::nullopt) const
Report if there is any evidence in the collection.
Definition: EvidenceCollection.cpp:108
const std::vector< Evidence > * getEvidence(const Configuration &configuration) const
Returns all evidence collected for a given configuration.
Definition: EvidenceCollection.cpp:22
Evidence & modifyLastEvidence(const Configuration &configuration)
Returns a modifiable reference to the last evidence of a given configuration.
Definition: EvidenceCollection.cpp:30
void addEvidence(const Configuration &configuration, const Evidence &evidence)
Store a piece of evidence in the internal storage.
Definition: EvidenceCollection.cpp:17
std::tuple< Configuration, Evidence > getLatestOptimalConfiguration() const
Retrieve the configuration with the lowest evidence value for the latest tuning phase.
Definition: EvidenceCollection.cpp:104
EvidenceMode
Helper enum to switch between evidence measurements modes.
Definition: EvidenceCollection.h:29
std::tuple< Configuration, Evidence > getBestConfigWithRebuild() const
Retrieve the configuration with the best total evidence.
Definition: EvidenceCollection.cpp:39
std::tuple< Configuration, Evidence > getOptimalConfiguration(size_t tuningPhase, EvidenceMode mode=EFFECTIVE, std::optional< ContainerOption > containerConstraint=std::nullopt, std::optional< double > csfConstraint=std::nullopt) const
Retrieve the configuration with the lowest evidence value for the given tuning phase.
Definition: EvidenceCollection.cpp:43
std::tuple< Configuration, Evidence > getBestConfigForContainerAndCSF(ContainerOption containerOption, double cellSizeFactor) const
Retrieve the configuration with the best reduced evidence for a particular container plus cell size f...
Definition: EvidenceCollection.cpp:34
Helper class that associates a measurement with the iteration when it was taken.
Definition: Evidence.h:15
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:34
std::string format_as(const OwnershipState &state)
This function is needed to pass an ownership state to spdlog/fmt.
Definition: OwnershipState.h:64