Used to represent a Fuzzy Control System. More...
#include <FuzzyControlSystem.h>
Public Member Functions | |
| FuzzyControlSystem (std::shared_ptr< FuzzyControlSettings > settings) | |
| Constructs an empty FuzzyControlSystem with the given settings. | |
| void | addRule (const FuzzyRule &rule) |
| Adds a new FuzzyRule to the FuzzyControlSystem. | |
| std::shared_ptr< FuzzySet > | applyRules (const FuzzySet::Data &data) const |
| Applies all the rules of the FuzzyControlSystem with the given data and calculates the union of all the cut-consequents. | |
| double | predict (const FuzzySet::Data &data, size_t numSamples=1000) const |
| Predicts the output of the FuzzyControlSystem for the given data. | |
| operator std::string () const | |
| Returns a string representation of the FuzzyControlSystem. | |
Used to represent a Fuzzy Control System.
A Fuzzy Control System is a collection of FuzzyRules that can be applied to a given input to predict an output.
|
explicit |
Constructs an empty FuzzyControlSystem with the given settings.
| settings | The settings of the FuzzyControlSystem. |
| void autopas::FuzzyLogic::FuzzyControlSystem::addRule | ( | const FuzzyRule & | rule | ) |
Adds a new FuzzyRule to the FuzzyControlSystem.
| rule | The FuzzyRule to add. |
Additionally, the method checks if all the consequents of the FuzzyControlSystem have the same domain. Otherwise, an exception is thrown.
| std::shared_ptr< FuzzySet > autopas::FuzzyLogic::FuzzyControlSystem::applyRules | ( | const FuzzySet::Data & | data | ) | const |
Applies all the rules of the FuzzyControlSystem with the given data and calculates the union of all the cut-consequents.
| data | A map of the form {dimension_name: value}. |
| double autopas::FuzzyLogic::FuzzyControlSystem::predict | ( | const FuzzySet::Data & | data, |
| size_t | numSamples = 1000 |
||
| ) | const |
Predicts the output of the FuzzyControlSystem for the given data.
| data | A map of the form {dimension_name: value}. |
| numSamples | The number of samples to use for the numerical defuzzification. Default is 1000. |
This method performs the full prediction process of the FuzzyControlSystem. It first applies all the rules of the FuzzyControlSystem to the data and unites all the cut-consequents. The resulting FuzzySet is then defuzzified and the calculated value is returned.
The method reads the "defuzzificationMethod" and "numSamples" settings from the provided settings and performs the defuzzification accordingly.