AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
autopas::FuzzyTuning Class Reference

A tuning strategy that uses fuzzy logic to make predictions about the performance of configurations. More...

#include <FuzzyTuning.h>

Inheritance diagram for autopas::FuzzyTuning:
Inheritance graph
[legend]
Collaboration diagram for autopas::FuzzyTuning:
Collaboration graph
[legend]

Public Member Functions

 FuzzyTuning (std::string fuzzyRuleFileName)
 Constructor for the FuzzyTuning strategy.
 
TuningStrategyOption getOptionType () const override
 Get this object's associated TuningStrategyOption type.
 
bool needsLiveInfo () const override
 Returns whether this tuning strategy wants to get a LiveInfo object passed before a new tuning phase.
 
void receiveLiveInfo (const LiveInfo &value) override
 Virtual method that subclasses can override to receive the LiveInfo object before a tuning phase if they return true in needsLiveInfo().
 
void addEvidence (const Configuration &configuration, const Evidence &evidence) override
 Notifies the strategy about empirically collected information for the given configuration.
 
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.
 
bool optimizeSuggestions (std::vector< Configuration > &configQueue, const EvidenceCollection &evidenceCollection) override
 Optimizes the queue of configurations to process.
 
std::shared_ptr< FuzzyControlSettingsgetFuzzyControlSettings () const
 Getter for the fuzzy control settings.
 
const std::map< std::string, std::shared_ptr< FuzzyControlSystem > > & getFuzzyControlSystems () const
 Getter for the fuzzy control systems.
 
const std::map< std::string, std::shared_ptr< OutputMapper > > & getOutputMappings () const
 Getter for the output mappings.
 
- Public Member Functions inherited from autopas::TuningStrategyInterface
virtual TuningStrategyOption getOptionType () const =0
 Get this object's associated TuningStrategyOption type.
 
virtual void addEvidence (const Configuration &configuration, const Evidence &evidence)
 Notifies the strategy about empirically collected information for the given configuration.
 
virtual bool optimizeSuggestions (std::vector< Configuration > &configQueue, const EvidenceCollection &evidenceCollection)=0
 Optimizes the queue of configurations to process.
 
virtual bool reset (size_t iteration, size_t tuningPhase, std::vector< Configuration > &configQueue, const autopas::EvidenceCollection &evidenceCollection)=0
 Reset all internal parameters to the beginning of a new tuning phase.
 
virtual bool needsLiveInfo () const
 Returns whether this tuning strategy wants to get a LiveInfo object passed before a new tuning phase.
 
virtual void receiveLiveInfo (const LiveInfo &info)
 Virtual method that subclasses can override to receive the LiveInfo object before a tuning phase if they return true in needsLiveInfo().
 
virtual void rejectConfiguration (const Configuration &configuration, bool indefinitely)
 Notify the strategy about a configuration that is (currently) invalid and thus can potentially be dropped from some internal storage.
 
virtual bool needsSmoothedHomogeneityAndMaxDensity () const
 Indicate whether the strategy needs smoothed values of homogeneity and max density.
 
virtual void receiveSmoothedHomogeneityAndMaxDensity (double homogeneity, double maxDensity)
 Method to pass smoothed homogeneity and the maximal density to the tuning strategy.
 

Detailed Description

A tuning strategy that uses fuzzy logic to make predictions about the performance of configurations.

The goal of this tuning strategy is to allow expert users to encode their knowledge about the performance of different configurations in a rule file and use this knowledge to let a FuzzyControlSystem combine all this information to make predictions about the optimal configuration for the current simulation state.

Similar to the RuleBasedTuning strategy, the "knowledge" is encoded in a rule file consisting of 4 parts:

Summary of the Fuzzy Language:

This is a small example of how a typical rule file could look like:

# Define the settings of the fuzzy control system
FuzzySystemSettings:
defuzzificationMethod: "MeanOfMaximum"
# Define all of the linguistic variables together with their linguistic terms
FuzzyVariable: domain: "homogeneity" range: (-0.009, 0.1486)
"lower than 0.049": SigmoidFinite(0.0914, 0.049, 0.0065)
"lower than 0.041": SigmoidFinite(0.0834, 0.041, -0.001)
"higher than 0.049": SigmoidFinite(0.0065, 0.049, 0.0914)
"higher than 0.041": SigmoidFinite(-0.001, 0.041, 0.0834)
FuzzyVariable: domain: "threadCount" range: (-19.938, 48.938)
"lower than 18.0": SigmoidFinite(38.938, 18.0, -2.938)
"lower than 26.0": SigmoidFinite(46.938, 26.0, 5.061)
"lower than 8.0": SigmoidFinite(28.938, 8.0, -12.938)
"higher than 18.0": SigmoidFinite(-2.938, 18.0, 38.938)
"higher than 26.0": SigmoidFinite(5.0617, 26.0, 46.938)
"higher than 8.0": SigmoidFinite(-12.93, 8.0, 28.938)
FuzzyVariable: domain: "particlesPerCellStdDev" range: (-0.017, 0.072)
"lower than 0.013": SigmoidFinite(0.0639, 0.038, 0.012)
"lower than 0.014": SigmoidFinite(0.0399, 0.014, -0.011)
"higher than 0.013": SigmoidFinite(0.012, 0.013, 0.0639)
"higher than 0.014": SigmoidFinite(-0.011, 0.014, 0.0399)
FuzzyVariable: domain: "Newton 3" range: (0, 1)
"disabled, enabled": Gaussian(0.3333, 0.1667)
"enabled": Gaussian(0.6667, 0.1667)
# Define how the result of the output variables should be interpreted in the context of autopas
OutputMapping:
"Newton 3":
0.333 => [newton3="disabled"], [newton3="enabled"]
0.666 => [newton3="enabled"]
# Define a bunch of rules connecting the input variables to the output variables
if ("threadCount" == "lower than 18.0") && ("threadCount" == "higher than 8.0")
&& ("homogeneity" == "lower than 0.041")
then ("Newton 3" == "enabled")
if ("threadCount" == "higher than 26.0") && ("particlesPerCellStdDev" == "lower than 0.013")
then ("Newton 3" == "disabled, enabled")
...
This is the main namespace of AutoPas.
Definition: AutoPasDecl.h:32

