fuzzylite® 6.0
==================
<img src="https://raw.githubusercontent.com/fuzzylite/fuzzylite/release/fuzzylite.png" align="right" alt="fuzzylite">
A Fuzzy Logic Control Library in C++
------------------------------------
By: [Juan Rada-Vilela](https://www.fuzzylite.com/jcrada), Ph.D.
Released: 20/March/2017
[](http://www.gnu.org/licenses/gpl-3.0)
[](https://scan.coverity.com/projects/5759)
| Branch | Unix | Windows |
|--------|------|---------|
| [release](https://github.com/fuzzylite/fuzzylite/tree/release) | [](https://travis-ci.org/fuzzylite/fuzzylite) | [](https://ci.appveyor.com/project/jcrada/fuzzylite/branch/release) |
| [master](https://github.com/fuzzylite/fuzzylite/tree/master) | [](https://travis-ci.org/fuzzylite/fuzzylite) | [](https://ci.appveyor.com/project/jcrada/fuzzylite/branch/master) |
***
### Table of Contents
[License](#license) <br/>
[Introduction](#introduction)<br/>
[Features](#features)<br/>
[Example](#example) <br/>
[Compile, Link, and Execute](#compile-build-execute)<br/>
[Bulding from Source](#building)<br/>
[Binaries](#binaries) <br/>
[What's new](#whatsnew)<br/>
[What's next](#whatsnext) <br/>
***
### <a name="license" rel='nofollow' onclick='return false;'>License</a>
`fuzzylite 6.0` is licensed under the [**GNU General Public License (GPL) 3.0**](https://www.gnu.org/licenses/gpl.html). You are **strongly** encouraged to support the development of the FuzzyLite Libraries by purchasing a license of [`QtFuzzyLite 6`](https://www.fuzzylite.com/downloads).
[`QtFuzzyLite 6`](https://www.fuzzylite.com/downloads/) is the new and (very likely) the best graphical user interface available to easily design and directly operate fuzzy logic controllers in real time. Available for Windows, Mac, and Linux, its goal is to significantly **speed up** the design of your fuzzy logic controllers, while providing a very **useful**, **functional** and **beautiful** user interface.
Please, download it and check it out for free at [www.fuzzylite.com/downloads/](https://www.fuzzylite.com/downloads/).
***
### <a name="introduction" rel='nofollow' onclick='return false;'>Introduction</a>
`fuzzylite` is a free and open-source fuzzy logic control library programmed in C++ for multiple platforms (e.g., Windows, Linux, Mac, iOS). [`jfuzzylite`](https://github.com/fuzzylite/jfuzzylite/) is the equivalent library for Java and Android platforms. Together, they are **The FuzzyLite Libraries for Fuzzy Logic Control**.
The **goal** of the FuzzyLite Libraries is to **easily** design and **efficiently** operate fuzzy logic controllers following an **object-oriented** programming model **without** relying on external libraries.
#### Reference
If you are using the FuzzyLite Libraries, please cite the following reference in your article:
Juan Rada-Vilela. fuzzylite: a fuzzy logic control library, 2017. URL https://www.fuzzylite.com/.
```bibtex
@misc{fl::fuzzylite,
author={Juan Rada-Vilela},
title={fuzzylite: a fuzzy logic control library},
url={https://www.fuzzylite.com/},
year={2017}}
```
#### Documentation
The documentation for the `fuzzylite` library is available at: [www.fuzzylite.com/documentation/](https://www.fuzzylite.com/documentation/).
#### Contributing
All contributions are welcome, provided they follow the following guidelines:
- Pull requests are made to the [master](https://github.com/fuzzylite/fuzzylite/tree/master) branch, **not** the release branch
- Source code is consistent with standards in the library
- Contribution is appropriately documented and tested, raising issues where appropriate
- License of the contribution is waived to match the license of the FuzzyLite Libraries
***
### <a name="features" rel='nofollow' onclick='return false;'>Features</a>
**(6) Controllers**: Mamdani, Takagi-Sugeno, Larsen, Tsukamoto, Inverse Tsukamoto, Hybrids
**(21) Linguistic terms**: (4) *Basic*: triangle, trapezoid, rectangle, discrete.
(9) *Extended*: bell, cosine, gaussian, gaussian product, pi-shape, sigmoid difference, sigmoid product, spike.
(5) *Edges*: binary, concave, ramp, sigmoid, s-shape, z-shape.
(3) *Functions*: constant, linear, function.
**(7) Activation methods**: general, proportional, threshold, first, last, lowest, highest.
**(8) Conjunction and Implication (T-Norms)**: minimum, algebraic product, bounded difference, drastic product, einstein product, hamacher product, nilpotent minimum, function.
**(10) Disjunction and Aggregation (S-Norms)**: maximum, algebraic sum, bounded sum, drastic sum, einstein sum, hamacher sum, nilpotent maximum, normalized sum, unbounded sum, function.
**(7) Defuzzifiers**: (5) *Integral*: centroid, bisector, smallest of maximum, largest of maximum, mean of maximum.
(2) *Weighted*: weighted average, weighted sum.
**(7) Hedges**: any, not, extremely, seldom, somewhat, very, function.
**(3) Importers**: FuzzyLite Language `fll`, Fuzzy Inference System `fis`, Fuzzy Control Language `fcl`.
**(7) Exporters**: `C++`, `Java`, FuzzyLite Language `fll`, FuzzyLite Dataset `fld`, `R` script, Fuzzy Inference System `fis`, Fuzzy Control Language `fcl`.
**(30+) Examples** of Mamdani, Takagi-Sugeno, Tsukamoto, and Hybrid controllers from `fuzzylite`, Octave, and Matlab, each included in the following formats: `C++`, `Java`, `fll`, `fld`, `R`, `fis`, and `fcl`.
***
### <a name="example" rel='nofollow' onclick='return false;'>Example</a>
#### FuzzyLite Language
```yaml
#File: ObstacleAvoidance.fll
Engine: ObstacleAvoidance
InputVariable: obstacle
enabled: true
range: 0.000 1.000
lock-range: false
term: left Ramp 1.000 0.000
term: right Ramp 0.000 1.000
OutputVariable: mSteer
enabled: true
range: 0.000 1.000
lock-range: false
aggregation: Maximum
defuzzifier: Centroid 100
default: nan
lock-previous: false
term: left Ramp 1.000 0.000
term: right Ramp 0.000 1.000
RuleBlock: mamdani
enabled: true
conjunction: none
disjunction: none
implication: AlgebraicProduct
activation: General
rule: if obstacle is left then mSteer is right
rule: if obstacle is right then mSteer is left
```
```cpp
//File: ObstacleAvoidance.cpp
#include "fl/Headers.h"
int main(int argc, char* argv[]){
using namespace fl;
Engine* engine = FllImporter().fromFile("ObstacleAvoidance.fll");
std::string status;
if (not engine->isReady(&status))
throw Exception("[engine error] engine is not ready:\n" + status, FL_AT);
InputVariable* obstacle = engine->getInputVariable("obstacle");
OutputVariable* steer = engine->getOutputVariable("mSteer");
for (int i = 0; i <= 50; ++i){
scalar location = obstacle->getMinimum() + i * (obstacle->range() / 50);
obstacle->setValue(location);
engine->process();
FL_LOG("obstacle.input = " << Op::str(location) <<
" => " << "steer.output = " << Op::str(steer->getValue()));
}
}
```
#### C++
```cpp
//File: ObstacleAvoidance.cpp
#include "fl/Headers.h"
int main(int argc, char* argv[]){
using namespace fl;
//Code automatically generated with fuzzylite 6.0.
using namespace fl;
Engine* engine = new Engine;
engine->setName("ObstacleAvoidance");
engine->setDescription("");
InputVariable* obstacle = new InputVariable;
obstacle->setName("obstacle");
obstacle->setDescription("");
obstacle->setEnabled(true);
obstacle->setRange(0.000, 1.000);
obstacle->setLockValueInRange(false);
obstacle->addTerm(new Ramp("left", 1.000, 0.000));
obstacle->addTerm(new Ramp("right", 0.000, 1.000));
engine->addInputVariable(obstacle);
OutputVariable* mSteer = new OutputVaria