14#include <unordered_map>
15#include <unordered_set>
18#ifdef AUTOPAS_ENABLE_RULES_BASED_AND_FUZZY_TUNING
19#include "RuleBasedProgramParser.h"
20#include "RuleBasedProgramTree.h"
90#ifdef AUTOPAS_ENABLE_RULES_BASED_AND_FUZZY_TUNING
92 unsigned long betterRuntime,
const Configuration &shouldBeBetterConfig,
93 unsigned long shouldBeBetterRuntime,
const LiveInfo &liveInfo)>;
105 explicit RuleBasedTuning(
const std::set<Configuration> &searchSpace,
bool verifyModeEnabled =
false,
106 std::string ruleFileName =
"tuningRules.rule",
117 bool reset(
size_t iteration,
size_t tuningPhase, std::vector<Configuration> &configQueue,
135#ifdef AUTOPAS_ENABLE_RULES_BASED_AND_FUZZY_TUNING
144 std::string rulesToString(
const std::string &filePath)
const;
153 void verifyCurrentConfigTime(
const Configuration &configuration)
const;
159 std::vector<RuleSyntax::ConfigurationOrder> applyRules(
const std::vector<Configuration> &searchSpace);
161 std::vector<RuleSyntax::ConfigurationOrder> _lastApplicableConfigurationOrders{};
165 bool _verifyModeEnabled{};
171 long _wouldHaveSkippedTuningTime{0};
175 bool _rulesTooHarsh{
false};
179 std::set<Configuration> _searchSpace{};
180 std::list<Configuration> _originalSearchSpace{};
181 std::set<Configuration> _removedConfigurations{};
183 std::string _ruleFileName{};
185 std::unordered_map<Configuration, long, ConfigHash> _traversalTimes{};
187 long _tuningTimeLifetime{0};
188 long _wouldHaveSkippedTuningTimeLifetime{0};
190 LiveInfo _currentLiveInfo{};
Class containing multiple options that form an algorithm configuration for the pairwise iteration.
Definition: Configuration.h:24
Class to manage all evidence.
Definition: EvidenceCollection.h:21
Helper class that associates a measurement with the iteration when it was taken.
Definition: Evidence.h:15
This class is able to gather and store important information for a tuning phase from a container and ...
Definition: LiveInfo.h:31
A tuning strategy that uses information collected live from the domain to exclude configurations that...
Definition: RuleBasedTuning.h:84
bool reset(size_t iteration, size_t tuningPhase, std::vector< Configuration > &configQueue, const autopas::EvidenceCollection &evidenceCollection) override
Reset all internal parameters to the beginning of a new tuning phase.
Definition: RuleBasedTuning.cpp:58
long getLifetimeTuningTime() const
Definition: RuleBasedTuning.cpp:87
void addEvidence(const Configuration &configuration, const Evidence &evidence) override
Notifies the strategy about empirically collected information for the given configuration.
Definition: RuleBasedTuning.cpp:43
TuningStrategyOption getOptionType() const override
Get this object's associated TuningStrategyOption type.
Definition: RuleBasedTuning.cpp:110
long getLifetimeWouldHaveSkippedTuningTime() const
Definition: RuleBasedTuning.cpp:85
void receiveLiveInfo(const LiveInfo &info) override
Virtual method that subclasses can override to receive the LiveInfo object before a tuning phase if t...
Definition: RuleBasedTuning.cpp:41
bool optimizeSuggestions(std::vector< Configuration > &configQueue, const EvidenceCollection &evidenceCollection) override
Optimizes the queue of configurations to process.
Definition: RuleBasedTuning.cpp:89
bool needsLiveInfo() const override
Returns whether this tuning strategy wants to get a LiveInfo object passed before a new tuning phase.
Definition: RuleBasedTuning.cpp:39
int PrintTuningErrorFunType
A function type used to print errors found in verify mode.
Definition: RuleBasedTuning.h:95
Interface for tuning strategies for the auto tuner.
Definition: TuningStrategyInterface.h:23
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32
A ConfigurationOrder statement in the rule language e.g.
Definition: RuleBasedProgramTree.h:193