A larger example file is stored in /examples/md-flexible/input/fuzzyRules.frule.

Due to the compilation cost of ANTLR and issues with compiling the bundled dependency uuid on some machines, this tuning strategy can be disabled with the CMake option AUTOPAS_ENABLE_RULES_BASED_AND_FUZZY_TUNING=OFF.

Constructor & Destructor Documentation

◆ FuzzyTuning()

autopas::FuzzyTuning::FuzzyTuning ( std::string  fuzzyRuleFileName)
explicit

Constructor for the FuzzyTuning strategy.

Parameters
fuzzyRuleFileNameThe path of the fuzzy rule file.

Member Function Documentation

◆ addEvidence()

void autopas::FuzzyTuning::addEvidence ( const Configuration configuration,
const Evidence evidence 
)
overridevirtual

Notifies the strategy about empirically collected information for the given configuration.

All evidence is stored centrally in the AutoTuner and its EvidenceCollection is passed to the tuning strategies during optimization.

Implementing this function is only necessary if the tuning strategy processes evidence differently than EvidenceCollection.

Parameters
configurationConfiguration used to obtain the evidence.
evidenceMeasurement and when it was taken.

Reimplemented from autopas::TuningStrategyInterface.

◆ getFuzzyControlSettings()

std::shared_ptr< FuzzyControlSettings > autopas::FuzzyTuning::getFuzzyControlSettings ( ) const

Getter for the fuzzy control settings.

Returns
The fuzzy control settings.

◆ getFuzzyControlSystems()

const std::map< std::string, std::shared_ptr< FuzzyControlSystem > > & autopas::FuzzyTuning::getFuzzyControlSystems ( ) const

Getter for the fuzzy control systems.

Returns
The fuzzy control systems.

◆ getOptionType()

TuningStrategyOption autopas::FuzzyTuning::getOptionType ( ) const
overridevirtual

Get this object's associated TuningStrategyOption type.

Returns
TuningStrategyOption

Implements autopas::TuningStrategyInterface.

◆ getOutputMappings()

const std::map< std::string, std::shared_ptr< OutputMapper > > & autopas::FuzzyTuning::getOutputMappings ( ) const

Getter for the output mappings.

Returns
The output mappings.

◆ needsLiveInfo()

bool autopas::FuzzyTuning::needsLiveInfo ( ) const
overridevirtual

Returns whether this tuning strategy wants to get a LiveInfo object passed before a new tuning phase.

Returns
True, if this tuning strategy wants a LiveInfo object passed before a new tuning phase via receiveLiveInfo().

Reimplemented from autopas::TuningStrategyInterface.

◆ optimizeSuggestions()

bool autopas::FuzzyTuning::optimizeSuggestions ( std::vector< Configuration > &  configQueue,
const EvidenceCollection evidenceCollection 
)
overridevirtual

Optimizes the queue of configurations to process.

This function is called once before each iteration in a tuning phase so all tuning strategies can give their input on which configuration to try next. This is done by reordering configQueue so that the next configuration to try is at the end (FIFO).

Parameters
configQueueQueue of configurations to be tested. The tuning strategy should edit this queue.
evidenceCollectionAll collected evidence until now.
Returns
boolean value to signal if the tuning strategy has intentionally wiped the config queue

Implements autopas::TuningStrategyInterface.

◆ receiveLiveInfo()

void autopas::FuzzyTuning::receiveLiveInfo ( const LiveInfo info)
overridevirtual

Virtual method that subclasses can override to receive the LiveInfo object before a tuning phase if they return true in needsLiveInfo().

Parameters
infoA new LiveInfo object that has already gathered its information.

Reimplemented from autopas::TuningStrategyInterface.

◆ reset()

bool autopas::FuzzyTuning::reset ( size_t  iteration,
size_t  tuningPhase,
std::vector< Configuration > &  configQueue,
const autopas::EvidenceCollection evidenceCollection 
)
overridevirtual

Reset all internal parameters to the beginning of a new tuning phase.

This can also mean to reorder the configQueue to some initially expected state.

Parameters
iterationGives the current iteration to the tuning strategy.
tuningPhaseGives the current tuning phase to the tuning strategy.
configQueueQueue of configurations to be tested. The tuning strategy should edit this queue.
evidenceCollectionAll collected evidence until now.
Returns
boolean value to signal if the tuning strategy has intentionally wiped the config queue

Implements autopas::TuningStrategyInterface.


The documentation for this class was generated from the following files: