summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schauer <josch@debian.org>2015-07-07 10:12:00 +0100
committerJohannes Schauer <josch@debian.org>2015-07-07 10:12:00 +0100
commit0e8c1c9d31d15034b1ff1062c9bf0bfcdc849dd9 (patch)
tree840a335d9a4487d3f1909a31c8526a2e647809e7
Import fuzzylite_5.1+dfsg.orig.tar.xz
[dgit import orig fuzzylite_5.1+dfsg.orig.tar.xz]
-rw-r--r--.gitignore21
-rw-r--r--.travis.yml144
-rw-r--r--AUTHOR3
-rw-r--r--COPYING674
-rw-r--r--COPYING.LESSER165
-rw-r--r--ChangeLog231
-rw-r--r--INSTALL32
-rw-r--r--LICENSE165
-rw-r--r--NEWS317
-rw-r--r--README.md455
-rw-r--r--examples/README.md13
-rwxr-xr-xexamples/examples.matbin0 -> 1062107 bytes
-rw-r--r--examples/mamdani/AllTerms.cpp95
-rw-r--r--examples/mamdani/AllTerms.fcl88
-rw-r--r--examples/mamdani/AllTerms.fis83
-rw-r--r--examples/mamdani/AllTerms.fld1026
-rw-r--r--examples/mamdani/AllTerms.fll77
-rw-r--r--examples/mamdani/AllTerms.java105
-rw-r--r--examples/mamdani/Laundry.cpp67
-rw-r--r--examples/mamdani/Laundry.fcl56
-rw-r--r--examples/mamdani/Laundry.fld1026
-rw-r--r--examples/mamdani/Laundry.fll43
-rw-r--r--examples/mamdani/Laundry.java77
-rw-r--r--examples/mamdani/SimpleDimmer.cpp44
-rw-r--r--examples/mamdani/SimpleDimmer.fcl35
-rw-r--r--examples/mamdani/SimpleDimmer.fis32
-rw-r--r--examples/mamdani/SimpleDimmer.fld1026
-rw-r--r--examples/mamdani/SimpleDimmer.fll26
-rw-r--r--examples/mamdani/SimpleDimmer.java54
-rw-r--r--examples/mamdani/SimpleDimmerChained.fll40
-rw-r--r--examples/mamdani/SimpleDimmerInverse.cpp61
-rw-r--r--examples/mamdani/SimpleDimmerInverse.fcl49
-rw-r--r--examples/mamdani/SimpleDimmerInverse.fld1026
-rw-r--r--examples/mamdani/SimpleDimmerInverse.fll40
-rw-r--r--examples/mamdani/SimpleDimmerInverse.java71
-rw-r--r--examples/mamdani/octave/COPYING674
-rw-r--r--examples/mamdani/octave/DESCRIPTION12
-rw-r--r--examples/mamdani/octave/investment_portfolio.cpp52
-rw-r--r--examples/mamdani/octave/investment_portfolio.fcl44
-rw-r--r--examples/mamdani/octave/investment_portfolio.fis39
-rw-r--r--examples/mamdani/octave/investment_portfolio.fld1026
-rw-r--r--examples/mamdani/octave/investment_portfolio.fll31
-rw-r--r--examples/mamdani/octave/investment_portfolio.java62
-rw-r--r--examples/mamdani/octave/mamdani_tip_calculator.cpp66
-rw-r--r--examples/mamdani/octave/mamdani_tip_calculator.fcl55
-rw-r--r--examples/mamdani/octave/mamdani_tip_calculator.fis47
-rw-r--r--examples/mamdani/octave/mamdani_tip_calculator.fld1026
-rw-r--r--examples/mamdani/octave/mamdani_tip_calculator.fll42
-rw-r--r--examples/mamdani/octave/mamdani_tip_calculator.java76
-rw-r--r--examples/original/mamdani/AllTerms.fis84
-rw-r--r--examples/original/mamdani/AllTerms.fll77
-rw-r--r--examples/original/mamdani/Laundry.fll43
-rw-r--r--examples/original/mamdani/SimpleDimmer.fis39
-rw-r--r--examples/original/mamdani/SimpleDimmer.fll26
-rw-r--r--examples/original/mamdani/SimpleDimmerInverse.fll40
-rw-r--r--examples/original/mamdani/octave/COPYING674
-rw-r--r--examples/original/mamdani/octave/DESCRIPTION12
-rw-r--r--examples/original/mamdani/octave/investment_portfolio.fis64
-rw-r--r--examples/original/mamdani/octave/investment_portfolio.fll31
-rw-r--r--examples/original/mamdani/octave/mamdani_tip_calculator.fis72
-rw-r--r--examples/original/mamdani/octave/mamdani_tip_calculator.fll42
-rw-r--r--examples/original/takagi-sugeno/SimpleDimmer.fis41
-rw-r--r--examples/original/takagi-sugeno/SimpleDimmer.fll26
-rw-r--r--examples/original/takagi-sugeno/approximation.fis80
-rw-r--r--examples/original/takagi-sugeno/approximation.fll63
-rw-r--r--examples/original/takagi-sugeno/octave/COPYING674
-rw-r--r--examples/original/takagi-sugeno/octave/DESCRIPTION12
-rw-r--r--examples/original/takagi-sugeno/octave/cubic_approximator.fis81
-rw-r--r--examples/original/takagi-sugeno/octave/cubic_approximator.fll50
-rw-r--r--examples/original/takagi-sugeno/octave/heart_disease_risk.fis90
-rw-r--r--examples/original/takagi-sugeno/octave/heart_disease_risk.fll48
-rw-r--r--examples/original/takagi-sugeno/octave/linear_tip_calculator.fis64
-rw-r--r--examples/original/takagi-sugeno/octave/linear_tip_calculator.fll31
-rw-r--r--examples/original/takagi-sugeno/octave/sugeno_tip_calculator.fis98
-rw-r--r--examples/original/takagi-sugeno/octave/sugeno_tip_calculator.fll59
-rw-r--r--examples/original/tsukamoto/tsukamoto.fis65
-rw-r--r--examples/original/tsukamoto/tsukamoto.fll59
-rw-r--r--examples/takagi-sugeno/SimpleDimmer.cpp44
-rw-r--r--examples/takagi-sugeno/SimpleDimmer.fcl33
-rw-r--r--examples/takagi-sugeno/SimpleDimmer.fis32
-rw-r--r--examples/takagi-sugeno/SimpleDimmer.fld1026
-rw-r--r--examples/takagi-sugeno/SimpleDimmer.fll26
-rw-r--r--examples/takagi-sugeno/SimpleDimmer.java54
-rw-r--r--examples/takagi-sugeno/approximation.cpp87
-rw-r--r--examples/takagi-sugeno/approximation.fcl68
-rw-r--r--examples/takagi-sugeno/approximation.fis65
-rw-r--r--examples/takagi-sugeno/approximation.fld1026
-rw-r--r--examples/takagi-sugeno/approximation.fll63
-rw-r--r--examples/takagi-sugeno/approximation.java97
-rw-r--r--examples/takagi-sugeno/octave/COPYING674
-rw-r--r--examples/takagi-sugeno/octave/DESCRIPTION12
-rw-r--r--examples/takagi-sugeno/octave/cubic_approximator.cpp68
-rw-r--r--examples/takagi-sugeno/octave/cubic_approximator.fcl57
-rw-r--r--examples/takagi-sugeno/octave/cubic_approximator.fis56
-rw-r--r--examples/takagi-sugeno/octave/cubic_approximator.fld1026
-rw-r--r--examples/takagi-sugeno/octave/cubic_approximator.fll50
-rw-r--r--examples/takagi-sugeno/octave/cubic_approximator.java78
-rw-r--r--examples/takagi-sugeno/octave/heart_disease_risk.cpp69
-rw-r--r--examples/takagi-sugeno/octave/heart_disease_risk.fcl58
-rw-r--r--examples/takagi-sugeno/octave/heart_disease_risk.fis56
-rw-r--r--examples/takagi-sugeno/octave/heart_disease_risk.fld1026
-rw-r--r--examples/takagi-sugeno/octave/heart_disease_risk.fll48
-rw-r--r--examples/takagi-sugeno/octave/heart_disease_risk.java79
-rw-r--r--examples/takagi-sugeno/octave/linear_tip_calculator.cpp52
-rw-r--r--examples/takagi-sugeno/octave/linear_tip_calculator.fcl41
-rw-r--r--examples/takagi-sugeno/octave/linear_tip_calculator.fis39
-rw-r--r--examples/takagi-sugeno/octave/linear_tip_calculator.fld1026
-rw-r--r--examples/takagi-sugeno/octave/linear_tip_calculator.fll31
-rw-r--r--examples/takagi-sugeno/octave/linear_tip_calculator.java62
-rw-r--r--examples/takagi-sugeno/octave/sugeno_tip_calculator.cpp86
-rw-r--r--examples/takagi-sugeno/octave/sugeno_tip_calculator.fcl67
-rw-r--r--examples/takagi-sugeno/octave/sugeno_tip_calculator.fis61
-rw-r--r--examples/takagi-sugeno/octave/sugeno_tip_calculator.fld1026
-rw-r--r--examples/takagi-sugeno/octave/sugeno_tip_calculator.fll59
-rw-r--r--examples/takagi-sugeno/octave/sugeno_tip_calculator.java96
-rw-r--r--examples/tsukamoto/tsukamoto.cpp86
-rw-r--r--examples/tsukamoto/tsukamoto.fcl63
-rw-r--r--examples/tsukamoto/tsukamoto.fis56
-rw-r--r--examples/tsukamoto/tsukamoto.fld1026
-rw-r--r--examples/tsukamoto/tsukamoto.fll59
-rw-r--r--examples/tsukamoto/tsukamoto.java96
-rw-r--r--fuzzylite.pngbin0 -> 2883 bytes
-rw-r--r--fuzzylite/CMakeLists.txt208
-rw-r--r--fuzzylite/FL_HEADERS92
-rw-r--r--fuzzylite/FL_SOURCES87
-rw-r--r--fuzzylite/build.bat105
-rwxr-xr-xfuzzylite/build.sh70
-rw-r--r--fuzzylite/fl/Console.h90
-rw-r--r--fuzzylite/fl/Engine.h152
-rw-r--r--fuzzylite/fl/Exception.h66
-rw-r--r--fuzzylite/fl/Headers.h131
-rw-r--r--fuzzylite/fl/Operation.h144
-rw-r--r--fuzzylite/fl/defuzzifier/Bisector.h49
-rw-r--r--fuzzylite/fl/defuzzifier/Centroid.h47
-rw-r--r--fuzzylite/fl/defuzzifier/Defuzzifier.h53
-rw-r--r--fuzzylite/fl/defuzzifier/IntegralDefuzzifier.h53
-rw-r--r--fuzzylite/fl/defuzzifier/LargestOfMaximum.h47
-rw-r--r--fuzzylite/fl/defuzzifier/MeanOfMaximum.h48
-rw-r--r--fuzzylite/fl/defuzzifier/SmallestOfMaximum.h48
-rw-r--r--fuzzylite/fl/defuzzifier/WeightedAverage.h50
-rw-r--r--fuzzylite/fl/defuzzifier/WeightedDefuzzifier.h63
-rw-r--r--fuzzylite/fl/defuzzifier/WeightedSum.h50
-rw-r--r--fuzzylite/fl/factory/CloningFactory.h62
-rw-r--r--fuzzylite/fl/factory/ConstructionFactory.h64
-rw-r--r--fuzzylite/fl/factory/DefuzzifierFactory.h51
-rw-r--r--fuzzylite/fl/factory/FactoryManager.h81
-rw-r--r--fuzzylite/fl/factory/FunctionFactory.h51
-rw-r--r--fuzzylite/fl/factory/HedgeFactory.h42
-rw-r--r--fuzzylite/fl/factory/SNormFactory.h42
-rw-r--r--fuzzylite/fl/factory/TNormFactory.h42
-rw-r--r--fuzzylite/fl/factory/TermFactory.h43
-rw-r--r--fuzzylite/fl/fuzzylite.h222
-rw-r--r--fuzzylite/fl/hedge/Any.h47
-rw-r--r--fuzzylite/fl/hedge/Extremely.h42
-rw-r--r--fuzzylite/fl/hedge/Hedge.h51
-rw-r--r--fuzzylite/fl/hedge/Not.h42
-rw-r--r--fuzzylite/fl/hedge/Seldom.h42
-rw-r--r--fuzzylite/fl/hedge/Somewhat.h42
-rw-r--r--fuzzylite/fl/hedge/Very.h42
-rw-r--r--fuzzylite/fl/imex/CppExporter.h70
-rw-r--r--fuzzylite/fl/imex/Exporter.h52
-rw-r--r--fuzzylite/fl/imex/FclExporter.h70
-rw-r--r--fuzzylite/fl/imex/FclImporter.h74
-rw-r--r--fuzzylite/fl/imex/FisExporter.h74
-rw-r--r--fuzzylite/fl/imex/FisImporter.h79
-rw-r--r--fuzzylite/fl/imex/FldExporter.h84
-rw-r--r--fuzzylite/fl/imex/FllExporter.h83
-rw-r--r--fuzzylite/fl/imex/FllImporter.h77
-rw-r--r--fuzzylite/fl/imex/Importer.h52
-rw-r--r--fuzzylite/fl/imex/JavaExporter.h68
-rw-r--r--fuzzylite/fl/norm/Norm.h55
-rw-r--r--fuzzylite/fl/norm/SNorm.h47
-rw-r--r--fuzzylite/fl/norm/TNorm.h47
-rw-r--r--fuzzylite/fl/norm/s/AlgebraicSum.h46
-rw-r--r--fuzzylite/fl/norm/s/BoundedSum.h43
-rw-r--r--fuzzylite/fl/norm/s/DrasticSum.h43
-rw-r--r--fuzzylite/fl/norm/s/EinsteinSum.h44
-rw-r--r--fuzzylite/fl/norm/s/HamacherSum.h44
-rw-r--r--fuzzylite/fl/norm/s/Maximum.h45
-rw-r--r--fuzzylite/fl/norm/s/NilpotentMaximum.h43
-rw-r--r--fuzzylite/fl/norm/s/NormalizedSum.h44
-rw-r--r--fuzzylite/fl/norm/t/AlgebraicProduct.h45
-rw-r--r--fuzzylite/fl/norm/t/BoundedDifference.h44
-rw-r--r--fuzzylite/fl/norm/t/DrasticProduct.h45
-rw-r--r--fuzzylite/fl/norm/t/EinsteinProduct.h45
-rw-r--r--fuzzylite/fl/norm/t/HamacherProduct.h44
-rw-r--r--fuzzylite/fl/norm/t/Minimum.h44
-rw-r--r--fuzzylite/fl/norm/t/NilpotentMinimum.h43
-rw-r--r--fuzzylite/fl/rule/Antecedent.h77
-rw-r--r--fuzzylite/fl/rule/Consequent.h68
-rw-r--r--fuzzylite/fl/rule/Expression.h84
-rw-r--r--fuzzylite/fl/rule/Rule.h121
-rw-r--r--fuzzylite/fl/rule/RuleBlock.h97
-rw-r--r--fuzzylite/fl/term/Accumulated.h94
-rw-r--r--fuzzylite/fl/term/Activated.h65
-rw-r--r--fuzzylite/fl/term/Bell.h68
-rw-r--r--fuzzylite/fl/term/Concave.h64
-rw-r--r--fuzzylite/fl/term/Constant.h58
-rw-r--r--fuzzylite/fl/term/Cosine.h62
-rw-r--r--fuzzylite/fl/term/Discrete.h81
-rw-r--r--fuzzylite/fl/term/Function.h171
-rw-r--r--fuzzylite/fl/term/Gaussian.h63
-rw-r--r--fuzzylite/fl/term/GaussianProduct.h73
-rw-r--r--fuzzylite/fl/term/Linear.h72
-rw-r--r--fuzzylite/fl/term/PiShape.h74
-rw-r--r--fuzzylite/fl/term/Ramp.h68
-rw-r--r--fuzzylite/fl/term/Rectangle.h62
-rw-r--r--fuzzylite/fl/term/SShape.h64
-rw-r--r--fuzzylite/fl/term/Sigmoid.h68
-rw-r--r--fuzzylite/fl/term/SigmoidDifference.h73
-rw-r--r--fuzzylite/fl/term/SigmoidProduct.h73
-rw-r--r--fuzzylite/fl/term/Spike.h62
-rw-r--r--fuzzylite/fl/term/Term.h71
-rw-r--r--fuzzylite/fl/term/Trapezoid.h69
-rw-r--r--fuzzylite/fl/term/Triangle.h68
-rw-r--r--fuzzylite/fl/term/ZShape.h63
-rw-r--r--fuzzylite/fl/variable/InputVariable.h52
-rw-r--r--fuzzylite/fl/variable/OutputVariable.h90
-rw-r--r--fuzzylite/fl/variable/Variable.h96
-rw-r--r--fuzzylite/fuzzylite.139
-rw-r--r--fuzzylite/fuzzylite.doxygen1781
-rw-r--r--fuzzylite/fuzzylite.pc.in10
-rw-r--r--fuzzylite/src/Console.cpp820
-rw-r--r--fuzzylite/src/Engine.cpp698
-rw-r--r--fuzzylite/src/Exception.cpp183
-rw-r--r--fuzzylite/src/Operation.cpp477
-rw-r--r--fuzzylite/src/defuzzifier/Bisector.cpp85
-rw-r--r--fuzzylite/src/defuzzifier/Centroid.cpp80
-rw-r--r--fuzzylite/src/defuzzifier/IntegralDefuzzifier.cpp53
-rw-r--r--fuzzylite/src/defuzzifier/LargestOfMaximum.cpp75
-rw-r--r--fuzzylite/src/defuzzifier/MeanOfMaximum.cpp88
-rw-r--r--fuzzylite/src/defuzzifier/SmallestOfMaximum.cpp77
-rw-r--r--fuzzylite/src/defuzzifier/WeightedAverage.cpp123
-rw-r--r--fuzzylite/src/defuzzifier/WeightedDefuzzifier.cpp178
-rw-r--r--fuzzylite/src/defuzzifier/WeightedSum.cpp121
-rw-r--r--fuzzylite/src/factory/CloningFactory.cpp135
-rw-r--r--fuzzylite/src/factory/ConstructionFactory.cpp114
-rw-r--r--fuzzylite/src/factory/DefuzzifierFactory.cpp78
-rw-r--r--fuzzylite/src/factory/FactoryManager.cpp127
-rw-r--r--fuzzylite/src/factory/FunctionFactory.cpp172
-rw-r--r--fuzzylite/src/factory/HedgeFactory.cpp51
-rw-r--r--fuzzylite/src/factory/SNormFactory.cpp55
-rw-r--r--fuzzylite/src/factory/TNormFactory.cpp53
-rw-r--r--fuzzylite/src/factory/TermFactory.cpp81
-rw-r--r--fuzzylite/src/fuzzylite.cpp128
-rw-r--r--fuzzylite/src/hedge/Any.cpp52
-rw-r--r--fuzzylite/src/hedge/Extremely.cpp50
-rw-r--r--fuzzylite/src/hedge/Not.cpp46
-rw-r--r--fuzzylite/src/hedge/Seldom.cpp50
-rw-r--r--fuzzylite/src/hedge/Somewhat.cpp45
-rw-r--r--fuzzylite/src/hedge/Very.cpp45
-rw-r--r--fuzzylite/src/imex/CppExporter.cpp234
-rw-r--r--fuzzylite/src/imex/Exporter.cpp49
-rw-r--r--fuzzylite/src/imex/FclExporter.cpp256
-rw-r--r--fuzzylite/src/imex/FclImporter.cpp607
-rw-r--r--fuzzylite/src/imex/FisExporter.cpp463
-rw-r--r--fuzzylite/src/imex/FisImporter.cpp501
-rw-r--r--fuzzylite/src/imex/FldExporter.cpp246
-rw-r--r--fuzzylite/src/imex/FllExporter.cpp189
-rw-r--r--fuzzylite/src/imex/FllImporter.cpp317
-rw-r--r--fuzzylite/src/imex/Importer.cpp54
-rw-r--r--fuzzylite/src/imex/JavaExporter.cpp228
-rwxr-xr-xfuzzylite/src/m/compare.m60
-rwxr-xr-xfuzzylite/src/m/compare_examples.m45
-rw-r--r--fuzzylite/src/main.cpp71
-rw-r--r--fuzzylite/src/norm/s/AlgebraicSum.cpp45
-rw-r--r--fuzzylite/src/norm/s/BoundedSum.cpp45
-rw-r--r--fuzzylite/src/norm/s/DrasticSum.cpp48
-rw-r--r--fuzzylite/src/norm/s/EinsteinSum.cpp45
-rw-r--r--fuzzylite/src/norm/s/HamacherSum.cpp45
-rw-r--r--fuzzylite/src/norm/s/Maximum.cpp45
-rw-r--r--fuzzylite/src/norm/s/NilpotentMaximum.cpp50
-rw-r--r--fuzzylite/src/norm/s/NormalizedSum.cpp46
-rw-r--r--fuzzylite/src/norm/t/AlgebraicProduct.cpp45
-rw-r--r--fuzzylite/src/norm/t/BoundedDifference.cpp46
-rw-r--r--fuzzylite/src/norm/t/DrasticProduct.cpp48
-rw-r--r--fuzzylite/src/norm/t/EinsteinProduct.cpp45
-rw-r--r--fuzzylite/src/norm/t/HamacherProduct.cpp46
-rw-r--r--fuzzylite/src/norm/t/Minimum.cpp46
-rw-r--r--fuzzylite/src/norm/t/NilpotentMinimum.cpp50
-rw-r--r--fuzzylite/src/rule/Antecedent.cpp368
-rw-r--r--fuzzylite/src/rule/Consequent.cpp243
-rw-r--r--fuzzylite/src/rule/Expression.cpp83
-rw-r--r--fuzzylite/src/rule/Rule.cpp262
-rw-r--r--fuzzylite/src/rule/RuleBlock.cpp210
-rw-r--r--fuzzylite/src/term/Accumulated.cpp211
-rw-r--r--fuzzylite/src/term/Activated.cpp100
-rw-r--r--fuzzylite/src/term/Bell.cpp99
-rw-r--r--fuzzylite/src/term/Concave.cpp107
-rw-r--r--fuzzylite/src/term/Constant.cpp70
-rw-r--r--fuzzylite/src/term/Cosine.cpp96
-rw-r--r--fuzzylite/src/term/Discrete.cpp210
-rw-r--r--fuzzylite/src/term/Function.cpp600
-rw-r--r--fuzzylite/src/term/Gaussian.cpp92
-rw-r--r--fuzzylite/src/term/GaussianProduct.cpp120
-rw-r--r--fuzzylite/src/term/Linear.cpp135
-rw-r--r--fuzzylite/src/term/PiShape.cpp133
-rw-r--r--fuzzylite/src/term/Ramp.cpp110
-rw-r--r--fuzzylite/src/term/Rectangle.cpp93
-rw-r--r--fuzzylite/src/term/SShape.cpp102
-rw-r--r--fuzzylite/src/term/Sigmoid.cpp98
-rw-r--r--fuzzylite/src/term/SigmoidDifference.cpp114
-rw-r--r--fuzzylite/src/term/SigmoidProduct.cpp112
-rw-r--r--fuzzylite/src/term/Spike.cpp90
-rw-r--r--fuzzylite/src/term/Term.cpp74
-rw-r--r--fuzzylite/src/term/Trapezoid.cpp130
-rw-r--r--fuzzylite/src/term/Triangle.cpp115
-rw-r--r--fuzzylite/src/term/ZShape.cpp102
-rw-r--r--fuzzylite/src/variable/InputVariable.cpp54
-rw-r--r--fuzzylite/src/variable/OutputVariable.cpp195
-rw-r--r--fuzzylite/src/variable/Variable.cpp244
311 files changed, 45057 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0def275
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,21 @@
+# Compiled Object files
+*.slo
+*.lo
+*.o
+*.obj
+
+# Compiled Dynamic libraries
+*.so
+*.dylib
+*.dll
+
+# Compiled Static libraries
+*.lai
+*.la
+*.a
+*.lib
+
+# Executables
+*.exe
+*.out
+*.app
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..a22168d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,144 @@
+language: cpp
+
+os:
+ - linux
+ - osx
+
+before_install:
+
+ - if [ "$TRAVIS_OS_NAME" = "linux" ];
+ then
+ sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test;
+ sudo add-apt-repository --yes ppa:h-rayflood/llvm;
+ sudo add-apt-repository --yes ppa:andykimpe/cmake;
+ sudo apt-get update -qq;
+ sudo apt-get install -qq cmake;
+ sudo apt-get install -qq $SUPPORT;
+ sudo apt-get install -qq $PACKAGE;
+ fi
+
+ #setup compiler
+ - export CC=${REAL_CC} CXX=${REAL_CXX}
+
+script:
+ - cd fuzzylite
+ - mkdir -p $FL_CONF
+ - cd $FL_CONF
+ - cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=$FL_CONF -DFL_BACKTRACE=ON -DFL_USE_FLOAT=$FL_USE_FLOAT -DFL_CPP11=$FL_CPP11
+ - make
+
+env:
+ - ignore=this
+
+matrix:
+ exclude:
+ - env: ignore=this
+ include:
+#clang-3.2
+##Debug
+ - compiler: clang
+ env: REAL_CC=clang-3.2 REAL_CXX=clang++-3.2 PACKAGE=clang-3.2 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.2 REAL_CXX=clang++-3.2 PACKAGE=clang-3.2 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.2 REAL_CXX=clang++-3.2 PACKAGE=clang-3.2 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=clang-3.2 REAL_CXX=clang++-3.2 PACKAGE=clang-3.2 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=ON
+##Release
+ - compiler: clang
+ env: REAL_CC=clang-3.2 REAL_CXX=clang++-3.2 PACKAGE=clang-3.2 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.2 REAL_CXX=clang++-3.2 PACKAGE=clang-3.2 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.2 REAL_CXX=clang++-3.2 PACKAGE=clang-3.2 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=clang-3.2 REAL_CXX=clang++-3.2 PACKAGE=clang-3.2 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=ON
+
+#clang-3.3
+##Debug
+ - compiler: clang
+ env: REAL_CC=clang-3.3 REAL_CXX=clang++-3.3 PACKAGE=clang-3.3 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.3 REAL_CXX=clang++-3.3 PACKAGE=clang-3.3 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.3 REAL_CXX=clang++-3.3 PACKAGE=clang-3.3 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=clang-3.3 REAL_CXX=clang++-3.3 PACKAGE=clang-3.3 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=ON
+##Release
+ - compiler: clang
+ env: REAL_CC=clang-3.3 REAL_CXX=clang++-3.3 PACKAGE=clang-3.3 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.3 REAL_CXX=clang++-3.3 PACKAGE=clang-3.3 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.3 REAL_CXX=clang++-3.3 PACKAGE=clang-3.3 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=clang-3.3 REAL_CXX=clang++-3.3 PACKAGE=clang-3.3 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=ON
+
+#clang-3.4
+##Debug
+ - compiler: clang
+ env: REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=g++-4.8 FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=ON
+##Release
+ - compiler: clang
+ env: REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=g++-4.8 FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=ON
+
+
+#gcc-4.7
+##Debug
+ - compiler: clang
+ env: REAL_CC=gcc-4.7 REAL_CXX=g++-4.7 PACKAGE=g++-4.7 SUPPORT= FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=gcc-4.7 REAL_CXX=g++-4.7 PACKAGE=g++-4.7 SUPPORT= FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=gcc-4.7 REAL_CXX=g++-4.7 PACKAGE=g++-4.7 SUPPORT= FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=gcc-4.7 REAL_CXX=g++-4.7 PACKAGE=g++-4.7 SUPPORT= FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=ON
+##Release
+ - compiler: clang
+ env: REAL_CC=gcc-4.7 REAL_CXX=g++-4.7 PACKAGE=g++-4.7 SUPPORT= FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=gcc-4.7 REAL_CXX=g++-4.7 PACKAGE=g++-4.7 SUPPORT= FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=gcc-4.7 REAL_CXX=g++-4.7 PACKAGE=g++-4.7 SUPPORT= FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=gcc-4.7 REAL_CXX=g++-4.7 PACKAGE=g++-4.7 SUPPORT= FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=ON
+
+#gcc-4.8
+##Debug
+ - compiler: clang
+ env: REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT= FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT= FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT= FL_CONF=Debug FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT= FL_CONF=Debug FL_USE_FLOAT=ON FL_CPP11=ON
+##Release
+ - compiler: clang
+ env: REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT= FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT= FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=OFF
+ - compiler: clang
+ env: REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT= FL_CONF=Release FL_USE_FLOAT=OFF FL_CPP11=ON
+ - compiler: clang
+ env: REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT= FL_CONF=Release FL_USE_FLOAT=ON FL_CPP11=ON
+
+
+notifications:
+ email:
+ recipients:
+ - jcrada@fuzzylite.com
+ on_success: change
+ on_failure: always
diff --git a/AUTHOR b/AUTHOR
new file mode 100644
index 0000000..eb752b0
--- /dev/null
+++ b/AUTHOR
@@ -0,0 +1,3 @@
+Juan Rada-Vilela, Ph.D.
+jcrada@fuzzylite.com
+http://www.fuzzylite.com/jcrada \ No newline at end of file
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/COPYING.LESSER b/COPYING.LESSER
new file mode 100644
index 0000000..65c5ca8
--- /dev/null
+++ b/COPYING.LESSER
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..012623e
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,231 @@
+Version 5.1
+* Updated `JavaExporter` to remove boolean from exported `Function.create(String name, String formula, Engine engine, boolean)`
+* Improved CMakeLists to remove errors from warnings, and exclude library rt for benchmarks
+* Moved benchmarks in `Console.cpp` to FL_CPP11 in order to get rid of rt library
+* Made most constructors `explicit`
+* FL_WINDOWS, FL_APPLE and FL_UNIX are automatically defined in `fuzzylite.h`
+* Option to prefix namespace `fl::` in class `CppExporter`
+* New methods `FclExporter::toString([[Input|Output]Variable]|RuleBlock|Norm])`
+* New methods `FclExporter::toString(Norm)`
+* Identifier FL_IOVERRIDE in SNorm and TNorm
+* New private methods `CloningFactory::register[Operators|Functions]`
+* `FisExporter` merges all ruleblocks into one
+* New `Rule::clone()` method
+* Fixed `FclImporter` exception on malformed Term
+* Made sure this version builds successfully with g++5.1
+
+
+Version 5.0
+* Modified Function::Unary and Binary to take scalar instead of double
+* Fixed building using -DFL_USE_FLOAT=ON
+* Added deductive type of Engine with Engine::type()
+* Fixed minor memory leak at RuleBlock (conjunction, disjunction, activation)
+* Fixed minor memory leak at Accumulated (accumulation, thresholded terms)
+* Fixed minor memory leak at OutputVariable (defuzzifier)
+* Fixed minor memory leak at Function::Node
+* Fixed minor memory leak at FactoryManager
+* Improved handling of Exceptions
+* Modified FclExporter and FisExporter to provide backward compatibility with FCL and FIS formats
+* Updated the FIS and FCL examples for backward compatibility
+* Included the original example files
+* Updated FLD examples produced from the engines of the original examples
+* Fixed some original examples of takagi-sugeno to use AlgebraicProduct activation
+* FldExporter no longer restarts the engine
+* Fixed rethrowing of exceptions to provide proper information about errors!
+* Catching std::exceptions where possible to avoid unexpected exceptions
+* FldExporter exports from a custom input dataset
+* Console includes option to read custom input dataset from file
+* Console provides more information about its usage
+* Renamed methods FldExporter::toWriter() to FldExporter::write()
+* Removed variable and methods for property FldExporter::maximum
+* Accuracy improvements importing fis files with large number of decimals
+* Updated FLD examples to reflect accuracy
+* Changed operation for multiple hedges to operate from last to first
+* Fixed OutputVariable to store last valid output value regardless of locks
+* Renamed Op::isNan to Op::isNaN
+* New OutputVariable::(get|set)OutputValue to store value from defuzzification
+* Changed OutputVariable::defuzzify to store its output value
+* Changed return type of scalar OutputVariable::defuzzify to void OutputVariable::defuzzify
+* Renamed OutputVariable::(get|set)LastValidOutput to OutputVariable::(get|set)LastValidOutputValue
+* Removed OutputVariable::defuzzifyNoLocks
+* Removed const from Term* Accumulated::(get|set)Accumulation
+* Added InputVariable::fuzzyInputValue and OutputVariable::fuzzyOutputValue
+* Removed defaults in Engine::configure
+* Added Engine::configure without conjuntion and disjuntion
+* Added parameter string to Engine::type
+* Changed Engine::isReady
+* Correct handling of integral defuzzification with min|max=NaN|Inf
+* Added method Rule::isLoaded to determine whether a rule is to be activated
+* Added method Rule::unload to allow existence of invalid rules
+* Added methods Engine::set((Input|Output)Variables), Engine::setRuleBlocks
+* Added method RuleBlock::setRules
+* Changed visibility of Rule::setText to public
+* Added method Rule::load(const Engine*)
+* Renamed term Thresholded to Activated
+* Renamed Thresholded::(set|get)Threshold to Activated::(set|get)Degree
+* Removed variable Rule::FL_ASSIGNS="=" and method Rule::assignsKeyword()
+* Modified original takagi-sugeno examples to reflect proper activation and accumulation
+* Moved Engine::_hedges (and methods) to Rule::_hedges
+* Renamed Antecedent::(get|set)Root to Antecedent::(get|set)Expression
+* Added (Antecedent|Consequent)::(get|set)Text
+* Added (Antecedent|Consequent)::load|unload
+* Renamed typedef Factory::Creator to Factory::Constructor
+* Added an M-file to compare output values of fuzzylite engines with Matlab
+* Removed const from Norms in RuleBlock::(get|set)(Activation|Conjunction|Disjunction)
+* Deleted method Op::repeat
+* Added built-in functions gt,lt,ge,le,eq and operator !
+* Renamed Term::copy to Term::clone in every Term
+* Added copy constructors and assignment operators to (Input|Output)Variable
+* Added copy constructors and assignment operators to Accumulated
+* Merged Function::Operator and Function::BuiltInFunction into Function::Element
+* Created FunctionFactory for Function::Elements
+* IMPORTANT: Changed starting precedence of Function::Element::Operators to 10 (refer to FunctionFactory)
+* Setters of FactoryManager no longer delete previous factories
+* Renamed Factory<T>::(register|deregister)Class to Factory<T>::(register|deregister)Constructor
+* Renamed Factory<T> to ConstructionFactory<T>
+* Created CloningFactory<T>
+* Moved functions and operators of term Function to a FunctionFactory
+* Added clone methods to Defuzzifiers, Hedges, Norms, and Terms
+* Changed Exception::btCallStack(const int) to Exception::btCallStack(void)
+* Using std::auto_ptr to (T|S)Norms in RuleBlock, SNorm in Accumulated, and Defuzzifier in OutputVariable
+* Added methods Engine::set((Input|Output)Variable) and Engine::setRuleBlock()
+* Added method RuleBlock::reloadRules()
+* Changed Linear pointers to input variables for a pointer to Engine
+* Added support to compare infinity values with fl::Op::isEq and therefore other comparison operators
+* Parameters of all terms are set to fl::nan by default
+* Added methods Engine::(input|output)Variables() and ::ruleBlocks() to return mutable references
+* Added method Variable::terms() to return mutable reference
+* Added method RuleBlock::rules() to return mutable reference
+* Added methods Ramp::direction() and Sigmoid::direction() to represent direction of slope
+* Added method fl::Op::isFinite(x) to check x is not (nan or inf)
+* Changed fl::Op::isEq(a,b) to return true if a = b = NaN
+* Added method Accumulated::terms() to return mutable reference
+* Changed visibility of Linear::coefficients to protected
+* Added methods Linear::coefficients(), Linear::setCoefficients()
+* Removed public variables Discrete::x,y
+* Added in Discrete a typedef to std::pair<scalar, scalar> Pair, and changed signatures of methods and types of their parameters
+* Changed representation of Discrete::(x,y) from std::vector<scalar> to std::vector<Pair>
+* Added methods Discrete::setXY(), Discrete::xy(), ::xy(int) to set and get new representation
+* Added methods Discrete::toPairs(std::vector<scalar>) and Discrete::toVector(std::vector<Pair>)
+* Added method Discrete::formatXY() to get pairs (x,y) nicely formatted
+* Linear term no longer throws exception when inputVariables != |coefficients|
+* Changed visibility of Function::root to protected and renamed it to Function::_root
+* Added method Function::root() to return pointer to Function::_root
+* Added option to prefix the namespace in CppExporter, by default it does not prefix
+* Added method OutputVariable::clear() to restart the output variable
+* Renamed variable OutputVariable::_lastValidOutputValue to ::_previousOutputValue
+* Renamed method OutputVariable::(get|set)LastValidOutputValue to ::(get|set)PreviousOutputValue
+* Renamed variable OutputVariable::_lockOutputRange to ::_lockOutputValueInRange
+* Renamed method OutputVariable::setLockOutputRange() to ::setLockOutputValueInRange
+* Renamed method OutputVariable::isLockingOutputRange() to ::isLockedOutputValueInRange
+* Renamed variable OutputVariable::_lockValidOutput to ::_lockPreviousOutputValue
+* Renamed method OutputVariable::setLockValidOutput() to ::setLockPreviousOutputValue
+* Renamed method OutputVariable::isLockingValidOutput() to ::isLockedPreviousOutputValue
+* Renamed FLL property 'lock-valid' to 'lock-previous'
+* Renamed FIS property 'LockValid' to 'LockPrevious'
+* Renamed FCL property 'LOCK: VALID' to 'LOCK: PREVIOUS'
+* Added method Engine::variables() to retrieve both Input and OutputVariables
+* Added method Term::updateReference(Term*, Engine*) to ensure Linear and Function terms to update references of engines
+* Added method Engine::updateReferences() to update references to the engine in its terms.
+* Added in Discrete a typedef to std::pair<scalar, scalar> Pair, and changed signatures of methods and types of their parameters
+* Added terms: Concave, Cosine and Spike
+* Renamed methods Triangle::(set|get)(A|B|C) to (set|get)(Vertex(A|B|C))
+* Renamed methods Trapezoid::(set|get)(A|B|C|D) to (set|get)(Vertex(A|B|C|D))
+* Removed method fuzzylite::configuration()
+* Renamed MACRO FL_DEBUG to FL_DBG
+* Renamed MACRO (FL_BEGIN_DEBUG_BLOCK and FL_END_DEBUG_BLOCK) to (FL_DEBUG_BEGIN and FL_DEBUG_END)
+* Renamed methods in (Fis|Fcl)Importers::extract? to ::parse?
+* Made defaultResolution a static property of IntegralDefuzzifiers
+* Added method Engine::type(name, reason) to show type and reason why type
+* Added method Engine::clone()
+* Added support for Tsukamoto with Concave terms
+* Changed Accumulated to take Activated* terms instead of const Terms*
+* Deleted class Tsukamoto
+* Created class WeightedDefuzzifier from which Weighted(Average|Sum) derive with options: Automatic|TakagiSugeno|Tsukamoto
+* Added methods WeightedDefuzzifier::tsukamoto() and ::inferType()
+* Added benchmarks for fuzzylite in Linux
+* Created the FuzzyLite Interactive Console
+* Added basic rule chaining such that Output Variables can be utilized as antecedents
+* Added two examples for rule chaining: mamdani/Laundry.fll and mamdani/SimpleDimmerInverse.fll
+* Added Term::(get|set)Height and changed all terms accordingly
+* Renamed method Op::makeValidId to Op::validName, which now returns "unnamed" for empty strings.
+* Converted examples/original/*.fis to examples/original/*.fll
+* Removed Exception Specification from methods in Discrete, Linear and Function terms
+* Changed name of debug libraries to fuzzylited.dll and fuzzylite-staticd.lib
+* Removed method Operation::toScalar(std::string, bool, scalar)
+* Added method Operation::toScalar(std::string) [throws Exception], and ::toScalar(std::string, scalar alternative) throw()
+* Added method ImEx::(from|to)File to import and export engines using files
+* WeightedAverage and WeightedSum without Activation operators have default behaviour, i.e., AlgebraicProduct
+* FactoryManager utilizes smart pointers.
+* Rule utilizes smart pointers for Antecedent and Consequent
+* Exceptions are thrown when Conjunction, Disjunction, Activation and Accumulation operators are NULL when they are required
+* Exception is thrown when Defuzzifier is required and not set.
+* Added support for C++11 utilizing smart pointers, identifiers (override, noexcept), and delete identifiers to DISABLE_COPY(Class)
+* Macros for identifiers are FL_IOVERRIDE, FL_IFINAL, FL_IDEFAULT, FL_IDELETE, and FL_INOEXCEPT (fl/fuzzylite.h)
+* Added macro FL_unique_ptr to refer to std::auto_ptr (C++98) or std::unique_ptr (C++11), and its respective FL_move_ptr(x) to move a smart pointer.
+* Added constant fl::null to refer to 0L (C++98) or nullptr (C++11)
+* Added macros FL_DEFAULT_COPY(Class), FL_DEFAULT_MOVE(Class), and FL_DEFAULT_COPY_AND_MOVE(Class) for default copy and move constructors and operators
+* Added build.sh to build fuzzylite
+* Changed default to fuzzylite::_macheps = 1e-6;
+* Renamed macro FL_EXPORTS to FL_API
+* Added macro FL_SHARED_LIBRARY and FL_STATIC_LIBRARY to be defined when building shared and static libraries
+
+
+Version 4.0
+* FuzzyRule merged with Rule, and FuzzyRule deleted.
+* FuzzyAntecedent merged with Antecedent, and FuzzyAntecedent deleted
+* FuzzyConsequent merged with Consequent, and FuzzyConsequent deleted
+* FuzzyExpression renamed Expression
+* Renamed Rule::get/setUnparsedRule to get/setText
+* Renamed RuleBlock::get/set(Tnorm|Snorm) to get/set(Conjunction|Disjunction)
+* Renamed RuleBlock::fireRules to activate
+* Renamed Rule::fireStrength to activationDegree, fire to activate
+* Renamed Consequent::fire to modify
+* Created IntegralDefuzzifier to extract divisions from Defuzzifier
+* Renamed divisions from IntegralDefuzzifier to resolution, FL_DIVISIONS to FL_RESOLUTION
+* Deleted MaximumDefuzzifier
+* Centroid, Bisector, and Largest/Smallest/Mean Defuzzifiers inherit from IntegralDefuzzifier
+* Changed names of arithmetic operations in fl::Operation
+* Renamed Function::get/set(Infix) to get/set(Formula)
+* Renamed InputVariable::get/set(Input) to get/set(InputValue)
+* Renamed Antecedent::firingStrength to activationDegree
+* Renamed Antecedent::toString/(Prefix,Infix,Postfix) to to/(Prefix,Infix,Postfix)
+* Renamed Rule::FL_ASSIGN to Rule::FL_EQUALS
+* New method restart in Engine
+* New methods Engine::setInputValue(name, value), scalar Engine::getOutputValue(name)
+* Renamed Op::str(vector/varargs) to Op::join(vector/varargs)
+* Refactored associtativity, unary and binary properties in Element within Function
+* Removed unnecessary Hedges creation upon importing engines, now is automatic via Factories
+* Created the JavaExporter
+* Renamed methods within Fis/Fcl/CppExporter to toString(*);
+* Extracted TNorms and SNorms from TNorm.h/cpp and SNorm.h/cpp
+* Created proper Factories with registration of classes and constructors
+* Renamed method Factory::create to Factory::createInstance
+* Added static constructor method to every Defuzzifier, Hedge, TNorm, and SNorm
+* Removed FL_PRECISION, FL_DECIMALS as Macros, and created static variables in fuzzylite.h
+* Renamed FL_PRECISION to macheps, i.e., machine epsilon to differentiate real numbers
+* Removed FL_DEBUG and created a static variable in fuzzylite.h
+* Removed FL_NO_LOG as it is now controlled with fuzzylite::logging(), previously named logEnabled()
+* Libraries and Console application are both built in folder bin/ (previously libraries were at lib/)
+* Removed Engine::toStringFis/Fcl/Cpp to encourage use of Fcl/Fis/CppExporters instead
+* Renamed Op::logical_and to Op::logicalAnd, Op::logical_or to Op::logicalOr
+* Added support to Fis/FclImporters to treat comments (%,#,//,/*) in fis and fcl files
+* Created the Console application instead of previous demo
+* Added Variable::range() to return (maximum - minimum)
+* Removed Variable::isEmpty, use Variable::terms().empty()
+* Removed RuleBlock::isEmpty, use RuleBlock::rules().empty()
+* Created method Op::makeValidId to ensure names are valid
+* Engine, Variable and Term::toString return FllExport::toString
+* Created Term::parameters to return list of parameter values as string separated by spaces
+* Created Term::configure to configure from Term::parameters
+* FclImEx import and export terms using Term::parameters
+* Created the FuzzyLite Language in FllImporter and FllExporter
+* Created the FuzzyLite Dataset FldExporter
+* Added property Enable to Engine, Variable and RuleBlock
+* Extended FCL and FIS to consider Enabled properties
+* Changed Engine::defuzzify() to consider enabled variables
+* Changed Engine::process() to consider enabled rule blocks
+* Changed OutputVariable::output() to OutputVariable::fuzzyOutput()
+* Renamed Rectangle::minimum/maximum to Rectangle::start/end
+* Renamed fuzzylite::shortVersion to fuzzylite::version
+* Improved accuracy of Triangle and Trapezoid
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..856303e
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,32 @@
+INSTALL
+=======
+
+(1) Make sure you uninstall previous versions of fuzzylite from your computer.
+
+(2) The following building script is available in folder `fuzzylite/fuzzylite/`:
+```
+#In Windows,
+> build.bat help
+Usage: build.bat [options]
+where [options] can be any of the following:
+ all builds fuzzylite in debug and release mode (default)
+ debug builds fuzzylite in debug mode
+ release builds fuzzylite in release mode
+ clean erases previous builds
+ help shows this information
+
+#In Unix, from fuzzylite/fuzzylite
+$ ./build.sh help
+Usage: [bash] ./build.sh [options]
+where [options] can be any of the following:
+ all builds fuzzylite in debug and release mode (default)
+ debug builds fuzzylite in debug mode
+ release builds fuzzylite in release mode
+ clean erases previous builds
+ help shows this information
+```
+
+(3) After executing the script, the binaries will be built and stored in sub-folders `release/bin` and `debug/bin`
+
+
+For more advanced building options, please check the contents of `fuzzylite/fuzzylite/build.[bat|sh]` and the contents of `fuzzylite/fuzzylite/CMakeLists.txt`.
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..65c5ca8
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..daa131e
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,317 @@
+Extracted from [README.md](/README.md)
+================================================
+
+
+### <a name="features">Features</a>
+
+**Controllers** *Types* (5) Mamdani, Takagi-Sugeno, Larsen, Tsukamoto, Inverse Tsukamoto
+
+**Linguistic terms** *Basic* (4) triangle, trapezoid, rectangle, discrete. *Extended* (9) bell, cosine, gaussian, gaussian product, pi-shape, sigmoid difference, sigmoid product, spike. *Edges* (4) concave, ramp, sigmoid, s-shape, z-shape. *Functions* (3) constant, linear, function.
+
+**Conjunction and Activation** *T-Norm* (7) minimum, algebraic product, bounded difference, drastic product, einstein product, hamacher product, nilpotent minimum.
+
+**Disjunction and Accumulation** *S-Norm* (8) maximum, algebraic sum, bounded sum, normalized sum, drastic sum, einstein sum, hamacher sum, nilpotent maximum.
+
+**Defuzzifiers** *Integral* (5) centroid, bisector, smallest of maximum, largest of maximum, mean of maximum, *Weighted* (2) weighted average, weighted sum.
+
+**Hedges** *Types* (6) any, not, extremely, seldom, somewhat, very.
+
+**Import** *Types* (3) FuzzyLite Language `fll`, Fuzzy Inference System `fis`, Fuzzy Control Language `fcl`.
+
+**Export** *Types* (6) `C++`, `Java`, FuzzyLite Language `fll`, FuzzyLite Dataset `fld`, Fuzzy Inference System `fis`, Fuzzy Control Language `fcl`.
+
+**Examples** (30+) of Mamdani, Takagi-Sugeno and Tsukamoto controllers from `fuzzylite`, Octave and Matlab, each included in the following formats: `C++`, `Java`, `fll`, `fld`, `fis`, and `fcl`.
+
+***
+
+### <a name="example">Example</a>
+
+```cpp
+#include "fl/Headers.h"
+
+int main(int argc, char* argv[]){
+ using namespace fl;
+ Engine* engine = new Engine("simple-dimmer");
+
+ InputVariable* ambient = new InputVariable;
+ ambient->setName("Ambient");
+ ambient->setRange(0.000, 1.000);
+ ambient->addTerm(new Triangle("DARK", 0.000, 0.500));
+ ambient->addTerm(new Triangle("MEDIUM", 0.250, 0.750));
+ ambient->addTerm(new Triangle("BRIGHT", 0.500, 1.000));
+ engine->addInputVariable(ambient);
+
+ OutputVariable* power = new OutputVariable;
+ power->setName("Power");
+ power->setRange(0.000, 2.000);
+ power->setDefaultValue(fl::nan);
+ power->addTerm(new Triangle("LOW", 0.000, 1.000));
+ power->addTerm(new Triangle("MEDIUM", 0.500, 1.500));
+ power->addTerm(new Triangle("HIGH", 1.000, 2.000));
+ engine->addOutputVariable(power);
+
+ RuleBlock* ruleblock = new RuleBlock;
+ ruleblock->addRule(Rule::parse("if Ambient is DARK then Power is HIGH", engine));
+ ruleblock->addRule(Rule::parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
+ ruleblock->addRule(Rule::parse("if Ambient is BRIGHT then Power is LOW", engine));
+ engine->addRuleBlock(ruleblock);
+
+ engine->configure("", "", "Minimum", "Maximum", "Centroid");
+
+ std::string status;
+ if (not engine->isReady(&status))
+ throw Exception("Engine not ready. "
+ "The following errors were encountered:\n" + status, FL_AT);
+
+ for (int i = 0; i < 50; ++i){
+ scalar light = ambient->getMinimum() + i * (ambient->range() / 50);
+ ambient->setInputValue(light);
+ engine->process();
+ FL_LOG("Ambient.input = " << Op::str(light) << " -> " <<
+ "Power.output = " << Op::str(power->getOutputValue()));
+ }
+}
+```
+
+***
+
+### <a name="whatsnew">What's New?</a>
+The entire `fuzzylite` library has been thoroughly revised, refactored, validated, and significantly improved. The following sections detail the changes and enhancements of version 5.0. Users of previous versions are **strongly** encouraged to carefully read the list before migrating to version 5.0. Important changes and enhancements are marked as **(important)**, **(VERY important)** and **(EXTREMELY important)**.
+
+#### <a name="new-general">General</a>
++ **(important)** `fuzzylite v5.0` is dual-licensed under the [GNU LGPL v3.0](https://www.gnu.org/licenses/lgpl.html) and a paid commercial license.
++ Support for both `C++98` and `C++11` using the latest features.
++ Support for multiple compilers `g++`, `Clang`, `MSVC`.
++ Refactoring of many classes to improve design and performance.
++ **(important)** Performance improvements of Takagi-Sugeno controllers by over 55% with respect to v4.0 (estimate based on the average performance on the examples included).
++ Smart pointers in many classes take care of automatically deleting objects when setting new pointers (`Accumulated`, `FactoryManager`, `Function`, `OutputVariable`, `Rule`, and `RuleBlock`).
+* **(important)** Exceptions are thrown when any of the following `RuleBlock::[conjunction|disjunction|activation]`, `Accumulated::accumulation`, and `OutputVariable::defuzzifier` are required but set to `fl::null`, thereby replacing the operations that would lead to `[signal 11] Segmentation fault` to operations that throw a `fl::Exception` instead.
++ Automatic build script to build `fuzzylite` in `debug` and `release` mode.
++ Binaries of debug libraries are renamed to append the letter `d` (e.g.,`fuzzylited.dll`, `libfuzzylited.so`).
++ **(important)** New file [`fuzzylite/src/m/compare.m`](/fuzzylite/src/m/compare.m) <!---check link--> to compare the output values of your `fuzzylite` engines with the evaluation of the same engine in Octave/Matlab.
++ **(important)** There is practically no difference between the output values obtained with `fuzzylite` and those obtained with Octave/Matlab. Based on the examples, the average mean square error (MSE) between the output values is less than `7.3e-12` (or `0.0000000000073`) due to negligible differences in floating-point arithmetic. The results and comparison can be found in [`examples/examples.mat`](/examples/examples.mat) <!---check link-->.
++ **(important)** Source code of applications based on version 4.0 will most likely not compile with version 5.0.
++ Minor bugs and memory leaks fixed.
+
+####<a name="new-macros">Macros</a>
+* **(important)** Added support for `C++11` with smart pointers, method identifiers, move constructors and move operators as follows. For precise information, refer to file [`fuzzylite/fl/fuzzylite.h`](/fuzzylite/fl/fuzzylite.h). <!---check link-->
+* **(important)** Macros for identifiers are defined as `FL_IOVERRIDE override`, `FL_IFINAL final`, `FL_IDEFAULT = default`, `FL_IDELETE = delete`, `FL_INOEXCEPT noexcept`, `FL_DEFAULT_COPY(Class)`, `FL_DEFAULT_MOVE(Class)`, and `FL_DEFAULT_COPY_AND_MOVE(Class)`.
+* **(important)** Added macro `FL_unique_ptr` to refer to `std::auto_ptr` (`C++98`) or `std::unique_ptr` (`C++11`), and its respective `FL_move_ptr(x)` to move a smart pointer, albeit `FL_move_ptr(x)` is not used within the library as it is not needed.
+* **(important)** Added global variables `const long fl::null = 0L` to refer to the null pointer in `C++98` and `const std::nullptr_t null = nullptr` to refer to the null pointer in `C++11`.
+* **(important)** Renamed macro `FL_DEBUG` to `FL_DBG`.
+* **(important)** Renamed macros `FL_BEGIN_DEBUG_BLOCK` and `FL_END_DEBUG_BLOCK` to `FL_DEBUG_BEGIN` and `FL_DEBUG_END`, respectively.
+* **(important)** Renamed macro `FL_EXPORT` to `FL_API`
+* **(EXTREMELY important)** Added macro definitions `FL_EXPORT_LIBRARY` and `FL_IMPORT_LIBRARY`. If you are building `fuzzylite` as a **shared library**, you need to define `FL_EXPORT_LIBRARY`. If you are building `fuzzylite` **executable** *and* it utilizes the `fuzzylite` **shared library**, you need to define `FL_IMPORT_LIBRARY`. If you are building `fuzzylite` as a **static library** and/or building `fuzzylite` **executable** using the `fuzzylite` **static library**, then you do not need to define either `FL_[IMPORT|EXPORT]_LIBRARY`. Note that the same conditions apply for your application. This is particularly important in Windows platforms, as `FL_IMPORT_LIBRARY` and `FL_EXPORT_LIBRARY` define `FL_API` to `__declspec(dllimport)` and `__declspec(dllexport)`, respectively. If in doubt, please check [`fuzzylite/CMakeLists.txt`](/fuzzylite/CMakeLists.txt)<!---check link-->
+
+#### <a name="new-operation">Operation</a>
+* **(important)** Added method `Operation::toScalar(std::string x, scalar alternative) FL_INOEXCEPT` which returns `alternative` if `x` is not a valid `scalar`, and never throws an exception.
+* **(important)** Added method `Operation::toScalar(std::string x)` that returns the scalar value of `x` or throws a `fl::Exception` if `x` is not a valid `scalar`.
+* **(VERY important)** Marked method (from v4.0) `Operation::toScalar(std::string, bool, scalar) FL_IDELETE;` and removed its implementation such that its usage is prevented at compile time in `C++11` and at linker time in `C++98`. Please, use the appropriate `Op::toScalar` methods mentioned above.
++ Renamed method `Op::isNan` to `Op::isNaN`.
+* Added method `fl::Op::isFinite(x)` which returns `not (isNaN(x) or isInf(x))`.
+* Changed `fl::Op::isEq(a,b)` to return `true` if `a == b == NaN`.
+* Changed `fl::Op::isEq(a,b)` to return `true` if `a == b == Inf`.
+* Changes to `fl::Op::isEq` affect other comparison methods `fl::Op::is[Lt|LEq|GEq|Gt]`.
+* Added shortcuts of comparisons `fl::Op::[gt,lt,ge,le,eq,neq](scalar a, scalar b)`, mostly to provide binary versions (without `macheps`) for term `Function`.
+* Deleted method `Op::repeat`.
+* Removed method `fuzzylite::configuration()`.
+* Changed default `fuzzylite::_macheps = 1e-6;`.
+* Renamed method `Op::makeValidId` to `Op::validName`, which now returns `"unnamed"` for empty strings.
+
+
+
+####<a name="new-engine">Engine</a>
+* **(VERY important)** Moved `Engine::hedges` (and relevant methods) to `Rule::hedges`.
+* Added enumeration for the type of engine: `enum Engine::Type{Mamdani, Larsen, TakagiSugeno, Tsukamoto, InverseTsukamoto, Hybrid, Unknown}`.
+* Added method `Type Engine::type(std::string* name, std::string* reason)` to infer the type of the engine based on its configuration, additionally provides the name of the type and the inference reasons for its type.
+* **(important)** Changed method `Engine::isReady(std::string)` to satisfy the default operation of controllers. The method `Engine::isReady(std::string)` was initially conceived to provide information before a potential `[signal 11] Segmentation fault` happened due to improper configuration. However, given the improved handling of signals and exceptions mentioned in Section [General](#new-general), using method `Engine::isReady(std::string)` is not necessary except for providing suggestions of what could potentially cause an error.
+* Added methods `Engine::set[Input|Output]Variables(std::vector)` and `Engine::setRuleBlocks(std::vector)`.
+* Added methods `Engine::[input|output]Variables()` and `Engine::ruleBlocks()` to return mutable references.
+* Added method `Engine::variables()` to retrieve a vector (copy) containing the `InputVariables` followed by the `OutputVariables`.
+* Added method `Engine::updateReferences()` to update the references to the engine in all the necessary linguistic terms (i.e., `Linear` and `Function`).
+* Added method `Engine::clone()`.
+* Added copy constructors, assignment operators, and default move constructor to `Engine`.
+
+
+
+####<a name="new-inoutvars">Input Variables and Output Variables</a>
+* **(important)** Added methods `OutputVariable::[get|set]OutputValue()` to [retrieve|store] value from defuzzification
+* **(important)** Changed return type of `scalar OutputVariable::defuzzify()` to `void OutputVariable::defuzzify()` because now it automatically stores the defuzzified output value, and also stores the previous *valid* output value regardless of locks. Like in version 4.0, if `OutputVariable::lockPreviousOutputValue=true`, and the defuzzified output value is not valid (i.e., `[NaN|Inf]`) or no rules were activated, then the defuzzified output value is replaced for the previous valid output value.
+* Removed method `OutputVariable::defuzzifyNoLocks()`.
+* Renamed variable `OutputVariable::lastValidOutputValue` to `OutputVariable::previousOutputValue`.
+* **(important)** Renamed method `OutputVariable::[get|set]LastValidOutput()` to `OutputVariable::[get|set]PreviousOutputValue()`.
+* Renamed variable `OutputVariable::lockValidOutput` to `OutputVariable::lockPreviousOutputValue`.
+* **(important)** Renamed method `OutputVariable::setLockValidOutput()` to `OutputVariable::setLockPreviousOutputValue()`.
+* **(important)** Renamed method `OutputVariable::isLockingValidOutput()` to `OutputVariable::isLockedPreviousOutputValue()`.
+* Renamed variable `OutputVariable::lockOutputRange` to `OutputVariable::lockOutputValueInRange`.
+* **(important)** Renamed method `OutputVariable::setLockOutputRange()` to `OutputVariable::setLockOutputValueInRange()`.
+* **(important)** Renamed method `OutputVariable::isLockingOutputRange()` to `OutputVariable::isLockedOutputValueInRange()`.
+* Added methods `std::string InputVariable::fuzzyInputValue()` and `std::string OutputVariable::fuzzyOutputValue()`.
+* Added method `OutputVariable::clear()` to clear the fuzzy output, and set `OutputVariable::previousOutputValue = fl::nan` and set `OutputVariable::outputValue = fl::nan`.
+* Added copy constructors, assignment operators, move constructors and move operators to [Input|Output]Variable.
+* Added method `Variable::terms()` to return mutable reference.
+* **(important)** Changed `OutputVariable::[defuzzifier|fuzzyOutput]` to smart pointers (`FL_unique_ptr`).
+
+
+#### <a name="new-terms">Linguistic Terms</a>
+* **(VERY important)** Added Term::[get|set]Height to define the height of *integral* terms, and multiply their respective membership functions accordingly.
+* Added copy constructors, assignment operators, move constructors and move operators to every `Term`.
+* **(VERY important)** Parameters of all terms are set by default to `fl::nan`.
+* **(important)** Renamed method `Term::copy()` to `Term::clone()` in every `Term`.
+* Added method `Term::updateReference(Term*, Engine*)` to ensure `Linear` and `Function` terms have updated pointers to the `Engine` (useful when cloning and copy-constructing).
++ **(important)** Added linguistic terms `Concave`, `Cosine` and `Spike`.
+* **(important)** Changed `Accumulated` to take `Activated*` terms instead of `const Terms*`.
+* Removed `const` from return type of method `SNorm* Accumulated::[get|set]Accumulation()`.
+* Changed `Accumulated::accumulation` to a smart pointer (`FL_unique_ptr`).
+* Added method `Accumulated::terms()` to return mutable reference.
+* **(important)** Renamed methods `Triangle::[set|get][A|B|C]` to `::[set|get]Vertex[A|B|C]`.
+* **(important)** Renamed methods `Trapezoid::[set|get][A|B|C|D]` to `::[set|get]Vertex[A|B|C|D]`.
+* **(important)** Renamed term `Thresholded` to `Activated`.
+* **(important)** Renamed methods `Thresholded::[set|get]Threshold()` to `Activated::[set|get]Degree()`.
+* Added enumeration `[Ramp|Sigmoid]::Direction{ NEGATIVE, ZERO, POSITIVE }` to refer to the slope.
+* Added methods `Ramp::direction()` and `Sigmoid::direction()` to retrieve direction of slope.
+* Removed Exception Specification from methods in `Discrete`, `Linear` and `Function` terms.
+
+#### <a name="new-linear-discrete">Linear and Discrete Terms</a>
+* **(important)** Changed `Linear` from having pointers to the input variables to having a pointer to the `Engine`.
+* Changed visibility of `Linear::coefficients` to `protected`.
+* **(important)** Added methods `Linear::coefficients()`, `Linear::setCoefficients()`.
+* `Linear` term no longer throws exception when `inputVariables != |coefficients|`.
+* **(important)** Removed public vector of variables `Discrete::[x|y]`.
+* **(important)** Added a `typedef std::pair<scalar, scalar> Discrete::Pair`.
+* **(important)** Changed representation of `Discrete::[x|y]` from `std::vector<scalar>` to `std::vector<Discrete::Pair>`.
+* Added methods `Discrete::setXY()` and `Discrete::xy()` to set and get the new representation of pairs.
+* Added methods `Discrete::xy(int index)` to retrieve `Discrete::Pair` at `index`.
+* **(important)** Added methods `Discrete::toPairs(std::vector<scalar>)` which throws an exception if the vector is missing a value (i.e., `std::vector<scalar>.size() % 2 != 0`), and `Discrete::toPairs(std::vector<scalar>, scalar missingValue)` which adds `missingValue` in case `std::vector<scalar>.size() %2 == 1`, hence never throwing an exception.
+* Added method `Discrete::toVector(std::vector<Discrete::Pair>)` to convert `std::vector<Discrete::Pair>` to a `std::vector<scalar>`.
+* Added method `Discrete::formatXY()` to get pairs `(x,y)` nicely formatted.
+
+####<a name="new-function">Function Term</a>
+* **(important)** Merged structs `Function::Operator` and `Function::BuiltInFunction` into a single `struct Function::Element`.
+* **(EXTREMELY important)** Changed the precedence of all built-in instances of `Function::Element` of type `Operator` starting from `100` and decreasing by `10`. The precedence of built-in operators is the following: `(100)` Logical not `[!]` and Negation `[~]`; `(90)` Power `[^]`; `(80)` Multiplication `[*]`, Division `[/]` and Modulo `[%]`; `(70)` Addition `[+]` and Subtraction `[-]`; `(60)` Logical AND `[and]` and Logical OR `[or]`. If you have registered your own operators, please adjust their precedence as required.
+* Added to `Function` built-in comparison functions `gt,lt,ge,le,eq` and operator logical not `!`.
+* Modified typedefs `Function::Unary` and `Function::Binary` to take `scalar` instead of `double`.
+* Changed `public Function::root` to `protected Function::_root` and it is now a smart pointer (`FL_unique_ptr`).
+* Added method `Function::root()` to return pointer to `Function::root`.
+* **(EXTREMELY important)** Moved built-in functions and operators from `Function` to a `FunctionFactory`.
+
+
+#### <a name="new-norms-hedges">[T|S]Norms and Hedges</a>
++ **(important)** Fixed operation when using multiple hedges to operate from right-most to left-most, e.g. `if Ambient is not very extremely bright`, now evaluates as follows `not(very(extremely(bright)))`.
++ Added `TNorm` nilpotent minimum and `SNorm` nilpotent maximum.
+* Added clone methods to every `Norm`.
+* Added clone methods to every `Hedge`.
+* **(VERY important)** Moved `Engine::hedges` to `Rule::hedges`.
+
+
+#### <a name="new-rules">Rules</a>
+* **(VERY important)** Moved `Engine::hedges` (and methods) to `Rule::hedges`.
+* Added method `Rule::isLoaded()` to determine whether a rule was properly parsed and thus can be activated.
+* Added method `Rule::unload()` to allow the existence of a rule in an inactive state (useful for invalid rules).
+* **(important)** Removed variable `Rule::FL_ASSIGNS` and method `Rule::assignsKeyword()`, for which the symbol `=` in rules is no longer valid.
+* Changed visibility of method `Rule::setText()` to `public`.
+* Added method `Rule::load(const Engine*)`.
+* Changed `Rule::[antecedent|consequent]` to smart pointers (`FL_unique_ptr`).
+* **(important)** Renamed method `Antecedent::[get|set]Root()` to `Antecedent::[get|set]Expression()`.
+* Added methods `[Antecedent|Consequent]::[get|set]Text()`.
+* **(important)** Added methods `[Antecedent|Consequent]::[load|unload]()`, with the same objective as `Rule::[load|unload]()`.
+
+#### <a name="new-ruleblocks">Rule Blocks</a>
+* Added method `RuleBlock::reloadRules()`.
+* Added method `RuleBlock::setRules(std::vector)`.
+* Added method `RuleBlock::rules()` to return mutable reference.
+* Removed `const` from `TNorm` and `SNorm` in `RuleBlock::[get|set][Conjunction|Disjunction|Activation]()`, respectively.
+* Changed `RuleBlock::[conjunction|disjunction|activation]` to smart pointers (`FL_unique_ptr`).
+* **(VERY important)** Added basic rule chaining such that an `OutputVariable` can be utilized in the `Antecedent` of a `Rule`. For example, considering the rule `if Power is high then InversePower is low`, where `Power` and `InversePower` are both output variables, the activation degree of the `Antecedent` will correspond to the accumulated activation degree of the term `high` in the fuzzy output of `Power`. If `Power::accumulation = none`, the accumulated activation degree of the term `high` will be computed as the regular sum of the activation degrees of term `high` in the fuzzy output of `Power`. Otherwise, the accumulated activation degree is computed utilizing the `Power::accumulation` operator.
+
+
+#### <a name="new-weighted">Weighted Defuzzifiers</a>
++ **(VERY important)** Performance improvements of Takagi-Sugeno controllers by over 55% (with respect to v4.0) based on the average performance on the examples included.
+* **(important)** Created class `WeightedDefuzzifier` from which classes `Weighted[Average|Sum]` are derived.
+* **(important)** Added enumeration `WeightedDefuzzifier::Type{Automatic, TakagiSugeno, Tsukamoto}` and respective methods `WeightedDefuzzifier::[get|set]Type()` and `WeightedDefuzzifer::getTypeName()`.
+* Added method `WeightedDefuzzifier::inferType(Term*)` to automatically determine the `WeightedDefuzzifier::Type` based on the class of `Term`.
+* **(important)** By default, `WeightedDefuzzifier::type = Automatic`, which automatically infers the type based on the `WeightedDefuzzifier::inferType()`.
+* **(important)** There is a small performance penalty when using `WeightedDefuzzifier::type = Automatic` because `WeightedDefuzzifier::inferType()` performs three `dynamic_cast<>`.
+* **(important)** Deleted class `Tsukamoto`. Its method `static tsukamoto()` was moved to `virtual WeightedDefuzzifier::tsukamoto()`, which allows overriding it
+* Added support for `Tsukamoto` with `Concave` terms.
++ **(EXTREMELY important)** In version 5.0, the traditional operation of Takagi-Sugeno and Tsukamoto controllers is achieved by setting `OutputVariable::accumulation = none`. Unlike version 4.0, the `RuleBlock::activation` will not have any effect on Takagi-Sugeno nor Tsukamoto controllers, for which `RuleBlock::activation` should also be set to `none`. More information about the roles of the `OutputVariable::accumulation` and `RuleBlock::activation` operators are detailed as follows. Refer to [sciweavers](http://www.sciweavers.org/free-online-latex-equation-editor) to convert LaTeX equations.
++ **(VERY important)** In version 5.0, the role of the `RuleBlock::activation` `TNorm` on the `Weighted[Average|Sum]` always performs a regular multiplication of the weights and the values (i.e., $w_i \times z_j$) regardless of the `TNorm` chosen. In other words, selecting any `RuleBlock::activation` for `Weighted[Average|Sum]` is irrelevant, and should be set to `none` as every `TNorm` will have the same multiplication effect. This operation is different from `fuzzylite` version 4.0, where the `RuleBlock::activation` operator was utilized to multiply the weights and values (i.e. $w_i \otimes z_j$), and therefore the traditional operation of the `Weighted[Average|Sum]` was achieved when `RuleBlock::activation = AlgebraicProduct;`.
++ **(VERY important)** In version 5.0, the role of the `OutputVariable::accumulation = none` on the `Weighted[Average|Sum]` results in a regular sum of the multiplied weights and values, i.e., $\dfrac{\sum_i^n w_i \times z_j}{\sum_i^n w_i}$. However, if the `OutputVariable::accumulation != none`, the role of the `SNorm` will be to accumulate the activation degrees of the *repeated* terms in the fuzzy output of the variable. For example, considering the rules `if Ambient is dark then Power is high` and `if Ambient is medium then Power is high`, for any input value of `Ambient` that activates both rules, the fuzzy output of `Power` will have the term `high` activated with the degree from `Rule 1`, and the term `high` activated with the degree from `Rule 2`. Since the term `high` appears twice in the fuzzy output, the role of the accumulation operator will be to accumulate the activation degree of `high` resulting in $\dfrac{(w_1 \oplus w_2) \times z_{high}}{(w_1 \oplus w_2)}$. If another term were activated, the result would be $\dfrac{(w_1 \oplus w_2) \times z_{high} + w_i \times z_j}{(w_1 \oplus w_2) + w_i}$. In version 4.0, the accumulation operator had no effect on the `Weighted[Average|Sum]`.
+
+
+
+#### <a name="new-integral">Integral Defuzzifiers</a>
+* **(important)** Proper handling of indefinite integral defuzzification, that is, returning `fl::nan` when `[minimum|maximum]=[NaN|Inf]`.
+* Default resolution of integration is defined as `static int IntegralDefuzzifier::defaultResolution=200`, and can be changed via `static IntegralDefuzzifier::setDefaultResolution()`.
++ **(important)** In `fuzzylite`, the accumulation operator has been for several versions associated with the output variables and **not** with the rule blocks, despite that the FCL format and other fuzzy logic control libraries associate the accumulation operator with the rule blocks. The argument for such a decision is that `fuzzylite` provides **coherent** support for multiple rule blocks operating on the same engine and on the same output variables. For example, if multiple rule blocks operate on the same output variables, it only makes sense to have a single accumulation operator associated with each output variable such that the defuzzifier can naturally operate over the accumulated fuzzy output. Differently, if the accumulation operator were associated with the rule block, the possibility of having different accumulation operators in different rule blocks questions (1) **the possibility of having multiple rule blocks operating over the same output variables**; and (2) **the usage of different accumulation operators over the accumulation and defuzzification processes**. Certainly, if (1) is not possible, i.e, different rule blocks only operate on different output variables, then (2) is not a problem because the accumulation process and defuzzification of each variable will only have a single accumulation operator. It is therefore that the association of the accumulation operator with the output variable in `fuzzylite` provides a **better design** and an additional feature that allows having multiple rule blocks operating over the same output variables.
+* Added copy constructors, assignment operators, move constructors and move operators.
+* Added method `Defuzzifier::clone()`.
+
+####<a name="new-imex">Importers and Exporters</a>
+* **(EXTREMELY important)** Since terms have a new `height` property, `[Fll|Fis|Fcl]Exporter` exports terms with an additional `scalar` at the end, which indicates the `height` of the term. However, if `height=1.0`, the additional scalar is not exported.
+* **(EXTREMELY important)** In `[Fll|Fis|Fcl]Importer`, when importing terms, if there is an additional `scalar` it will be assumed as the `height` of the term. For example, `term: high Gaussian 1.0 0.5 0.75` will create a `Gaussian` term with mean `1.0`, standard deviation `0.5` and height `0.75`. This is **extremely important** because there are some examples from Matlab in `fis` format that append a useless `0.0` to some terms.
+* **(EXTREMELY important)** In `FisExporter`, if the Takagi-Sugeno controller has no `activation` or `accumulation` operators (as it should generally be the case), Octave and Matlab will not be able to import the `fis` file. To overcome this issue, you will have to set `ImpMethod="min"` and `AggMethod="max"`, where `ImpMethod` and `AggMethod` are just dummy operators that can be set to any `TNorm` and `SNorm`, respectively.
++ **(important)** Improved compatibility of the exported code obtained with `[Fis|Fcl]Exporter` by exporting the additional features of `fuzzylite` only when these are different from the default operation. For example, the following features will not be exported given their values: `[Input|Output]Variable::enabled = true;`, `OutputVariable::lock-previous = false;`, `OutputVariable::lock-range = false;`, amongst others.
+* **(important)** Renamed FLL property `'lock-valid'` to `'lock-previous'`.
+* **(important)** Renamed FIS property `'LockValid'` to `'LockPrevious'`.
+* **(important)** Renamed FCL property `'LOCK: VALID'` to `'LOCK: PREVIOUS'`.
++ **(important)** Export your controllers to files using `[Fll|Fld|Fis|Fcl]Exporter::toFile()`.
++ **(important)** Import your controllers from files using `[Fll|Fis|Fcl]Importer::fromFile()`.
++ **(important)** `FldExporter` exports the FuzzyLite Dataset of an engine utilizing the input values of another FuzzyLite Dataset.
+* `FldExporter` no longer restarts the engine when exporting.
+* **(important)** Renamed method `FldExporter::toWriter()` to `FldExporter::write()`.
+* Removed variable and methods for property `int FldExporter::_maximum`.
+* Added option in `CppExporter` to prepend the namespace prefix `fl::` to the classes, and by default it does not prepend prefix.
+* Improvement accuracy of `FisImporter` when importing `fis` files whose scalar values have more than three decimal numbers.
+* Renamed methods in `[Fis|Fcl]Importer::extract*` to `[Fis|Fcl]Importer::parse*`.
+
+
+
+#### <a name="new-factories">Factories</a>
+* Created a generic `CloningFactory<T>` to create clones of objects.
+* **(important)** Created `FunctionFactory` based on `CloningFactory<Function::Element>` where function operators and methods are stored to be cloned as necessary by `Function`. Additional functions and operators can be easily registered.
+* **(VERY important)** Moved built-in functions and operators from `Function` to `FunctionFactory`.
+* Renamed methods `Factory<T>::[register|deregister]Class()` to `Factory<T>::[register|deregister]Constructor()`.
+* **(important)** Renamed `Factory<T>` to `ConstructionFactory<T>`.
+* Renamed `typedef Factory::Creator` to `typedef Factory::Constructor`.
+* Changed pointers of `FactoryManager` to smart pointers (`FL_unique_ptr`).
+
+
+
+#### <a name="new-examples">Examples</a>
+* **(important)** Added two examples for basic rule chaining: `mamdani/SimpleDimmerInverse.fll` and `mamdani/Laundry.fll`.
+* Included the `original` example files in `fis` format.
+* Added conversion of `examples/original/*.fis` to `examples/original/*.fll`.
+* Modified `original/takagi-sugeno` examples to reflect `activation: none; accumulation: none;`.
+* Updated FLD examples produced from the `original` examples.
++ **(important)** Added file [`fuzzylite/src/m/compare.m`](/fuzzylite/src/m/compare.m) <!---check link--> to compare the output values of your `fuzzylite` engines with the evaluation of the same engine in Octave/Matlab.
++ **(important)** Added file [`examples/examples.mat`](/examples/examples.mat) <!---check link--> containing the comparison of the output values between `fuzzylite` and Matlab's Fuzzy Logic Toolbox.
+* Added code to perform benchmarks in Linux.
+
+
+#### <a name="new-console">Console</a>
+* **(important)** Console includes option to import custom input dataset from file an export its respective output values.
+* **(important)** Created the FuzzyLite Interactive Console, which can be started by specifying an input file and the output format, e.g., `fuzzylite -i SimpleDimmer.fll -of fld`.
+* Console provides more information about its usage.
+
+
+
+####<a name="new-fixes"> Fixes Bugs and Leaks</a>
++ **(important)** Fixed operation when using multiple hedges to operate from right-most to left-most, e.g. `if Ambient is not very extremely bright` evaluates as follows `not(very(extremely(bright)))`.
+* **(important)** Fixed membership functions of specific cases of `Triangle` when `a=b` or `b=c`, and `Trapezoid` when `a=b` or `c=d`.
+* Fixed minor memory leak at `~RuleBlock::[conjunction|disjunction|activation]`.
+* Fixed minor memory leak at `~Accumulated::accumulation`.
+* Fixed minor memory leak at `~OutputVariable::defuzzifier`.
+* Fixed minor memory leak at `~Function::Node`.
+* Fixed minor memory leak at `~FactoryManager::[factories]`.
+* Fixed some rethrowing of exceptions to provide proper information about errors. Specifically, changed some rethrown exceptions from `throw ex;` to just `throw;`
+* Fixed building using `-DFL_USE_FLOAT=ON`
+
+
+***
+
+For more information, visit [www.fuzzylite.com](http://www.fuzzylite.com).
+
+fuzzylite&trade; is a trademark of FuzzyLite Limited.
+
+Copyright &#xa9; 2010-2014 FuzzyLite Limited. All rights reserved. \ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..21c873a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,455 @@
+fuzzylite &reg; [![Build Status](https://travis-ci.org/fuzzylite/fuzzylite.svg?branch=v5.x)](https://travis-ci.org/fuzzylite/fuzzylite) <img src="https://github.com/fuzzylite/fuzzylite/raw/v5.x/fuzzylite.png" align="right" alt="fuzzylite">
+===========
+
+A Fuzzy Logic Control Library in C++
+------------------------------------
+
+By: [Juan Rada-Vilela](http://www.fuzzylite.com/jcrada), Ph.D.
+
+
+
+***
+
+
+### Table of Contents
+[License](#license) &nbsp;
+[Introduction](#introduction) &nbsp;
+[Features](#features) &nbsp;
+[Example](#example) &nbsp;
+[Bulding from source](#building) &nbsp;
+[Binaries](#binaries) &nbsp;
+[What's next](#whatsnext) &nbsp;
+[What's new](#whatsnew) : [General](#new-general), [Macros](#new-macros), [Operation](#new-operation), [Engine](#new-engine), [Input Variables and Output Variables](#new-inoutvars), [Linguistic Terms](#new-terms), [Linear and Discrete Terms](#new-linear-discrete), [Function Term](#new-function), [[T|S]Norms and Hedges](#new-norms-hedges), [Rules](#new-rules), [Rule Blocks](#new-ruleblocks), [Weighted Defuzzifiers](#new-weighted), [Integral Defuzzifiers](#new-integral), [Importers and Exporters](#new-imex), [Examples](#new-examples), [Console](#new-console), [Fixed Bugs and Leaks](#new-fixes)
+
+
+### <a name="license">License</a>
+`fuzzylite` will **always** be free and open source. However, `fuzzylite` is **no** longer released under the Apache License. Since version 5.0, `fuzzylite` is **dual-licensed** under the [**GNU Lesser General Public License (LGPL) v3.0**](https://www.gnu.org/licenses/lgpl.html) and a **paid commercial license**.
+
+
+In brief, an important restriction the LGPL imposes on your closed-source application is that **you are no longer allowed to statically link** against `fuzzylite`. If your application requires static linking, **you will need to purchase a commercial license** from FuzzyLite Limited. Please, contact [sales@fuzzylite.com](mailto:sales@fuzzylite.com) for commercial licenses, and refer to the [GNU LGPL](https://www.gnu.org/licenses/lgpl.html) for further information on your rights.
+
+The change of license is an attempt to raise funds in order to be able to work part-time in the development of the `fuzzylite` family of products, namely `fuzzylite` (C++), `jfuzzylite` (Java), `pyfuzzylite` (Python), and `QtFuzzyLite` (Windows/Linux/Mac).
+
+**There are still many things to do!**
+
+Besides [donations](http://www.fuzzylite.com/donations/), you can significantly contribute by **purchasing a license** of the entirely new [`QtFuzzyLite`](http://www.fuzzylite.com/QtFuzzyLite/) commercial application. In addition, if you require (paid) private support, please contact [jcrada@fuzzylite.com](mailto:jcrada@fuzzylite.com).
+
+
+***
+
+
+
+
+### <a name="introduction">Introduction</a>
+`fuzzylite` is a free and open-source fuzzy logic control library programmed in C++ for multiple platforms (Windows, Linux, Mac, iOS). Its goal is to allow you to easily create fuzzy logic controllers in a few steps utilizing object-oriented programming without requiring any third-party libraries.
+
+#### Reference
+If you are using `fuzzylite`, please cite the following reference in your article:
+
+Juan Rada-Vilela. fuzzylite: a fuzzy logic control library, 2014. URL http://www.fuzzylite.com.
+
+```bibtex
+ @misc{fl::fuzzylite,
+ author={Juan Rada-Vilela},
+ title={fuzzylite: a fuzzy logic control library},
+ url={http://www.fuzzylite.com},
+ year={2014}}
+```
+
+***
+
+### <a name="features">Features</a>
+
+**Controllers** *Types* (5) Mamdani, Takagi-Sugeno, Larsen, Tsukamoto, Inverse Tsukamoto
+
+**Linguistic terms** *Basic* (4) triangle, trapezoid, rectangle, discrete. *Extended* (9) bell, cosine, gaussian, gaussian product, pi-shape, sigmoid difference, sigmoid product, spike. *Edges* (4) concave, ramp, sigmoid, s-shape, z-shape. *Functions* (3) constant, linear, function.
+
+**Conjunction and Activation** *T-Norm* (7) minimum, algebraic product, bounded difference, drastic product, einstein product, hamacher product, nilpotent minimum.
+
+**Disjunction and Accumulation** *S-Norm* (8) maximum, algebraic sum, bounded sum, normalized sum, drastic sum, einstein sum, hamacher sum, nilpotent maximum.
+
+**Defuzzifiers** *Integral* (5) centroid, bisector, smallest of maximum, largest of maximum, mean of maximum, *Weighted* (2) weighted average, weighted sum.
+
+**Hedges** *Types* (6) any, not, extremely, seldom, somewhat, very.
+
+**Import** *Types* (3) FuzzyLite Language `fll`, Fuzzy Inference System `fis`, Fuzzy Control Language `fcl`.
+
+**Export** *Types* (6) `C++`, `Java`, FuzzyLite Language `fll`, FuzzyLite Dataset `fld`, Fuzzy Inference System `fis`, Fuzzy Control Language `fcl`.
+
+**Examples** (30+) of Mamdani, Takagi-Sugeno and Tsukamoto controllers from `fuzzylite`, Octave and Matlab, each included in the following formats: `C++`, `Java`, `fll`, `fld`, `fis`, and `fcl`.
+
+***
+
+### <a name="example">Example</a>
+
+```cpp
+#include "fl/Headers.h"
+
+int main(int argc, char* argv[]){
+ using namespace fl;
+ Engine* engine = new Engine("simple-dimmer");
+
+ InputVariable* ambient = new InputVariable;
+ ambient->setName("Ambient");
+ ambient->setRange(0.000, 1.000);
+ ambient->addTerm(new Triangle("DARK", 0.000, 0.500));
+ ambient->addTerm(new Triangle("MEDIUM", 0.250, 0.750));
+ ambient->addTerm(new Triangle("BRIGHT", 0.500, 1.000));
+ engine->addInputVariable(ambient);
+
+ OutputVariable* power = new OutputVariable;
+ power->setName("Power");
+ power->setRange(0.000, 2.000);
+ power->setDefaultValue(fl::nan);
+ power->addTerm(new Triangle("LOW", 0.000, 1.000));
+ power->addTerm(new Triangle("MEDIUM", 0.500, 1.500));
+ power->addTerm(new Triangle("HIGH", 1.000, 2.000));
+ engine->addOutputVariable(power);
+
+ RuleBlock* ruleblock = new RuleBlock;
+ ruleblock->addRule(Rule::parse("if Ambient is DARK then Power is HIGH", engine));
+ ruleblock->addRule(Rule::parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
+ ruleblock->addRule(Rule::parse("if Ambient is BRIGHT then Power is LOW", engine));
+ engine->addRuleBlock(ruleblock);
+
+ engine->configure("", "", "Minimum", "Maximum", "Centroid");
+
+ std::string status;
+ if (not engine->isReady(&status))
+ throw Exception("Engine not ready. "
+ "The following errors were encountered:\n" + status, FL_AT);
+
+ for (int i = 0; i < 50; ++i){
+ scalar light = ambient->getMinimum() + i * (ambient->range() / 50);
+ ambient->setInputValue(light);
+ engine->process();
+ FL_LOG("Ambient.input = " << Op::str(light) << " -> " <<
+ "Power.output = " << Op::str(power->getOutputValue()));
+ }
+}
+```
+
+***
+
+### <a name="whatsnext">What's Next?</a>
+
++ Source code documentation
++ Type-2 Fuzzy Logic Controllers
++ Adaptive Neuro-Fuzzy Inference System (ANFIS)
++ Fuzzy C-means data clustering
+
+***
+
+### <a name="building">Building from Source</a>
+Building from source requires you to have CMake installed.
+
+The files [`fuzzylite/build.bat`](/fuzzylite/build.bat) and [`fuzzylite/build.sh`](/fuzzylite/build.sh) are automatic build scripts for Windows and Unix platforms, respectively. The usage of these scripts is presented as follows.
+
+#### Windows
+```bash
+> build.bat help
+Usage: build.bat [options]
+where [options] can be any of the following:
+ all builds fuzzylite in debug and release mode (default)
+ debug builds fuzzylite in debug mode
+ release builds fuzzylite in release mode
+ clean erases previous builds
+ help shows this information
+```
+
+#### Unix
+```bash
+$ ./build.sh help
+Usage: [bash] ./build.sh [options]
+where [options] can be any of the following:
+ all builds fuzzylite in debug and release mode (default)
+ debug builds fuzzylite in debug mode
+ release builds fuzzylite in release mode
+ clean erases previous builds
+ help shows this information
+```
+
+**(important)** After executing the building script, the binaries will be built and stored in the sub-folders `release/bin` and `debug/bin`.
+
+#### Advanced Building Options
+For more advanced building options, please check the contents of [`fuzzylite/build.bat`](/fuzzylite/build.bat) or [`fuzzylite/build.sh`](/fuzzylite/build.sh), and the contents of [`fuzzylite/CMakeLists.txt`](/fuzzylite/CMakeLists.txt).
+
+The following building options are available:
+
+`-DFL_USE_FLOAT=ON` builds the binaries using `typedef float fl::scalar` instead of `typedef double fl::scalar` (default is OFF, i.e., double is used)
+
+`-DFL_BACKTRACE=OFF` disables the backtrace information in case of errors (default in Unix platforms is ON, and in Windows platforms is OFF). In Windows, the backtrace information requires the library `dbghelp`, which should be available in your system.
+
+`-DFL_CPP11=ON` builds `fuzzylite` utilizing `C++11` features (default is OFF, i.e., `C++98`)
+
+`-DCMAKE_BUILD_TYPE=[Debug|Release]` sets the mode of your build. You can only build one mode at a time with a single CMake script.
+
+***
+
+### <a name="binaries">Binaries</a>
+
+After building from source, the following are the relevant binaries that will be created in `release` mode. In `debug` mode, binaries will append a `d` at the end of the name (e.g., `fuzzylited.dll`).
+
+#### Windows
+
+- console application: `fuzzylite.exe`
+- shared library: `fuzzylite.dll`, `fuzzylite.lib`
+- static library: `fuzzylite-static.lib`
+
+#### Linux
+
+- console application: `fuzzylite`
+- shared library: `libfuzzylite.so`
+- static library: `libfuzzylite.a`
+
+#### Mac
+
+- console application: `fuzzylite`
+- shared library: `libfuzzylite.dylib`
+- static library: `libfuzzylite.a`
+
+
+The console application of `fuzzylite` allows you to import and export your controllers. Its usage can be obtained executing the console binary. In addition, the FuzzyLite Interactive Console is activated when exporting to `fld` without providing an output file. The interactive console allows you to evaluate any controller by manually providing the input the values.
+
+
+***
+
+### <a name="whatsnew">What's New?</a>
+The entire `fuzzylite` library has been thoroughly revised, refactored, validated, and significantly improved. The following sections detail the changes and enhancements of version 5.0. Users of previous versions are **strongly** encouraged to carefully read the list before migrating to version 5.0. Important changes and enhancements are marked as **(important)**, **(VERY important)** and **(EXTREMELY important)**.
+
+#### <a name="new-general">General</a>
++ **(important)** `fuzzylite v5.0` is dual-licensed under the [GNU LGPL v3.0](https://www.gnu.org/licenses/lgpl.html) and a paid commercial license.
++ Support for both `C++98` and `C++11` using the latest features.
++ Support for multiple compilers `g++`, `Clang`, `MSVC`.
++ Refactoring of many classes to improve design and performance.
++ **(important)** Performance improvements of Takagi-Sugeno controllers by over 55% with respect to v4.0 (estimate based on the average performance on the examples included).
++ Smart pointers in many classes take care of automatically deleting objects when setting new pointers (`Accumulated`, `FactoryManager`, `Function`, `OutputVariable`, `Rule`, and `RuleBlock`).
+* **(important)** Exceptions are thrown when any of the following `RuleBlock::[conjunction|disjunction|activation]`, `Accumulated::accumulation`, and `OutputVariable::defuzzifier` are required but set to `fl::null`, thereby replacing the operations that would lead to `[signal 11] Segmentation fault` to operations that throw a `fl::Exception` instead.
++ Automatic build script to build `fuzzylite` in `debug` and `release` mode.
++ Binaries of debug libraries are renamed to append the letter `d` (e.g.,`fuzzylited.dll`, `libfuzzylited.so`).
++ **(important)** New file [`fuzzylite/src/m/compare.m`](/fuzzylite/src/m/compare.m) <!---check link--> to compare the output values of your `fuzzylite` engines with the evaluation of the same engine in Octave/Matlab.
++ **(important)** There is practically no difference between the output values obtained with `fuzzylite` and those obtained with Octave/Matlab. Based on the examples, the average mean square error (MSE) between the output values is less than `7.3e-12` (or `0.0000000000073`) due to negligible differences in floating-point arithmetic. The results and comparison can be found in [`examples/examples.mat`](/examples/examples.mat) <!---check link-->.
++ **(important)** Source code of applications based on version 4.0 will most likely not compile with version 5.0.
++ Minor bugs and memory leaks fixed.
+
+####<a name="new-macros">Macros</a>
+* **(important)** Added support for `C++11` with smart pointers, method identifiers, move constructors and move operators as follows. For precise information, refer to file [`fuzzylite/fl/fuzzylite.h`](/fuzzylite/fl/fuzzylite.h). <!---check link-->
+* **(important)** Macros for identifiers are defined as `FL_IOVERRIDE override`, `FL_IFINAL final`, `FL_IDEFAULT = default`, `FL_IDELETE = delete`, `FL_INOEXCEPT noexcept`, `FL_DEFAULT_COPY(Class)`, `FL_DEFAULT_MOVE(Class)`, and `FL_DEFAULT_COPY_AND_MOVE(Class)`.
+* **(important)** Added macro `FL_unique_ptr` to refer to `std::auto_ptr` (`C++98`) or `std::unique_ptr` (`C++11`), and its respective `FL_move_ptr(x)` to move a smart pointer, albeit `FL_move_ptr(x)` is not used within the library as it is not needed.
+* **(important)** Added global variables `const long fl::null = 0L` to refer to the null pointer in `C++98` and `const std::nullptr_t null = nullptr` to refer to the null pointer in `C++11`.
+* **(important)** Renamed macro `FL_DEBUG` to `FL_DBG`.
+* **(important)** Renamed macros `FL_BEGIN_DEBUG_BLOCK` and `FL_END_DEBUG_BLOCK` to `FL_DEBUG_BEGIN` and `FL_DEBUG_END`, respectively.
+* **(important)** Renamed macro `FL_EXPORT` to `FL_API`
+* **(EXTREMELY important)** Added macro definitions `FL_EXPORT_LIBRARY` and `FL_IMPORT_LIBRARY`. If you are building `fuzzylite` as a **shared library**, you need to define `FL_EXPORT_LIBRARY`. If you are building `fuzzylite` **executable** *and* it utilizes the `fuzzylite` **shared library**, you need to define `FL_IMPORT_LIBRARY`. If you are building `fuzzylite` as a **static library** and/or building `fuzzylite` **executable** using the `fuzzylite` **static library**, then you do not need to define either `FL_[IMPORT|EXPORT]_LIBRARY`. Note that the same conditions apply for your application. This is particularly important in Windows platforms, as `FL_IMPORT_LIBRARY` and `FL_EXPORT_LIBRARY` define `FL_API` to `__declspec(dllimport)` and `__declspec(dllexport)`, respectively. If in doubt, please check [`fuzzylite/CMakeLists.txt`](/fuzzylite/CMakeLists.txt)<!---check link-->
+
+#### <a name="new-operation">Operation</a>
+* **(important)** Added method `Operation::toScalar(std::string x, scalar alternative) FL_INOEXCEPT` which returns `alternative` if `x` is not a valid `scalar`, and never throws an exception.
+* **(important)** Added method `Operation::toScalar(std::string x)` that returns the scalar value of `x` or throws a `fl::Exception` if `x` is not a valid `scalar`.
+* **(VERY important)** Marked method (from v4.0) `Operation::toScalar(std::string, bool, scalar) FL_IDELETE;` and removed its implementation such that its usage is prevented at compile time in `C++11` and at linker time in `C++98`. Please, use the appropriate `Op::toScalar` methods mentioned above.
++ Renamed method `Op::isNan` to `Op::isNaN`.
+* Added method `fl::Op::isFinite(x)` which returns `not (isNaN(x) or isInf(x))`.
+* Changed `fl::Op::isEq(a,b)` to return `true` if `a == b == NaN`.
+* Changed `fl::Op::isEq(a,b)` to return `true` if `a == b == Inf`.
+* Changes to `fl::Op::isEq` affect other comparison methods `fl::Op::is[Lt|LEq|GEq|Gt]`.
+* Added shortcuts of comparisons `fl::Op::[gt,lt,ge,le,eq,neq](scalar a, scalar b)`, mostly to provide binary versions (without `macheps`) for term `Function`.
+* Deleted method `Op::repeat`.
+* Removed method `fuzzylite::configuration()`.
+* Changed default `fuzzylite::_macheps = 1e-6;`.
+* Renamed method `Op::makeValidId` to `Op::validName`, which now returns `"unnamed"` for empty strings.
+
+
+
+####<a name="new-engine">Engine</a>
+* **(VERY important)** Moved `Engine::hedges` (and relevant methods) to `Rule::hedges`.
+* Added enumeration for the type of engine: `enum Engine::Type{Mamdani, Larsen, TakagiSugeno, Tsukamoto, InverseTsukamoto, Hybrid, Unknown}`.
+* Added method `Type Engine::type(std::string* name, std::string* reason)` to infer the type of the engine based on its configuration, additionally provides the name of the type and the inference reasons for its type.
+* **(important)** Changed method `Engine::isReady(std::string)` to satisfy the default operation of controllers. The method `Engine::isReady(std::string)` was initially conceived to provide information before a potential `[signal 11] Segmentation fault` happened due to improper configuration. However, given the improved handling of signals and exceptions mentioned in Section [General](#new-general), using method `Engine::isReady(std::string)` is not necessary except for providing suggestions of what could potentially cause an error.
+* Added methods `Engine::set[Input|Output]Variables(std::vector)` and `Engine::setRuleBlocks(std::vector)`.
+* Added methods `Engine::[input|output]Variables()` and `Engine::ruleBlocks()` to return mutable references.
+* Added method `Engine::variables()` to retrieve a vector (copy) containing the `InputVariables` followed by the `OutputVariables`.
+* Added method `Engine::updateReferences()` to update the references to the engine in all the necessary linguistic terms (i.e., `Linear` and `Function`).
+* Added method `Engine::clone()`.
+* Added copy constructors, assignment operators, and default move constructor to `Engine`.
+
+
+
+####<a name="new-inoutvars">Input Variables and Output Variables</a>
+* **(important)** Added methods `OutputVariable::[get|set]OutputValue()` to [retrieve|store] value from defuzzification
+* **(important)** Changed return type of `scalar OutputVariable::defuzzify()` to `void OutputVariable::defuzzify()` because now it automatically stores the defuzzified output value, and also stores the previous *valid* output value regardless of locks. Like in version 4.0, if `OutputVariable::lockPreviousOutputValue=true`, and the defuzzified output value is not valid (i.e., `[NaN|Inf]`) or no rules were activated, then the defuzzified output value is replaced for the previous valid output value.
+* Removed method `OutputVariable::defuzzifyNoLocks()`.
+* Renamed variable `OutputVariable::lastValidOutputValue` to `OutputVariable::previousOutputValue`.
+* **(important)** Renamed method `OutputVariable::[get|set]LastValidOutput()` to `OutputVariable::[get|set]PreviousOutputValue()`.
+* Renamed variable `OutputVariable::lockValidOutput` to `OutputVariable::lockPreviousOutputValue`.
+* **(important)** Renamed method `OutputVariable::setLockValidOutput()` to `OutputVariable::setLockPreviousOutputValue()`.
+* **(important)** Renamed method `OutputVariable::isLockingValidOutput()` to `OutputVariable::isLockedPreviousOutputValue()`.
+* Renamed variable `OutputVariable::lockOutputRange` to `OutputVariable::lockOutputValueInRange`.
+* **(important)** Renamed method `OutputVariable::setLockOutputRange()` to `OutputVariable::setLockOutputValueInRange()`.
+* **(important)** Renamed method `OutputVariable::isLockingOutputRange()` to `OutputVariable::isLockedOutputValueInRange()`.
+* Added methods `std::string InputVariable::fuzzyInputValue()` and `std::string OutputVariable::fuzzyOutputValue()`.
+* Added method `OutputVariable::clear()` to clear the fuzzy output, and set `OutputVariable::previousOutputValue = fl::nan` and set `OutputVariable::outputValue = fl::nan`.
+* Added copy constructors, assignment operators, move constructors and move operators to [Input|Output]Variable.
+* Added method `Variable::terms()` to return mutable reference.
+* **(important)** Changed `OutputVariable::[defuzzifier|fuzzyOutput]` to smart pointers (`FL_unique_ptr`).
+
+
+#### <a name="new-terms">Linguistic Terms</a>
+* **(VERY important)** Added Term::[get|set]Height to define the height of *integral* terms, and multiply their respective membership functions accordingly.
+* Added copy constructors, assignment operators, move constructors and move operators to every `Term`.
+* **(VERY important)** Parameters of all terms are set by default to `fl::nan`.
+* **(important)** Renamed method `Term::copy()` to `Term::clone()` in every `Term`.
+* Added method `Term::updateReference(Term*, Engine*)` to ensure `Linear` and `Function` terms have updated pointers to the `Engine` (useful when cloning and copy-constructing).
++ **(important)** Added linguistic terms `Concave`, `Cosine` and `Spike`.
+* **(important)** Changed `Accumulated` to take `Activated*` terms instead of `const Terms*`.
+* Removed `const` from return type of method `SNorm* Accumulated::[get|set]Accumulation()`.
+* Changed `Accumulated::accumulation` to a smart pointer (`FL_unique_ptr`).
+* Added method `Accumulated::terms()` to return mutable reference.
+* **(important)** Renamed methods `Triangle::[set|get][A|B|C]` to `::[set|get]Vertex[A|B|C]`.
+* **(important)** Renamed methods `Trapezoid::[set|get][A|B|C|D]` to `::[set|get]Vertex[A|B|C|D]`.
+* **(important)** Renamed term `Thresholded` to `Activated`.
+* **(important)** Renamed methods `Thresholded::[set|get]Threshold()` to `Activated::[set|get]Degree()`.
+* Added enumeration `[Ramp|Sigmoid]::Direction{ NEGATIVE, ZERO, POSITIVE }` to refer to the slope.
+* Added methods `Ramp::direction()` and `Sigmoid::direction()` to retrieve direction of slope.
+* Removed Exception Specification from methods in `Discrete`, `Linear` and `Function` terms.
+
+#### <a name="new-linear-discrete">Linear and Discrete Terms</a>
+* **(important)** Changed `Linear` from having pointers to the input variables to having a pointer to the `Engine`.
+* Changed visibility of `Linear::coefficients` to `protected`.
+* **(important)** Added methods `Linear::coefficients()`, `Linear::setCoefficients()`.
+* `Linear` term no longer throws exception when `inputVariables != |coefficients|`.
+* **(important)** Removed public vector of variables `Discrete::[x|y]`.
+* **(important)** Added a `typedef std::pair<scalar, scalar> Discrete::Pair`.
+* **(important)** Changed representation of `Discrete::[x|y]` from `std::vector<scalar>` to `std::vector<Discrete::Pair>`.
+* Added methods `Discrete::setXY()` and `Discrete::xy()` to set and get the new representation of pairs.
+* Added methods `Discrete::xy(int index)` to retrieve `Discrete::Pair` at `index`.
+* **(important)** Added methods `Discrete::toPairs(std::vector<scalar>)` which throws an exception if the vector is missing a value (i.e., `std::vector<scalar>.size() % 2 != 0`), and `Discrete::toPairs(std::vector<scalar>, scalar missingValue)` which adds `missingValue` in case `std::vector<scalar>.size() %2 == 1`, hence never throwing an exception.
+* Added method `Discrete::toVector(std::vector<Discrete::Pair>)` to convert `std::vector<Discrete::Pair>` to a `std::vector<scalar>`.
+* Added method `Discrete::formatXY()` to get pairs `(x,y)` nicely formatted.
+
+####<a name="new-function">Function Term</a>
+* **(important)** Merged structs `Function::Operator` and `Function::BuiltInFunction` into a single `struct Function::Element`.
+* **(EXTREMELY important)** Changed the precedence of all built-in instances of `Function::Element` of type `Operator` starting from `100` and decreasing by `10`. The precedence of built-in operators is the following: `(100)` Logical not `[!]` and Negation `[~]`; `(90)` Power `[^]`; `(80)` Multiplication `[*]`, Division `[/]` and Modulo `[%]`; `(70)` Addition `[+]` and Subtraction `[-]`; `(60)` Logical AND `[and]` and Logical OR `[or]`. If you have registered your own operators, please adjust their precedence as required.
+* Added to `Function` built-in comparison functions `gt,lt,ge,le,eq` and operator logical not `!`.
+* Modified typedefs `Function::Unary` and `Function::Binary` to take `scalar` instead of `double`.
+* Changed `public Function::root` to `protected Function::_root` and it is now a smart pointer (`FL_unique_ptr`).
+* Added method `Function::root()` to return pointer to `Function::root`.
+* **(EXTREMELY important)** Moved built-in functions and operators from `Function` to a `FunctionFactory`.
+
+
+#### <a name="new-norms-hedges">[T|S]Norms and Hedges</a>
++ **(important)** Fixed operation when using multiple hedges to operate from right-most to left-most, e.g. `if Ambient is not very extremely bright`, now evaluates as follows `not(very(extremely(bright)))`.
++ Added `TNorm` nilpotent minimum and `SNorm` nilpotent maximum.
+* Added clone methods to every `Norm`.
+* Added clone methods to every `Hedge`.
+* **(VERY important)** Moved `Engine::hedges` to `Rule::hedges`.
+
+
+#### <a name="new-rules">Rules</a>
+* **(VERY important)** Moved `Engine::hedges` (and methods) to `Rule::hedges`.
+* Added method `Rule::isLoaded()` to determine whether a rule was properly parsed and thus can be activated.
+* Added method `Rule::unload()` to allow the existence of a rule in an inactive state (useful for invalid rules).
+* **(important)** Removed variable `Rule::FL_ASSIGNS` and method `Rule::assignsKeyword()`, for which the symbol `=` in rules is no longer valid.
+* Changed visibility of method `Rule::setText()` to `public`.
+* Added method `Rule::load(const Engine*)`.
+* Changed `Rule::[antecedent|consequent]` to smart pointers (`FL_unique_ptr`).
+* **(important)** Renamed method `Antecedent::[get|set]Root()` to `Antecedent::[get|set]Expression()`.
+* Added methods `[Antecedent|Consequent]::[get|set]Text()`.
+* **(important)** Added methods `[Antecedent|Consequent]::[load|unload]()`, with the same objective as `Rule::[load|unload]()`.
+
+#### <a name="new-ruleblocks">Rule Blocks</a>
+* Added method `RuleBlock::reloadRules()`.
+* Added method `RuleBlock::setRules(std::vector)`.
+* Added method `RuleBlock::rules()` to return mutable reference.
+* Removed `const` from `TNorm` and `SNorm` in `RuleBlock::[get|set][Conjunction|Disjunction|Activation]()`, respectively.
+* Changed `RuleBlock::[conjunction|disjunction|activation]` to smart pointers (`FL_unique_ptr`).
+* **(VERY important)** Added basic rule chaining such that an `OutputVariable` can be utilized in the `Antecedent` of a `Rule`. For example, considering the rule `if Power is high then InversePower is low`, where `Power` and `InversePower` are both output variables, the activation degree of the `Antecedent` will correspond to the accumulated activation degree of the term `high` in the fuzzy output of `Power`. If `Power::accumulation = none`, the accumulated activation degree of the term `high` will be computed as the regular sum of the activation degrees of term `high` in the fuzzy output of `Power`. Otherwise, the accumulated activation degree is computed utilizing the `Power::accumulation` operator.
+
+
+#### <a name="new-weighted">Weighted Defuzzifiers</a>
++ **(VERY important)** Performance improvements of Takagi-Sugeno controllers by over 55% (with respect to v4.0) based on the average performance on the examples included.
+* **(important)** Created class `WeightedDefuzzifier` from which classes `Weighted[Average|Sum]` are derived.
+* **(important)** Added enumeration `WeightedDefuzzifier::Type{Automatic, TakagiSugeno, Tsukamoto}` and respective methods `WeightedDefuzzifier::[get|set]Type()` and `WeightedDefuzzifer::getTypeName()`.
+* Added method `WeightedDefuzzifier::inferType(Term*)` to automatically determine the `WeightedDefuzzifier::Type` based on the class of `Term`.
+* **(important)** By default, `WeightedDefuzzifier::type = Automatic`, which automatically infers the type based on the `WeightedDefuzzifier::inferType()`.
+* **(important)** There is a small performance penalty when using `WeightedDefuzzifier::type = Automatic` because `WeightedDefuzzifier::inferType()` performs three `dynamic_cast<>`.
+* **(important)** Deleted class `Tsukamoto`. Its method `static tsukamoto()` was moved to `virtual WeightedDefuzzifier::tsukamoto()`, which allows overriding it
+* Added support for `Tsukamoto` with `Concave` terms.
++ **(EXTREMELY important)** In version 5.0, the traditional operation of Takagi-Sugeno and Tsukamoto controllers is achieved by setting `OutputVariable::accumulation = none`. Unlike version 4.0, the `RuleBlock::activation` will not have any effect on Takagi-Sugeno nor Tsukamoto controllers, for which `RuleBlock::activation` should also be set to `none`. More information about the roles of the `OutputVariable::accumulation` and `RuleBlock::activation` operators are detailed as follows. Refer to [sciweavers](http://www.sciweavers.org/free-online-latex-equation-editor) to convert LaTeX equations.
++ **(VERY important)** In version 5.0, the role of the `RuleBlock::activation` `TNorm` on the `Weighted[Average|Sum]` always performs a regular multiplication of the weights and the values (i.e., $w_i \times z_j$) regardless of the `TNorm` chosen. In other words, selecting any `RuleBlock::activation` for `Weighted[Average|Sum]` is irrelevant, and should be set to `none` as every `TNorm` will have the same multiplication effect. This operation is different from `fuzzylite` version 4.0, where the `RuleBlock::activation` operator was utilized to multiply the weights and values (i.e. $w_i \otimes z_j$), and therefore the traditional operation of the `Weighted[Average|Sum]` was achieved when `RuleBlock::activation = AlgebraicProduct;`.
++ **(VERY important)** In version 5.0, the role of the `OutputVariable::accumulation = none` on the `Weighted[Average|Sum]` results in a regular sum of the multiplied weights and values, i.e., $\dfrac{\sum_i^n w_i \times z_j}{\sum_i^n w_i}$. However, if the `OutputVariable::accumulation != none`, the role of the `SNorm` will be to accumulate the activation degrees of the *repeated* terms in the fuzzy output of the variable. For example, considering the rules `if Ambient is dark then Power is high` and `if Ambient is medium then Power is high`, for any input value of `Ambient` that activates both rules, the fuzzy output of `Power` will have the term `high` activated with the degree from `Rule 1`, and the term `high` activated with the degree from `Rule 2`. Since the term `high` appears twice in the fuzzy output, the role of the accumulation operator will be to accumulate the activation degree of `high` resulting in $\dfrac{(w_1 \oplus w_2) \times z_{high}}{(w_1 \oplus w_2)}$. If another term were activated, the result would be $\dfrac{(w_1 \oplus w_2) \times z_{high} + w_i \times z_j}{(w_1 \oplus w_2) + w_i}$. In version 4.0, the accumulation operator had no effect on the `Weighted[Average|Sum]`.
+
+
+
+#### <a name="new-integral">Integral Defuzzifiers</a>
+* **(important)** Proper handling of indefinite integral defuzzification, that is, returning `fl::nan` when `[minimum|maximum]=[NaN|Inf]`.
+* Default resolution of integration is defined as `static int IntegralDefuzzifier::defaultResolution=200`, and can be changed via `static IntegralDefuzzifier::setDefaultResolution()`.
++ **(important)** In `fuzzylite`, the accumulation operator has been for several versions associated with the output variables and **not** with the rule blocks, despite that the FCL format and other fuzzy logic control libraries associate the accumulation operator with the rule blocks. The argument for such a decision is that `fuzzylite` provides **coherent** support for multiple rule blocks operating on the same engine and on the same output variables. For example, if multiple rule blocks operate on the same output variables, it only makes sense to have a single accumulation operator associated with each output variable such that the defuzzifier can naturally operate over the accumulated fuzzy output. Differently, if the accumulation operator were associated with the rule block, the possibility of having different accumulation operators in different rule blocks questions (1) **the possibility of having multiple rule blocks operating over the same output variables**; and (2) **the usage of different accumulation operators over the accumulation and defuzzification processes**. Certainly, if (1) is not possible, i.e, different rule blocks only operate on different output variables, then (2) is not a problem because the accumulation process and defuzzification of each variable will only have a single accumulation operator. It is therefore that the association of the accumulation operator with the output variable in `fuzzylite` provides a **better design** and an additional feature that allows having multiple rule blocks operating over the same output variables.
+* Added copy constructors, assignment operators, move constructors and move operators.
+* Added method `Defuzzifier::clone()`.
+
+####<a name="new-imex">Importers and Exporters</a>
+* **(EXTREMELY important)** Since terms have a new `height` property, `[Fll|Fis|Fcl]Exporter` exports terms with an additional `scalar` at the end, which indicates the `height` of the term. However, if `height=1.0`, the additional scalar is not exported.
+* **(EXTREMELY important)** In `[Fll|Fis|Fcl]Importer`, when importing terms, if there is an additional `scalar` it will be assumed as the `height` of the term. For example, `term: high Gaussian 1.0 0.5 0.75` will create a `Gaussian` term with mean `1.0`, standard deviation `0.5` and height `0.75`. This is **extremely important** because there are some examples from Matlab in `fis` format that append a useless `0.0` to some terms.
+* **(EXTREMELY important)** In `FisExporter`, if the Takagi-Sugeno controller has no `activation` or `accumulation` operators (as it should generally be the case), Octave and Matlab will not be able to import the `fis` file. To overcome this issue, you will have to set `ImpMethod="min"` and `AggMethod="max"`, where `ImpMethod` and `AggMethod` are just dummy operators that can be set to any `TNorm` and `SNorm`, respectively.
++ **(important)** Improved compatibility of the exported code obtained with `[Fis|Fcl]Exporter` by exporting the additional features of `fuzzylite` only when these are different from the default operation. For example, the following features will not be exported given their values: `[Input|Output]Variable::enabled = true;`, `OutputVariable::lock-previous = false;`, `OutputVariable::lock-range = false;`, amongst others.
+* **(important)** Renamed FLL property `'lock-valid'` to `'lock-previous'`.
+* **(important)** Renamed FIS property `'LockValid'` to `'LockPrevious'`.
+* **(important)** Renamed FCL property `'LOCK: VALID'` to `'LOCK: PREVIOUS'`.
++ **(important)** Export your controllers to files using `[Fll|Fld|Fis|Fcl]Exporter::toFile()`.
++ **(important)** Import your controllers from files using `[Fll|Fis|Fcl]Importer::fromFile()`.
++ **(important)** `FldExporter` exports the FuzzyLite Dataset of an engine utilizing the input values of another FuzzyLite Dataset.
+* `FldExporter` no longer restarts the engine when exporting.
+* **(important)** Renamed method `FldExporter::toWriter()` to `FldExporter::write()`.
+* Removed variable and methods for property `int FldExporter::_maximum`.
+* Added option in `CppExporter` to prepend the namespace prefix `fl::` to the classes, and by default it does not prepend prefix.
+* Improvement accuracy of `FisImporter` when importing `fis` files whose scalar values have more than three decimal numbers.
+* Renamed methods in `[Fis|Fcl]Importer::extract*` to `[Fis|Fcl]Importer::parse*`.
+
+
+
+#### <a name="new-factories">Factories</a>
+* Created a generic `CloningFactory<T>` to create clones of objects.
+* **(important)** Created `FunctionFactory` based on `CloningFactory<Function::Element>` where function operators and methods are stored to be cloned as necessary by `Function`. Additional functions and operators can be easily registered.
+* **(VERY important)** Moved built-in functions and operators from `Function` to `FunctionFactory`.
+* Renamed methods `Factory<T>::[register|deregister]Class()` to `Factory<T>::[register|deregister]Constructor()`.
+* **(important)** Renamed `Factory<T>` to `ConstructionFactory<T>`.
+* Renamed `typedef Factory::Creator` to `typedef Factory::Constructor`.
+* Changed pointers of `FactoryManager` to smart pointers (`FL_unique_ptr`).
+
+
+
+#### <a name="new-examples">Examples</a>
+* **(important)** Added two examples for basic rule chaining: `mamdani/SimpleDimmerInverse.fll` and `mamdani/Laundry.fll`.
+* Included the `original` example files in `fis` format.
+* Added conversion of `examples/original/*.fis` to `examples/original/*.fll`.
+* Modified `original/takagi-sugeno` examples to reflect `activation: none; accumulation: none;`.
+* Updated FLD examples produced from the `original` examples.
++ **(important)** Added file [`fuzzylite/src/m/compare.m`](/fuzzylite/src/m/compare.m) <!---check link--> to compare the output values of your `fuzzylite` engines with the evaluation of the same engine in Octave/Matlab.
++ **(important)** Added file [`examples/examples.mat`](/examples/examples.mat) <!---check link--> containing the comparison of the output values between `fuzzylite` and Matlab's Fuzzy Logic Toolbox.
+* Added code to perform benchmarks in Linux.
+
+
+#### <a name="new-console">Console</a>
+* **(important)** Console includes option to import custom input dataset from file an export its respective output values.
+* **(important)** Created the FuzzyLite Interactive Console, which can be started by specifying an input file and the output format, e.g., `fuzzylite -i SimpleDimmer.fll -of fld`.
+* Console provides more information about its usage.
+
+
+
+####<a name="new-fixes"> Fixes Bugs and Leaks</a>
++ **(important)** Fixed operation when using multiple hedges to operate from right-most to left-most, e.g. `if Ambient is not very extremely bright` evaluates as follows `not(very(extremely(bright)))`.
+* **(important)** Fixed membership functions of specific cases of `Triangle` when `a=b` or `b=c`, and `Trapezoid` when `a=b` or `c=d`.
+* Fixed minor memory leak at `~RuleBlock::[conjunction|disjunction|activation]`.
+* Fixed minor memory leak at `~Accumulated::accumulation`.
+* Fixed minor memory leak at `~OutputVariable::defuzzifier`.
+* Fixed minor memory leak at `~Function::Node`.
+* Fixed minor memory leak at `~FactoryManager::[factories]`.
+* Fixed some rethrowing of exceptions to provide proper information about errors. Specifically, changed some rethrown exceptions from `throw ex;` to just `throw;`
+* Fixed building using `-DFL_USE_FLOAT=ON`
+
+***
+
+For more information, visit [www.fuzzylite.com](http://www.fuzzylite.com).
+
+fuzzylite&reg; is a registered trademark of FuzzyLite Limited.
+
+Copyright &#xa9; 2010-2015 FuzzyLite Limited. All rights reserved.
diff --git a/examples/README.md b/examples/README.md
new file mode 100644
index 0000000..6525a9a
--- /dev/null
+++ b/examples/README.md
@@ -0,0 +1,13 @@
+Disclaimer
+==========
+
+The following folders contain examples from Matlab and Octave distributions. The examples are presented in the following formats: fuzzylite v5.0 `.cpp`, jfuzzylite v5.0 `.java`, FuzzyLite Language `.fll`, FuzzyLite Dataset `.fld`, Fuzzy Inference System `.fis`, and Fuzzy Controller Language `.fcl`. The formats were created automatically utilizing the `[Cpp|Java|Fll|Fld|Fis|Fcl]Exporter`.
+
+The original files from Matlab and Octave distributions are contained within the folder `original`, although the following files from Matlab were modified to remove the fourth parameter of the term `gbellmf`, which is not required for its configuration.
+
++ [`examples/original/mamdani/matlab/mam21.fis`](/examples/original/mamdani/matlab/mam21.fis)
+
++ [`examples/original/mamdani/matlab/mam22.fis`](/examples/original/mamdani/matlab/mam22.fis)
+
+In addition to the original examples, the examples are presented in the FuzzyLite Language to include scalar values with at least the same number of decimal places, and a proper configuration in the cases of Takagi-Sugeno controllers (i.e., `RuleBlock::activation = none` and `OutputVariable::accumulation = none`) to satisfy the regular operation of the controllers in `fuzzylite` v5.0.
+
diff --git a/examples/examples.mat b/examples/examples.mat
new file mode 100755
index 0000000..5955fbd
--- /dev/null
+++ b/examples/examples.mat
Binary files differ
diff --git a/examples/mamdani/AllTerms.cpp b/examples/mamdani/AllTerms.cpp
new file mode 100644
index 0000000..7bb1f31
--- /dev/null
+++ b/examples/mamdani/AllTerms.cpp
@@ -0,0 +1,95 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("qtfuzzylite");
+
+InputVariable* inputVariable = new InputVariable;
+inputVariable->setEnabled(true);
+inputVariable->setName("AllInputTerms");
+inputVariable->setRange(0.000, 6.500);
+inputVariable->addTerm(new Sigmoid("A", 0.500, -20.000));
+inputVariable->addTerm(new ZShape("B", 0.000, 1.000));
+inputVariable->addTerm(new Ramp("C", 1.000, 0.000));
+inputVariable->addTerm(new Triangle("D", 0.500, 1.000, 1.500));
+inputVariable->addTerm(new Trapezoid("E", 1.000, 1.250, 1.750, 2.000));
+inputVariable->addTerm(new Concave("F", 0.850, 0.250));
+inputVariable->addTerm(new Rectangle("G", 1.750, 2.250));
+inputVariable->addTerm(Discrete::create("H", 10, 2.000, 0.000, 2.250, 1.000, 2.500, 0.500, 2.750, 1.000, 3.000, 0.000));
+inputVariable->addTerm(new Gaussian("I", 3.000, 0.200));
+inputVariable->addTerm(new Cosine("J", 3.250, 0.650));
+inputVariable->addTerm(new GaussianProduct("K", 3.500, 0.100, 3.300, 0.300));
+inputVariable->addTerm(new Spike("L", 3.640, 1.040));
+inputVariable->addTerm(new Bell("M", 4.000, 0.250, 3.000));
+inputVariable->addTerm(new PiShape("N", 4.000, 4.500, 4.500, 5.000));
+inputVariable->addTerm(new Concave("O", 5.650, 6.250));
+inputVariable->addTerm(new SigmoidDifference("P", 4.750, 10.000, 30.000, 5.250));
+inputVariable->addTerm(new SigmoidProduct("Q", 5.250, 20.000, -10.000, 5.750));
+inputVariable->addTerm(new Ramp("R", 5.500, 6.500));
+inputVariable->addTerm(new SShape("S", 5.500, 6.500));
+inputVariable->addTerm(new Sigmoid("T", 6.000, 20.000));
+engine->addInputVariable(inputVariable);
+
+OutputVariable* outputVariable = new OutputVariable;
+outputVariable->setEnabled(true);
+outputVariable->setName("AllOutputTerms");
+outputVariable->setRange(0.000, 6.500);
+outputVariable->fuzzyOutput()->setAccumulation(new Maximum);
+outputVariable->setDefuzzifier(new Centroid(200));
+outputVariable->setDefaultValue(fl::nan);
+outputVariable->setLockPreviousOutputValue(false);
+outputVariable->setLockOutputValueInRange(false);
+outputVariable->addTerm(new Sigmoid("A", 0.500, -20.000));
+outputVariable->addTerm(new ZShape("B", 0.000, 1.000));
+outputVariable->addTerm(new Ramp("C", 1.000, 0.000));
+outputVariable->addTerm(new Triangle("D", 0.500, 1.000, 1.500));
+outputVariable->addTerm(new Trapezoid("E", 1.000, 1.250, 1.750, 2.000));
+outputVariable->addTerm(new Concave("F", 0.850, 0.250));
+outputVariable->addTerm(new Rectangle("G", 1.750, 2.250));
+outputVariable->addTerm(Discrete::create("H", 10, 2.000, 0.000, 2.250, 1.000, 2.500, 0.500, 2.750, 1.000, 3.000, 0.000));
+outputVariable->addTerm(new Gaussian("I", 3.000, 0.200));
+outputVariable->addTerm(new Cosine("J", 3.250, 0.650));
+outputVariable->addTerm(new GaussianProduct("K", 3.500, 0.100, 3.300, 0.300));
+outputVariable->addTerm(new Spike("L", 3.640, 1.040));
+outputVariable->addTerm(new Bell("M", 4.000, 0.250, 3.000));
+outputVariable->addTerm(new PiShape("N", 4.000, 4.500, 4.500, 5.000));
+outputVariable->addTerm(new Concave("O", 5.650, 6.250));
+outputVariable->addTerm(new SigmoidDifference("P", 4.750, 10.000, 30.000, 5.250));
+outputVariable->addTerm(new SigmoidProduct("Q", 5.250, 20.000, -10.000, 5.750));
+outputVariable->addTerm(new Ramp("R", 5.500, 6.500));
+outputVariable->addTerm(new SShape("S", 5.500, 6.500));
+outputVariable->addTerm(new Sigmoid("T", 6.000, 20.000));
+engine->addOutputVariable(outputVariable);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(new Minimum);
+ruleBlock->setDisjunction(new Maximum);
+ruleBlock->setActivation(new Minimum);
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is A then AllOutputTerms is T", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is B then AllOutputTerms is S", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is C then AllOutputTerms is R", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is D then AllOutputTerms is Q", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is E then AllOutputTerms is P", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is F then AllOutputTerms is O", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is G then AllOutputTerms is N", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is H then AllOutputTerms is M", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is I then AllOutputTerms is L", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is J then AllOutputTerms is K", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is K then AllOutputTerms is J", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is L then AllOutputTerms is I", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is M then AllOutputTerms is H", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is N then AllOutputTerms is G", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is O then AllOutputTerms is F", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is P then AllOutputTerms is E", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is Q then AllOutputTerms is D", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is R then AllOutputTerms is C", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is S then AllOutputTerms is B", engine));
+ruleBlock->addRule(fl::Rule::parse("if AllInputTerms is T then AllOutputTerms is A", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/mamdani/AllTerms.fcl b/examples/mamdani/AllTerms.fcl
new file mode 100644
index 0000000..ef08722
--- /dev/null
+++ b/examples/mamdani/AllTerms.fcl
@@ -0,0 +1,88 @@
+FUNCTION_BLOCK qtfuzzylite
+
+VAR_INPUT
+ AllInputTerms: REAL;
+END_VAR
+
+VAR_OUTPUT
+ AllOutputTerms: REAL;
+END_VAR
+
+FUZZIFY AllInputTerms
+ RANGE := (0.000 .. 6.500);
+ TERM A := Sigmoid 0.500 -20.000;
+ TERM B := ZShape 0.000 1.000;
+ TERM C := Ramp 1.000 0.000;
+ TERM D := Triangle 0.500 1.000 1.500;
+ TERM E := Trapezoid 1.000 1.250 1.750 2.000;
+ TERM F := Concave 0.850 0.250;
+ TERM G := Rectangle 1.750 2.250;
+ TERM H := (2.000, 0.000) (2.250, 1.000) (2.500, 0.500) (2.750, 1.000) (3.000, 0.000);
+ TERM I := Gaussian 3.000 0.200;
+ TERM J := Cosine 3.250 0.650;
+ TERM K := GaussianProduct 3.500 0.100 3.300 0.300;
+ TERM L := Spike 3.640 1.040;
+ TERM M := Bell 4.000 0.250 3.000;
+ TERM N := PiShape 4.000 4.500 4.500 5.000;
+ TERM O := Concave 5.650 6.250;
+ TERM P := SigmoidDifference 4.750 10.000 30.000 5.250;
+ TERM Q := SigmoidProduct 5.250 20.000 -10.000 5.750;
+ TERM R := Ramp 5.500 6.500;
+ TERM S := SShape 5.500 6.500;
+ TERM T := Sigmoid 6.000 20.000;
+END_FUZZIFY
+
+DEFUZZIFY AllOutputTerms
+ RANGE := (0.000 .. 6.500);
+ TERM A := Sigmoid 0.500 -20.000;
+ TERM B := ZShape 0.000 1.000;
+ TERM C := Ramp 1.000 0.000;
+ TERM D := Triangle 0.500 1.000 1.500;
+ TERM E := Trapezoid 1.000 1.250 1.750 2.000;
+ TERM F := Concave 0.850 0.250;
+ TERM G := Rectangle 1.750 2.250;
+ TERM H := (2.000, 0.000) (2.250, 1.000) (2.500, 0.500) (2.750, 1.000) (3.000, 0.000);
+ TERM I := Gaussian 3.000 0.200;
+ TERM J := Cosine 3.250 0.650;
+ TERM K := GaussianProduct 3.500 0.100 3.300 0.300;
+ TERM L := Spike 3.640 1.040;
+ TERM M := Bell 4.000 0.250 3.000;
+ TERM N := PiShape 4.000 4.500 4.500 5.000;
+ TERM O := Concave 5.650 6.250;
+ TERM P := SigmoidDifference 4.750 10.000 30.000 5.250;
+ TERM Q := SigmoidProduct 5.250 20.000 -10.000 5.750;
+ TERM R := Ramp 5.500 6.500;
+ TERM S := SShape 5.500 6.500;
+ TERM T := Sigmoid 6.000 20.000;
+ METHOD : COG;
+ ACCU : MAX;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ AND : MIN;
+ OR : MAX;
+ ACT : MIN;
+ RULE 1 : if AllInputTerms is A then AllOutputTerms is T
+ RULE 2 : if AllInputTerms is B then AllOutputTerms is S
+ RULE 3 : if AllInputTerms is C then AllOutputTerms is R
+ RULE 4 : if AllInputTerms is D then AllOutputTerms is Q
+ RULE 5 : if AllInputTerms is E then AllOutputTerms is P
+ RULE 6 : if AllInputTerms is F then AllOutputTerms is O
+ RULE 7 : if AllInputTerms is G then AllOutputTerms is N
+ RULE 8 : if AllInputTerms is H then AllOutputTerms is M
+ RULE 9 : if AllInputTerms is I then AllOutputTerms is L
+ RULE 10 : if AllInputTerms is J then AllOutputTerms is K
+ RULE 11 : if AllInputTerms is K then AllOutputTerms is J
+ RULE 12 : if AllInputTerms is L then AllOutputTerms is I
+ RULE 13 : if AllInputTerms is M then AllOutputTerms is H
+ RULE 14 : if AllInputTerms is N then AllOutputTerms is G
+ RULE 15 : if AllInputTerms is O then AllOutputTerms is F
+ RULE 16 : if AllInputTerms is P then AllOutputTerms is E
+ RULE 17 : if AllInputTerms is Q then AllOutputTerms is D
+ RULE 18 : if AllInputTerms is R then AllOutputTerms is C
+ RULE 19 : if AllInputTerms is S then AllOutputTerms is B
+ RULE 20 : if AllInputTerms is T then AllOutputTerms is A
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/mamdani/AllTerms.fis b/examples/mamdani/AllTerms.fis
new file mode 100644
index 0000000..61a6d18
--- /dev/null
+++ b/examples/mamdani/AllTerms.fis
@@ -0,0 +1,83 @@
+[System]
+Name='qtfuzzylite'
+Type='mamdani'
+NumInputs=1
+NumOutputs=1
+NumRules=20
+AndMethod='min'
+OrMethod='max'
+ImpMethod='min'
+AggMethod='max'
+DefuzzMethod='centroid'
+
+[Input1]
+Name='AllInputTerms'
+Range=[0.000 6.500]
+NumMFs=20
+MF1='A':'sigmf',[-20.000 0.500]
+MF2='B':'zmf',[0.000 1.000]
+MF3='C':'rampmf',[1.000 0.000]
+MF4='D':'trimf',[0.500 1.000 1.500]
+MF5='E':'trapmf',[1.000 1.250 1.750 2.000]
+MF6='F':'concavemf',[0.850 0.250]
+MF7='G':'rectmf',[1.750 2.250]
+MF8='H':'discretemf',[2.000 0.000 2.250 1.000 2.500 0.500 2.750 1.000 3.000 0.000]
+MF9='I':'gaussmf',[0.200 3.000]
+MF10='J':'cosinemf',[3.250 0.650]
+MF11='K':'gauss2mf',[0.100 3.500 0.300 3.300]
+MF12='L':'spikemf',[3.640 1.040]
+MF13='M':'gbellmf',[0.250 3.000 4.000]
+MF14='N':'pimf',[4.000 4.500 4.500 5.000]
+MF15='O':'concavemf',[5.650 6.250]
+MF16='P':'dsigmf',[10.000 4.750 30.000 5.250]
+MF17='Q':'psigmf',[20.000 5.250 -10.000 5.750]
+MF18='R':'rampmf',[5.500 6.500]
+MF19='S':'smf',[5.500 6.500]
+MF20='T':'sigmf',[20.000 6.000]
+
+[Output1]
+Name='AllOutputTerms'
+Range=[0.000 6.500]
+NumMFs=20
+MF1='A':'sigmf',[-20.000 0.500]
+MF2='B':'zmf',[0.000 1.000]
+MF3='C':'rampmf',[1.000 0.000]
+MF4='D':'trimf',[0.500 1.000 1.500]
+MF5='E':'trapmf',[1.000 1.250 1.750 2.000]
+MF6='F':'concavemf',[0.850 0.250]
+MF7='G':'rectmf',[1.750 2.250]
+MF8='H':'discretemf',[2.000 0.000 2.250 1.000 2.500 0.500 2.750 1.000 3.000 0.000]
+MF9='I':'gaussmf',[0.200 3.000]
+MF10='J':'cosinemf',[3.250 0.650]
+MF11='K':'gauss2mf',[0.100 3.500 0.300 3.300]
+MF12='L':'spikemf',[3.640 1.040]
+MF13='M':'gbellmf',[0.250 3.000 4.000]
+MF14='N':'pimf',[4.000 4.500 4.500 5.000]
+MF15='O':'concavemf',[5.650 6.250]
+MF16='P':'dsigmf',[10.000 4.750 30.000 5.250]
+MF17='Q':'psigmf',[20.000 5.250 -10.000 5.750]
+MF18='R':'rampmf',[5.500 6.500]
+MF19='S':'smf',[5.500 6.500]
+MF20='T':'sigmf',[20.000 6.000]
+
+[Rules]
+1.000 , 20.000 (1.000) : 1
+2.000 , 19.000 (1.000) : 1
+3.000 , 18.000 (1.000) : 1
+4.000 , 17.000 (1.000) : 1
+5.000 , 16.000 (1.000) : 1
+6.000 , 15.000 (1.000) : 1
+7.000 , 14.000 (1.000) : 1
+8.000 , 13.000 (1.000) : 1
+9.000 , 12.000 (1.000) : 1
+10.000 , 11.000 (1.000) : 1
+11.000 , 10.000 (1.000) : 1
+12.000 , 9.000 (1.000) : 1
+13.000 , 8.000 (1.000) : 1
+14.000 , 7.000 (1.000) : 1
+15.000 , 6.000 (1.000) : 1
+16.000 , 5.000 (1.000) : 1
+17.000 , 4.000 (1.000) : 1
+18.000 , 3.000 (1.000) : 1
+19.000 , 2.000 (1.000) : 1
+20.000 , 1.000 (1.000) : 1
diff --git a/examples/mamdani/AllTerms.fld b/examples/mamdani/AllTerms.fld
new file mode 100644
index 0000000..95116fa
--- /dev/null
+++ b/examples/mamdani/AllTerms.fld
@@ -0,0 +1,1026 @@
+#@Engine: qtfuzzylite;
+#@InputVariable: AllInputTerms; @OutputVariable: AllOutputTerms;
+0.00000000 4.59989528
+0.00635386 4.59989528
+0.01270772 4.59989528
+0.01906158 4.59989215
+0.02541544 4.59988508
+0.03176931 4.59987800
+0.03812317 4.59987091
+0.04447703 4.59986380
+0.05083089 4.59985436
+0.05718475 4.59984014
+0.06353861 4.59982589
+0.06989247 4.59981161
+0.07624633 4.59979731
+0.08260020 4.59978148
+0.08895406 4.59976002
+0.09530792 4.59973853
+0.10166178 4.59971699
+0.10801564 4.59969542
+0.11436950 4.59967311
+0.12072336 4.59964434
+0.12707722 4.59961551
+0.13343109 4.59958663
+0.13978495 4.59955769
+0.14613881 4.59952871
+0.15249267 4.59949265
+0.15884653 4.59945641
+0.16520039 4.59942010
+0.17155425 4.59938372
+0.17790811 4.59934727
+0.18426197 4.59930456
+0.19061584 4.59926081
+0.19696970 4.59921698
+0.20332356 4.59917307
+0.20967742 4.59912907
+0.21603128 4.59907961
+0.22238514 4.59902827
+0.22873900 4.59897684
+0.23509286 4.59892531
+0.24144673 4.59887368
+0.24780059 4.59881738
+0.25415445 4.59691917
+0.26050831 4.59649344
+0.26686217 4.59613763
+0.27321603 4.59574220
+0.27956989 4.59527472
+0.28592375 4.59472722
+0.29227761 4.59411601
+0.29863148 4.59343292
+0.30498534 4.59266881
+0.31133920 4.59177691
+0.31769306 4.59072170
+0.32404692 4.58953931
+0.33040078 4.58821415
+0.33675464 4.58672898
+0.34310850 4.58501913
+0.34946237 4.58298678
+0.35581623 4.58071110
+0.36217009 4.57816482
+0.36852395 4.57531844
+0.37487781 4.57209253
+0.38123167 4.56826124
+0.38758553 4.56399478
+0.39393939 4.55925255
+0.40029326 4.55399273
+0.40664712 4.54814499
+0.41300098 4.54124963
+0.41935484 4.53365966
+0.42570870 4.52533306
+0.43206256 4.51623220
+0.43841642 4.50632570
+0.44477028 4.49679479
+0.45112414 4.49371013
+0.45747801 4.49066211
+0.46383187 4.48765002
+0.47018573 4.48467321
+0.47653959 4.48157929
+0.48289345 4.47849013
+0.48924731 4.47543574
+0.49560117 4.47241549
+0.50195503 4.46942878
+0.50830890 4.46635382
+0.51466276 4.46326454
+0.52101662 4.46020827
+0.52737048 4.45718444
+0.53372434 4.45419251
+0.54007820 4.45113732
+0.54643206 4.44805138
+0.55278592 4.44499678
+0.55913978 4.44197300
+0.56549365 4.43897956
+0.57184751 4.43594462
+0.57820137 4.43286470
+0.58455523 4.42981456
+0.59090909 4.42679371
+0.59726295 4.42380172
+0.60361681 4.42078721
+0.60997067 4.41771542
+0.61632454 4.41467191
+0.62267840 4.41165627
+0.62903226 4.40866808
+0.63538612 4.40567398
+0.64173998 4.40261191
+0.64809384 4.39957674
+0.65444770 4.39656808
+0.66080156 4.39358555
+0.66715543 4.39061167
+0.67350929 4.38756054
+0.67986315 4.38453499
+0.68621701 4.38153468
+0.69257087 4.37880303
+0.69892473 4.37647513
+0.70527859 4.37447251
+0.71163245 4.37287629
+0.71798631 4.37166784
+0.72434018 4.37088208
+0.73069404 4.37049511
+0.73704790 4.37038886
+0.74340176 4.37064262
+0.74975562 4.37108759
+0.75610948 4.37180971
+0.76246334 4.37286007
+0.76881720 4.37417270
+0.77517107 4.37551934
+0.78152493 4.37694454
+0.78787879 4.37839069
+0.79423265 4.37985711
+0.80058651 4.38133785
+0.80694037 4.38282570
+0.81329423 4.38399523
+0.81964809 4.38518475
+0.82600196 4.38627238
+0.83235582 4.38726315
+0.83870968 4.38827040
+0.84506354 4.38921872
+0.85141740 4.38993199
+0.85777126 4.39066514
+0.86412512 4.39141423
+0.87047898 4.39217807
+0.87683284 4.39292534
+0.88318671 4.39340549
+0.88954057 4.39376844
+0.89589443 4.39404783
+0.90224829 4.39434112
+0.90860215 4.39441413
+0.91495601 4.39443473
+0.92130987 4.39447393
+0.92766373 4.39445587
+0.93401760 4.39402302
+0.94037146 4.39356564
+0.94672532 4.39297918
+0.95307918 4.39226487
+0.95943304 4.39119401
+0.96578690 4.38989115
+0.97214076 4.38796712
+0.97849462 4.38600893
+0.98484848 4.38407835
+0.99120235 4.38215966
+0.99755621 4.38024519
+1.00391007 4.37834225
+1.01026393 4.37645076
+1.01661779 4.37457058
+1.02297165 4.37270159
+1.02932551 4.37083696
+1.03567937 4.36877780
+1.04203324 4.36610094
+1.04838710 4.36313118
+1.05474096 4.35990289
+1.06109482 4.35644500
+1.06744868 4.35289881
+1.07380254 4.34968954
+1.08015640 4.34716128
+1.08651026 4.34611783
+1.09286413 4.34663860
+1.09921799 4.34758866
+1.10557185 4.34836750
+1.11192571 4.34914531
+1.11827957 4.34958039
+1.12463343 4.35003899
+1.13098729 4.35014697
+1.13734115 4.35002141
+1.14369501 4.34987408
+1.15004888 4.34973832
+1.15640274 4.34945577
+1.16275660 4.34879209
+1.16911046 4.34814083
+1.17546432 4.34731869
+1.18181818 4.34624489
+1.18817204 4.34469651
+1.19452590 4.34288533
+1.20087977 4.34082275
+1.20723363 4.33851027
+1.21358749 4.33615665
+1.21994135 4.33335536
+1.22629521 4.33013730
+1.23264907 4.32664160
+1.23900293 4.32198901
+1.24535679 4.31616989
+1.25171065 4.31025501
+1.25806452 4.30433460
+1.26441838 4.29837199
+1.27077224 4.29236663
+1.27712610 4.28609815
+1.28347996 4.27962801
+1.28983382 4.27309980
+1.29618768 4.26651947
+1.30254154 4.25988662
+1.30889541 4.25320051
+1.31524927 4.24629927
+1.32160313 4.24005945
+1.32795699 4.23795316
+1.33431085 4.23585513
+1.34066471 4.23376527
+1.34701857 4.23168350
+1.35337243 4.22960435
+1.35972630 4.22753110
+1.36608016 4.22546570
+1.37243402 4.22340809
+1.37878788 4.22135819
+1.38514174 4.21931137
+1.39149560 4.21726922
+1.39784946 4.21523454
+1.40420332 4.21320729
+1.41055718 4.21118737
+1.41691105 4.20917103
+1.42326491 4.20715813
+1.42961877 4.20515236
+1.43597263 4.20315365
+1.44232649 4.20116193
+1.44868035 4.19917429
+1.45503421 4.19718890
+1.46138807 4.19521029
+1.46774194 4.19323841
+1.47409580 4.19127319
+1.48044966 4.18931257
+1.48680352 4.18735301
+1.49315738 4.18539991
+1.49951124 4.18345322
+1.50586510 4.18151287
+1.51221896 4.17957767
+1.51857283 4.17764235
+1.52492669 4.17571319
+1.53128055 4.17379013
+1.53763441 4.17187310
+1.54398827 4.16996178
+1.55034213 4.16804919
+1.55669599 4.16614246
+1.56304985 4.16424153
+1.56940371 4.16234634
+1.57575758 4.16045686
+1.58211144 4.15856612
+1.58846530 4.15668038
+1.59481916 4.15480017
+1.60117302 4.15292542
+1.60752688 4.15105609
+1.61388074 4.14918610
+1.62023460 4.14731998
+1.62658847 4.14545912
+1.63294233 4.14360345
+1.63929619 4.14175295
+1.64565005 4.13990238
+1.65200391 4.13805457
+1.65835777 4.13621175
+1.66471163 4.13437388
+1.67106549 4.13254091
+1.67741935 4.13070850
+1.68377322 4.12887773
+1.69012708 4.12705172
+1.69648094 4.12523040
+1.70283480 4.12341375
+1.70918866 4.12159827
+1.71554252 4.11978336
+1.72189638 4.11797295
+1.72825024 4.11616701
+1.73460411 4.11436550
+1.74095797 4.11256579
+1.74731183 4.11076557
+1.75366569 4.16815388
+1.76001955 4.16667554
+1.76637341 4.16410645
+1.77272727 4.16043775
+1.77908113 4.15638598
+1.78543500 4.15183330
+1.79178886 4.14667777
+1.79814272 4.14136638
+1.80449658 4.13570068
+1.81085044 4.12992982
+1.81720430 4.12387456
+1.82355816 4.11726659
+1.82991202 4.11042338
+1.83626588 4.10317095
+1.84261975 4.09581886
+1.84897361 4.08832336
+1.85532747 4.08042629
+1.86168133 4.07241751
+1.86803519 4.06429132
+1.87438905 4.05568572
+1.88074291 4.04633694
+1.88709677 4.03689612
+1.89345064 4.02761208
+1.89980450 4.01817993
+1.90615836 4.00859076
+1.91251222 3.99884449
+1.91886608 3.98920625
+1.92521994 3.97958231
+1.93157380 3.96973063
+1.93792766 3.96399899
+1.94428152 3.96201550
+1.95063539 3.96003562
+1.95698925 3.95805933
+1.96334311 3.95608658
+1.96969697 3.95411363
+1.97605083 3.95214101
+1.98240469 3.95017184
+1.98875855 3.94820607
+1.99511241 3.94624368
+2.00146628 3.94428172
+2.00782014 3.94231916
+2.01417400 3.94035987
+2.02052786 3.93840382
+2.02688172 3.93645098
+2.03323558 3.93449920
+2.03958944 3.93254591
+2.04594330 3.93059572
+2.05229717 3.92832105
+2.05865103 3.92627635
+2.06500489 3.92447527
+2.07135875 3.92277481
+2.07771261 3.92110473
+2.08406647 3.91946430
+2.09042033 3.91801074
+2.09677419 3.91668068
+2.10312805 3.91536878
+2.10948192 3.91408031
+2.11583578 3.91281472
+2.12218964 3.91172397
+2.12854350 3.91066873
+2.13489736 3.90968063
+2.14125122 3.90866978
+2.14760508 3.90758799
+2.15395894 3.90652395
+2.16031281 3.90547728
+2.16666667 3.90444268
+2.17302053 3.90342393
+2.17937439 3.90242153
+2.18572825 3.90148645
+2.19208211 3.90044592
+2.19843597 3.89939315
+2.20478983 3.89835323
+2.21114370 3.89732738
+2.21749756 3.89631533
+2.22385142 3.89532342
+2.23020528 3.89423978
+2.23655914 3.89316626
+2.24291300 3.89208563
+2.24926686 3.89092119
+2.25562072 3.76337314
+2.26197458 3.76081058
+2.26832845 3.75822085
+2.27468231 3.75551510
+2.28103617 3.75278784
+2.28739003 3.75004999
+2.29374389 3.74729617
+2.30009775 3.74452493
+2.30645161 3.74170572
+2.31280547 3.73878316
+2.31915934 3.73582261
+2.32551320 3.73283947
+2.33186706 3.72983299
+2.33822092 3.72680713
+2.34457478 3.72376166
+2.35092864 3.72069632
+2.35728250 3.71760993
+2.36363636 3.71449828
+2.36999022 3.71136598
+2.37634409 3.70821278
+2.38269795 3.70489596
+2.38905181 3.70154910
+2.39540567 3.69815149
+2.40175953 3.69472082
+2.40811339 3.69126224
+2.41446725 3.68777534
+2.42082111 3.68425972
+2.42717498 3.68070953
+2.43352884 3.67712936
+2.43988270 3.67351920
+2.44623656 3.66987859
+2.45259042 3.66620712
+2.45894428 3.66249957
+2.46529814 3.65875916
+2.47165200 3.65498647
+2.47800587 3.65104597
+2.48435973 3.64701800
+2.49071359 3.64293652
+2.49706745 3.63878867
+2.50342131 3.63659673
+2.50977517 3.63611399
+2.51612903 3.63561093
+2.52248289 3.63510324
+2.52883675 3.63453444
+2.53519062 3.63385004
+2.54154448 3.63317427
+2.54789834 3.63250700
+2.55425220 3.63184550
+2.56060606 3.63118938
+2.56695992 3.63054136
+2.57331378 3.62990130
+2.57966764 3.62926907
+2.58602151 3.62864268
+2.59237537 3.62802052
+2.59872923 3.62740583
+2.60508309 3.62679849
+2.61143695 3.62618413
+2.61779081 3.62554215
+2.62414467 3.62488392
+2.63049853 3.62406075
+2.63685239 3.62318956
+2.64320626 3.62232742
+2.64956012 3.62147802
+2.65591398 3.62064524
+2.66226784 3.61982108
+2.66862170 3.61902917
+2.67497556 3.61825984
+2.68132942 3.61749945
+2.68768328 3.61673378
+2.69403715 3.61592994
+2.70039101 3.61501009
+2.70674487 3.61408072
+2.71309873 3.61321512
+2.71945259 3.61235895
+2.72580645 3.61151329
+2.73216031 3.61064326
+2.73851417 3.60961746
+2.74486804 3.60859393
+2.75122190 3.60702762
+2.75757576 3.60351398
+2.76392962 3.59960789
+2.77028348 3.59555467
+2.77663734 3.59147098
+2.78299120 3.58703970
+2.78934506 3.58242764
+2.79569892 3.57776988
+2.80205279 3.57306558
+2.80840665 3.56829409
+2.81476051 3.56334023
+2.82111437 3.55802164
+2.82746823 3.55251633
+2.83382209 3.54693068
+2.84017595 3.54126260
+2.84652981 3.53550824
+2.85288368 3.52966479
+2.85923754 3.52373194
+2.86559140 3.51744075
+2.87194526 3.51081525
+2.87829912 3.50398168
+2.88465298 3.49701812
+2.89100684 3.48987377
+2.89736070 3.48252541
+2.90371457 3.47502794
+2.91006843 3.46722539
+2.91642229 3.45888634
+2.92277615 3.45055564
+2.92913001 3.44204877
+2.93548387 3.43336011
+2.94183773 3.42460297
+2.94819159 3.41528161
+2.95454545 3.40565175
+2.96089932 3.40300714
+2.96725318 3.40043451
+2.97360704 3.39786239
+2.97996090 3.39528792
+2.98631476 3.39271389
+2.99266862 3.39014036
+2.99902248 3.38756888
+3.00537634 3.38500034
+3.01173021 3.38243001
+3.01808407 3.38007765
+3.02443793 3.37787501
+3.03079179 3.37552494
+3.03714565 3.37340204
+3.04349951 3.37111671
+3.04985337 3.36882418
+3.05620723 3.36662318
+3.06256109 3.36450384
+3.06891496 3.36240980
+3.07526882 3.36033602
+3.08162268 3.35835345
+3.08797654 3.35647890
+3.09433040 3.35462247
+3.10068426 3.35277157
+3.10703812 3.35090734
+3.11339198 3.34899388
+3.11974585 3.34690989
+3.12609971 3.34481953
+3.13245357 3.34259889
+3.13880743 3.34027538
+3.14516129 3.33788302
+3.15151515 3.33541209
+3.15786901 3.33287539
+3.16422287 3.33020839
+3.17057674 3.32753274
+3.17693060 3.32484854
+3.18328446 3.32215720
+3.18963832 3.31945931
+3.19599218 3.31667743
+3.20234604 3.31378377
+3.20869990 3.31088178
+3.21505376 3.30797303
+3.22140762 3.30519492
+3.22776149 3.30243306
+3.23411535 3.29966916
+3.24046921 3.29698360
+3.24682307 3.29438892
+3.25317693 3.29169494
+3.25953079 3.28891268
+3.26588465 3.28630351
+3.27223851 3.28369610
+3.27859238 3.28109052
+3.28494624 3.27860857
+3.29130010 3.27619341
+3.29765396 3.27372222
+3.30400782 3.27116176
+3.31036168 3.26874774
+3.31671554 3.26596679
+3.32306940 3.26308532
+3.32942326 3.26019945
+3.33577713 3.25734721
+3.34213099 3.25458122
+3.34848485 3.25172732
+3.35483871 3.24879215
+3.36119257 3.24576566
+3.36754643 3.24271852
+3.37390029 3.23961927
+3.38025415 3.23641405
+3.38660802 3.23321121
+3.39296188 3.22976019
+3.39931574 3.22637810
+3.40566960 3.22279662
+3.41202346 3.21915441
+3.41837732 3.21527248
+3.42473118 3.21129762
+3.43108504 3.20713137
+3.43743891 3.20292699
+3.44379277 3.19841827
+3.45014663 3.19381075
+3.45650049 3.18886054
+3.46285435 3.18335924
+3.46920821 3.17702423
+3.47556207 3.17049682
+3.48191593 3.16377804
+3.48826979 3.15683580
+3.49462366 3.15177725
+3.50097752 3.14803572
+3.50733138 3.14419775
+3.51368524 3.14044671
+3.52003910 3.13665574
+3.52639296 3.13280620
+3.53274682 3.12889965
+3.53910068 3.12512947
+3.54545455 3.12126138
+3.55180841 3.11732325
+3.55816227 3.11337877
+3.56451613 3.10955691
+3.57086999 3.10568995
+3.57722385 3.10181269
+3.58357771 3.09811330
+3.58993157 3.09438699
+3.59628543 3.09086132
+3.60263930 3.08751561
+3.60899316 3.08415516
+3.61534702 3.08099062
+3.62170088 3.07776100
+3.62805474 3.07468958
+3.63440860 3.07176252
+3.64076246 3.06907851
+3.64711632 3.06688891
+3.65347019 3.06484834
+3.65982405 3.06284108
+3.66617791 3.06094316
+3.67253177 3.05894665
+3.67888563 3.05703324
+3.68523949 3.05164677
+3.69159335 3.04363857
+3.69794721 3.03471641
+3.70430108 3.02543208
+3.71065494 3.01589929
+3.71700880 3.00553223
+3.72336266 2.99463175
+3.72971652 2.98325797
+3.73607038 2.97164536
+3.74242424 2.95913845
+3.74877810 2.94665618
+3.75513196 2.93476834
+3.76148583 2.92401169
+3.76783969 2.91397295
+3.77419355 2.90500583
+3.78054741 2.89739564
+3.78690127 2.89023994
+3.79325513 2.88386471
+3.79960899 2.87814643
+3.80596285 2.87333892
+3.81231672 2.86877440
+3.81867058 2.86469132
+3.82502444 2.86094168
+3.83137830 2.85747363
+3.83773216 2.85439583
+3.84408602 2.85144970
+3.85043988 2.84854948
+3.85679374 2.84569551
+3.86314761 2.84293338
+3.86950147 2.84039038
+3.87585533 2.83818725
+3.88220919 2.83628229
+3.88856305 2.83439521
+3.89491691 2.83251336
+3.90127077 2.83063091
+3.90762463 2.82874730
+3.91397849 2.82686252
+3.92033236 2.82497962
+3.92668622 2.82309721
+3.93304008 2.82121357
+3.93939394 2.81932867
+3.94574780 2.81744251
+3.95210166 2.81555763
+3.95845552 2.81367374
+3.96480938 2.81178852
+3.97116325 2.80990194
+3.97751711 2.80801400
+3.98387097 2.80612671
+3.99022483 2.80424094
+3.99657869 2.80235372
+4.00293255 2.80046506
+4.00928641 2.79857491
+4.01564027 2.79668478
+4.02199413 2.79479670
+4.02834800 2.79290707
+4.03470186 2.79101588
+4.04105572 2.78912311
+4.04740958 2.78722967
+4.05376344 2.78533883
+4.06011730 2.78344635
+4.06647116 2.78155219
+4.07282502 2.77965634
+4.07917889 2.77775913
+4.08553275 2.77586508
+4.09188661 2.77396927
+4.09824047 2.77207168
+4.10459433 2.77017228
+4.11094819 2.76827109
+4.11730205 2.76637434
+4.12365591 2.76447607
+4.13000978 2.76259577
+4.13636364 2.76075882
+4.14271750 2.75893517
+4.14907136 2.75713151
+4.15542522 2.75534631
+4.16177908 2.75358066
+4.16813294 2.75148207
+4.17448680 2.74737957
+4.18084066 2.74328575
+4.18719453 2.73904082
+4.19354839 2.73500045
+4.19990225 2.73095663
+4.20625611 2.72730610
+4.21260997 2.72385368
+4.21896383 2.72065040
+4.22531769 2.71721572
+4.23167155 2.71426493
+4.23802542 2.71137767
+4.24437928 2.70845631
+4.25073314 2.70550205
+4.25708700 2.69996380
+4.26344086 2.69440475
+4.26979472 2.68881807
+4.27614858 2.68315293
+4.28250244 2.67735284
+4.28885630 2.67153447
+4.29521017 2.66571019
+4.30156403 2.65989453
+4.30791789 2.65390481
+4.31427175 2.64708228
+4.32062561 2.64037670
+4.32697947 2.63438347
+4.33333333 2.62861133
+4.33968719 2.62304526
+4.34604106 2.61768259
+4.35239492 2.61251066
+4.35874878 2.60752294
+4.36510264 2.60271328
+4.37145650 2.59807611
+4.37781036 2.59361216
+4.38416422 2.58930980
+4.39051808 2.58516418
+4.39687195 2.58117070
+4.40322581 2.57732505
+4.40957967 2.57362922
+4.41593353 2.57007381
+4.42228739 2.56665466
+4.42864125 2.56336836
+4.43499511 2.56021170
+4.44134897 2.55718697
+4.44770283 2.55428733
+4.45405670 2.55150882
+4.46041056 2.54884895
+4.46676442 2.54630540
+4.47311828 2.54388055
+4.47947214 2.54156989
+4.48582600 2.53936947
+4.49217986 2.53727757
+4.49853372 2.53529258
+4.50488759 2.53341685
+4.51124145 2.53164806
+4.51759531 2.52998217
+4.52394917 2.52841809
+4.53030303 2.52695485
+4.53665689 2.52559467
+4.54301075 2.52433737
+4.54936461 2.52317872
+4.55571848 2.52211823
+4.56207234 2.52115550
+4.56842620 2.52029257
+4.57478006 2.51953144
+4.58113392 2.51886761
+4.58748778 2.51830117
+4.59384164 2.51783230
+4.60019550 2.51746288
+4.60654936 2.51719708
+4.61290323 2.51703018
+4.61925709 2.51696285
+4.62561095 2.51699591
+4.63196481 2.51713108
+4.63831867 2.51737487
+4.64467253 2.51772231
+4.65102639 2.51817478
+4.65738025 2.51365912
+4.66373412 2.50812539
+4.67008798 2.50254117
+4.67644184 2.49690585
+4.68279570 2.49122666
+4.68914956 2.48551165
+4.69550342 2.48013193
+4.70185728 2.47482314
+4.70821114 2.46951049
+4.71456500 2.46420298
+4.72091887 2.45891090
+4.72727273 2.45364485
+4.73362659 2.44842132
+4.73998045 2.44324745
+4.74633431 2.43829931
+4.75268817 2.43276374
+4.75904203 2.42594901
+4.76539589 2.41929175
+4.77174976 2.41266990
+4.77810362 2.40605558
+4.78445748 2.39925032
+4.79081134 2.39250730
+4.79716520 2.38586294
+4.80351906 2.37967484
+4.80987292 2.37356953
+4.81622678 2.36760890
+4.82258065 2.36164133
+4.82893451 2.35521881
+4.83528837 2.34873027
+4.84164223 2.34243033
+4.84799609 2.33632066
+4.85434995 2.33039904
+4.86070381 2.32481692
+4.86705767 2.31953567
+4.87341153 2.31441875
+4.87976540 2.30946679
+4.88611926 2.30477217
+4.89247312 2.30022466
+4.89882698 2.29582445
+4.90518084 2.29156138
+4.91153470 2.28743097
+4.91788856 2.28342860
+4.92424242 2.27955015
+4.93059629 2.27579688
+4.93695015 2.27215754
+4.94330401 2.26862746
+4.94965787 2.26530921
+4.95601173 2.26211366
+4.96236559 2.25901275
+4.96871945 2.25599608
+4.97507331 2.25305960
+4.98142717 2.25019972
+4.98778104 2.24741298
+4.99413490 2.24474210
+5.00048876 2.24213855
+5.00684262 2.23959626
+5.01319648 2.23711290
+5.01955034 2.23468644
+5.02590420 2.23232023
+5.03225806 2.23000972
+5.03861193 2.22775220
+5.04496579 2.22554726
+5.05131965 2.22339513
+5.05767351 2.22130091
+5.06402737 2.21926461
+5.07038123 2.21728613
+5.07673509 2.21536907
+5.08308895 2.21351825
+5.08944282 2.21174342
+5.09579668 2.21005250
+5.10215054 2.20845203
+5.10850440 2.20695434
+5.11485826 2.20557445
+5.12121212 2.20433321
+5.12756598 2.20325400
+5.13391984 2.20235861
+5.14027370 2.20167781
+5.14662757 2.20124760
+5.15298143 2.20111168
+5.15933529 2.20132119
+5.16568915 2.20193404
+5.17204301 2.20307241
+5.17839687 2.20475357
+5.18475073 2.20726794
+5.19110459 2.21067269
+5.19745846 2.21491846
+5.20381232 2.22008426
+5.21016618 2.22646298
+5.21652004 2.23442174
+5.22287390 2.24385294
+5.22922776 2.24551921
+5.23558162 2.24815352
+5.24193548 2.25200556
+5.24828935 2.25714357
+5.25464321 2.25724236
+5.26099707 2.25616649
+5.26735093 2.25520784
+5.27370479 2.25248810
+5.28005865 2.24548917
+5.28641251 2.23618077
+5.29276637 2.22750996
+5.29912023 2.21983090
+5.30547410 2.21317646
+5.31182796 2.20715601
+5.31818182 2.20179151
+5.32453568 2.19721742
+5.33088954 2.19294220
+5.33724340 2.18926362
+5.34359726 2.18576371
+5.34995112 2.18274758
+5.35630499 2.17987881
+5.36265885 2.17713283
+5.36901271 2.17468567
+5.37536657 2.17233874
+5.38172043 2.17006553
+5.38807429 2.16786008
+5.39442815 2.16579907
+5.40078201 2.16380630
+5.40713587 2.16184094
+5.41348974 2.15990253
+5.41984360 2.15799046
+5.42619746 2.15609712
+5.43255132 2.15422018
+5.43890518 2.15235753
+5.44525904 2.15050915
+5.45161290 2.14867742
+5.45796676 2.14685502
+5.46432063 2.14504070
+5.47067449 2.14323338
+5.47702835 2.14143305
+5.48338221 2.13964470
+5.48973607 2.13786091
+5.49608993 2.13608110
+5.50244379 2.13432811
+5.50879765 2.13264953
+5.51515152 2.13098914
+5.52150538 2.12933904
+5.52785924 2.12769901
+5.53421310 2.12606893
+5.54056696 2.12444872
+5.54692082 2.12297169
+5.55327468 2.12151101
+5.55962854 2.12000896
+5.56598240 2.11852374
+5.57233627 2.11705545
+5.57869013 2.11576567
+5.58504399 2.11453786
+5.59139785 2.11333588
+5.59775171 2.11220915
+5.60410557 2.11125442
+5.61045943 2.11033818
+5.61681329 2.10945768
+5.62316716 2.10879468
+5.62952102 2.10825077
+5.63587488 2.10774775
+5.64222874 2.10752398
+5.64858260 2.10735134
+5.65493646 2.10726066
+5.66129032 2.10750332
+5.66764418 2.10779560
+5.67399804 2.10835799
+5.68035191 2.10902043
+5.68670577 2.10984600
+5.69305963 2.11097904
+5.69941349 2.11222876
+5.70576735 2.11373651
+5.71212121 2.11528838
+5.71847507 2.11718851
+5.72482893 2.11914029
+5.73118280 2.12140684
+5.73753666 2.12370922
+5.74389052 2.12586442
+5.75024438 2.12753370
+5.75659824 2.12895198
+5.76295210 2.12981477
+5.76930596 2.13011125
+5.77565982 2.12994191
+5.78201369 2.12933282
+5.78836755 2.12820110
+5.79472141 2.12646697
+5.80107527 2.12412333
+5.80742913 2.12143814
+5.81378299 2.11846532
+5.82013685 2.11546501
+5.82649071 2.11243946
+5.83284457 2.10938833
+5.83919844 2.10641445
+5.84555230 2.10343192
+5.85190616 2.10042326
+5.85826002 2.09738809
+5.86461388 2.09432602
+5.87096774 2.09133192
+5.87732160 2.08834373
+5.88367546 2.08532809
+5.89002933 2.08228458
+5.89638319 2.07921279
+5.90273705 2.07619828
+5.90909091 2.07320629
+5.91544477 2.07018544
+5.92179863 2.06713530
+5.92815249 2.06405538
+5.93450635 2.06102044
+5.94086022 2.05802700
+5.94721408 2.05500322
+5.95356794 2.05194862
+5.95992180 2.04886268
+5.96627566 2.04580749
+5.97262952 2.04281556
+5.97898338 2.03979173
+5.98533724 2.03673546
+5.99169110 2.03364618
+5.99804497 2.03057122
+6.00439883 2.02758451
+6.01075269 2.02456426
+6.01710655 2.02150987
+6.02346041 2.01842071
+6.02981427 2.01532679
+6.03616813 2.01234998
+6.04252199 2.00933789
+6.04887586 2.00628987
+6.05522972 2.00320521
+6.06158358 1.99367430
+6.06793744 1.98376780
+6.07429130 1.97466694
+6.08064516 1.96634034
+6.08699902 1.95875037
+6.09335288 1.95185501
+6.09970674 1.94600727
+6.10606061 1.94074745
+6.11241447 1.93600522
+6.11876833 1.93173876
+6.12512219 1.92790747
+6.13147605 1.92468156
+6.13782991 1.92183518
+6.14418377 1.91928890
+6.15053763 1.91701322
+6.15689150 1.91498087
+6.16324536 1.91327102
+6.16959922 1.91178585
+6.17595308 1.91046069
+6.18230694 1.90927830
+6.18866080 1.90822309
+6.19501466 1.90733119
+6.20136852 1.90656708
+6.20772239 1.90588399
+6.21407625 1.90527278
+6.22043011 1.90472528
+6.22678397 1.90425780
+6.23313783 1.90386237
+6.23949169 1.90350656
+6.24584555 1.90308083
+6.25219941 1.90118262
+6.25855327 1.90112632
+6.26490714 1.90107469
+6.27126100 1.90102316
+6.27761486 1.90097173
+6.28396872 1.90092039
+6.29032258 1.90087093
+6.29667644 1.90082693
+6.30303030 1.90078302
+6.30938416 1.90073919
+6.31573803 1.90069544
+6.32209189 1.90065273
+6.32844575 1.90061628
+6.33479961 1.90057990
+6.34115347 1.90054359
+6.34750733 1.90050735
+6.35386119 1.90047129
+6.36021505 1.90044231
+6.36656891 1.90041337
+6.37292278 1.90038449
+6.37927664 1.90035566
+6.38563050 1.90032689
+6.39198436 1.90030458
+6.39833822 1.90028301
+6.40469208 1.90026147
+6.41104594 1.90023998
+6.41739980 1.90021852
+6.42375367 1.90020269
+6.43010753 1.90018839
+6.43646139 1.90017411
+6.44281525 1.90015986
+6.44916911 1.90014564
+6.45552297 1.90013620
+6.46187683 1.90012909
+6.46823069 1.90012200
+6.47458456 1.90011492
+6.48093842 1.90010785
+6.48729228 1.90010472
+6.49364614 1.90010472
+6.50000000 1.90010472
diff --git a/examples/mamdani/AllTerms.fll b/examples/mamdani/AllTerms.fll
new file mode 100644
index 0000000..58d5705
--- /dev/null
+++ b/examples/mamdani/AllTerms.fll
@@ -0,0 +1,77 @@
+Engine: qtfuzzylite
+InputVariable: AllInputTerms
+ enabled: true
+ range: 0.000 6.500
+ term: A Sigmoid 0.500 -20.000
+ term: B ZShape 0.000 1.000
+ term: C Ramp 1.000 0.000
+ term: D Triangle 0.500 1.000 1.500
+ term: E Trapezoid 1.000 1.250 1.750 2.000
+ term: F Concave 0.850 0.250
+ term: G Rectangle 1.750 2.250
+ term: H Discrete 2.000 0.000 2.250 1.000 2.500 0.500 2.750 1.000 3.000 0.000
+ term: I Gaussian 3.000 0.200
+ term: J Cosine 3.250 0.650
+ term: K GaussianProduct 3.500 0.100 3.300 0.300
+ term: L Spike 3.640 1.040
+ term: M Bell 4.000 0.250 3.000
+ term: N PiShape 4.000 4.500 4.500 5.000
+ term: O Concave 5.650 6.250
+ term: P SigmoidDifference 4.750 10.000 30.000 5.250
+ term: Q SigmoidProduct 5.250 20.000 -10.000 5.750
+ term: R Ramp 5.500 6.500
+ term: S SShape 5.500 6.500
+ term: T Sigmoid 6.000 20.000
+OutputVariable: AllOutputTerms
+ enabled: true
+ range: 0.000 6.500
+ accumulation: Maximum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: A Sigmoid 0.500 -20.000
+ term: B ZShape 0.000 1.000
+ term: C Ramp 1.000 0.000
+ term: D Triangle 0.500 1.000 1.500
+ term: E Trapezoid 1.000 1.250 1.750 2.000
+ term: F Concave 0.850 0.250
+ term: G Rectangle 1.750 2.250
+ term: H Discrete 2.000 0.000 2.250 1.000 2.500 0.500 2.750 1.000 3.000 0.000
+ term: I Gaussian 3.000 0.200
+ term: J Cosine 3.250 0.650
+ term: K GaussianProduct 3.500 0.100 3.300 0.300
+ term: L Spike 3.640 1.040
+ term: M Bell 4.000 0.250 3.000
+ term: N PiShape 4.000 4.500 4.500 5.000
+ term: O Concave 5.650 6.250
+ term: P SigmoidDifference 4.750 10.000 30.000 5.250
+ term: Q SigmoidProduct 5.250 20.000 -10.000 5.750
+ term: R Ramp 5.500 6.500
+ term: S SShape 5.500 6.500
+ term: T Sigmoid 6.000 20.000
+RuleBlock:
+ enabled: true
+ conjunction: Minimum
+ disjunction: Maximum
+ activation: Minimum
+ rule: if AllInputTerms is A then AllOutputTerms is T
+ rule: if AllInputTerms is B then AllOutputTerms is S
+ rule: if AllInputTerms is C then AllOutputTerms is R
+ rule: if AllInputTerms is D then AllOutputTerms is Q
+ rule: if AllInputTerms is E then AllOutputTerms is P
+ rule: if AllInputTerms is F then AllOutputTerms is O
+ rule: if AllInputTerms is G then AllOutputTerms is N
+ rule: if AllInputTerms is H then AllOutputTerms is M
+ rule: if AllInputTerms is I then AllOutputTerms is L
+ rule: if AllInputTerms is J then AllOutputTerms is K
+ rule: if AllInputTerms is K then AllOutputTerms is J
+ rule: if AllInputTerms is L then AllOutputTerms is I
+ rule: if AllInputTerms is M then AllOutputTerms is H
+ rule: if AllInputTerms is N then AllOutputTerms is G
+ rule: if AllInputTerms is O then AllOutputTerms is F
+ rule: if AllInputTerms is P then AllOutputTerms is E
+ rule: if AllInputTerms is Q then AllOutputTerms is D
+ rule: if AllInputTerms is R then AllOutputTerms is C
+ rule: if AllInputTerms is S then AllOutputTerms is B
+ rule: if AllInputTerms is T then AllOutputTerms is A \ No newline at end of file
diff --git a/examples/mamdani/AllTerms.java b/examples/mamdani/AllTerms.java
new file mode 100644
index 0000000..c59f9a1
--- /dev/null
+++ b/examples/mamdani/AllTerms.java
@@ -0,0 +1,105 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class AllTerms{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("qtfuzzylite");
+
+InputVariable inputVariable = new InputVariable();
+inputVariable.setEnabled(true);
+inputVariable.setName("AllInputTerms");
+inputVariable.setRange(0.000, 6.500);
+inputVariable.addTerm(new Sigmoid("A", 0.500, -20.000));
+inputVariable.addTerm(new ZShape("B", 0.000, 1.000));
+inputVariable.addTerm(new Ramp("C", 1.000, 0.000));
+inputVariable.addTerm(new Triangle("D", 0.500, 1.000, 1.500));
+inputVariable.addTerm(new Trapezoid("E", 1.000, 1.250, 1.750, 2.000));
+inputVariable.addTerm(new Concave("F", 0.850, 0.250));
+inputVariable.addTerm(new Rectangle("G", 1.750, 2.250));
+inputVariable.addTerm(Discrete.create("H", 2.000, 0.000, 2.250, 1.000, 2.500, 0.500, 2.750, 1.000, 3.000, 0.000));
+inputVariable.addTerm(new Gaussian("I", 3.000, 0.200));
+inputVariable.addTerm(new Cosine("J", 3.250, 0.650));
+inputVariable.addTerm(new GaussianProduct("K", 3.500, 0.100, 3.300, 0.300));
+inputVariable.addTerm(new Spike("L", 3.640, 1.040));
+inputVariable.addTerm(new Bell("M", 4.000, 0.250, 3.000));
+inputVariable.addTerm(new PiShape("N", 4.000, 4.500, 4.500, 5.000));
+inputVariable.addTerm(new Concave("O", 5.650, 6.250));
+inputVariable.addTerm(new SigmoidDifference("P", 4.750, 10.000, 30.000, 5.250));
+inputVariable.addTerm(new SigmoidProduct("Q", 5.250, 20.000, -10.000, 5.750));
+inputVariable.addTerm(new Ramp("R", 5.500, 6.500));
+inputVariable.addTerm(new SShape("S", 5.500, 6.500));
+inputVariable.addTerm(new Sigmoid("T", 6.000, 20.000));
+engine.addInputVariable(inputVariable);
+
+OutputVariable outputVariable = new OutputVariable();
+outputVariable.setEnabled(true);
+outputVariable.setName("AllOutputTerms");
+outputVariable.setRange(0.000, 6.500);
+outputVariable.fuzzyOutput().setAccumulation(new Maximum());
+outputVariable.setDefuzzifier(new Centroid(200));
+outputVariable.setDefaultValue(Double.NaN);
+outputVariable.setLockPreviousOutputValue(false);
+outputVariable.setLockOutputValueInRange(false);
+outputVariable.addTerm(new Sigmoid("A", 0.500, -20.000));
+outputVariable.addTerm(new ZShape("B", 0.000, 1.000));
+outputVariable.addTerm(new Ramp("C", 1.000, 0.000));
+outputVariable.addTerm(new Triangle("D", 0.500, 1.000, 1.500));
+outputVariable.addTerm(new Trapezoid("E", 1.000, 1.250, 1.750, 2.000));
+outputVariable.addTerm(new Concave("F", 0.850, 0.250));
+outputVariable.addTerm(new Rectangle("G", 1.750, 2.250));
+outputVariable.addTerm(Discrete.create("H", 2.000, 0.000, 2.250, 1.000, 2.500, 0.500, 2.750, 1.000, 3.000, 0.000));
+outputVariable.addTerm(new Gaussian("I", 3.000, 0.200));
+outputVariable.addTerm(new Cosine("J", 3.250, 0.650));
+outputVariable.addTerm(new GaussianProduct("K", 3.500, 0.100, 3.300, 0.300));
+outputVariable.addTerm(new Spike("L", 3.640, 1.040));
+outputVariable.addTerm(new Bell("M", 4.000, 0.250, 3.000));
+outputVariable.addTerm(new PiShape("N", 4.000, 4.500, 4.500, 5.000));
+outputVariable.addTerm(new Concave("O", 5.650, 6.250));
+outputVariable.addTerm(new SigmoidDifference("P", 4.750, 10.000, 30.000, 5.250));
+outputVariable.addTerm(new SigmoidProduct("Q", 5.250, 20.000, -10.000, 5.750));
+outputVariable.addTerm(new Ramp("R", 5.500, 6.500));
+outputVariable.addTerm(new SShape("S", 5.500, 6.500));
+outputVariable.addTerm(new Sigmoid("T", 6.000, 20.000));
+engine.addOutputVariable(outputVariable);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(new Minimum());
+ruleBlock.setDisjunction(new Maximum());
+ruleBlock.setActivation(new Minimum());
+ruleBlock.addRule(Rule.parse("if AllInputTerms is A then AllOutputTerms is T", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is B then AllOutputTerms is S", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is C then AllOutputTerms is R", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is D then AllOutputTerms is Q", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is E then AllOutputTerms is P", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is F then AllOutputTerms is O", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is G then AllOutputTerms is N", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is H then AllOutputTerms is M", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is I then AllOutputTerms is L", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is J then AllOutputTerms is K", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is K then AllOutputTerms is J", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is L then AllOutputTerms is I", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is M then AllOutputTerms is H", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is N then AllOutputTerms is G", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is O then AllOutputTerms is F", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is P then AllOutputTerms is E", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is Q then AllOutputTerms is D", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is R then AllOutputTerms is C", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is S then AllOutputTerms is B", engine));
+ruleBlock.addRule(Rule.parse("if AllInputTerms is T then AllOutputTerms is A", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/mamdani/Laundry.cpp b/examples/mamdani/Laundry.cpp
new file mode 100644
index 0000000..7fbcb11
--- /dev/null
+++ b/examples/mamdani/Laundry.cpp
@@ -0,0 +1,67 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("Laundry");
+
+InputVariable* inputVariable1 = new InputVariable;
+inputVariable1->setEnabled(true);
+inputVariable1->setName("Load");
+inputVariable1->setRange(0.000, 6.000);
+inputVariable1->addTerm(Discrete::create("small", 8, 0.000, 1.000, 1.000, 1.000, 2.000, 0.800, 5.000, 0.000));
+inputVariable1->addTerm(Discrete::create("normal", 6, 3.000, 0.000, 4.000, 1.000, 6.000, 0.000));
+engine->addInputVariable(inputVariable1);
+
+InputVariable* inputVariable2 = new InputVariable;
+inputVariable2->setEnabled(true);
+inputVariable2->setName("Dirt");
+inputVariable2->setRange(0.000, 6.000);
+inputVariable2->addTerm(Discrete::create("low", 6, 0.000, 1.000, 2.000, 0.800, 5.000, 0.000));
+inputVariable2->addTerm(Discrete::create("high", 8, 1.000, 0.000, 2.000, 0.200, 4.000, 0.800, 6.000, 1.000));
+engine->addInputVariable(inputVariable2);
+
+OutputVariable* outputVariable1 = new OutputVariable;
+outputVariable1->setEnabled(true);
+outputVariable1->setName("Detergent");
+outputVariable1->setRange(0.000, 80.000);
+outputVariable1->fuzzyOutput()->setAccumulation(new Maximum);
+outputVariable1->setDefuzzifier(new MeanOfMaximum(500));
+outputVariable1->setDefaultValue(fl::nan);
+outputVariable1->setLockPreviousOutputValue(false);
+outputVariable1->setLockOutputValueInRange(false);
+outputVariable1->addTerm(Discrete::create("less", 6, 10.000, 0.000, 40.000, 1.000, 50.000, 0.000));
+outputVariable1->addTerm(Discrete::create("normal", 8, 40.000, 0.000, 50.000, 1.000, 60.000, 1.000, 80.000, 0.000));
+outputVariable1->addTerm(Discrete::create("more", 4, 50.000, 0.000, 80.000, 1.000));
+engine->addOutputVariable(outputVariable1);
+
+OutputVariable* outputVariable2 = new OutputVariable;
+outputVariable2->setEnabled(true);
+outputVariable2->setName("Cycle");
+outputVariable2->setRange(0.000, 20.000);
+outputVariable2->fuzzyOutput()->setAccumulation(new Maximum);
+outputVariable2->setDefuzzifier(new MeanOfMaximum(500));
+outputVariable2->setDefaultValue(fl::nan);
+outputVariable2->setLockPreviousOutputValue(false);
+outputVariable2->setLockOutputValueInRange(false);
+outputVariable2->addTerm(Discrete::create("short", 6, 0.000, 1.000, 10.000, 1.000, 20.000, 0.000));
+outputVariable2->addTerm(Discrete::create("long", 4, 10.000, 0.000, 20.000, 1.000));
+engine->addOutputVariable(outputVariable2);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(new Minimum);
+ruleBlock->setDisjunction(new Maximum);
+ruleBlock->setActivation(new Minimum);
+ruleBlock->addRule(fl::Rule::parse("if Load is small and Dirt is not high then Detergent is less", engine));
+ruleBlock->addRule(fl::Rule::parse("if Load is small and Dirt is high then Detergent is normal", engine));
+ruleBlock->addRule(fl::Rule::parse("if Load is normal and Dirt is low then Detergent is less", engine));
+ruleBlock->addRule(fl::Rule::parse("if Load is normal and Dirt is high then Detergent is more", engine));
+ruleBlock->addRule(fl::Rule::parse("if Detergent is normal or Detergent is less then Cycle is short", engine));
+ruleBlock->addRule(fl::Rule::parse("if Detergent is more then Cycle is long", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/mamdani/Laundry.fcl b/examples/mamdani/Laundry.fcl
new file mode 100644
index 0000000..a5d5380
--- /dev/null
+++ b/examples/mamdani/Laundry.fcl
@@ -0,0 +1,56 @@
+FUNCTION_BLOCK Laundry
+
+VAR_INPUT
+ Load: REAL;
+ Dirt: REAL;
+END_VAR
+
+VAR_OUTPUT
+ Detergent: REAL;
+ Cycle: REAL;
+END_VAR
+
+FUZZIFY Load
+ RANGE := (0.000 .. 6.000);
+ TERM small := (0.000, 1.000) (1.000, 1.000) (2.000, 0.800) (5.000, 0.000);
+ TERM normal := (3.000, 0.000) (4.000, 1.000) (6.000, 0.000);
+END_FUZZIFY
+
+FUZZIFY Dirt
+ RANGE := (0.000 .. 6.000);
+ TERM low := (0.000, 1.000) (2.000, 0.800) (5.000, 0.000);
+ TERM high := (1.000, 0.000) (2.000, 0.200) (4.000, 0.800) (6.000, 1.000);
+END_FUZZIFY
+
+DEFUZZIFY Detergent
+ RANGE := (0.000 .. 80.000);
+ TERM less := (10.000, 0.000) (40.000, 1.000) (50.000, 0.000);
+ TERM normal := (40.000, 0.000) (50.000, 1.000) (60.000, 1.000) (80.000, 0.000);
+ TERM more := (50.000, 0.000) (80.000, 1.000);
+ METHOD : MM;
+ ACCU : MAX;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY Cycle
+ RANGE := (0.000 .. 20.000);
+ TERM short := (0.000, 1.000) (10.000, 1.000) (20.000, 0.000);
+ TERM long := (10.000, 0.000) (20.000, 1.000);
+ METHOD : MM;
+ ACCU : MAX;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ AND : MIN;
+ OR : MAX;
+ ACT : MIN;
+ RULE 1 : if Load is small and Dirt is not high then Detergent is less
+ RULE 2 : if Load is small and Dirt is high then Detergent is normal
+ RULE 3 : if Load is normal and Dirt is low then Detergent is less
+ RULE 4 : if Load is normal and Dirt is high then Detergent is more
+ RULE 5 : if Detergent is normal or Detergent is less then Cycle is short
+ RULE 6 : if Detergent is more then Cycle is long
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/mamdani/Laundry.fld b/examples/mamdani/Laundry.fld
new file mode 100644
index 0000000..f72dfb6
--- /dev/null
+++ b/examples/mamdani/Laundry.fld
@@ -0,0 +1,1026 @@
+#@Engine: Laundry;
+#@InputVariable: Load; @InputVariable: Dirt; @OutputVariable: Detergent; @OutputVariable: Cycle;
+0.00000000 0.00000000 39.92000000 5.00000000
+0.00000000 0.19354839 39.92000000 5.00000000
+0.00000000 0.38709677 39.92000000 5.00000000
+0.00000000 0.58064516 39.92000000 5.00000000
+0.00000000 0.77419355 39.92000000 5.00000000
+0.00000000 0.96774194 39.92000000 5.00000000
+0.00000000 1.16129032 39.68000000 5.16000000
+0.00000000 1.35483871 39.28000000 5.36000000
+0.00000000 1.54838710 38.88000000 5.54000000
+0.00000000 1.74193548 38.48000000 5.74000000
+0.00000000 1.93548387 38.16000000 5.94000000
+0.00000000 2.12903226 37.60000000 6.20000000
+0.00000000 2.32258065 37.04000000 6.48000000
+0.00000000 2.51612903 36.40000000 6.78000000
+0.00000000 2.70967742 35.92000000 7.06000000
+0.00000000 2.90322581 35.28000000 7.36000000
+0.00000000 3.09677419 57.36000000 7.36000000
+0.00000000 3.29032258 57.12000000 7.06000000
+0.00000000 3.48387097 56.72000000 6.78000000
+0.00000000 3.67741935 56.48000000 6.48000000
+0.00000000 3.87096774 56.24000000 6.20000000
+0.00000000 4.06451613 55.92000000 5.96000000
+0.00000000 4.25806452 55.92000000 5.88000000
+0.00000000 4.45161290 55.76000000 5.78000000
+0.00000000 4.64516129 55.68000000 5.68000000
+0.00000000 4.83870968 55.60000000 5.58000000
+0.00000000 5.03225806 55.44000000 5.48000000
+0.00000000 5.22580645 55.44000000 5.38000000
+0.00000000 5.41935484 55.28000000 5.30000000
+0.00000000 5.61290323 55.20000000 5.20000000
+0.00000000 5.80645161 55.04000000 5.10000000
+0.00000000 6.00000000 54.96000000 5.00000000
+0.19354839 0.00000000 39.92000000 5.00000000
+0.19354839 0.19354839 39.92000000 5.00000000
+0.19354839 0.38709677 39.92000000 5.00000000
+0.19354839 0.58064516 39.92000000 5.00000000
+0.19354839 0.77419355 39.92000000 5.00000000
+0.19354839 0.96774194 39.92000000 5.00000000
+0.19354839 1.16129032 39.68000000 5.16000000
+0.19354839 1.35483871 39.28000000 5.36000000
+0.19354839 1.54838710 38.88000000 5.54000000
+0.19354839 1.74193548 38.48000000 5.74000000
+0.19354839 1.93548387 38.16000000 5.94000000
+0.19354839 2.12903226 37.60000000 6.20000000
+0.19354839 2.32258065 37.04000000 6.48000000
+0.19354839 2.51612903 36.40000000 6.78000000
+0.19354839 2.70967742 35.92000000 7.06000000
+0.19354839 2.90322581 35.28000000 7.36000000
+0.19354839 3.09677419 57.36000000 7.36000000
+0.19354839 3.29032258 57.12000000 7.06000000
+0.19354839 3.48387097 56.72000000 6.78000000
+0.19354839 3.67741935 56.48000000 6.48000000
+0.19354839 3.87096774 56.24000000 6.20000000
+0.19354839 4.06451613 55.92000000 5.96000000
+0.19354839 4.25806452 55.92000000 5.88000000
+0.19354839 4.45161290 55.76000000 5.78000000
+0.19354839 4.64516129 55.68000000 5.68000000
+0.19354839 4.83870968 55.60000000 5.58000000
+0.19354839 5.03225806 55.44000000 5.48000000
+0.19354839 5.22580645 55.44000000 5.38000000
+0.19354839 5.41935484 55.28000000 5.30000000
+0.19354839 5.61290323 55.20000000 5.20000000
+0.19354839 5.80645161 55.04000000 5.10000000
+0.19354839 6.00000000 54.96000000 5.00000000
+0.38709677 0.00000000 39.92000000 5.00000000
+0.38709677 0.19354839 39.92000000 5.00000000
+0.38709677 0.38709677 39.92000000 5.00000000
+0.38709677 0.58064516 39.92000000 5.00000000
+0.38709677 0.77419355 39.92000000 5.00000000
+0.38709677 0.96774194 39.92000000 5.00000000
+0.38709677 1.16129032 39.68000000 5.16000000
+0.38709677 1.35483871 39.28000000 5.36000000
+0.38709677 1.54838710 38.88000000 5.54000000
+0.38709677 1.74193548 38.48000000 5.74000000
+0.38709677 1.93548387 38.16000000 5.94000000
+0.38709677 2.12903226 37.60000000 6.20000000
+0.38709677 2.32258065 37.04000000 6.48000000
+0.38709677 2.51612903 36.40000000 6.78000000
+0.38709677 2.70967742 35.92000000 7.06000000
+0.38709677 2.90322581 35.28000000 7.36000000
+0.38709677 3.09677419 57.36000000 7.36000000
+0.38709677 3.29032258 57.12000000 7.06000000
+0.38709677 3.48387097 56.72000000 6.78000000
+0.38709677 3.67741935 56.48000000 6.48000000
+0.38709677 3.87096774 56.24000000 6.20000000
+0.38709677 4.06451613 55.92000000 5.96000000
+0.38709677 4.25806452 55.92000000 5.88000000
+0.38709677 4.45161290 55.76000000 5.78000000
+0.38709677 4.64516129 55.68000000 5.68000000
+0.38709677 4.83870968 55.60000000 5.58000000
+0.38709677 5.03225806 55.44000000 5.48000000
+0.38709677 5.22580645 55.44000000 5.38000000
+0.38709677 5.41935484 55.28000000 5.30000000
+0.38709677 5.61290323 55.20000000 5.20000000
+0.38709677 5.80645161 55.04000000 5.10000000
+0.38709677 6.00000000 54.96000000 5.00000000
+0.58064516 0.00000000 39.92000000 5.00000000
+0.58064516 0.19354839 39.92000000 5.00000000
+0.58064516 0.38709677 39.92000000 5.00000000
+0.58064516 0.58064516 39.92000000 5.00000000
+0.58064516 0.77419355 39.92000000 5.00000000
+0.58064516 0.96774194 39.92000000 5.00000000
+0.58064516 1.16129032 39.68000000 5.16000000
+0.58064516 1.35483871 39.28000000 5.36000000
+0.58064516 1.54838710 38.88000000 5.54000000
+0.58064516 1.74193548 38.48000000 5.74000000
+0.58064516 1.93548387 38.16000000 5.94000000
+0.58064516 2.12903226 37.60000000 6.20000000
+0.58064516 2.32258065 37.04000000 6.48000000
+0.58064516 2.51612903 36.40000000 6.78000000
+0.58064516 2.70967742 35.92000000 7.06000000
+0.58064516 2.90322581 35.28000000 7.36000000
+0.58064516 3.09677419 57.36000000 7.36000000
+0.58064516 3.29032258 57.12000000 7.06000000
+0.58064516 3.48387097 56.72000000 6.78000000
+0.58064516 3.67741935 56.48000000 6.48000000
+0.58064516 3.87096774 56.24000000 6.20000000
+0.58064516 4.06451613 55.92000000 5.96000000
+0.58064516 4.25806452 55.92000000 5.88000000
+0.58064516 4.45161290 55.76000000 5.78000000
+0.58064516 4.64516129 55.68000000 5.68000000
+0.58064516 4.83870968 55.60000000 5.58000000
+0.58064516 5.03225806 55.44000000 5.48000000
+0.58064516 5.22580645 55.44000000 5.38000000
+0.58064516 5.41935484 55.28000000 5.30000000
+0.58064516 5.61290323 55.20000000 5.20000000
+0.58064516 5.80645161 55.04000000 5.10000000
+0.58064516 6.00000000 54.96000000 5.00000000
+0.77419355 0.00000000 39.92000000 5.00000000
+0.77419355 0.19354839 39.92000000 5.00000000
+0.77419355 0.38709677 39.92000000 5.00000000
+0.77419355 0.58064516 39.92000000 5.00000000
+0.77419355 0.77419355 39.92000000 5.00000000
+0.77419355 0.96774194 39.92000000 5.00000000
+0.77419355 1.16129032 39.68000000 5.16000000
+0.77419355 1.35483871 39.28000000 5.36000000
+0.77419355 1.54838710 38.88000000 5.54000000
+0.77419355 1.74193548 38.48000000 5.74000000
+0.77419355 1.93548387 38.16000000 5.94000000
+0.77419355 2.12903226 37.60000000 6.20000000
+0.77419355 2.32258065 37.04000000 6.48000000
+0.77419355 2.51612903 36.40000000 6.78000000
+0.77419355 2.70967742 35.92000000 7.06000000
+0.77419355 2.90322581 35.28000000 7.36000000
+0.77419355 3.09677419 57.36000000 7.36000000
+0.77419355 3.29032258 57.12000000 7.06000000
+0.77419355 3.48387097 56.72000000 6.78000000
+0.77419355 3.67741935 56.48000000 6.48000000
+0.77419355 3.87096774 56.24000000 6.20000000
+0.77419355 4.06451613 55.92000000 5.96000000
+0.77419355 4.25806452 55.92000000 5.88000000
+0.77419355 4.45161290 55.76000000 5.78000000
+0.77419355 4.64516129 55.68000000 5.68000000
+0.77419355 4.83870968 55.60000000 5.58000000
+0.77419355 5.03225806 55.44000000 5.48000000
+0.77419355 5.22580645 55.44000000 5.38000000
+0.77419355 5.41935484 55.28000000 5.30000000
+0.77419355 5.61290323 55.20000000 5.20000000
+0.77419355 5.80645161 55.04000000 5.10000000
+0.77419355 6.00000000 54.96000000 5.00000000
+0.96774194 0.00000000 39.92000000 5.00000000
+0.96774194 0.19354839 39.92000000 5.00000000
+0.96774194 0.38709677 39.92000000 5.00000000
+0.96774194 0.58064516 39.92000000 5.00000000
+0.96774194 0.77419355 39.92000000 5.00000000
+0.96774194 0.96774194 39.92000000 5.00000000
+0.96774194 1.16129032 39.68000000 5.16000000
+0.96774194 1.35483871 39.28000000 5.36000000
+0.96774194 1.54838710 38.88000000 5.54000000
+0.96774194 1.74193548 38.48000000 5.74000000
+0.96774194 1.93548387 38.16000000 5.94000000
+0.96774194 2.12903226 37.60000000 6.20000000
+0.96774194 2.32258065 37.04000000 6.48000000
+0.96774194 2.51612903 36.40000000 6.78000000
+0.96774194 2.70967742 35.92000000 7.06000000
+0.96774194 2.90322581 35.28000000 7.36000000
+0.96774194 3.09677419 57.36000000 7.36000000
+0.96774194 3.29032258 57.12000000 7.06000000
+0.96774194 3.48387097 56.72000000 6.78000000
+0.96774194 3.67741935 56.48000000 6.48000000
+0.96774194 3.87096774 56.24000000 6.20000000
+0.96774194 4.06451613 55.92000000 5.96000000
+0.96774194 4.25806452 55.92000000 5.88000000
+0.96774194 4.45161290 55.76000000 5.78000000
+0.96774194 4.64516129 55.68000000 5.68000000
+0.96774194 4.83870968 55.60000000 5.58000000
+0.96774194 5.03225806 55.44000000 5.48000000
+0.96774194 5.22580645 55.44000000 5.38000000
+0.96774194 5.41935484 55.28000000 5.30000000
+0.96774194 5.61290323 55.20000000 5.20000000
+0.96774194 5.80645161 55.04000000 5.10000000
+0.96774194 6.00000000 54.96000000 5.00000000
+1.16129032 0.00000000 39.68000000 5.16000000
+1.16129032 0.19354839 39.68000000 5.16000000
+1.16129032 0.38709677 39.68000000 5.16000000
+1.16129032 0.58064516 39.68000000 5.16000000
+1.16129032 0.77419355 39.68000000 5.16000000
+1.16129032 0.96774194 39.68000000 5.16000000
+1.16129032 1.16129032 39.68000000 5.16000000
+1.16129032 1.35483871 39.28000000 5.36000000
+1.16129032 1.54838710 38.88000000 5.54000000
+1.16129032 1.74193548 38.48000000 5.74000000
+1.16129032 1.93548387 38.16000000 5.94000000
+1.16129032 2.12903226 37.60000000 6.20000000
+1.16129032 2.32258065 37.04000000 6.48000000
+1.16129032 2.51612903 36.40000000 6.78000000
+1.16129032 2.70967742 35.92000000 7.06000000
+1.16129032 2.90322581 35.28000000 7.36000000
+1.16129032 3.09677419 57.36000000 7.36000000
+1.16129032 3.29032258 57.12000000 7.06000000
+1.16129032 3.48387097 56.72000000 6.78000000
+1.16129032 3.67741935 56.48000000 6.48000000
+1.16129032 3.87096774 56.24000000 6.20000000
+1.16129032 4.06451613 55.92000000 5.96000000
+1.16129032 4.25806452 55.92000000 5.88000000
+1.16129032 4.45161290 55.76000000 5.78000000
+1.16129032 4.64516129 55.68000000 5.68000000
+1.16129032 4.83870968 55.60000000 5.58000000
+1.16129032 5.03225806 55.44000000 5.48000000
+1.16129032 5.22580645 55.44000000 5.38000000
+1.16129032 5.41935484 55.28000000 5.30000000
+1.16129032 5.61290323 55.20000000 5.20000000
+1.16129032 5.80645161 55.12000000 5.16000000
+1.16129032 6.00000000 55.12000000 5.16000000
+1.35483871 0.00000000 39.28000000 5.36000000
+1.35483871 0.19354839 39.28000000 5.36000000
+1.35483871 0.38709677 39.28000000 5.36000000
+1.35483871 0.58064516 39.28000000 5.36000000
+1.35483871 0.77419355 39.28000000 5.36000000
+1.35483871 0.96774194 39.28000000 5.36000000
+1.35483871 1.16129032 39.28000000 5.36000000
+1.35483871 1.35483871 39.28000000 5.36000000
+1.35483871 1.54838710 38.88000000 5.54000000
+1.35483871 1.74193548 38.48000000 5.74000000
+1.35483871 1.93548387 38.16000000 5.94000000
+1.35483871 2.12903226 37.60000000 6.20000000
+1.35483871 2.32258065 37.04000000 6.48000000
+1.35483871 2.51612903 36.40000000 6.78000000
+1.35483871 2.70967742 35.92000000 7.06000000
+1.35483871 2.90322581 35.28000000 7.36000000
+1.35483871 3.09677419 57.36000000 7.36000000
+1.35483871 3.29032258 57.12000000 7.06000000
+1.35483871 3.48387097 56.72000000 6.78000000
+1.35483871 3.67741935 56.48000000 6.48000000
+1.35483871 3.87096774 56.24000000 6.20000000
+1.35483871 4.06451613 55.92000000 5.96000000
+1.35483871 4.25806452 55.92000000 5.88000000
+1.35483871 4.45161290 55.76000000 5.78000000
+1.35483871 4.64516129 55.68000000 5.68000000
+1.35483871 4.83870968 55.60000000 5.58000000
+1.35483871 5.03225806 55.44000000 5.48000000
+1.35483871 5.22580645 55.44000000 5.38000000
+1.35483871 5.41935484 55.36000000 5.36000000
+1.35483871 5.61290323 55.36000000 5.36000000
+1.35483871 5.80645161 55.36000000 5.36000000
+1.35483871 6.00000000 55.36000000 5.36000000
+1.54838710 0.00000000 38.88000000 5.54000000
+1.54838710 0.19354839 38.88000000 5.54000000
+1.54838710 0.38709677 38.88000000 5.54000000
+1.54838710 0.58064516 38.88000000 5.54000000
+1.54838710 0.77419355 38.88000000 5.54000000
+1.54838710 0.96774194 38.88000000 5.54000000
+1.54838710 1.16129032 38.88000000 5.54000000
+1.54838710 1.35483871 38.88000000 5.54000000
+1.54838710 1.54838710 38.88000000 5.54000000
+1.54838710 1.74193548 38.48000000 5.74000000
+1.54838710 1.93548387 38.16000000 5.94000000
+1.54838710 2.12903226 37.60000000 6.20000000
+1.54838710 2.32258065 37.04000000 6.48000000
+1.54838710 2.51612903 36.40000000 6.78000000
+1.54838710 2.70967742 35.92000000 7.06000000
+1.54838710 2.90322581 35.28000000 7.36000000
+1.54838710 3.09677419 57.36000000 7.36000000
+1.54838710 3.29032258 57.12000000 7.06000000
+1.54838710 3.48387097 56.72000000 6.78000000
+1.54838710 3.67741935 56.48000000 6.48000000
+1.54838710 3.87096774 56.24000000 6.20000000
+1.54838710 4.06451613 55.92000000 5.96000000
+1.54838710 4.25806452 55.92000000 5.88000000
+1.54838710 4.45161290 55.76000000 5.78000000
+1.54838710 4.64516129 55.68000000 5.68000000
+1.54838710 4.83870968 55.60000000 5.58000000
+1.54838710 5.03225806 55.60000000 5.54000000
+1.54838710 5.22580645 55.60000000 5.54000000
+1.54838710 5.41935484 55.60000000 5.54000000
+1.54838710 5.61290323 55.60000000 5.54000000
+1.54838710 5.80645161 55.60000000 5.54000000
+1.54838710 6.00000000 55.60000000 5.54000000
+1.74193548 0.00000000 38.48000000 5.74000000
+1.74193548 0.19354839 38.48000000 5.74000000
+1.74193548 0.38709677 38.48000000 5.74000000
+1.74193548 0.58064516 38.48000000 5.74000000
+1.74193548 0.77419355 38.48000000 5.74000000
+1.74193548 0.96774194 38.48000000 5.74000000
+1.74193548 1.16129032 38.48000000 5.74000000
+1.74193548 1.35483871 38.48000000 5.74000000
+1.74193548 1.54838710 38.48000000 5.74000000
+1.74193548 1.74193548 38.48000000 5.74000000
+1.74193548 1.93548387 38.16000000 5.94000000
+1.74193548 2.12903226 37.60000000 6.20000000
+1.74193548 2.32258065 37.04000000 6.48000000
+1.74193548 2.51612903 36.40000000 6.78000000
+1.74193548 2.70967742 35.92000000 7.06000000
+1.74193548 2.90322581 35.28000000 7.36000000
+1.74193548 3.09677419 57.36000000 7.36000000
+1.74193548 3.29032258 57.12000000 7.06000000
+1.74193548 3.48387097 56.72000000 6.78000000
+1.74193548 3.67741935 56.48000000 6.48000000
+1.74193548 3.87096774 56.24000000 6.20000000
+1.74193548 4.06451613 55.92000000 5.96000000
+1.74193548 4.25806452 55.92000000 5.88000000
+1.74193548 4.45161290 55.76000000 5.78000000
+1.74193548 4.64516129 55.76000000 5.74000000
+1.74193548 4.83870968 55.76000000 5.74000000
+1.74193548 5.03225806 55.76000000 5.74000000
+1.74193548 5.22580645 55.76000000 5.74000000
+1.74193548 5.41935484 55.76000000 5.74000000
+1.74193548 5.61290323 55.76000000 5.74000000
+1.74193548 5.80645161 55.76000000 5.74000000
+1.74193548 6.00000000 55.76000000 5.74000000
+1.93548387 0.00000000 38.16000000 5.94000000
+1.93548387 0.19354839 38.16000000 5.94000000
+1.93548387 0.38709677 38.16000000 5.94000000
+1.93548387 0.58064516 38.16000000 5.94000000
+1.93548387 0.77419355 38.16000000 5.94000000
+1.93548387 0.96774194 38.16000000 5.94000000
+1.93548387 1.16129032 38.16000000 5.94000000
+1.93548387 1.35483871 38.16000000 5.94000000
+1.93548387 1.54838710 38.16000000 5.94000000
+1.93548387 1.74193548 38.16000000 5.94000000
+1.93548387 1.93548387 38.16000000 5.94000000
+1.93548387 2.12903226 37.60000000 6.20000000
+1.93548387 2.32258065 37.04000000 6.48000000
+1.93548387 2.51612903 36.40000000 6.78000000
+1.93548387 2.70967742 35.92000000 7.06000000
+1.93548387 2.90322581 35.28000000 7.36000000
+1.93548387 3.09677419 57.36000000 7.36000000
+1.93548387 3.29032258 57.12000000 7.06000000
+1.93548387 3.48387097 56.72000000 6.78000000
+1.93548387 3.67741935 56.48000000 6.48000000
+1.93548387 3.87096774 56.24000000 6.20000000
+1.93548387 4.06451613 55.92000000 5.96000000
+1.93548387 4.25806452 55.92000000 5.94000000
+1.93548387 4.45161290 55.92000000 5.94000000
+1.93548387 4.64516129 55.92000000 5.94000000
+1.93548387 4.83870968 55.92000000 5.94000000
+1.93548387 5.03225806 55.92000000 5.94000000
+1.93548387 5.22580645 55.92000000 5.94000000
+1.93548387 5.41935484 55.92000000 5.94000000
+1.93548387 5.61290323 55.92000000 5.94000000
+1.93548387 5.80645161 55.92000000 5.94000000
+1.93548387 6.00000000 55.92000000 5.94000000
+2.12903226 0.00000000 37.68000000 6.18000000
+2.12903226 0.19354839 37.68000000 6.18000000
+2.12903226 0.38709677 37.68000000 6.18000000
+2.12903226 0.58064516 37.68000000 6.18000000
+2.12903226 0.77419355 37.68000000 6.18000000
+2.12903226 0.96774194 37.68000000 6.18000000
+2.12903226 1.16129032 37.68000000 6.18000000
+2.12903226 1.35483871 37.68000000 6.18000000
+2.12903226 1.54838710 37.68000000 6.18000000
+2.12903226 1.74193548 37.68000000 6.18000000
+2.12903226 1.93548387 37.68000000 6.18000000
+2.12903226 2.12903226 37.60000000 6.20000000
+2.12903226 2.32258065 37.04000000 6.48000000
+2.12903226 2.51612903 36.40000000 6.78000000
+2.12903226 2.70967742 35.92000000 7.06000000
+2.12903226 2.90322581 35.28000000 7.36000000
+2.12903226 3.09677419 57.36000000 7.36000000
+2.12903226 3.29032258 57.12000000 7.06000000
+2.12903226 3.48387097 56.72000000 6.78000000
+2.12903226 3.67741935 56.48000000 6.48000000
+2.12903226 3.87096774 56.24000000 6.20000000
+2.12903226 4.06451613 56.16000000 6.18000000
+2.12903226 4.25806452 56.16000000 6.18000000
+2.12903226 4.45161290 56.16000000 6.18000000
+2.12903226 4.64516129 56.16000000 6.18000000
+2.12903226 4.83870968 56.16000000 6.18000000
+2.12903226 5.03225806 56.16000000 6.18000000
+2.12903226 5.22580645 56.16000000 6.18000000
+2.12903226 5.41935484 56.16000000 6.18000000
+2.12903226 5.61290323 56.16000000 6.18000000
+2.12903226 5.80645161 56.16000000 6.18000000
+2.12903226 6.00000000 56.16000000 6.18000000
+2.32258065 0.00000000 37.12000000 6.44000000
+2.32258065 0.19354839 37.12000000 6.44000000
+2.32258065 0.38709677 37.12000000 6.44000000
+2.32258065 0.58064516 37.12000000 6.44000000
+2.32258065 0.77419355 37.12000000 6.44000000
+2.32258065 0.96774194 37.12000000 6.44000000
+2.32258065 1.16129032 37.12000000 6.44000000
+2.32258065 1.35483871 37.12000000 6.44000000
+2.32258065 1.54838710 37.12000000 6.44000000
+2.32258065 1.74193548 37.12000000 6.44000000
+2.32258065 1.93548387 37.12000000 6.44000000
+2.32258065 2.12903226 37.12000000 6.44000000
+2.32258065 2.32258065 37.04000000 6.48000000
+2.32258065 2.51612903 36.40000000 6.78000000
+2.32258065 2.70967742 35.92000000 7.06000000
+2.32258065 2.90322581 35.28000000 7.36000000
+2.32258065 3.09677419 57.36000000 7.36000000
+2.32258065 3.29032258 57.12000000 7.06000000
+2.32258065 3.48387097 56.72000000 6.78000000
+2.32258065 3.67741935 56.48000000 6.48000000
+2.32258065 3.87096774 56.48000000 6.44000000
+2.32258065 4.06451613 56.48000000 6.44000000
+2.32258065 4.25806452 56.48000000 6.44000000
+2.32258065 4.45161290 56.48000000 6.44000000
+2.32258065 4.64516129 56.48000000 6.44000000
+2.32258065 4.83870968 56.48000000 6.44000000
+2.32258065 5.03225806 56.48000000 6.44000000
+2.32258065 5.22580645 56.48000000 6.44000000
+2.32258065 5.41935484 56.48000000 6.44000000
+2.32258065 5.61290323 56.48000000 6.44000000
+2.32258065 5.80645161 56.48000000 6.44000000
+2.32258065 6.00000000 56.48000000 6.44000000
+2.51612903 0.00000000 36.64000000 6.68000000
+2.51612903 0.19354839 36.64000000 6.68000000
+2.51612903 0.38709677 36.64000000 6.68000000
+2.51612903 0.58064516 36.64000000 6.68000000
+2.51612903 0.77419355 36.64000000 6.68000000
+2.51612903 0.96774194 36.64000000 6.68000000
+2.51612903 1.16129032 36.64000000 6.68000000
+2.51612903 1.35483871 36.64000000 6.68000000
+2.51612903 1.54838710 36.64000000 6.68000000
+2.51612903 1.74193548 36.64000000 6.68000000
+2.51612903 1.93548387 36.64000000 6.68000000
+2.51612903 2.12903226 36.64000000 6.68000000
+2.51612903 2.32258065 36.64000000 6.68000000
+2.51612903 2.51612903 36.40000000 6.78000000
+2.51612903 2.70967742 35.92000000 7.06000000
+2.51612903 2.90322581 35.28000000 7.36000000
+2.51612903 3.09677419 57.36000000 7.36000000
+2.51612903 3.29032258 57.12000000 7.06000000
+2.51612903 3.48387097 56.72000000 6.78000000
+2.51612903 3.67741935 56.64000000 6.68000000
+2.51612903 3.87096774 56.64000000 6.68000000
+2.51612903 4.06451613 56.64000000 6.68000000
+2.51612903 4.25806452 56.64000000 6.68000000
+2.51612903 4.45161290 56.64000000 6.68000000
+2.51612903 4.64516129 56.64000000 6.68000000
+2.51612903 4.83870968 56.64000000 6.68000000
+2.51612903 5.03225806 56.64000000 6.68000000
+2.51612903 5.22580645 56.64000000 6.68000000
+2.51612903 5.41935484 56.64000000 6.68000000
+2.51612903 5.61290323 56.64000000 6.68000000
+2.51612903 5.80645161 56.64000000 6.68000000
+2.51612903 6.00000000 56.64000000 6.68000000
+2.70967742 0.00000000 36.08000000 6.94000000
+2.70967742 0.19354839 36.08000000 6.94000000
+2.70967742 0.38709677 36.08000000 6.94000000
+2.70967742 0.58064516 36.08000000 6.94000000
+2.70967742 0.77419355 36.08000000 6.94000000
+2.70967742 0.96774194 36.08000000 6.94000000
+2.70967742 1.16129032 36.08000000 6.94000000
+2.70967742 1.35483871 36.08000000 6.94000000
+2.70967742 1.54838710 36.08000000 6.94000000
+2.70967742 1.74193548 36.08000000 6.94000000
+2.70967742 1.93548387 36.08000000 6.94000000
+2.70967742 2.12903226 36.08000000 6.94000000
+2.70967742 2.32258065 36.08000000 6.94000000
+2.70967742 2.51612903 36.08000000 6.94000000
+2.70967742 2.70967742 35.92000000 7.06000000
+2.70967742 2.90322581 35.28000000 7.36000000
+2.70967742 3.09677419 57.36000000 7.36000000
+2.70967742 3.29032258 57.12000000 7.06000000
+2.70967742 3.48387097 56.96000000 6.94000000
+2.70967742 3.67741935 56.96000000 6.94000000
+2.70967742 3.87096774 56.96000000 6.94000000
+2.70967742 4.06451613 56.96000000 6.94000000
+2.70967742 4.25806452 56.96000000 6.94000000
+2.70967742 4.45161290 56.96000000 6.94000000
+2.70967742 4.64516129 56.96000000 6.94000000
+2.70967742 4.83870968 56.96000000 6.94000000
+2.70967742 5.03225806 56.96000000 6.94000000
+2.70967742 5.22580645 56.96000000 6.94000000
+2.70967742 5.41935484 56.96000000 6.94000000
+2.70967742 5.61290323 56.96000000 6.94000000
+2.70967742 5.80645161 56.96000000 6.94000000
+2.70967742 6.00000000 56.96000000 6.94000000
+2.90322581 0.00000000 35.60000000 7.20000000
+2.90322581 0.19354839 35.60000000 7.20000000
+2.90322581 0.38709677 35.60000000 7.20000000
+2.90322581 0.58064516 35.60000000 7.20000000
+2.90322581 0.77419355 35.60000000 7.20000000
+2.90322581 0.96774194 35.60000000 7.20000000
+2.90322581 1.16129032 35.60000000 7.20000000
+2.90322581 1.35483871 35.60000000 7.20000000
+2.90322581 1.54838710 35.60000000 7.20000000
+2.90322581 1.74193548 35.60000000 7.20000000
+2.90322581 1.93548387 35.60000000 7.20000000
+2.90322581 2.12903226 35.60000000 7.20000000
+2.90322581 2.32258065 35.60000000 7.20000000
+2.90322581 2.51612903 35.60000000 7.20000000
+2.90322581 2.70967742 35.60000000 7.20000000
+2.90322581 2.90322581 35.28000000 7.36000000
+2.90322581 3.09677419 57.36000000 7.36000000
+2.90322581 3.29032258 57.20000000 7.20000000
+2.90322581 3.48387097 57.20000000 7.20000000
+2.90322581 3.67741935 57.20000000 7.20000000
+2.90322581 3.87096774 57.20000000 7.20000000
+2.90322581 4.06451613 57.20000000 7.20000000
+2.90322581 4.25806452 57.20000000 7.20000000
+2.90322581 4.45161290 57.20000000 7.20000000
+2.90322581 4.64516129 57.20000000 7.20000000
+2.90322581 4.83870968 57.20000000 7.20000000
+2.90322581 5.03225806 57.20000000 7.20000000
+2.90322581 5.22580645 57.20000000 7.20000000
+2.90322581 5.41935484 57.20000000 7.20000000
+2.90322581 5.61290323 57.20000000 7.20000000
+2.90322581 5.80645161 57.20000000 7.20000000
+2.90322581 6.00000000 57.20000000 7.20000000
+3.09677419 0.00000000 35.12000000 7.46000000
+3.09677419 0.19354839 35.12000000 7.46000000
+3.09677419 0.38709677 35.12000000 7.46000000
+3.09677419 0.58064516 35.12000000 7.46000000
+3.09677419 0.77419355 35.12000000 7.46000000
+3.09677419 0.96774194 35.12000000 7.46000000
+3.09677419 1.16129032 35.12000000 7.46000000
+3.09677419 1.35483871 35.12000000 7.46000000
+3.09677419 1.54838710 35.12000000 7.46000000
+3.09677419 1.74193548 35.12000000 7.46000000
+3.09677419 1.93548387 35.12000000 7.46000000
+3.09677419 2.12903226 35.12000000 7.46000000
+3.09677419 2.32258065 35.12000000 7.46000000
+3.09677419 2.51612903 35.12000000 7.46000000
+3.09677419 2.70967742 35.12000000 7.46000000
+3.09677419 2.90322581 35.12000000 7.46000000
+3.09677419 3.09677419 57.52000000 7.46000000
+3.09677419 3.29032258 57.52000000 7.46000000
+3.09677419 3.48387097 57.52000000 7.46000000
+3.09677419 3.67741935 57.52000000 7.46000000
+3.09677419 3.87096774 57.52000000 7.46000000
+3.09677419 4.06451613 57.52000000 7.46000000
+3.09677419 4.25806452 57.52000000 7.46000000
+3.09677419 4.45161290 57.52000000 7.46000000
+3.09677419 4.64516129 57.52000000 7.46000000
+3.09677419 4.83870968 57.52000000 7.46000000
+3.09677419 5.03225806 57.52000000 7.46000000
+3.09677419 5.22580645 57.52000000 7.46000000
+3.09677419 5.41935484 57.52000000 7.46000000
+3.09677419 5.61290323 57.52000000 7.46000000
+3.09677419 5.80645161 57.52000000 7.46000000
+3.09677419 6.00000000 57.52000000 7.46000000
+3.29032258 0.00000000 34.56000000 7.72000000
+3.29032258 0.19354839 34.56000000 7.72000000
+3.29032258 0.38709677 34.56000000 7.72000000
+3.29032258 0.58064516 34.56000000 7.72000000
+3.29032258 0.77419355 34.56000000 7.72000000
+3.29032258 0.96774194 34.56000000 7.72000000
+3.29032258 1.16129032 34.56000000 7.72000000
+3.29032258 1.35483871 34.56000000 7.72000000
+3.29032258 1.54838710 34.56000000 7.72000000
+3.29032258 1.74193548 34.56000000 7.72000000
+3.29032258 1.93548387 34.56000000 7.72000000
+3.29032258 2.12903226 34.56000000 7.72000000
+3.29032258 2.32258065 34.56000000 7.72000000
+3.29032258 2.51612903 34.56000000 7.72000000
+3.29032258 2.70967742 34.56000000 7.72000000
+3.29032258 2.90322581 47.28000000 7.72000000
+3.29032258 3.09677419 47.28000000 7.72000000
+3.29032258 3.29032258 57.68000000 7.72000000
+3.29032258 3.48387097 57.68000000 7.72000000
+3.29032258 3.67741935 57.68000000 7.72000000
+3.29032258 3.87096774 57.68000000 7.72000000
+3.29032258 4.06451613 57.68000000 7.72000000
+3.29032258 4.25806452 57.68000000 7.72000000
+3.29032258 4.45161290 57.68000000 7.72000000
+3.29032258 4.64516129 57.68000000 7.72000000
+3.29032258 4.83870968 57.68000000 7.72000000
+3.29032258 5.03225806 57.68000000 7.72000000
+3.29032258 5.22580645 57.68000000 7.72000000
+3.29032258 5.41935484 57.68000000 7.72000000
+3.29032258 5.61290323 57.68000000 7.72000000
+3.29032258 5.80645161 57.68000000 7.72000000
+3.29032258 6.00000000 57.68000000 7.72000000
+3.48387097 0.00000000 34.80000000 7.58000000
+3.48387097 0.19354839 34.80000000 7.58000000
+3.48387097 0.38709677 34.80000000 7.58000000
+3.48387097 0.58064516 34.80000000 7.58000000
+3.48387097 0.77419355 34.80000000 7.58000000
+3.48387097 0.96774194 34.80000000 7.58000000
+3.48387097 1.16129032 34.80000000 7.58000000
+3.48387097 1.35483871 34.80000000 7.58000000
+3.48387097 1.54838710 34.80000000 7.58000000
+3.48387097 1.74193548 34.80000000 7.58000000
+3.48387097 1.93548387 34.80000000 7.58000000
+3.48387097 2.12903226 34.80000000 7.58000000
+3.48387097 2.32258065 34.80000000 7.58000000
+3.48387097 2.51612903 34.80000000 7.58000000
+3.48387097 2.70967742 34.80000000 7.58000000
+3.48387097 2.90322581 34.80000000 7.58000000
+3.48387097 3.09677419 34.80000000 10.00000000
+3.48387097 3.29032258 72.24000000 17.42000000
+3.48387097 3.48387097 72.24000000 17.42000000
+3.48387097 3.67741935 72.24000000 17.42000000
+3.48387097 3.87096774 72.24000000 17.42000000
+3.48387097 4.06451613 72.24000000 17.42000000
+3.48387097 4.25806452 72.24000000 17.42000000
+3.48387097 4.45161290 72.24000000 17.42000000
+3.48387097 4.64516129 72.24000000 17.42000000
+3.48387097 4.83870968 72.24000000 17.42000000
+3.48387097 5.03225806 72.24000000 17.42000000
+3.48387097 5.22580645 72.24000000 17.42000000
+3.48387097 5.41935484 72.24000000 17.42000000
+3.48387097 5.61290323 72.24000000 17.42000000
+3.48387097 5.80645161 72.24000000 17.42000000
+3.48387097 6.00000000 72.24000000 17.42000000
+3.67741935 0.00000000 36.80000000 6.62000000
+3.67741935 0.19354839 36.80000000 6.62000000
+3.67741935 0.38709677 36.80000000 6.62000000
+3.67741935 0.58064516 36.80000000 6.62000000
+3.67741935 0.77419355 36.80000000 6.62000000
+3.67741935 0.96774194 36.80000000 6.62000000
+3.67741935 1.16129032 36.80000000 6.62000000
+3.67741935 1.35483871 36.80000000 6.62000000
+3.67741935 1.54838710 36.80000000 6.62000000
+3.67741935 1.74193548 36.80000000 6.62000000
+3.67741935 1.93548387 36.80000000 6.62000000
+3.67741935 2.12903226 36.80000000 6.62000000
+3.67741935 2.32258065 36.80000000 6.62000000
+3.67741935 2.51612903 36.64000000 6.68000000
+3.67741935 2.70967742 36.08000000 6.94000000
+3.67741935 2.90322581 35.60000000 7.20000000
+3.67741935 3.09677419 72.96000000 17.64000000
+3.67741935 3.29032258 73.84000000 17.94000000
+3.67741935 3.48387097 74.64000000 18.22000000
+3.67741935 3.67741935 75.20000000 18.38000000
+3.67741935 3.87096774 75.20000000 18.38000000
+3.67741935 4.06451613 75.20000000 18.38000000
+3.67741935 4.25806452 75.20000000 18.38000000
+3.67741935 4.45161290 75.20000000 18.38000000
+3.67741935 4.64516129 75.20000000 18.38000000
+3.67741935 4.83870968 75.20000000 18.38000000
+3.67741935 5.03225806 75.20000000 18.38000000
+3.67741935 5.22580645 75.20000000 18.38000000
+3.67741935 5.41935484 75.20000000 18.38000000
+3.67741935 5.61290323 75.20000000 18.38000000
+3.67741935 5.80645161 75.20000000 18.38000000
+3.67741935 6.00000000 75.20000000 18.38000000
+3.87096774 0.00000000 38.72000000 5.64000000
+3.87096774 0.19354839 38.72000000 5.64000000
+3.87096774 0.38709677 38.72000000 5.64000000
+3.87096774 0.58064516 38.72000000 5.64000000
+3.87096774 0.77419355 38.72000000 5.64000000
+3.87096774 0.96774194 38.72000000 5.64000000
+3.87096774 1.16129032 38.72000000 5.64000000
+3.87096774 1.35483871 38.64000000 5.68000000
+3.87096774 1.54838710 38.48000000 5.78000000
+3.87096774 1.74193548 38.24000000 5.88000000
+3.87096774 1.93548387 38.08000000 5.96000000
+3.87096774 2.12903226 37.68000000 6.18000000
+3.87096774 2.32258065 37.12000000 6.44000000
+3.87096774 2.51612903 36.64000000 6.68000000
+3.87096774 2.70967742 36.08000000 6.94000000
+3.87096774 2.90322581 35.60000000 7.20000000
+3.87096774 3.09677419 72.96000000 17.64000000
+3.87096774 3.29032258 73.84000000 17.94000000
+3.87096774 3.48387097 74.64000000 18.22000000
+3.87096774 3.67741935 75.52000000 18.52000000
+3.87096774 3.87096774 76.40000000 18.80000000
+3.87096774 4.06451613 77.12000000 19.04000000
+3.87096774 4.25806452 77.36000000 19.12000000
+3.87096774 4.45161290 77.68000000 19.22000000
+3.87096774 4.64516129 78.00000000 19.32000000
+3.87096774 4.83870968 78.08000000 19.36000000
+3.87096774 5.03225806 78.08000000 19.36000000
+3.87096774 5.22580645 78.08000000 19.36000000
+3.87096774 5.41935484 78.08000000 19.36000000
+3.87096774 5.61290323 78.08000000 19.36000000
+3.87096774 5.80645161 78.08000000 19.36000000
+3.87096774 6.00000000 78.08000000 19.36000000
+4.06451613 0.00000000 39.68000000 5.16000000
+4.06451613 0.19354839 39.68000000 5.16000000
+4.06451613 0.38709677 39.60000000 5.20000000
+4.06451613 0.58064516 39.44000000 5.30000000
+4.06451613 0.77419355 39.20000000 5.38000000
+4.06451613 0.96774194 39.04000000 5.48000000
+4.06451613 1.16129032 38.80000000 5.58000000
+4.06451613 1.35483871 38.64000000 5.68000000
+4.06451613 1.54838710 38.48000000 5.78000000
+4.06451613 1.74193548 38.24000000 5.88000000
+4.06451613 1.93548387 38.08000000 5.96000000
+4.06451613 2.12903226 37.68000000 6.18000000
+4.06451613 2.32258065 37.12000000 6.44000000
+4.06451613 2.51612903 36.64000000 6.68000000
+4.06451613 2.70967742 36.08000000 6.94000000
+4.06451613 2.90322581 35.60000000 7.20000000
+4.06451613 3.09677419 72.96000000 17.64000000
+4.06451613 3.29032258 73.84000000 17.94000000
+4.06451613 3.48387097 74.64000000 18.22000000
+4.06451613 3.67741935 75.52000000 18.52000000
+4.06451613 3.87096774 76.40000000 18.80000000
+4.06451613 4.06451613 77.12000000 19.04000000
+4.06451613 4.25806452 77.36000000 19.12000000
+4.06451613 4.45161290 77.68000000 19.22000000
+4.06451613 4.64516129 78.00000000 19.32000000
+4.06451613 4.83870968 78.24000000 19.42000000
+4.06451613 5.03225806 78.56000000 19.52000000
+4.06451613 5.22580645 78.80000000 19.62000000
+4.06451613 5.41935484 79.12000000 19.70000000
+4.06451613 5.61290323 79.44000000 19.80000000
+4.06451613 5.80645161 79.52000000 19.84000000
+4.06451613 6.00000000 79.52000000 19.84000000
+4.25806452 0.00000000 38.72000000 5.64000000
+4.25806452 0.19354839 38.72000000 5.64000000
+4.25806452 0.38709677 38.72000000 5.64000000
+4.25806452 0.58064516 38.72000000 5.64000000
+4.25806452 0.77419355 38.72000000 5.64000000
+4.25806452 0.96774194 38.72000000 5.64000000
+4.25806452 1.16129032 38.72000000 5.64000000
+4.25806452 1.35483871 38.64000000 5.68000000
+4.25806452 1.54838710 38.48000000 5.78000000
+4.25806452 1.74193548 38.24000000 5.88000000
+4.25806452 1.93548387 38.08000000 5.96000000
+4.25806452 2.12903226 37.68000000 6.18000000
+4.25806452 2.32258065 37.12000000 6.44000000
+4.25806452 2.51612903 36.64000000 6.68000000
+4.25806452 2.70967742 36.08000000 6.94000000
+4.25806452 2.90322581 35.60000000 7.20000000
+4.25806452 3.09677419 72.96000000 17.64000000
+4.25806452 3.29032258 73.84000000 17.94000000
+4.25806452 3.48387097 74.64000000 18.22000000
+4.25806452 3.67741935 75.52000000 18.52000000
+4.25806452 3.87096774 76.40000000 18.80000000
+4.25806452 4.06451613 77.12000000 19.04000000
+4.25806452 4.25806452 77.36000000 19.12000000
+4.25806452 4.45161290 77.68000000 19.22000000
+4.25806452 4.64516129 78.00000000 19.32000000
+4.25806452 4.83870968 78.08000000 19.36000000
+4.25806452 5.03225806 78.08000000 19.36000000
+4.25806452 5.22580645 78.08000000 19.36000000
+4.25806452 5.41935484 78.08000000 19.36000000
+4.25806452 5.61290323 78.08000000 19.36000000
+4.25806452 5.80645161 78.08000000 19.36000000
+4.25806452 6.00000000 78.08000000 19.36000000
+4.45161290 0.00000000 37.76000000 6.12000000
+4.45161290 0.19354839 37.76000000 6.12000000
+4.45161290 0.38709677 37.76000000 6.12000000
+4.45161290 0.58064516 37.76000000 6.12000000
+4.45161290 0.77419355 37.76000000 6.12000000
+4.45161290 0.96774194 37.76000000 6.12000000
+4.45161290 1.16129032 37.76000000 6.12000000
+4.45161290 1.35483871 37.76000000 6.12000000
+4.45161290 1.54838710 37.76000000 6.12000000
+4.45161290 1.74193548 37.76000000 6.12000000
+4.45161290 1.93548387 37.76000000 6.12000000
+4.45161290 2.12903226 37.68000000 6.18000000
+4.45161290 2.32258065 37.12000000 6.44000000
+4.45161290 2.51612903 36.64000000 6.68000000
+4.45161290 2.70967742 36.08000000 6.94000000
+4.45161290 2.90322581 35.60000000 7.20000000
+4.45161290 3.09677419 72.96000000 17.64000000
+4.45161290 3.29032258 73.84000000 17.94000000
+4.45161290 3.48387097 74.64000000 18.22000000
+4.45161290 3.67741935 75.52000000 18.52000000
+4.45161290 3.87096774 76.40000000 18.80000000
+4.45161290 4.06451613 76.64000000 18.88000000
+4.45161290 4.25806452 76.64000000 18.88000000
+4.45161290 4.45161290 76.64000000 18.88000000
+4.45161290 4.64516129 76.64000000 18.88000000
+4.45161290 4.83870968 76.64000000 18.88000000
+4.45161290 5.03225806 76.64000000 18.88000000
+4.45161290 5.22580645 76.64000000 18.88000000
+4.45161290 5.41935484 76.64000000 18.88000000
+4.45161290 5.61290323 76.64000000 18.88000000
+4.45161290 5.80645161 76.64000000 18.88000000
+4.45161290 6.00000000 76.64000000 18.88000000
+4.64516129 0.00000000 36.80000000 6.62000000
+4.64516129 0.19354839 36.80000000 6.62000000
+4.64516129 0.38709677 36.80000000 6.62000000
+4.64516129 0.58064516 36.80000000 6.62000000
+4.64516129 0.77419355 36.80000000 6.62000000
+4.64516129 0.96774194 36.80000000 6.62000000
+4.64516129 1.16129032 36.80000000 6.62000000
+4.64516129 1.35483871 36.80000000 6.62000000
+4.64516129 1.54838710 36.80000000 6.62000000
+4.64516129 1.74193548 36.80000000 6.62000000
+4.64516129 1.93548387 36.80000000 6.62000000
+4.64516129 2.12903226 36.80000000 6.62000000
+4.64516129 2.32258065 36.80000000 6.62000000
+4.64516129 2.51612903 36.64000000 6.68000000
+4.64516129 2.70967742 36.08000000 6.94000000
+4.64516129 2.90322581 35.60000000 7.20000000
+4.64516129 3.09677419 72.96000000 17.64000000
+4.64516129 3.29032258 73.84000000 17.94000000
+4.64516129 3.48387097 74.64000000 18.22000000
+4.64516129 3.67741935 75.20000000 18.38000000
+4.64516129 3.87096774 75.20000000 18.38000000
+4.64516129 4.06451613 75.20000000 18.38000000
+4.64516129 4.25806452 75.20000000 18.38000000
+4.64516129 4.45161290 75.20000000 18.38000000
+4.64516129 4.64516129 75.20000000 18.38000000
+4.64516129 4.83870968 75.20000000 18.38000000
+4.64516129 5.03225806 75.20000000 18.38000000
+4.64516129 5.22580645 75.20000000 18.38000000
+4.64516129 5.41935484 75.20000000 18.38000000
+4.64516129 5.61290323 75.20000000 18.38000000
+4.64516129 5.80645161 75.20000000 18.38000000
+4.64516129 6.00000000 75.20000000 18.38000000
+4.83870968 0.00000000 35.76000000 7.10000000
+4.83870968 0.19354839 35.76000000 7.10000000
+4.83870968 0.38709677 35.76000000 7.10000000
+4.83870968 0.58064516 35.76000000 7.10000000
+4.83870968 0.77419355 35.76000000 7.10000000
+4.83870968 0.96774194 35.76000000 7.10000000
+4.83870968 1.16129032 35.76000000 7.10000000
+4.83870968 1.35483871 35.76000000 7.10000000
+4.83870968 1.54838710 35.76000000 7.10000000
+4.83870968 1.74193548 35.76000000 7.10000000
+4.83870968 1.93548387 35.76000000 7.10000000
+4.83870968 2.12903226 35.76000000 7.10000000
+4.83870968 2.32258065 35.76000000 7.10000000
+4.83870968 2.51612903 35.76000000 7.10000000
+4.83870968 2.70967742 35.76000000 7.10000000
+4.83870968 2.90322581 35.60000000 7.20000000
+4.83870968 3.09677419 72.96000000 17.64000000
+4.83870968 3.29032258 73.68000000 17.90000000
+4.83870968 3.48387097 73.68000000 17.90000000
+4.83870968 3.67741935 73.68000000 17.90000000
+4.83870968 3.87096774 73.68000000 17.90000000
+4.83870968 4.06451613 73.68000000 17.90000000
+4.83870968 4.25806452 73.68000000 17.90000000
+4.83870968 4.45161290 73.68000000 17.90000000
+4.83870968 4.64516129 73.68000000 17.90000000
+4.83870968 4.83870968 73.68000000 17.90000000
+4.83870968 5.03225806 73.68000000 17.90000000
+4.83870968 5.22580645 73.68000000 17.90000000
+4.83870968 5.41935484 73.68000000 17.90000000
+4.83870968 5.61290323 73.68000000 17.90000000
+4.83870968 5.80645161 73.68000000 17.90000000
+4.83870968 6.00000000 73.68000000 17.90000000
+5.03225806 0.00000000 34.80000000 7.58000000
+5.03225806 0.19354839 34.80000000 7.58000000
+5.03225806 0.38709677 34.80000000 7.58000000
+5.03225806 0.58064516 34.80000000 7.58000000
+5.03225806 0.77419355 34.80000000 7.58000000
+5.03225806 0.96774194 34.80000000 7.58000000
+5.03225806 1.16129032 34.80000000 7.58000000
+5.03225806 1.35483871 34.80000000 7.58000000
+5.03225806 1.54838710 34.80000000 7.58000000
+5.03225806 1.74193548 34.80000000 7.58000000
+5.03225806 1.93548387 34.80000000 7.58000000
+5.03225806 2.12903226 34.80000000 7.58000000
+5.03225806 2.32258065 34.80000000 7.58000000
+5.03225806 2.51612903 34.80000000 7.58000000
+5.03225806 2.70967742 34.80000000 7.58000000
+5.03225806 2.90322581 34.80000000 7.58000000
+5.03225806 3.09677419 34.80000000 10.00000000
+5.03225806 3.29032258 72.24000000 17.42000000
+5.03225806 3.48387097 72.24000000 17.42000000
+5.03225806 3.67741935 72.24000000 17.42000000
+5.03225806 3.87096774 72.24000000 17.42000000
+5.03225806 4.06451613 72.24000000 17.42000000
+5.03225806 4.25806452 72.24000000 17.42000000
+5.03225806 4.45161290 72.24000000 17.42000000
+5.03225806 4.64516129 72.24000000 17.42000000
+5.03225806 4.83870968 72.24000000 17.42000000
+5.03225806 5.03225806 72.24000000 17.42000000
+5.03225806 5.22580645 72.24000000 17.42000000
+5.03225806 5.41935484 72.24000000 17.42000000
+5.03225806 5.61290323 72.24000000 17.42000000
+5.03225806 5.80645161 72.24000000 17.42000000
+5.03225806 6.00000000 72.24000000 17.42000000
+5.22580645 0.00000000 33.84000000 8.06000000
+5.22580645 0.19354839 33.84000000 8.06000000
+5.22580645 0.38709677 33.84000000 8.06000000
+5.22580645 0.58064516 33.84000000 8.06000000
+5.22580645 0.77419355 33.84000000 8.06000000
+5.22580645 0.96774194 33.84000000 8.06000000
+5.22580645 1.16129032 33.84000000 8.06000000
+5.22580645 1.35483871 33.84000000 8.06000000
+5.22580645 1.54838710 33.84000000 8.06000000
+5.22580645 1.74193548 33.84000000 8.06000000
+5.22580645 1.93548387 33.84000000 8.06000000
+5.22580645 2.12903226 33.84000000 8.06000000
+5.22580645 2.32258065 33.84000000 8.06000000
+5.22580645 2.51612903 33.84000000 8.06000000
+5.22580645 2.70967742 33.84000000 10.00000000
+5.22580645 2.90322581 33.84000000 10.00000000
+5.22580645 3.09677419 33.84000000 10.00000000
+5.22580645 3.29032258 33.84000000 10.00000000
+5.22580645 3.48387097 33.84000000 10.00000000
+5.22580645 3.67741935 70.80000000 16.94000000
+5.22580645 3.87096774 70.80000000 16.94000000
+5.22580645 4.06451613 70.80000000 16.94000000
+5.22580645 4.25806452 70.80000000 16.94000000
+5.22580645 4.45161290 70.80000000 16.94000000
+5.22580645 4.64516129 70.80000000 16.94000000
+5.22580645 4.83870968 70.80000000 16.94000000
+5.22580645 5.03225806 70.80000000 16.94000000
+5.22580645 5.22580645 70.80000000 16.94000000
+5.22580645 5.41935484 70.80000000 16.94000000
+5.22580645 5.61290323 70.80000000 16.94000000
+5.22580645 5.80645161 70.80000000 16.94000000
+5.22580645 6.00000000 70.80000000 16.94000000
+5.41935484 0.00000000 32.88000000 8.54000000
+5.41935484 0.19354839 32.88000000 8.54000000
+5.41935484 0.38709677 32.88000000 8.54000000
+5.41935484 0.58064516 32.88000000 8.54000000
+5.41935484 0.77419355 32.88000000 8.54000000
+5.41935484 0.96774194 32.88000000 8.54000000
+5.41935484 1.16129032 32.88000000 8.54000000
+5.41935484 1.35483871 32.88000000 8.54000000
+5.41935484 1.54838710 32.88000000 8.54000000
+5.41935484 1.74193548 32.88000000 8.54000000
+5.41935484 1.93548387 32.88000000 8.54000000
+5.41935484 2.12903226 32.88000000 8.54000000
+5.41935484 2.32258065 32.88000000 10.00000000
+5.41935484 2.51612903 32.88000000 10.00000000
+5.41935484 2.70967742 32.88000000 10.00000000
+5.41935484 2.90322581 32.88000000 10.00000000
+5.41935484 3.09677419 32.88000000 10.00000000
+5.41935484 3.29032258 32.88000000 10.00000000
+5.41935484 3.48387097 32.88000000 10.00000000
+5.41935484 3.67741935 32.88000000 10.00000000
+5.41935484 3.87096774 32.88000000 10.00000000
+5.41935484 4.06451613 69.36000000 16.46000000
+5.41935484 4.25806452 69.36000000 16.46000000
+5.41935484 4.45161290 69.36000000 16.46000000
+5.41935484 4.64516129 69.36000000 16.46000000
+5.41935484 4.83870968 69.36000000 16.46000000
+5.41935484 5.03225806 69.36000000 16.46000000
+5.41935484 5.22580645 69.36000000 16.46000000
+5.41935484 5.41935484 69.36000000 16.46000000
+5.41935484 5.61290323 69.36000000 16.46000000
+5.41935484 5.80645161 69.36000000 16.46000000
+5.41935484 6.00000000 69.36000000 16.46000000
+5.61290323 0.00000000 31.92000000 9.04000000
+5.61290323 0.19354839 31.92000000 9.04000000
+5.61290323 0.38709677 31.92000000 9.04000000
+5.61290323 0.58064516 31.92000000 9.04000000
+5.61290323 0.77419355 31.92000000 9.04000000
+5.61290323 0.96774194 31.92000000 9.04000000
+5.61290323 1.16129032 31.92000000 9.04000000
+5.61290323 1.35483871 31.92000000 9.04000000
+5.61290323 1.54838710 31.92000000 9.04000000
+5.61290323 1.74193548 31.92000000 9.04000000
+5.61290323 1.93548387 31.92000000 9.04000000
+5.61290323 2.12903226 31.92000000 10.00000000
+5.61290323 2.32258065 31.92000000 10.00000000
+5.61290323 2.51612903 31.92000000 10.00000000
+5.61290323 2.70967742 31.92000000 10.00000000
+5.61290323 2.90322581 31.92000000 10.00000000
+5.61290323 3.09677419 31.92000000 10.00000000
+5.61290323 3.29032258 31.92000000 10.00000000
+5.61290323 3.48387097 31.92000000 10.00000000
+5.61290323 3.67741935 31.92000000 10.00000000
+5.61290323 3.87096774 31.92000000 10.00000000
+5.61290323 4.06451613 31.92000000 10.00000000
+5.61290323 4.25806452 31.92000000 10.00000000
+5.61290323 4.45161290 67.92000000 15.96000000
+5.61290323 4.64516129 67.92000000 15.96000000
+5.61290323 4.83870968 67.92000000 15.96000000
+5.61290323 5.03225806 67.92000000 15.96000000
+5.61290323 5.22580645 67.92000000 15.96000000
+5.61290323 5.41935484 67.92000000 15.96000000
+5.61290323 5.61290323 67.92000000 15.96000000
+5.61290323 5.80645161 67.92000000 15.96000000
+5.61290323 6.00000000 67.92000000 15.96000000
+5.80645161 0.00000000 30.96000000 9.52000000
+5.80645161 0.19354839 30.96000000 9.52000000
+5.80645161 0.38709677 30.96000000 9.52000000
+5.80645161 0.58064516 30.96000000 9.52000000
+5.80645161 0.77419355 30.96000000 9.52000000
+5.80645161 0.96774194 30.96000000 9.52000000
+5.80645161 1.16129032 30.96000000 9.52000000
+5.80645161 1.35483871 30.96000000 9.52000000
+5.80645161 1.54838710 30.96000000 10.00000000
+5.80645161 1.74193548 30.96000000 10.00000000
+5.80645161 1.93548387 30.96000000 10.00000000
+5.80645161 2.12903226 30.96000000 10.00000000
+5.80645161 2.32258065 30.96000000 10.00000000
+5.80645161 2.51612903 30.96000000 10.00000000
+5.80645161 2.70967742 30.96000000 10.00000000
+5.80645161 2.90322581 30.96000000 10.00000000
+5.80645161 3.09677419 30.96000000 10.00000000
+5.80645161 3.29032258 30.96000000 10.00000000
+5.80645161 3.48387097 30.96000000 10.00000000
+5.80645161 3.67741935 30.96000000 10.00000000
+5.80645161 3.87096774 30.96000000 10.00000000
+5.80645161 4.06451613 30.96000000 10.00000000
+5.80645161 4.25806452 30.96000000 10.00000000
+5.80645161 4.45161290 30.96000000 10.00000000
+5.80645161 4.64516129 66.48000000 15.48000000
+5.80645161 4.83870968 66.48000000 15.48000000
+5.80645161 5.03225806 66.48000000 15.48000000
+5.80645161 5.22580645 66.48000000 15.48000000
+5.80645161 5.41935484 66.48000000 15.48000000
+5.80645161 5.61290323 66.48000000 15.48000000
+5.80645161 5.80645161 66.48000000 15.48000000
+5.80645161 6.00000000 66.48000000 15.48000000
+6.00000000 0.00000000 nan nan
+6.00000000 0.19354839 nan nan
+6.00000000 0.38709677 nan nan
+6.00000000 0.58064516 nan nan
+6.00000000 0.77419355 nan nan
+6.00000000 0.96774194 nan nan
+6.00000000 1.16129032 nan nan
+6.00000000 1.35483871 nan nan
+6.00000000 1.54838710 nan nan
+6.00000000 1.74193548 nan nan
+6.00000000 1.93548387 nan nan
+6.00000000 2.12903226 nan nan
+6.00000000 2.32258065 nan nan
+6.00000000 2.51612903 nan nan
+6.00000000 2.70967742 nan nan
+6.00000000 2.90322581 nan nan
+6.00000000 3.09677419 nan nan
+6.00000000 3.29032258 nan nan
+6.00000000 3.48387097 nan nan
+6.00000000 3.67741935 nan nan
+6.00000000 3.87096774 nan nan
+6.00000000 4.06451613 nan nan
+6.00000000 4.25806452 nan nan
+6.00000000 4.45161290 nan nan
+6.00000000 4.64516129 nan nan
+6.00000000 4.83870968 nan nan
+6.00000000 5.03225806 nan nan
+6.00000000 5.22580645 nan nan
+6.00000000 5.41935484 nan nan
+6.00000000 5.61290323 nan nan
+6.00000000 5.80645161 nan nan
+6.00000000 6.00000000 nan nan
diff --git a/examples/mamdani/Laundry.fll b/examples/mamdani/Laundry.fll
new file mode 100644
index 0000000..ef6fd44
--- /dev/null
+++ b/examples/mamdani/Laundry.fll
@@ -0,0 +1,43 @@
+Engine: Laundry
+InputVariable: Load
+ enabled: true
+ range: 0.000 6.000
+ term: small Discrete 0.000 1.000 1.000 1.000 2.000 0.800 5.000 0.000
+ term: normal Discrete 3.000 0.000 4.000 1.000 6.000 0.000
+InputVariable: Dirt
+ enabled: true
+ range: 0.000 6.000
+ term: low Discrete 0.000 1.000 2.000 0.800 5.000 0.000
+ term: high Discrete 1.000 0.000 2.000 0.200 4.000 0.800 6.000 1.000
+OutputVariable: Detergent
+ enabled: true
+ range: 0.000 80.000
+ accumulation: Maximum
+ defuzzifier: MeanOfMaximum 500
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: less Discrete 10.000 0.000 40.000 1.000 50.000 0.000
+ term: normal Discrete 40.000 0.000 50.000 1.000 60.000 1.000 80.000 0.000
+ term: more Discrete 50.000 0.000 80.000 1.000
+OutputVariable: Cycle
+ enabled: true
+ range: 0.000 20.000
+ accumulation: Maximum
+ defuzzifier: MeanOfMaximum 500
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: short Discrete 0.000 1.000 10.000 1.000 20.000 0.000
+ term: long Discrete 10.000 0.000 20.000 1.000
+RuleBlock:
+ enabled: true
+ conjunction: Minimum
+ disjunction: Maximum
+ activation: Minimum
+ rule: if Load is small and Dirt is not high then Detergent is less
+ rule: if Load is small and Dirt is high then Detergent is normal
+ rule: if Load is normal and Dirt is low then Detergent is less
+ rule: if Load is normal and Dirt is high then Detergent is more
+ rule: if Detergent is normal or Detergent is less then Cycle is short
+ rule: if Detergent is more then Cycle is long \ No newline at end of file
diff --git a/examples/mamdani/Laundry.java b/examples/mamdani/Laundry.java
new file mode 100644
index 0000000..d45e77e
--- /dev/null
+++ b/examples/mamdani/Laundry.java
@@ -0,0 +1,77 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class Laundry{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("Laundry");
+
+InputVariable inputVariable1 = new InputVariable();
+inputVariable1.setEnabled(true);
+inputVariable1.setName("Load");
+inputVariable1.setRange(0.000, 6.000);
+inputVariable1.addTerm(Discrete.create("small", 0.000, 1.000, 1.000, 1.000, 2.000, 0.800, 5.000, 0.000));
+inputVariable1.addTerm(Discrete.create("normal", 3.000, 0.000, 4.000, 1.000, 6.000, 0.000));
+engine.addInputVariable(inputVariable1);
+
+InputVariable inputVariable2 = new InputVariable();
+inputVariable2.setEnabled(true);
+inputVariable2.setName("Dirt");
+inputVariable2.setRange(0.000, 6.000);
+inputVariable2.addTerm(Discrete.create("low", 0.000, 1.000, 2.000, 0.800, 5.000, 0.000));
+inputVariable2.addTerm(Discrete.create("high", 1.000, 0.000, 2.000, 0.200, 4.000, 0.800, 6.000, 1.000));
+engine.addInputVariable(inputVariable2);
+
+OutputVariable outputVariable1 = new OutputVariable();
+outputVariable1.setEnabled(true);
+outputVariable1.setName("Detergent");
+outputVariable1.setRange(0.000, 80.000);
+outputVariable1.fuzzyOutput().setAccumulation(new Maximum());
+outputVariable1.setDefuzzifier(new MeanOfMaximum(500));
+outputVariable1.setDefaultValue(Double.NaN);
+outputVariable1.setLockPreviousOutputValue(false);
+outputVariable1.setLockOutputValueInRange(false);
+outputVariable1.addTerm(Discrete.create("less", 10.000, 0.000, 40.000, 1.000, 50.000, 0.000));
+outputVariable1.addTerm(Discrete.create("normal", 40.000, 0.000, 50.000, 1.000, 60.000, 1.000, 80.000, 0.000));
+outputVariable1.addTerm(Discrete.create("more", 50.000, 0.000, 80.000, 1.000));
+engine.addOutputVariable(outputVariable1);
+
+OutputVariable outputVariable2 = new OutputVariable();
+outputVariable2.setEnabled(true);
+outputVariable2.setName("Cycle");
+outputVariable2.setRange(0.000, 20.000);
+outputVariable2.fuzzyOutput().setAccumulation(new Maximum());
+outputVariable2.setDefuzzifier(new MeanOfMaximum(500));
+outputVariable2.setDefaultValue(Double.NaN);
+outputVariable2.setLockPreviousOutputValue(false);
+outputVariable2.setLockOutputValueInRange(false);
+outputVariable2.addTerm(Discrete.create("short", 0.000, 1.000, 10.000, 1.000, 20.000, 0.000));
+outputVariable2.addTerm(Discrete.create("long", 10.000, 0.000, 20.000, 1.000));
+engine.addOutputVariable(outputVariable2);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(new Minimum());
+ruleBlock.setDisjunction(new Maximum());
+ruleBlock.setActivation(new Minimum());
+ruleBlock.addRule(Rule.parse("if Load is small and Dirt is not high then Detergent is less", engine));
+ruleBlock.addRule(Rule.parse("if Load is small and Dirt is high then Detergent is normal", engine));
+ruleBlock.addRule(Rule.parse("if Load is normal and Dirt is low then Detergent is less", engine));
+ruleBlock.addRule(Rule.parse("if Load is normal and Dirt is high then Detergent is more", engine));
+ruleBlock.addRule(Rule.parse("if Detergent is normal or Detergent is less then Cycle is short", engine));
+ruleBlock.addRule(Rule.parse("if Detergent is more then Cycle is long", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/mamdani/SimpleDimmer.cpp b/examples/mamdani/SimpleDimmer.cpp
new file mode 100644
index 0000000..b4c6897
--- /dev/null
+++ b/examples/mamdani/SimpleDimmer.cpp
@@ -0,0 +1,44 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("simple-dimmer");
+
+InputVariable* inputVariable = new InputVariable;
+inputVariable->setEnabled(true);
+inputVariable->setName("Ambient");
+inputVariable->setRange(0.000, 1.000);
+inputVariable->addTerm(new Triangle("DARK", 0.000, 0.250, 0.500));
+inputVariable->addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+inputVariable->addTerm(new Triangle("BRIGHT", 0.500, 0.750, 1.000));
+engine->addInputVariable(inputVariable);
+
+OutputVariable* outputVariable = new OutputVariable;
+outputVariable->setEnabled(true);
+outputVariable->setName("Power");
+outputVariable->setRange(0.000, 1.000);
+outputVariable->fuzzyOutput()->setAccumulation(new Maximum);
+outputVariable->setDefuzzifier(new Centroid(200));
+outputVariable->setDefaultValue(fl::nan);
+outputVariable->setLockPreviousOutputValue(false);
+outputVariable->setLockOutputValueInRange(false);
+outputVariable->addTerm(new Triangle("LOW", 0.000, 0.250, 0.500));
+outputVariable->addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+outputVariable->addTerm(new Triangle("HIGH", 0.500, 0.750, 1.000));
+engine->addOutputVariable(outputVariable);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(fl::null);
+ruleBlock->setDisjunction(fl::null);
+ruleBlock->setActivation(new Minimum);
+ruleBlock->addRule(fl::Rule::parse("if Ambient is DARK then Power is HIGH", engine));
+ruleBlock->addRule(fl::Rule::parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
+ruleBlock->addRule(fl::Rule::parse("if Ambient is BRIGHT then Power is LOW", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/mamdani/SimpleDimmer.fcl b/examples/mamdani/SimpleDimmer.fcl
new file mode 100644
index 0000000..a9b9552
--- /dev/null
+++ b/examples/mamdani/SimpleDimmer.fcl
@@ -0,0 +1,35 @@
+FUNCTION_BLOCK simple-dimmer
+
+VAR_INPUT
+ Ambient: REAL;
+END_VAR
+
+VAR_OUTPUT
+ Power: REAL;
+END_VAR
+
+FUZZIFY Ambient
+ RANGE := (0.000 .. 1.000);
+ TERM DARK := Triangle 0.000 0.250 0.500;
+ TERM MEDIUM := Triangle 0.250 0.500 0.750;
+ TERM BRIGHT := Triangle 0.500 0.750 1.000;
+END_FUZZIFY
+
+DEFUZZIFY Power
+ RANGE := (0.000 .. 1.000);
+ TERM LOW := Triangle 0.000 0.250 0.500;
+ TERM MEDIUM := Triangle 0.250 0.500 0.750;
+ TERM HIGH := Triangle 0.500 0.750 1.000;
+ METHOD : COG;
+ ACCU : MAX;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ ACT : MIN;
+ RULE 1 : if Ambient is DARK then Power is HIGH
+ RULE 2 : if Ambient is MEDIUM then Power is MEDIUM
+ RULE 3 : if Ambient is BRIGHT then Power is LOW
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/mamdani/SimpleDimmer.fis b/examples/mamdani/SimpleDimmer.fis
new file mode 100644
index 0000000..40ac849
--- /dev/null
+++ b/examples/mamdani/SimpleDimmer.fis
@@ -0,0 +1,32 @@
+[System]
+Name='simple-dimmer'
+Type='mamdani'
+NumInputs=1
+NumOutputs=1
+NumRules=3
+AndMethod=''
+OrMethod=''
+ImpMethod='min'
+AggMethod='max'
+DefuzzMethod='centroid'
+
+[Input1]
+Name='Ambient'
+Range=[0.000 1.000]
+NumMFs=3
+MF1='DARK':'trimf',[0.000 0.250 0.500]
+MF2='MEDIUM':'trimf',[0.250 0.500 0.750]
+MF3='BRIGHT':'trimf',[0.500 0.750 1.000]
+
+[Output1]
+Name='Power'
+Range=[0.000 1.000]
+NumMFs=3
+MF1='LOW':'trimf',[0.000 0.250 0.500]
+MF2='MEDIUM':'trimf',[0.250 0.500 0.750]
+MF3='HIGH':'trimf',[0.500 0.750 1.000]
+
+[Rules]
+1.000 , 3.000 (1.000) : 1
+2.000 , 2.000 (1.000) : 1
+3.000 , 1.000 (1.000) : 1
diff --git a/examples/mamdani/SimpleDimmer.fld b/examples/mamdani/SimpleDimmer.fld
new file mode 100644
index 0000000..4d9a671
--- /dev/null
+++ b/examples/mamdani/SimpleDimmer.fld
@@ -0,0 +1,1026 @@
+#@Engine: simple-dimmer;
+#@InputVariable: Ambient; @OutputVariable: Power;
+0.00000000 nan
+0.00097752 0.75000000
+0.00195503 0.75000000
+0.00293255 0.75000000
+0.00391007 0.75000000
+0.00488759 0.75000000
+0.00586510 0.75000000
+0.00684262 0.75000000
+0.00782014 0.75000000
+0.00879765 0.75000000
+0.00977517 0.75000000
+0.01075269 0.75000000
+0.01173021 0.75000000
+0.01270772 0.75000000
+0.01368524 0.75000000
+0.01466276 0.75000000
+0.01564027 0.75000000
+0.01661779 0.75000000
+0.01759531 0.75000000
+0.01857283 0.75000000
+0.01955034 0.75000000
+0.02052786 0.75000000
+0.02150538 0.75000000
+0.02248289 0.75000000
+0.02346041 0.75000000
+0.02443793 0.75000000
+0.02541544 0.75000000
+0.02639296 0.75000000
+0.02737048 0.75000000
+0.02834800 0.75000000
+0.02932551 0.75000000
+0.03030303 0.75000000
+0.03128055 0.75000000
+0.03225806 0.75000000
+0.03323558 0.75000000
+0.03421310 0.75000000
+0.03519062 0.75000000
+0.03616813 0.75000000
+0.03714565 0.75000000
+0.03812317 0.75000000
+0.03910068 0.75000000
+0.04007820 0.75000000
+0.04105572 0.75000000
+0.04203324 0.75000000
+0.04301075 0.75000000
+0.04398827 0.75000000
+0.04496579 0.75000000
+0.04594330 0.75000000
+0.04692082 0.75000000
+0.04789834 0.75000000
+0.04887586 0.75000000
+0.04985337 0.75000000
+0.05083089 0.75000000
+0.05180841 0.75000000
+0.05278592 0.75000000
+0.05376344 0.75000000
+0.05474096 0.75000000
+0.05571848 0.75000000
+0.05669599 0.75000000
+0.05767351 0.75000000
+0.05865103 0.75000000
+0.05962854 0.75000000
+0.06060606 0.75000000
+0.06158358 0.75000000
+0.06256109 0.75000000
+0.06353861 0.75000000
+0.06451613 0.75000000
+0.06549365 0.75000000
+0.06647116 0.75000000
+0.06744868 0.75000000
+0.06842620 0.75000000
+0.06940371 0.75000000
+0.07038123 0.75000000
+0.07135875 0.75000000
+0.07233627 0.75000000
+0.07331378 0.75000000
+0.07429130 0.75000000
+0.07526882 0.75000000
+0.07624633 0.75000000
+0.07722385 0.75000000
+0.07820137 0.75000000
+0.07917889 0.75000000
+0.08015640 0.75000000
+0.08113392 0.75000000
+0.08211144 0.75000000
+0.08308895 0.75000000
+0.08406647 0.75000000
+0.08504399 0.75000000
+0.08602151 0.75000000
+0.08699902 0.75000000
+0.08797654 0.75000000
+0.08895406 0.75000000
+0.08993157 0.75000000
+0.09090909 0.75000000
+0.09188661 0.75000000
+0.09286413 0.75000000
+0.09384164 0.75000000
+0.09481916 0.75000000
+0.09579668 0.75000000
+0.09677419 0.75000000
+0.09775171 0.75000000
+0.09872923 0.75000000
+0.09970674 0.75000000
+0.10068426 0.75000000
+0.10166178 0.75000000
+0.10263930 0.75000000
+0.10361681 0.75000000
+0.10459433 0.75000000
+0.10557185 0.75000000
+0.10654936 0.75000000
+0.10752688 0.75000000
+0.10850440 0.75000000
+0.10948192 0.75000000
+0.11045943 0.75000000
+0.11143695 0.75000000
+0.11241447 0.75000000
+0.11339198 0.75000000
+0.11436950 0.75000000
+0.11534702 0.75000000
+0.11632454 0.75000000
+0.11730205 0.75000000
+0.11827957 0.75000000
+0.11925709 0.75000000
+0.12023460 0.75000000
+0.12121212 0.75000000
+0.12218964 0.75000000
+0.12316716 0.75000000
+0.12414467 0.75000000
+0.12512219 0.75000000
+0.12609971 0.75000000
+0.12707722 0.75000000
+0.12805474 0.75000000
+0.12903226 0.75000000
+0.13000978 0.75000000
+0.13098729 0.75000000
+0.13196481 0.75000000
+0.13294233 0.75000000
+0.13391984 0.75000000
+0.13489736 0.75000000
+0.13587488 0.75000000
+0.13685239 0.75000000
+0.13782991 0.75000000
+0.13880743 0.75000000
+0.13978495 0.75000000
+0.14076246 0.75000000
+0.14173998 0.75000000
+0.14271750 0.75000000
+0.14369501 0.75000000
+0.14467253 0.75000000
+0.14565005 0.75000000
+0.14662757 0.75000000
+0.14760508 0.75000000
+0.14858260 0.75000000
+0.14956012 0.75000000
+0.15053763 0.75000000
+0.15151515 0.75000000
+0.15249267 0.75000000
+0.15347019 0.75000000
+0.15444770 0.75000000
+0.15542522 0.75000000
+0.15640274 0.75000000
+0.15738025 0.75000000
+0.15835777 0.75000000
+0.15933529 0.75000000
+0.16031281 0.75000000
+0.16129032 0.75000000
+0.16226784 0.75000000
+0.16324536 0.75000000
+0.16422287 0.75000000
+0.16520039 0.75000000
+0.16617791 0.75000000
+0.16715543 0.75000000
+0.16813294 0.75000000
+0.16911046 0.75000000
+0.17008798 0.75000000
+0.17106549 0.75000000
+0.17204301 0.75000000
+0.17302053 0.75000000
+0.17399804 0.75000000
+0.17497556 0.75000000
+0.17595308 0.75000000
+0.17693060 0.75000000
+0.17790811 0.75000000
+0.17888563 0.75000000
+0.17986315 0.75000000
+0.18084066 0.75000000
+0.18181818 0.75000000
+0.18279570 0.75000000
+0.18377322 0.75000000
+0.18475073 0.75000000
+0.18572825 0.75000000
+0.18670577 0.75000000
+0.18768328 0.75000000
+0.18866080 0.75000000
+0.18963832 0.75000000
+0.19061584 0.75000000
+0.19159335 0.75000000
+0.19257087 0.75000000
+0.19354839 0.75000000
+0.19452590 0.75000000
+0.19550342 0.75000000
+0.19648094 0.75000000
+0.19745846 0.75000000
+0.19843597 0.75000000
+0.19941349 0.75000000
+0.20039101 0.75000000
+0.20136852 0.75000000
+0.20234604 0.75000000
+0.20332356 0.75000000
+0.20430108 0.75000000
+0.20527859 0.75000000
+0.20625611 0.75000000
+0.20723363 0.75000000
+0.20821114 0.75000000
+0.20918866 0.75000000
+0.21016618 0.75000000
+0.21114370 0.75000000
+0.21212121 0.75000000
+0.21309873 0.75000000
+0.21407625 0.75000000
+0.21505376 0.75000000
+0.21603128 0.75000000
+0.21700880 0.75000000
+0.21798631 0.75000000
+0.21896383 0.75000000
+0.21994135 0.75000000
+0.22091887 0.75000000
+0.22189638 0.75000000
+0.22287390 0.75000000
+0.22385142 0.75000000
+0.22482893 0.75000000
+0.22580645 0.75000000
+0.22678397 0.75000000
+0.22776149 0.75000000
+0.22873900 0.75000000
+0.22971652 0.75000000
+0.23069404 0.75000000
+0.23167155 0.75000000
+0.23264907 0.75000000
+0.23362659 0.75000000
+0.23460411 0.75000000
+0.23558162 0.75000000
+0.23655914 0.75000000
+0.23753666 0.75000000
+0.23851417 0.75000000
+0.23949169 0.75000000
+0.24046921 0.75000000
+0.24144673 0.75000000
+0.24242424 0.75000000
+0.24340176 0.75000000
+0.24437928 0.75000000
+0.24535679 0.75000000
+0.24633431 0.75000000
+0.24731183 0.75000000
+0.24828935 0.75000000
+0.24926686 0.75000000
+0.25024438 0.74963379
+0.25122190 0.74817607
+0.25219941 0.74672965
+0.25317693 0.74530727
+0.25415445 0.74390115
+0.25513196 0.74250538
+0.25610948 0.74111985
+0.25708700 0.73974444
+0.25806452 0.73838897
+0.25904203 0.73705025
+0.26001955 0.73572080
+0.26099707 0.73440054
+0.26197458 0.73308936
+0.26295210 0.73179453
+0.26392962 0.73051679
+0.26490714 0.72924739
+0.26588465 0.72798623
+0.26686217 0.72673323
+0.26783969 0.72549344
+0.26881720 0.72427097
+0.26979472 0.72305599
+0.27077224 0.72184842
+0.27174976 0.72064820
+0.27272727 0.71945844
+0.27370479 0.71828610
+0.27468231 0.71712050
+0.27565982 0.71596157
+0.27663734 0.71480927
+0.27761486 0.71366501
+0.27859238 0.71253818
+0.27956989 0.71141742
+0.28054741 0.71030267
+0.28152493 0.70919389
+0.28250244 0.70809106
+0.28347996 0.70700557
+0.28445748 0.70592553
+0.28543500 0.70485092
+0.28641251 0.70378169
+0.28739003 0.70271779
+0.28836755 0.70166862
+0.28934506 0.70062558
+0.29032258 0.69958742
+0.29130010 0.69855412
+0.29227761 0.69752564
+0.29325513 0.69650949
+0.29423265 0.69550004
+0.29521017 0.69449498
+0.29618768 0.69349430
+0.29716520 0.69249796
+0.29814272 0.69151186
+0.29912023 0.69053287
+0.30009775 0.68955785
+0.30107527 0.68858676
+0.30205279 0.68761958
+0.30303030 0.68666076
+0.30400782 0.68570938
+0.30498534 0.68476154
+0.30596285 0.68381725
+0.30694037 0.68287647
+0.30791789 0.68194242
+0.30889541 0.68101598
+0.30987292 0.68009273
+0.31085044 0.67917264
+0.31182796 0.67825571
+0.31280547 0.67734408
+0.31378299 0.67644013
+0.31476051 0.67553902
+0.31573803 0.67464075
+0.31671554 0.67374530
+0.31769306 0.67285389
+0.31867058 0.67197014
+0.31964809 0.67108892
+0.32062561 0.67021023
+0.32160313 0.66933404
+0.32258065 0.66846082
+0.32355816 0.66759513
+0.32453568 0.66673167
+0.32551320 0.66587045
+0.32649071 0.66501145
+0.32746823 0.66415466
+0.32844575 0.66330485
+0.32942326 0.66245716
+0.33040078 0.66161144
+0.33137830 0.66076767
+0.33235582 0.65992584
+0.33333333 0.65908967
+0.33431085 0.65825587
+0.33528837 0.65742377
+0.33626588 0.65659337
+0.33724340 0.65576467
+0.33822092 0.65494046
+0.33919844 0.65411875
+0.34017595 0.65329850
+0.34115347 0.65247971
+0.34213099 0.65166237
+0.34310850 0.65084852
+0.34408602 0.65003719
+0.34506354 0.64922708
+0.34604106 0.64841821
+0.34701857 0.64761056
+0.34799609 0.64680554
+0.34897361 0.64600293
+0.34995112 0.64520134
+0.35092864 0.64440076
+0.35190616 0.64360119
+0.35288368 0.64280350
+0.35386119 0.64200804
+0.35483871 0.64121338
+0.35581623 0.64041952
+0.35679374 0.63962646
+0.35777126 0.63883468
+0.35874878 0.63804481
+0.35972630 0.63725555
+0.36070381 0.63646688
+0.36168133 0.63567880
+0.36265885 0.63489151
+0.36363636 0.63410574
+0.36461388 0.63332037
+0.36559140 0.63253539
+0.36656891 0.63175080
+0.36754643 0.63096664
+0.36852395 0.63018348
+0.36950147 0.62940052
+0.37047898 0.62861775
+0.37145650 0.62783518
+0.37243402 0.62705280
+0.37341153 0.62627077
+0.37438905 0.62548876
+0.37536657 0.62470674
+0.37634409 0.62392473
+0.37732160 0.62314272
+0.37829912 0.62236043
+0.37927664 0.62157791
+0.38025415 0.62079519
+0.38123167 0.62001228
+0.38220919 0.61922917
+0.38318671 0.61844529
+0.38416422 0.61766080
+0.38514174 0.61687591
+0.38611926 0.61609064
+0.38709677 0.61530497
+0.38807429 0.61451813
+0.38905181 0.61373020
+0.39002933 0.61294168
+0.39100684 0.61215256
+0.39198436 0.61136285
+0.39296188 0.61057168
+0.39393939 0.60977882
+0.39491691 0.60898516
+0.39589443 0.60819070
+0.39687195 0.60739544
+0.39784946 0.60659855
+0.39882698 0.60579922
+0.39980450 0.60499890
+0.40078201 0.60419756
+0.40175953 0.60339521
+0.40273705 0.60259116
+0.40371457 0.60178382
+0.40469208 0.60097525
+0.40566960 0.60016546
+0.40664712 0.59935443
+0.40762463 0.59854174
+0.40860215 0.59772477
+0.40957967 0.59690634
+0.41055718 0.59608645
+0.41153470 0.59526511
+0.41251222 0.59444225
+0.41348974 0.59361396
+0.41446725 0.59278399
+0.41544477 0.59195232
+0.41642229 0.59111894
+0.41739980 0.59028386
+0.41837732 0.58944297
+0.41935484 0.58859969
+0.42033236 0.58775445
+0.42130987 0.58690726
+0.42228739 0.58605810
+0.42326491 0.58520295
+0.42424242 0.58434451
+0.42521994 0.58348384
+0.42619746 0.58262095
+0.42717498 0.58175582
+0.42815249 0.58088462
+0.42913001 0.58000905
+0.43010753 0.57913099
+0.43108504 0.57825040
+0.43206256 0.57736728
+0.43304008 0.57647812
+0.43401760 0.57558337
+0.43499511 0.57468581
+0.43597263 0.57378542
+0.43695015 0.57288218
+0.43792766 0.57197303
+0.43890518 0.57105688
+0.43988270 0.57013759
+0.44086022 0.56921513
+0.44183773 0.56828949
+0.44281525 0.56735818
+0.44379277 0.56641827
+0.44477028 0.56547486
+0.44574780 0.56452791
+0.44672532 0.56357742
+0.44770283 0.56262161
+0.44868035 0.56165541
+0.44965787 0.56068529
+0.45063539 0.55971125
+0.45161290 0.55873326
+0.45259042 0.55775044
+0.45356794 0.55675519
+0.45454545 0.55575559
+0.45552297 0.55475164
+0.45650049 0.55374329
+0.45747801 0.55273051
+0.45845552 0.55170345
+0.45943304 0.55067135
+0.46041056 0.54963442
+0.46138807 0.54859260
+0.46236559 0.54754587
+0.46334311 0.54648479
+0.46432063 0.54541689
+0.46529814 0.54434363
+0.46627566 0.54326495
+0.46725318 0.54218083
+0.46823069 0.54108237
+0.46920821 0.53997508
+0.47018573 0.53886183
+0.47116325 0.53774257
+0.47214076 0.53661727
+0.47311828 0.53547778
+0.47409580 0.53432712
+0.47507331 0.53316986
+0.47605083 0.53200593
+0.47702835 0.53083528
+0.47800587 0.52965071
+0.47898338 0.52845232
+0.47996090 0.52724659
+0.48093842 0.52603347
+0.48191593 0.52481288
+0.48289345 0.52357875
+0.48387097 0.52232778
+0.48484848 0.52106867
+0.48582600 0.51980133
+0.48680352 0.51852569
+0.48778104 0.51723703
+0.48875855 0.51592811
+0.48973607 0.51461012
+0.49071359 0.51328298
+0.49169110 0.51194659
+0.49266862 0.51059784
+0.49364614 0.50922495
+0.49462366 0.50784195
+0.49560117 0.50644876
+0.49657869 0.50504524
+0.49755621 0.50363020
+0.49853372 0.50218659
+0.49951124 0.50073171
+0.50048876 0.49926829
+0.50146628 0.49781341
+0.50244379 0.49636980
+0.50342131 0.49495476
+0.50439883 0.49355124
+0.50537634 0.49215805
+0.50635386 0.49077505
+0.50733138 0.48940216
+0.50830890 0.48805341
+0.50928641 0.48671702
+0.51026393 0.48538988
+0.51124145 0.48407189
+0.51221896 0.48276297
+0.51319648 0.48147431
+0.51417400 0.48019867
+0.51515152 0.47893133
+0.51612903 0.47767222
+0.51710655 0.47642125
+0.51808407 0.47518712
+0.51906158 0.47396653
+0.52003910 0.47275341
+0.52101662 0.47154768
+0.52199413 0.47034929
+0.52297165 0.46916472
+0.52394917 0.46799407
+0.52492669 0.46683014
+0.52590420 0.46567288
+0.52688172 0.46452222
+0.52785924 0.46338273
+0.52883675 0.46225743
+0.52981427 0.46113817
+0.53079179 0.46002492
+0.53176931 0.45891763
+0.53274682 0.45781917
+0.53372434 0.45673505
+0.53470186 0.45565637
+0.53567937 0.45458311
+0.53665689 0.45351521
+0.53763441 0.45245413
+0.53861193 0.45140740
+0.53958944 0.45036558
+0.54056696 0.44932865
+0.54154448 0.44829655
+0.54252199 0.44726949
+0.54349951 0.44625671
+0.54447703 0.44524836
+0.54545455 0.44424441
+0.54643206 0.44324481
+0.54740958 0.44224956
+0.54838710 0.44126674
+0.54936461 0.44028875
+0.55034213 0.43931471
+0.55131965 0.43834459
+0.55229717 0.43737839
+0.55327468 0.43642258
+0.55425220 0.43547209
+0.55522972 0.43452514
+0.55620723 0.43358173
+0.55718475 0.43264182
+0.55816227 0.43171051
+0.55913978 0.43078487
+0.56011730 0.42986241
+0.56109482 0.42894312
+0.56207234 0.42802697
+0.56304985 0.42711782
+0.56402737 0.42621458
+0.56500489 0.42531419
+0.56598240 0.42441663
+0.56695992 0.42352188
+0.56793744 0.42263272
+0.56891496 0.42174960
+0.56989247 0.42086901
+0.57086999 0.41999095
+0.57184751 0.41911538
+0.57282502 0.41824418
+0.57380254 0.41737905
+0.57478006 0.41651616
+0.57575758 0.41565549
+0.57673509 0.41479705
+0.57771261 0.41394190
+0.57869013 0.41309274
+0.57966764 0.41224555
+0.58064516 0.41140031
+0.58162268 0.41055703
+0.58260020 0.40971614
+0.58357771 0.40888106
+0.58455523 0.40804768
+0.58553275 0.40721601
+0.58651026 0.40638604
+0.58748778 0.40555775
+0.58846530 0.40473489
+0.58944282 0.40391355
+0.59042033 0.40309366
+0.59139785 0.40227523
+0.59237537 0.40145826
+0.59335288 0.40064557
+0.59433040 0.39983454
+0.59530792 0.39902475
+0.59628543 0.39821618
+0.59726295 0.39740884
+0.59824047 0.39660479
+0.59921799 0.39580244
+0.60019550 0.39500110
+0.60117302 0.39420078
+0.60215054 0.39340145
+0.60312805 0.39260456
+0.60410557 0.39180930
+0.60508309 0.39101484
+0.60606061 0.39022118
+0.60703812 0.38942832
+0.60801564 0.38863715
+0.60899316 0.38784744
+0.60997067 0.38705832
+0.61094819 0.38626980
+0.61192571 0.38548187
+0.61290323 0.38469503
+0.61388074 0.38390936
+0.61485826 0.38312409
+0.61583578 0.38233920
+0.61681329 0.38155471
+0.61779081 0.38077083
+0.61876833 0.37998772
+0.61974585 0.37920481
+0.62072336 0.37842209
+0.62170088 0.37763957
+0.62267840 0.37685728
+0.62365591 0.37607527
+0.62463343 0.37529326
+0.62561095 0.37451124
+0.62658847 0.37372923
+0.62756598 0.37294720
+0.62854350 0.37216482
+0.62952102 0.37138225
+0.63049853 0.37059948
+0.63147605 0.36981652
+0.63245357 0.36903336
+0.63343109 0.36824920
+0.63440860 0.36746461
+0.63538612 0.36667963
+0.63636364 0.36589426
+0.63734115 0.36510849
+0.63831867 0.36432120
+0.63929619 0.36353312
+0.64027370 0.36274445
+0.64125122 0.36195519
+0.64222874 0.36116532
+0.64320626 0.36037354
+0.64418377 0.35958048
+0.64516129 0.35878662
+0.64613881 0.35799196
+0.64711632 0.35719650
+0.64809384 0.35639881
+0.64907136 0.35559924
+0.65004888 0.35479866
+0.65102639 0.35399707
+0.65200391 0.35319446
+0.65298143 0.35238944
+0.65395894 0.35158179
+0.65493646 0.35077292
+0.65591398 0.34996281
+0.65689150 0.34915148
+0.65786901 0.34833763
+0.65884653 0.34752029
+0.65982405 0.34670150
+0.66080156 0.34588125
+0.66177908 0.34505954
+0.66275660 0.34423533
+0.66373412 0.34340663
+0.66471163 0.34257623
+0.66568915 0.34174413
+0.66666667 0.34091033
+0.66764418 0.34007416
+0.66862170 0.33923233
+0.66959922 0.33838856
+0.67057674 0.33754284
+0.67155425 0.33669515
+0.67253177 0.33584534
+0.67350929 0.33498855
+0.67448680 0.33412955
+0.67546432 0.33326833
+0.67644184 0.33240487
+0.67741935 0.33153918
+0.67839687 0.33066596
+0.67937439 0.32978977
+0.68035191 0.32891108
+0.68132942 0.32802986
+0.68230694 0.32714611
+0.68328446 0.32625470
+0.68426197 0.32535925
+0.68523949 0.32446098
+0.68621701 0.32355987
+0.68719453 0.32265592
+0.68817204 0.32174429
+0.68914956 0.32082736
+0.69012708 0.31990727
+0.69110459 0.31898402
+0.69208211 0.31805758
+0.69305963 0.31712353
+0.69403715 0.31618275
+0.69501466 0.31523846
+0.69599218 0.31429062
+0.69696970 0.31333924
+0.69794721 0.31238042
+0.69892473 0.31141324
+0.69990225 0.31044215
+0.70087977 0.30946713
+0.70185728 0.30848814
+0.70283480 0.30750204
+0.70381232 0.30650570
+0.70478983 0.30550502
+0.70576735 0.30449996
+0.70674487 0.30349051
+0.70772239 0.30247436
+0.70869990 0.30144588
+0.70967742 0.30041258
+0.71065494 0.29937442
+0.71163245 0.29833138
+0.71260997 0.29728221
+0.71358749 0.29621831
+0.71456500 0.29514908
+0.71554252 0.29407447
+0.71652004 0.29299443
+0.71749756 0.29190894
+0.71847507 0.29080611
+0.71945259 0.28969733
+0.72043011 0.28858258
+0.72140762 0.28746182
+0.72238514 0.28633499
+0.72336266 0.28519073
+0.72434018 0.28403843
+0.72531769 0.28287950
+0.72629521 0.28171390
+0.72727273 0.28054156
+0.72825024 0.27935180
+0.72922776 0.27815158
+0.73020528 0.27694401
+0.73118280 0.27572903
+0.73216031 0.27450656
+0.73313783 0.27326677
+0.73411535 0.27201377
+0.73509286 0.27075261
+0.73607038 0.26948321
+0.73704790 0.26820547
+0.73802542 0.26691064
+0.73900293 0.26559946
+0.73998045 0.26427920
+0.74095797 0.26294975
+0.74193548 0.26161103
+0.74291300 0.26025556
+0.74389052 0.25888015
+0.74486804 0.25749462
+0.74584555 0.25609885
+0.74682307 0.25469273
+0.74780059 0.25327035
+0.74877810 0.25182393
+0.74975562 0.25036621
+0.75073314 0.25000000
+0.75171065 0.25000000
+0.75268817 0.25000000
+0.75366569 0.25000000
+0.75464321 0.25000000
+0.75562072 0.25000000
+0.75659824 0.25000000
+0.75757576 0.25000000
+0.75855327 0.25000000
+0.75953079 0.25000000
+0.76050831 0.25000000
+0.76148583 0.25000000
+0.76246334 0.25000000
+0.76344086 0.25000000
+0.76441838 0.25000000
+0.76539589 0.25000000
+0.76637341 0.25000000
+0.76735093 0.25000000
+0.76832845 0.25000000
+0.76930596 0.25000000
+0.77028348 0.25000000
+0.77126100 0.25000000
+0.77223851 0.25000000
+0.77321603 0.25000000
+0.77419355 0.25000000
+0.77517107 0.25000000
+0.77614858 0.25000000
+0.77712610 0.25000000
+0.77810362 0.25000000
+0.77908113 0.25000000
+0.78005865 0.25000000
+0.78103617 0.25000000
+0.78201369 0.25000000
+0.78299120 0.25000000
+0.78396872 0.25000000
+0.78494624 0.25000000
+0.78592375 0.25000000
+0.78690127 0.25000000
+0.78787879 0.25000000
+0.78885630 0.25000000
+0.78983382 0.25000000
+0.79081134 0.25000000
+0.79178886 0.25000000
+0.79276637 0.25000000
+0.79374389 0.25000000
+0.79472141 0.25000000
+0.79569892 0.25000000
+0.79667644 0.25000000
+0.79765396 0.25000000
+0.79863148 0.25000000
+0.79960899 0.25000000
+0.80058651 0.25000000
+0.80156403 0.25000000
+0.80254154 0.25000000
+0.80351906 0.25000000
+0.80449658 0.25000000
+0.80547410 0.25000000
+0.80645161 0.25000000
+0.80742913 0.25000000
+0.80840665 0.25000000
+0.80938416 0.25000000
+0.81036168 0.25000000
+0.81133920 0.25000000
+0.81231672 0.25000000
+0.81329423 0.25000000
+0.81427175 0.25000000
+0.81524927 0.25000000
+0.81622678 0.25000000
+0.81720430 0.25000000
+0.81818182 0.25000000
+0.81915934 0.25000000
+0.82013685 0.25000000
+0.82111437 0.25000000
+0.82209189 0.25000000
+0.82306940 0.25000000
+0.82404692 0.25000000
+0.82502444 0.25000000
+0.82600196 0.25000000
+0.82697947 0.25000000
+0.82795699 0.25000000
+0.82893451 0.25000000
+0.82991202 0.25000000
+0.83088954 0.25000000
+0.83186706 0.25000000
+0.83284457 0.25000000
+0.83382209 0.25000000
+0.83479961 0.25000000
+0.83577713 0.25000000
+0.83675464 0.25000000
+0.83773216 0.25000000
+0.83870968 0.25000000
+0.83968719 0.25000000
+0.84066471 0.25000000
+0.84164223 0.25000000
+0.84261975 0.25000000
+0.84359726 0.25000000
+0.84457478 0.25000000
+0.84555230 0.25000000
+0.84652981 0.25000000
+0.84750733 0.25000000
+0.84848485 0.25000000
+0.84946237 0.25000000
+0.85043988 0.25000000
+0.85141740 0.25000000
+0.85239492 0.25000000
+0.85337243 0.25000000
+0.85434995 0.25000000
+0.85532747 0.25000000
+0.85630499 0.25000000
+0.85728250 0.25000000
+0.85826002 0.25000000
+0.85923754 0.25000000
+0.86021505 0.25000000
+0.86119257 0.25000000
+0.86217009 0.25000000
+0.86314761 0.25000000
+0.86412512 0.25000000
+0.86510264 0.25000000
+0.86608016 0.25000000
+0.86705767 0.25000000
+0.86803519 0.25000000
+0.86901271 0.25000000
+0.86999022 0.25000000
+0.87096774 0.25000000
+0.87194526 0.25000000
+0.87292278 0.25000000
+0.87390029 0.25000000
+0.87487781 0.25000000
+0.87585533 0.25000000
+0.87683284 0.25000000
+0.87781036 0.25000000
+0.87878788 0.25000000
+0.87976540 0.25000000
+0.88074291 0.25000000
+0.88172043 0.25000000
+0.88269795 0.25000000
+0.88367546 0.25000000
+0.88465298 0.25000000
+0.88563050 0.25000000
+0.88660802 0.25000000
+0.88758553 0.25000000
+0.88856305 0.25000000
+0.88954057 0.25000000
+0.89051808 0.25000000
+0.89149560 0.25000000
+0.89247312 0.25000000
+0.89345064 0.25000000
+0.89442815 0.25000000
+0.89540567 0.25000000
+0.89638319 0.25000000
+0.89736070 0.25000000
+0.89833822 0.25000000
+0.89931574 0.25000000
+0.90029326 0.25000000
+0.90127077 0.25000000
+0.90224829 0.25000000
+0.90322581 0.25000000
+0.90420332 0.25000000
+0.90518084 0.25000000
+0.90615836 0.25000000
+0.90713587 0.25000000
+0.90811339 0.25000000
+0.90909091 0.25000000
+0.91006843 0.25000000
+0.91104594 0.25000000
+0.91202346 0.25000000
+0.91300098 0.25000000
+0.91397849 0.25000000
+0.91495601 0.25000000
+0.91593353 0.25000000
+0.91691105 0.25000000
+0.91788856 0.25000000
+0.91886608 0.25000000
+0.91984360 0.25000000
+0.92082111 0.25000000
+0.92179863 0.25000000
+0.92277615 0.25000000
+0.92375367 0.25000000
+0.92473118 0.25000000
+0.92570870 0.25000000
+0.92668622 0.25000000
+0.92766373 0.25000000
+0.92864125 0.25000000
+0.92961877 0.25000000
+0.93059629 0.25000000
+0.93157380 0.25000000
+0.93255132 0.25000000
+0.93352884 0.25000000
+0.93450635 0.25000000
+0.93548387 0.25000000
+0.93646139 0.25000000
+0.93743891 0.25000000
+0.93841642 0.25000000
+0.93939394 0.25000000
+0.94037146 0.25000000
+0.94134897 0.25000000
+0.94232649 0.25000000
+0.94330401 0.25000000
+0.94428152 0.25000000
+0.94525904 0.25000000
+0.94623656 0.25000000
+0.94721408 0.25000000
+0.94819159 0.25000000
+0.94916911 0.25000000
+0.95014663 0.25000000
+0.95112414 0.25000000
+0.95210166 0.25000000
+0.95307918 0.25000000
+0.95405670 0.25000000
+0.95503421 0.25000000
+0.95601173 0.25000000
+0.95698925 0.25000000
+0.95796676 0.25000000
+0.95894428 0.25000000
+0.95992180 0.25000000
+0.96089932 0.25000000
+0.96187683 0.25000000
+0.96285435 0.25000000
+0.96383187 0.25000000
+0.96480938 0.25000000
+0.96578690 0.25000000
+0.96676442 0.25000000
+0.96774194 0.25000000
+0.96871945 0.25000000
+0.96969697 0.25000000
+0.97067449 0.25000000
+0.97165200 0.25000000
+0.97262952 0.25000000
+0.97360704 0.25000000
+0.97458456 0.25000000
+0.97556207 0.25000000
+0.97653959 0.25000000
+0.97751711 0.25000000
+0.97849462 0.25000000
+0.97947214 0.25000000
+0.98044966 0.25000000
+0.98142717 0.25000000
+0.98240469 0.25000000
+0.98338221 0.25000000
+0.98435973 0.25000000
+0.98533724 0.25000000
+0.98631476 0.25000000
+0.98729228 0.25000000
+0.98826979 0.25000000
+0.98924731 0.25000000
+0.99022483 0.25000000
+0.99120235 0.25000000
+0.99217986 0.25000000
+0.99315738 0.25000000
+0.99413490 0.25000000
+0.99511241 0.25000000
+0.99608993 0.25000000
+0.99706745 0.25000000
+0.99804497 0.25000000
+0.99902248 0.25000000
+1.00000000 nan
diff --git a/examples/mamdani/SimpleDimmer.fll b/examples/mamdani/SimpleDimmer.fll
new file mode 100644
index 0000000..3a4f8f9
--- /dev/null
+++ b/examples/mamdani/SimpleDimmer.fll
@@ -0,0 +1,26 @@
+Engine: simple-dimmer
+InputVariable: Ambient
+ enabled: true
+ range: 0.000 1.000
+ term: DARK Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: BRIGHT Triangle 0.500 0.750 1.000
+OutputVariable: Power
+ enabled: true
+ range: 0.000 1.000
+ accumulation: Maximum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: HIGH Triangle 0.500 0.750 1.000
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: Minimum
+ rule: if Ambient is DARK then Power is HIGH
+ rule: if Ambient is MEDIUM then Power is MEDIUM
+ rule: if Ambient is BRIGHT then Power is LOW \ No newline at end of file
diff --git a/examples/mamdani/SimpleDimmer.java b/examples/mamdani/SimpleDimmer.java
new file mode 100644
index 0000000..1846722
--- /dev/null
+++ b/examples/mamdani/SimpleDimmer.java
@@ -0,0 +1,54 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class SimpleDimmer{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("simple-dimmer");
+
+InputVariable inputVariable = new InputVariable();
+inputVariable.setEnabled(true);
+inputVariable.setName("Ambient");
+inputVariable.setRange(0.000, 1.000);
+inputVariable.addTerm(new Triangle("DARK", 0.000, 0.250, 0.500));
+inputVariable.addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+inputVariable.addTerm(new Triangle("BRIGHT", 0.500, 0.750, 1.000));
+engine.addInputVariable(inputVariable);
+
+OutputVariable outputVariable = new OutputVariable();
+outputVariable.setEnabled(true);
+outputVariable.setName("Power");
+outputVariable.setRange(0.000, 1.000);
+outputVariable.fuzzyOutput().setAccumulation(new Maximum());
+outputVariable.setDefuzzifier(new Centroid(200));
+outputVariable.setDefaultValue(Double.NaN);
+outputVariable.setLockPreviousOutputValue(false);
+outputVariable.setLockOutputValueInRange(false);
+outputVariable.addTerm(new Triangle("LOW", 0.000, 0.250, 0.500));
+outputVariable.addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+outputVariable.addTerm(new Triangle("HIGH", 0.500, 0.750, 1.000));
+engine.addOutputVariable(outputVariable);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(null);
+ruleBlock.setDisjunction(null);
+ruleBlock.setActivation(new Minimum());
+ruleBlock.addRule(Rule.parse("if Ambient is DARK then Power is HIGH", engine));
+ruleBlock.addRule(Rule.parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
+ruleBlock.addRule(Rule.parse("if Ambient is BRIGHT then Power is LOW", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/mamdani/SimpleDimmerChained.fll b/examples/mamdani/SimpleDimmerChained.fll
new file mode 100644
index 0000000..fd6b945
--- /dev/null
+++ b/examples/mamdani/SimpleDimmerChained.fll
@@ -0,0 +1,40 @@
+Engine: simple-dimmer
+InputVariable: Ambient
+ enabled: true
+ range: 0.000 1.000
+ term: DARK Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: BRIGHT Triangle 0.500 0.750 1.000
+OutputVariable: Power
+ enabled: true
+ range: 0.000 1.000
+ accumulation: Maximum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: HIGH Triangle 0.500 0.750 1.000
+OutputVariable: InversePower
+ enabled: true
+ range: 0.000 1.000
+ accumulation: Maximum
+ defuzzifier: Centroid 500
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Cosine 0.200 0.500
+ term: MEDIUM Cosine 0.500 0.500
+ term: HIGH Cosine 0.800 0.500
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: Minimum
+ rule: if Ambient is DARK then Power is HIGH
+ rule: if Ambient is MEDIUM then Power is MEDIUM
+ rule: if Ambient is BRIGHT then Power is LOW
+ rule: if Power is LOW then InversePower is HIGH
+ rule: if Power is MEDIUM then InversePower is MEDIUM
+ rule: if Power is HIGH then InversePower is LOW \ No newline at end of file
diff --git a/examples/mamdani/SimpleDimmerInverse.cpp b/examples/mamdani/SimpleDimmerInverse.cpp
new file mode 100644
index 0000000..cad1100
--- /dev/null
+++ b/examples/mamdani/SimpleDimmerInverse.cpp
@@ -0,0 +1,61 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("simple-dimmer");
+
+InputVariable* inputVariable = new InputVariable;
+inputVariable->setEnabled(true);
+inputVariable->setName("Ambient");
+inputVariable->setRange(0.000, 1.000);
+inputVariable->addTerm(new Triangle("DARK", 0.000, 0.250, 0.500));
+inputVariable->addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+inputVariable->addTerm(new Triangle("BRIGHT", 0.500, 0.750, 1.000));
+engine->addInputVariable(inputVariable);
+
+OutputVariable* outputVariable1 = new OutputVariable;
+outputVariable1->setEnabled(true);
+outputVariable1->setName("Power");
+outputVariable1->setRange(0.000, 1.000);
+outputVariable1->fuzzyOutput()->setAccumulation(new Maximum);
+outputVariable1->setDefuzzifier(new Centroid(200));
+outputVariable1->setDefaultValue(fl::nan);
+outputVariable1->setLockPreviousOutputValue(false);
+outputVariable1->setLockOutputValueInRange(false);
+outputVariable1->addTerm(new Triangle("LOW", 0.000, 0.250, 0.500));
+outputVariable1->addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+outputVariable1->addTerm(new Triangle("HIGH", 0.500, 0.750, 1.000));
+engine->addOutputVariable(outputVariable1);
+
+OutputVariable* outputVariable2 = new OutputVariable;
+outputVariable2->setEnabled(true);
+outputVariable2->setName("InversePower");
+outputVariable2->setRange(0.000, 1.000);
+outputVariable2->fuzzyOutput()->setAccumulation(new Maximum);
+outputVariable2->setDefuzzifier(new Centroid(500));
+outputVariable2->setDefaultValue(fl::nan);
+outputVariable2->setLockPreviousOutputValue(false);
+outputVariable2->setLockOutputValueInRange(false);
+outputVariable2->addTerm(new Cosine("LOW", 0.200, 0.500));
+outputVariable2->addTerm(new Cosine("MEDIUM", 0.500, 0.500));
+outputVariable2->addTerm(new Cosine("HIGH", 0.800, 0.500));
+engine->addOutputVariable(outputVariable2);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(NULL);
+ruleBlock->setDisjunction(NULL);
+ruleBlock->setActivation(new Minimum);
+ruleBlock->addRule(fl::Rule::parse("if Ambient is DARK then Power is HIGH", engine));
+ruleBlock->addRule(fl::Rule::parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
+ruleBlock->addRule(fl::Rule::parse("if Ambient is BRIGHT then Power is LOW", engine));
+ruleBlock->addRule(fl::Rule::parse("if Power is LOW then InversePower is HIGH", engine));
+ruleBlock->addRule(fl::Rule::parse("if Power is MEDIUM then InversePower is MEDIUM", engine));
+ruleBlock->addRule(fl::Rule::parse("if Power is HIGH then InversePower is LOW", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/mamdani/SimpleDimmerInverse.fcl b/examples/mamdani/SimpleDimmerInverse.fcl
new file mode 100644
index 0000000..337bc2b
--- /dev/null
+++ b/examples/mamdani/SimpleDimmerInverse.fcl
@@ -0,0 +1,49 @@
+FUNCTION_BLOCK simple-dimmer
+
+VAR_INPUT
+ Ambient: REAL;
+END_VAR
+
+VAR_OUTPUT
+ Power: REAL;
+ InversePower: REAL;
+END_VAR
+
+FUZZIFY Ambient
+ RANGE := (0.000 .. 1.000);
+ TERM DARK := Triangle 0.000 0.250 0.500;
+ TERM MEDIUM := Triangle 0.250 0.500 0.750;
+ TERM BRIGHT := Triangle 0.500 0.750 1.000;
+END_FUZZIFY
+
+DEFUZZIFY Power
+ RANGE := (0.000 .. 1.000);
+ TERM LOW := Triangle 0.000 0.250 0.500;
+ TERM MEDIUM := Triangle 0.250 0.500 0.750;
+ TERM HIGH := Triangle 0.500 0.750 1.000;
+ METHOD : COG;
+ ACCU : MAX;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY InversePower
+ RANGE := (0.000 .. 1.000);
+ TERM LOW := Cosine 0.200 0.500;
+ TERM MEDIUM := Cosine 0.500 0.500;
+ TERM HIGH := Cosine 0.800 0.500;
+ METHOD : COG;
+ ACCU : MAX;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ ACT : MIN;
+ RULE 1 : if Ambient is DARK then Power is HIGH
+ RULE 2 : if Ambient is MEDIUM then Power is MEDIUM
+ RULE 3 : if Ambient is BRIGHT then Power is LOW
+ RULE 4 : if Power is LOW then InversePower is HIGH
+ RULE 5 : if Power is MEDIUM then InversePower is MEDIUM
+ RULE 6 : if Power is HIGH then InversePower is LOW
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/mamdani/SimpleDimmerInverse.fld b/examples/mamdani/SimpleDimmerInverse.fld
new file mode 100644
index 0000000..45373fa
--- /dev/null
+++ b/examples/mamdani/SimpleDimmerInverse.fld
@@ -0,0 +1,1026 @@
+#@Engine: simple-dimmer;
+#@InputVariable: Ambient; @OutputVariable: Power; @OutputVariable: InversePower;
+0.00000000 nan nan
+0.00097752 0.75000000 0.22167150
+0.00195503 0.75000000 0.22030661
+0.00293255 0.75000000 0.21927211
+0.00391007 0.75000000 0.21837259
+0.00488759 0.75000000 0.21759504
+0.00586510 0.75000000 0.21689174
+0.00684262 0.75000000 0.21624205
+0.00782014 0.75000000 0.21563550
+0.00879765 0.75000000 0.21506612
+0.00977517 0.75000000 0.21453019
+0.01075269 0.75000000 0.21402519
+0.01173021 0.75000000 0.21353593
+0.01270772 0.75000000 0.21305965
+0.01368524 0.75000000 0.21260950
+0.01466276 0.75000000 0.21218150
+0.01564027 0.75000000 0.21174980
+0.01661779 0.75000000 0.21134250
+0.01759531 0.75000000 0.21094779
+0.01857283 0.75000000 0.21055498
+0.01955034 0.75000000 0.21018558
+0.02052786 0.75000000 0.20981005
+0.02150538 0.75000000 0.20945327
+0.02248289 0.75000000 0.20909971
+0.02346041 0.75000000 0.20875478
+0.02443793 0.75000000 0.20841846
+0.02541544 0.75000000 0.20810890
+0.02639296 0.75000000 0.20782234
+0.02737048 0.75000000 0.20755709
+0.02834800 0.75000000 0.20731004
+0.02932551 0.75000000 0.20708013
+0.03030303 0.75000000 0.20686499
+0.03128055 0.75000000 0.20666370
+0.03225806 0.75000000 0.20647468
+0.03323558 0.75000000 0.20629689
+0.03421310 0.75000000 0.20612956
+0.03519062 0.75000000 0.20597128
+0.03616813 0.75000000 0.20582215
+0.03714565 0.75000000 0.20568029
+0.03812317 0.75000000 0.20554655
+0.03910068 0.75000000 0.20541899
+0.04007820 0.75000000 0.20529802
+0.04105572 0.75000000 0.20518274
+0.04203324 0.75000000 0.20507272
+0.04301075 0.75000000 0.20496807
+0.04398827 0.75000000 0.20486764
+0.04496579 0.75000000 0.20477210
+0.04594330 0.75000000 0.20468037
+0.04692082 0.75000000 0.20459248
+0.04789834 0.75000000 0.20450839
+0.04887586 0.75000000 0.20442732
+0.04985337 0.75000000 0.20434987
+0.05083089 0.75000000 0.20427519
+0.05180841 0.75000000 0.20420327
+0.05278592 0.75000000 0.20413428
+0.05376344 0.75000000 0.20406751
+0.05474096 0.75000000 0.20400336
+0.05571848 0.75000000 0.20394144
+0.05669599 0.75000000 0.20388140
+0.05767351 0.75000000 0.20382383
+0.05865103 0.75000000 0.20376794
+0.05962854 0.75000000 0.20371384
+0.06060606 0.75000000 0.20366171
+0.06158358 0.75000000 0.20361103
+0.06256109 0.75000000 0.20356203
+0.06353861 0.75000000 0.20351462
+0.06451613 0.75000000 0.20346845
+0.06549365 0.75000000 0.20342386
+0.06647116 0.75000000 0.20338055
+0.06744868 0.75000000 0.20333832
+0.06842620 0.75000000 0.20329758
+0.06940371 0.75000000 0.20325787
+0.07038123 0.75000000 0.20321911
+0.07135875 0.75000000 0.20318172
+0.07233627 0.75000000 0.20314519
+0.07331378 0.75000000 0.20310954
+0.07429130 0.75000000 0.20307507
+0.07526882 0.75000000 0.20304135
+0.07624633 0.75000000 0.20300844
+0.07722385 0.75000000 0.20297656
+0.07820137 0.75000000 0.20294536
+0.07917889 0.75000000 0.20291488
+0.08015640 0.75000000 0.20288533
+0.08113392 0.75000000 0.20285637
+0.08211144 0.75000000 0.20282806
+0.08308895 0.75000000 0.20280059
+0.08406647 0.75000000 0.20277365
+0.08504399 0.75000000 0.20274728
+0.08602151 0.75000000 0.20272169
+0.08699902 0.75000000 0.20269657
+0.08797654 0.75000000 0.20267195
+0.08895406 0.75000000 0.20264805
+0.08993157 0.75000000 0.20262458
+0.09090909 0.75000000 0.20260154
+0.09188661 0.75000000 0.20257918
+0.09286413 0.75000000 0.20255721
+0.09384164 0.75000000 0.20253561
+0.09481916 0.75000000 0.20251464
+0.09579668 0.75000000 0.20249404
+0.09677419 0.75000000 0.20247377
+0.09775171 0.75000000 0.20245404
+0.09872923 0.75000000 0.20243468
+0.09970674 0.75000000 0.20241563
+0.10068426 0.75000000 0.20239704
+0.10166178 0.75000000 0.20237883
+0.10263930 0.75000000 0.20236089
+0.10361681 0.75000000 0.20234334
+0.10459433 0.75000000 0.20232618
+0.10557185 0.75000000 0.20230927
+0.10654936 0.75000000 0.20229268
+0.10752688 0.75000000 0.20227648
+0.10850440 0.75000000 0.20226051
+0.10948192 0.75000000 0.20224480
+0.11045943 0.75000000 0.20222950
+0.11143695 0.75000000 0.20221441
+0.11241447 0.75000000 0.20219951
+0.11339198 0.75000000 0.20218503
+0.11436950 0.75000000 0.20217075
+0.11534702 0.75000000 0.20215665
+0.11632454 0.75000000 0.20214289
+0.11730205 0.75000000 0.20212935
+0.11827957 0.75000000 0.20211599
+0.11925709 0.75000000 0.20210290
+0.12023460 0.75000000 0.20209006
+0.12121212 0.75000000 0.20207738
+0.12218964 0.75000000 0.20206492
+0.12316716 0.75000000 0.20205274
+0.12414467 0.75000000 0.20204069
+0.12512219 0.75000000 0.20202881
+0.12609971 0.75000000 0.20201724
+0.12707722 0.75000000 0.20200579
+0.12805474 0.75000000 0.20199447
+0.12903226 0.75000000 0.20198344
+0.13000978 0.75000000 0.20197255
+0.13098729 0.75000000 0.20196178
+0.13196481 0.75000000 0.20195125
+0.13294233 0.75000000 0.20194088
+0.13391984 0.75000000 0.20193062
+0.13489736 0.75000000 0.20192055
+0.13587488 0.75000000 0.20191067
+0.13685239 0.75000000 0.20190089
+0.13782991 0.75000000 0.20189126
+0.13880743 0.75000000 0.20188184
+0.13978495 0.75000000 0.20187251
+0.14076246 0.75000000 0.20186329
+0.14173998 0.75000000 0.20185431
+0.14271750 0.75000000 0.20184541
+0.14369501 0.75000000 0.20183659
+0.14467253 0.75000000 0.20182800
+0.14565005 0.75000000 0.20181950
+0.14662757 0.75000000 0.20181108
+0.14760508 0.75000000 0.20180284
+0.14858260 0.75000000 0.20179472
+0.14956012 0.75000000 0.20178668
+0.15053763 0.75000000 0.20177878
+0.15151515 0.75000000 0.20177102
+0.15249267 0.75000000 0.20176333
+0.15347019 0.75000000 0.20175576
+0.15444770 0.75000000 0.20174834
+0.15542522 0.75000000 0.20174097
+0.15640274 0.75000000 0.20173372
+0.15738025 0.75000000 0.20172662
+0.15835777 0.75000000 0.20171957
+0.15933529 0.75000000 0.20171261
+0.16031281 0.75000000 0.20170581
+0.16129032 0.75000000 0.20169907
+0.16226784 0.75000000 0.20169239
+0.16324536 0.75000000 0.20168588
+0.16422287 0.75000000 0.20167942
+0.16520039 0.75000000 0.20167302
+0.16617791 0.75000000 0.20166679
+0.16715543 0.75000000 0.20166060
+0.16813294 0.75000000 0.20165446
+0.16911046 0.75000000 0.20164849
+0.17008798 0.75000000 0.20164256
+0.17106549 0.75000000 0.20163668
+0.17204301 0.75000000 0.20163095
+0.17302053 0.75000000 0.20162527
+0.17399804 0.75000000 0.20161963
+0.17497556 0.75000000 0.20161414
+0.17595308 0.75000000 0.20160869
+0.17693060 0.75000000 0.20160329
+0.17790811 0.75000000 0.20159803
+0.17888563 0.75000000 0.20159280
+0.17986315 0.75000000 0.20158764
+0.18084066 0.75000000 0.20158259
+0.18181818 0.75000000 0.20157758
+0.18279570 0.75000000 0.20157264
+0.18377322 0.75000000 0.20156780
+0.18475073 0.75000000 0.20156299
+0.18572825 0.75000000 0.20155827
+0.18670577 0.75000000 0.20155363
+0.18768328 0.75000000 0.20154902
+0.18866080 0.75000000 0.20154451
+0.18963832 0.75000000 0.20154006
+0.19061584 0.75000000 0.20153564
+0.19159335 0.75000000 0.20153134
+0.19257087 0.75000000 0.20152707
+0.19354839 0.75000000 0.20152286
+0.19452590 0.75000000 0.20151874
+0.19550342 0.75000000 0.20151465
+0.19648094 0.75000000 0.20151063
+0.19745846 0.75000000 0.20150669
+0.19843597 0.75000000 0.20150276
+0.19941349 0.75000000 0.20149895
+0.20039101 0.75000000 0.20149517
+0.20136852 0.75000000 0.20149144
+0.20234604 0.75000000 0.20148780
+0.20332356 0.75000000 0.20148417
+0.20430108 0.75000000 0.20148065
+0.20527859 0.75000000 0.20147715
+0.20625611 0.75000000 0.20147372
+0.20723363 0.75000000 0.20147035
+0.20821114 0.75000000 0.20146701
+0.20918866 0.75000000 0.20146377
+0.21016618 0.75000000 0.20146055
+0.21114370 0.75000000 0.20145740
+0.21212121 0.75000000 0.20145431
+0.21309873 0.75000000 0.20145125
+0.21407625 0.75000000 0.20144828
+0.21505376 0.75000000 0.20144532
+0.21603128 0.75000000 0.20144246
+0.21700880 0.75000000 0.20143962
+0.21798631 0.75000000 0.20143687
+0.21896383 0.75000000 0.20143414
+0.21994135 0.75000000 0.20143149
+0.22091887 0.75000000 0.20142887
+0.22189638 0.75000000 0.20142632
+0.22287390 0.75000000 0.20142382
+0.22385142 0.75000000 0.20142138
+0.22482893 0.75000000 0.20141899
+0.22580645 0.75000000 0.20141666
+0.22678397 0.75000000 0.20141437
+0.22776149 0.75000000 0.20141216
+0.22873900 0.75000000 0.20140998
+0.22971652 0.75000000 0.20140789
+0.23069404 0.75000000 0.20140583
+0.23167155 0.75000000 0.20140385
+0.23264907 0.75000000 0.20140191
+0.23362659 0.75000000 0.20140003
+0.23460411 0.75000000 0.20139823
+0.23558162 0.75000000 0.20139648
+0.23655914 0.75000000 0.20139479
+0.23753666 0.75000000 0.20139318
+0.23851417 0.75000000 0.20139162
+0.23949169 0.75000000 0.20139013
+0.24046921 0.75000000 0.20138872
+0.24144673 0.75000000 0.20138738
+0.24242424 0.75000000 0.20138613
+0.24340176 0.75000000 0.20138495
+0.24437928 0.75000000 0.20138385
+0.24535679 0.75000000 0.20138285
+0.24633431 0.75000000 0.20138195
+0.24731183 0.75000000 0.20138117
+0.24828935 0.75000000 0.20138052
+0.24926686 0.75000000 0.20138004
+0.25024438 0.74963379 0.20184621
+0.25122190 0.74817607 0.20367689
+0.25219941 0.74672965 0.20547042
+0.25317693 0.74530727 0.20723292
+0.25415445 0.74390115 0.20896960
+0.25513196 0.74250538 0.21068200
+0.25610948 0.74111985 0.21237142
+0.25708700 0.73974444 0.21403914
+0.25806452 0.73838897 0.21568634
+0.25904203 0.73705025 0.21731416
+0.26001955 0.73572080 0.21892367
+0.26099707 0.73440054 0.22051588
+0.26197458 0.73308936 0.22209176
+0.26295210 0.73179453 0.22364976
+0.26392962 0.73051679 0.22519215
+0.26490714 0.72924739 0.22672038
+0.26588465 0.72798623 0.22823273
+0.26686217 0.72673323 0.22973063
+0.26783969 0.72549344 0.23121629
+0.26881720 0.72427097 0.23268587
+0.26979472 0.72305599 0.23414401
+0.27077224 0.72184842 0.23558882
+0.27174976 0.72064820 0.23702103
+0.27272727 0.71945844 0.23844203
+0.27370479 0.71828610 0.23984979
+0.27468231 0.71712050 0.24124792
+0.27565982 0.71596157 0.24263262
+0.27663734 0.71480927 0.24400876
+0.27761486 0.71366501 0.24537168
+0.27859238 0.71253818 0.24672667
+0.27956989 0.71141742 0.24806903
+0.28054741 0.71030267 0.24940367
+0.28152493 0.70919389 0.25072659
+0.28250244 0.70809106 0.25204165
+0.28347996 0.70700557 0.25334618
+0.28445748 0.70592553 0.25464239
+0.28543500 0.70485092 0.25592952
+0.28641251 0.70378169 0.25720758
+0.28739003 0.70271779 0.25847822
+0.28836755 0.70166862 0.25973880
+0.28934506 0.70062558 0.26099337
+0.29032258 0.69958742 0.26223755
+0.29130010 0.69855412 0.26347553
+0.29227761 0.69752564 0.26470524
+0.29325513 0.69650949 0.26592723
+0.29423265 0.69550004 0.26714320
+0.29521017 0.69449498 0.26834979
+0.29618768 0.69349430 0.26955111
+0.29716520 0.69249796 0.27074444
+0.29814272 0.69151186 0.27193114
+0.29912023 0.69053287 0.27311234
+0.30009775 0.68955785 0.27428495
+0.30107527 0.68858676 0.27545274
+0.30205279 0.68761958 0.27661362
+0.30303030 0.68666076 0.27776803
+0.30400782 0.68570938 0.27891786
+0.30498534 0.68476154 0.28005970
+0.30596285 0.68381725 0.28119682
+0.30694037 0.68287647 0.28232868
+0.30791789 0.68194242 0.28345356
+0.30889541 0.68101598 0.28457426
+0.30987292 0.68009273 0.28568897
+0.31085044 0.67917264 0.28679805
+0.31182796 0.67825571 0.28790314
+0.31280547 0.67734408 0.28900176
+0.31378299 0.67644013 0.29009583
+0.31476051 0.67553902 0.29118611
+0.31573803 0.67464075 0.29226963
+0.31671554 0.67374530 0.29334946
+0.31769306 0.67285389 0.29442525
+0.31867058 0.67197014 0.29549502
+0.31964809 0.67108892 0.29656133
+0.32062561 0.67021023 0.29762345
+0.32160313 0.66933404 0.29868024
+0.32258065 0.66846082 0.29973374
+0.32355816 0.66759513 0.30078303
+0.32453568 0.66673167 0.30182751
+0.32551320 0.66587045 0.30286887
+0.32649071 0.66501145 0.30390610
+0.32746823 0.66415466 0.30493893
+0.32844575 0.66330485 0.30596879
+0.32942326 0.66245716 0.30699470
+0.33040078 0.66161144 0.30801651
+0.33137830 0.66076767 0.30903550
+0.33235582 0.65992584 0.31005075
+0.33333333 0.65908967 0.31106215
+0.33431085 0.65825587 0.31207087
+0.33528837 0.65742377 0.31307613
+0.33626588 0.65659337 0.31407770
+0.33724340 0.65576467 0.31507673
+0.33822092 0.65494046 0.31607198
+0.33919844 0.65411875 0.31706264
+0.34017595 0.65329850 0.31805099
+0.34115347 0.65247971 0.31903617
+0.34213099 0.65166237 0.32001692
+0.34310850 0.65084852 0.32099560
+0.34408602 0.65003719 0.32197170
+0.34506354 0.64922708 0.32294352
+0.34604106 0.64841821 0.32391349
+0.34701857 0.64761056 0.32488146
+0.34799609 0.64680554 0.32584530
+0.34897361 0.64600293 0.32680750
+0.34995112 0.64520134 0.32776805
+0.35092864 0.64440076 0.32872502
+0.35190616 0.64360119 0.32968035
+0.35288368 0.64280350 0.33063426
+0.35386119 0.64200804 0.33158533
+0.35483871 0.64121338 0.33253470
+0.35581623 0.64041952 0.33348284
+0.35679374 0.63962646 0.33442883
+0.35777126 0.63883468 0.33537310
+0.35874878 0.63804481 0.33631634
+0.35972630 0.63725555 0.33725803
+0.36070381 0.63646688 0.33819806
+0.36168133 0.63567880 0.33913724
+0.36265885 0.63489151 0.34007538
+0.36363636 0.63410574 0.34101201
+0.36461388 0.63332037 0.34194799
+0.36559140 0.63253539 0.34288331
+0.36656891 0.63175080 0.34381737
+0.36754643 0.63096664 0.34475097
+0.36852395 0.63018348 0.34568410
+0.36950147 0.62940052 0.34661650
+0.37047898 0.62861775 0.34754854
+0.37145650 0.62783518 0.34848030
+0.37243402 0.62705280 0.34941175
+0.37341153 0.62627077 0.35034304
+0.37438905 0.62548876 0.35127424
+0.37536657 0.62470674 0.35220543
+0.37634409 0.62392473 0.35313679
+0.37732160 0.62314272 0.35406824
+0.37829912 0.62236043 0.35499987
+0.37927664 0.62157791 0.35593211
+0.38025415 0.62079519 0.35686463
+0.38123167 0.62001228 0.35779743
+0.38220919 0.61922917 0.35873133
+0.38318671 0.61844529 0.35966573
+0.38416422 0.61766080 0.36060060
+0.38514174 0.61687591 0.36153679
+0.38611926 0.61609064 0.36247390
+0.38709677 0.61530497 0.36341166
+0.38807429 0.61451813 0.36435085
+0.38905181 0.61373020 0.36529150
+0.39002933 0.61294168 0.36623299
+0.39100684 0.61215256 0.36717592
+0.39198436 0.61136285 0.36812094
+0.39296188 0.61057168 0.36906701
+0.39393939 0.60977882 0.37001444
+0.39491691 0.60898516 0.37096469
+0.39589443 0.60819070 0.37191618
+0.39687195 0.60739544 0.37286891
+0.39784946 0.60659855 0.37382525
+0.39882698 0.60579922 0.37478304
+0.39980450 0.60499890 0.37574227
+0.40078201 0.60419756 0.37670519
+0.40175953 0.60339521 0.37767018
+0.40273705 0.60259116 0.37863682
+0.40371457 0.60178382 0.37960719
+0.40469208 0.60097525 0.38058030
+0.40566960 0.60016546 0.38155526
+0.40664712 0.59935443 0.38253399
+0.40762463 0.59854174 0.38351615
+0.40860215 0.59772477 0.38450040
+0.40957967 0.59690634 0.38548843
+0.41055718 0.59608645 0.38648062
+0.41153470 0.59526511 0.38747513
+0.41251222 0.59444225 0.38847349
+0.41348974 0.59361396 0.38947672
+0.41446725 0.59278399 0.39048250
+0.41544477 0.59195232 0.39149155
+0.41642229 0.59111894 0.39250467
+0.41739980 0.59028386 0.39352048
+0.41837732 0.58944297 0.39453968
+0.41935484 0.58859969 0.39556327
+0.42033236 0.58775445 0.39658970
+0.42130987 0.58690726 0.39761971
+0.42228739 0.58605810 0.39865437
+0.42326491 0.58520295 0.39969203
+0.42424242 0.58434451 0.40073354
+0.42521994 0.58348384 0.40177991
+0.42619746 0.58262095 0.40282942
+0.42717498 0.58175582 0.40388318
+0.42815249 0.58088462 0.40494190
+0.42913001 0.58000905 0.40600393
+0.43010753 0.57913099 0.40707072
+0.43108504 0.57825040 0.40814248
+0.43206256 0.57736728 0.40921771
+0.43304008 0.57647812 0.41029836
+0.43401760 0.57558337 0.41138386
+0.43499511 0.57468581 0.41247301
+0.43597263 0.57378542 0.41356841
+0.43695015 0.57288218 0.41466839
+0.43792766 0.57197303 0.41577220
+0.43890518 0.57105688 0.41688332
+0.43988270 0.57013759 0.41799853
+0.44086022 0.56921513 0.41911858
+0.44183773 0.56828949 0.42024563
+0.44281525 0.56735818 0.42137689
+0.44379277 0.56641827 0.42251434
+0.44477028 0.56547486 0.42365807
+0.44574780 0.56452791 0.42480621
+0.44672532 0.56357742 0.42596221
+0.44770283 0.56262161 0.42712348
+0.44868035 0.56165541 0.42829028
+0.44965787 0.56068529 0.42946517
+0.45063539 0.55971125 0.43064489
+0.45161290 0.55873326 0.43183231
+0.45259042 0.55775044 0.43302636
+0.45356794 0.55675519 0.43422600
+0.45454545 0.55575559 0.43543492
+0.45552297 0.55475164 0.43664915
+0.45650049 0.55374329 0.43787175
+0.45747801 0.55273051 0.43910163
+0.45845552 0.55170345 0.44033810
+0.45943304 0.55067135 0.44158421
+0.46041056 0.54963442 0.44283613
+0.46138807 0.54859260 0.44409826
+0.46236559 0.54754587 0.44536727
+0.46334311 0.54648479 0.44664519
+0.46432063 0.54541689 0.44793195
+0.46529814 0.54434363 0.44922653
+0.46627566 0.54326495 0.45053171
+0.46725318 0.54218083 0.45184389
+0.46823069 0.54108237 0.45316819
+0.46920821 0.53997508 0.45449940
+0.47018573 0.53886183 0.45584313
+0.47116325 0.53774257 0.45719450
+0.47214076 0.53661727 0.45855837
+0.47311828 0.53547778 0.45993068
+0.47409580 0.53432712 0.46131585
+0.47507331 0.53316986 0.46270993
+0.47605083 0.53200593 0.46411767
+0.47702835 0.53083528 0.46553438
+0.47800587 0.52965071 0.46695262
+0.47898338 0.52845232 0.46837800
+0.47996090 0.52724659 0.46980609
+0.48093842 0.52603347 0.47123994
+0.48191593 0.52481288 0.47267837
+0.48289345 0.52357875 0.47412061
+0.48387097 0.52232778 0.47556907
+0.48484848 0.52106867 0.47702029
+0.48582600 0.51980133 0.47847676
+0.48680352 0.51852569 0.47993880
+0.48778104 0.51723703 0.48140371
+0.48875855 0.51592811 0.48287336
+0.48973607 0.51461012 0.48434789
+0.49071359 0.51328298 0.48582689
+0.49169110 0.51194659 0.48730922
+0.49266862 0.51059784 0.48879513
+0.49364614 0.50922495 0.49028478
+0.49462366 0.50784195 0.49177772
+0.49560117 0.50644876 0.49327351
+0.49657869 0.50504524 0.49477078
+0.49755621 0.50363020 0.49626887
+0.49853372 0.50218659 0.49776632
+0.49951124 0.50073171 0.49925937
+0.50048876 0.49926829 0.50074063
+0.50146628 0.49781341 0.50223368
+0.50244379 0.49636980 0.50373113
+0.50342131 0.49495476 0.50522922
+0.50439883 0.49355124 0.50672649
+0.50537634 0.49215805 0.50822228
+0.50635386 0.49077505 0.50971522
+0.50733138 0.48940216 0.51120487
+0.50830890 0.48805341 0.51269078
+0.50928641 0.48671702 0.51417311
+0.51026393 0.48538988 0.51565211
+0.51124145 0.48407189 0.51712664
+0.51221896 0.48276297 0.51859629
+0.51319648 0.48147431 0.52006120
+0.51417400 0.48019867 0.52152324
+0.51515152 0.47893133 0.52297971
+0.51612903 0.47767222 0.52443093
+0.51710655 0.47642125 0.52587939
+0.51808407 0.47518712 0.52732163
+0.51906158 0.47396653 0.52876006
+0.52003910 0.47275341 0.53019391
+0.52101662 0.47154768 0.53162200
+0.52199413 0.47034929 0.53304738
+0.52297165 0.46916472 0.53446562
+0.52394917 0.46799407 0.53588233
+0.52492669 0.46683014 0.53729007
+0.52590420 0.46567288 0.53868415
+0.52688172 0.46452222 0.54006932
+0.52785924 0.46338273 0.54144163
+0.52883675 0.46225743 0.54280550
+0.52981427 0.46113817 0.54415687
+0.53079179 0.46002492 0.54550060
+0.53176931 0.45891763 0.54683181
+0.53274682 0.45781917 0.54815611
+0.53372434 0.45673505 0.54946829
+0.53470186 0.45565637 0.55077347
+0.53567937 0.45458311 0.55206805
+0.53665689 0.45351521 0.55335481
+0.53763441 0.45245413 0.55463273
+0.53861193 0.45140740 0.55590174
+0.53958944 0.45036558 0.55716387
+0.54056696 0.44932865 0.55841579
+0.54154448 0.44829655 0.55966190
+0.54252199 0.44726949 0.56089837
+0.54349951 0.44625671 0.56212825
+0.54447703 0.44524836 0.56335085
+0.54545455 0.44424441 0.56456508
+0.54643206 0.44324481 0.56577400
+0.54740958 0.44224956 0.56697364
+0.54838710 0.44126674 0.56816769
+0.54936461 0.44028875 0.56935511
+0.55034213 0.43931471 0.57053483
+0.55131965 0.43834459 0.57170972
+0.55229717 0.43737839 0.57287652
+0.55327468 0.43642258 0.57403779
+0.55425220 0.43547209 0.57519379
+0.55522972 0.43452514 0.57634193
+0.55620723 0.43358173 0.57748566
+0.55718475 0.43264182 0.57862311
+0.55816227 0.43171051 0.57975437
+0.55913978 0.43078487 0.58088142
+0.56011730 0.42986241 0.58200147
+0.56109482 0.42894312 0.58311668
+0.56207234 0.42802697 0.58422780
+0.56304985 0.42711782 0.58533161
+0.56402737 0.42621458 0.58643159
+0.56500489 0.42531419 0.58752699
+0.56598240 0.42441663 0.58861614
+0.56695992 0.42352188 0.58970164
+0.56793744 0.42263272 0.59078229
+0.56891496 0.42174960 0.59185752
+0.56989247 0.42086901 0.59292928
+0.57086999 0.41999095 0.59399607
+0.57184751 0.41911538 0.59505810
+0.57282502 0.41824418 0.59611682
+0.57380254 0.41737905 0.59717058
+0.57478006 0.41651616 0.59822009
+0.57575758 0.41565549 0.59926646
+0.57673509 0.41479705 0.60030797
+0.57771261 0.41394190 0.60134563
+0.57869013 0.41309274 0.60238029
+0.57966764 0.41224555 0.60341030
+0.58064516 0.41140031 0.60443673
+0.58162268 0.41055703 0.60546032
+0.58260020 0.40971614 0.60647952
+0.58357771 0.40888106 0.60749533
+0.58455523 0.40804768 0.60850845
+0.58553275 0.40721601 0.60951750
+0.58651026 0.40638604 0.61052328
+0.58748778 0.40555775 0.61152651
+0.58846530 0.40473489 0.61252487
+0.58944282 0.40391355 0.61351938
+0.59042033 0.40309366 0.61451157
+0.59139785 0.40227523 0.61549960
+0.59237537 0.40145826 0.61648385
+0.59335288 0.40064557 0.61746601
+0.59433040 0.39983454 0.61844474
+0.59530792 0.39902475 0.61941970
+0.59628543 0.39821618 0.62039281
+0.59726295 0.39740884 0.62136318
+0.59824047 0.39660479 0.62232982
+0.59921799 0.39580244 0.62329481
+0.60019550 0.39500110 0.62425773
+0.60117302 0.39420078 0.62521696
+0.60215054 0.39340145 0.62617475
+0.60312805 0.39260456 0.62713109
+0.60410557 0.39180930 0.62808382
+0.60508309 0.39101484 0.62903531
+0.60606061 0.39022118 0.62998556
+0.60703812 0.38942832 0.63093299
+0.60801564 0.38863715 0.63187906
+0.60899316 0.38784744 0.63282408
+0.60997067 0.38705832 0.63376701
+0.61094819 0.38626980 0.63470850
+0.61192571 0.38548187 0.63564915
+0.61290323 0.38469503 0.63658834
+0.61388074 0.38390936 0.63752610
+0.61485826 0.38312409 0.63846321
+0.61583578 0.38233920 0.63939940
+0.61681329 0.38155471 0.64033427
+0.61779081 0.38077083 0.64126867
+0.61876833 0.37998772 0.64220257
+0.61974585 0.37920481 0.64313537
+0.62072336 0.37842209 0.64406789
+0.62170088 0.37763957 0.64500013
+0.62267840 0.37685728 0.64593176
+0.62365591 0.37607527 0.64686321
+0.62463343 0.37529326 0.64779457
+0.62561095 0.37451124 0.64872576
+0.62658847 0.37372923 0.64965696
+0.62756598 0.37294720 0.65058825
+0.62854350 0.37216482 0.65151970
+0.62952102 0.37138225 0.65245146
+0.63049853 0.37059948 0.65338350
+0.63147605 0.36981652 0.65431590
+0.63245357 0.36903336 0.65524903
+0.63343109 0.36824920 0.65618263
+0.63440860 0.36746461 0.65711669
+0.63538612 0.36667963 0.65805201
+0.63636364 0.36589426 0.65898799
+0.63734115 0.36510849 0.65992462
+0.63831867 0.36432120 0.66086276
+0.63929619 0.36353312 0.66180194
+0.64027370 0.36274445 0.66274197
+0.64125122 0.36195519 0.66368366
+0.64222874 0.36116532 0.66462690
+0.64320626 0.36037354 0.66557117
+0.64418377 0.35958048 0.66651716
+0.64516129 0.35878662 0.66746530
+0.64613881 0.35799196 0.66841467
+0.64711632 0.35719650 0.66936574
+0.64809384 0.35639881 0.67031965
+0.64907136 0.35559924 0.67127498
+0.65004888 0.35479866 0.67223195
+0.65102639 0.35399707 0.67319250
+0.65200391 0.35319446 0.67415470
+0.65298143 0.35238944 0.67511854
+0.65395894 0.35158179 0.67608651
+0.65493646 0.35077292 0.67705648
+0.65591398 0.34996281 0.67802830
+0.65689150 0.34915148 0.67900440
+0.65786901 0.34833763 0.67998308
+0.65884653 0.34752029 0.68096383
+0.65982405 0.34670150 0.68194901
+0.66080156 0.34588125 0.68293736
+0.66177908 0.34505954 0.68392802
+0.66275660 0.34423533 0.68492327
+0.66373412 0.34340663 0.68592230
+0.66471163 0.34257623 0.68692387
+0.66568915 0.34174413 0.68792913
+0.66666667 0.34091033 0.68893785
+0.66764418 0.34007416 0.68994925
+0.66862170 0.33923233 0.69096450
+0.66959922 0.33838856 0.69198349
+0.67057674 0.33754284 0.69300530
+0.67155425 0.33669515 0.69403121
+0.67253177 0.33584534 0.69506107
+0.67350929 0.33498855 0.69609390
+0.67448680 0.33412955 0.69713113
+0.67546432 0.33326833 0.69817249
+0.67644184 0.33240487 0.69921697
+0.67741935 0.33153918 0.70026626
+0.67839687 0.33066596 0.70131976
+0.67937439 0.32978977 0.70237655
+0.68035191 0.32891108 0.70343867
+0.68132942 0.32802986 0.70450498
+0.68230694 0.32714611 0.70557475
+0.68328446 0.32625470 0.70665054
+0.68426197 0.32535925 0.70773037
+0.68523949 0.32446098 0.70881389
+0.68621701 0.32355987 0.70990417
+0.68719453 0.32265592 0.71099824
+0.68817204 0.32174429 0.71209686
+0.68914956 0.32082736 0.71320195
+0.69012708 0.31990727 0.71431103
+0.69110459 0.31898402 0.71542574
+0.69208211 0.31805758 0.71654644
+0.69305963 0.31712353 0.71767132
+0.69403715 0.31618275 0.71880318
+0.69501466 0.31523846 0.71994030
+0.69599218 0.31429062 0.72108214
+0.69696970 0.31333924 0.72223197
+0.69794721 0.31238042 0.72338638
+0.69892473 0.31141324 0.72454726
+0.69990225 0.31044215 0.72571505
+0.70087977 0.30946713 0.72688766
+0.70185728 0.30848814 0.72806886
+0.70283480 0.30750204 0.72925556
+0.70381232 0.30650570 0.73044889
+0.70478983 0.30550502 0.73165021
+0.70576735 0.30449996 0.73285680
+0.70674487 0.30349051 0.73407277
+0.70772239 0.30247436 0.73529476
+0.70869990 0.30144588 0.73652447
+0.70967742 0.30041258 0.73776245
+0.71065494 0.29937442 0.73900663
+0.71163245 0.29833138 0.74026120
+0.71260997 0.29728221 0.74152178
+0.71358749 0.29621831 0.74279242
+0.71456500 0.29514908 0.74407048
+0.71554252 0.29407447 0.74535761
+0.71652004 0.29299443 0.74665382
+0.71749756 0.29190894 0.74795835
+0.71847507 0.29080611 0.74927341
+0.71945259 0.28969733 0.75059633
+0.72043011 0.28858258 0.75193097
+0.72140762 0.28746182 0.75327333
+0.72238514 0.28633499 0.75462832
+0.72336266 0.28519073 0.75599124
+0.72434018 0.28403843 0.75736738
+0.72531769 0.28287950 0.75875208
+0.72629521 0.28171390 0.76015021
+0.72727273 0.28054156 0.76155797
+0.72825024 0.27935180 0.76297897
+0.72922776 0.27815158 0.76441118
+0.73020528 0.27694401 0.76585599
+0.73118280 0.27572903 0.76731413
+0.73216031 0.27450656 0.76878371
+0.73313783 0.27326677 0.77026937
+0.73411535 0.27201377 0.77176727
+0.73509286 0.27075261 0.77327962
+0.73607038 0.26948321 0.77480785
+0.73704790 0.26820547 0.77635024
+0.73802542 0.26691064 0.77790824
+0.73900293 0.26559946 0.77948412
+0.73998045 0.26427920 0.78107633
+0.74095797 0.26294975 0.78268584
+0.74193548 0.26161103 0.78431366
+0.74291300 0.26025556 0.78596086
+0.74389052 0.25888015 0.78762858
+0.74486804 0.25749462 0.78931800
+0.74584555 0.25609885 0.79103040
+0.74682307 0.25469273 0.79276708
+0.74780059 0.25327035 0.79452958
+0.74877810 0.25182393 0.79632311
+0.74975562 0.25036621 0.79815379
+0.75073314 0.25000000 0.79861996
+0.75171065 0.25000000 0.79861948
+0.75268817 0.25000000 0.79861883
+0.75366569 0.25000000 0.79861805
+0.75464321 0.25000000 0.79861715
+0.75562072 0.25000000 0.79861615
+0.75659824 0.25000000 0.79861505
+0.75757576 0.25000000 0.79861387
+0.75855327 0.25000000 0.79861262
+0.75953079 0.25000000 0.79861128
+0.76050831 0.25000000 0.79860987
+0.76148583 0.25000000 0.79860838
+0.76246334 0.25000000 0.79860682
+0.76344086 0.25000000 0.79860521
+0.76441838 0.25000000 0.79860352
+0.76539589 0.25000000 0.79860177
+0.76637341 0.25000000 0.79859997
+0.76735093 0.25000000 0.79859809
+0.76832845 0.25000000 0.79859615
+0.76930596 0.25000000 0.79859417
+0.77028348 0.25000000 0.79859211
+0.77126100 0.25000000 0.79859002
+0.77223851 0.25000000 0.79858784
+0.77321603 0.25000000 0.79858563
+0.77419355 0.25000000 0.79858334
+0.77517107 0.25000000 0.79858101
+0.77614858 0.25000000 0.79857862
+0.77712610 0.25000000 0.79857618
+0.77810362 0.25000000 0.79857368
+0.77908113 0.25000000 0.79857113
+0.78005865 0.25000000 0.79856851
+0.78103617 0.25000000 0.79856586
+0.78201369 0.25000000 0.79856313
+0.78299120 0.25000000 0.79856038
+0.78396872 0.25000000 0.79855754
+0.78494624 0.25000000 0.79855468
+0.78592375 0.25000000 0.79855172
+0.78690127 0.25000000 0.79854875
+0.78787879 0.25000000 0.79854569
+0.78885630 0.25000000 0.79854260
+0.78983382 0.25000000 0.79853945
+0.79081134 0.25000000 0.79853623
+0.79178886 0.25000000 0.79853299
+0.79276637 0.25000000 0.79852965
+0.79374389 0.25000000 0.79852628
+0.79472141 0.25000000 0.79852285
+0.79569892 0.25000000 0.79851935
+0.79667644 0.25000000 0.79851583
+0.79765396 0.25000000 0.79851220
+0.79863148 0.25000000 0.79850856
+0.79960899 0.25000000 0.79850483
+0.80058651 0.25000000 0.79850105
+0.80156403 0.25000000 0.79849724
+0.80254154 0.25000000 0.79849331
+0.80351906 0.25000000 0.79848937
+0.80449658 0.25000000 0.79848535
+0.80547410 0.25000000 0.79848126
+0.80645161 0.25000000 0.79847714
+0.80742913 0.25000000 0.79847293
+0.80840665 0.25000000 0.79846866
+0.80938416 0.25000000 0.79846436
+0.81036168 0.25000000 0.79845994
+0.81133920 0.25000000 0.79845549
+0.81231672 0.25000000 0.79845098
+0.81329423 0.25000000 0.79844637
+0.81427175 0.25000000 0.79844173
+0.81524927 0.25000000 0.79843701
+0.81622678 0.25000000 0.79843220
+0.81720430 0.25000000 0.79842736
+0.81818182 0.25000000 0.79842242
+0.81915934 0.25000000 0.79841741
+0.82013685 0.25000000 0.79841236
+0.82111437 0.25000000 0.79840720
+0.82209189 0.25000000 0.79840197
+0.82306940 0.25000000 0.79839671
+0.82404692 0.25000000 0.79839131
+0.82502444 0.25000000 0.79838586
+0.82600196 0.25000000 0.79838037
+0.82697947 0.25000000 0.79837473
+0.82795699 0.25000000 0.79836905
+0.82893451 0.25000000 0.79836332
+0.82991202 0.25000000 0.79835744
+0.83088954 0.25000000 0.79835151
+0.83186706 0.25000000 0.79834554
+0.83284457 0.25000000 0.79833940
+0.83382209 0.25000000 0.79833321
+0.83479961 0.25000000 0.79832698
+0.83577713 0.25000000 0.79832058
+0.83675464 0.25000000 0.79831412
+0.83773216 0.25000000 0.79830761
+0.83870968 0.25000000 0.79830093
+0.83968719 0.25000000 0.79829419
+0.84066471 0.25000000 0.79828739
+0.84164223 0.25000000 0.79828043
+0.84261975 0.25000000 0.79827338
+0.84359726 0.25000000 0.79826628
+0.84457478 0.25000000 0.79825903
+0.84555230 0.25000000 0.79825166
+0.84652981 0.25000000 0.79824424
+0.84750733 0.25000000 0.79823667
+0.84848485 0.25000000 0.79822898
+0.84946237 0.25000000 0.79822122
+0.85043988 0.25000000 0.79821332
+0.85141740 0.25000000 0.79820528
+0.85239492 0.25000000 0.79819716
+0.85337243 0.25000000 0.79818892
+0.85434995 0.25000000 0.79818050
+0.85532747 0.25000000 0.79817200
+0.85630499 0.25000000 0.79816341
+0.85728250 0.25000000 0.79815459
+0.85826002 0.25000000 0.79814569
+0.85923754 0.25000000 0.79813671
+0.86021505 0.25000000 0.79812749
+0.86119257 0.25000000 0.79811816
+0.86217009 0.25000000 0.79810874
+0.86314761 0.25000000 0.79809911
+0.86412512 0.25000000 0.79808933
+0.86510264 0.25000000 0.79807945
+0.86608016 0.25000000 0.79806938
+0.86705767 0.25000000 0.79805912
+0.86803519 0.25000000 0.79804875
+0.86901271 0.25000000 0.79803822
+0.86999022 0.25000000 0.79802745
+0.87096774 0.25000000 0.79801656
+0.87194526 0.25000000 0.79800553
+0.87292278 0.25000000 0.79799421
+0.87390029 0.25000000 0.79798276
+0.87487781 0.25000000 0.79797119
+0.87585533 0.25000000 0.79795931
+0.87683284 0.25000000 0.79794726
+0.87781036 0.25000000 0.79793508
+0.87878788 0.25000000 0.79792262
+0.87976540 0.25000000 0.79790994
+0.88074291 0.25000000 0.79789710
+0.88172043 0.25000000 0.79788401
+0.88269795 0.25000000 0.79787065
+0.88367546 0.25000000 0.79785711
+0.88465298 0.25000000 0.79784335
+0.88563050 0.25000000 0.79782925
+0.88660802 0.25000000 0.79781497
+0.88758553 0.25000000 0.79780049
+0.88856305 0.25000000 0.79778559
+0.88954057 0.25000000 0.79777050
+0.89051808 0.25000000 0.79775520
+0.89149560 0.25000000 0.79773949
+0.89247312 0.25000000 0.79772352
+0.89345064 0.25000000 0.79770732
+0.89442815 0.25000000 0.79769073
+0.89540567 0.25000000 0.79767382
+0.89638319 0.25000000 0.79765666
+0.89736070 0.25000000 0.79763911
+0.89833822 0.25000000 0.79762117
+0.89931574 0.25000000 0.79760296
+0.90029326 0.25000000 0.79758437
+0.90127077 0.25000000 0.79756532
+0.90224829 0.25000000 0.79754596
+0.90322581 0.25000000 0.79752623
+0.90420332 0.25000000 0.79750596
+0.90518084 0.25000000 0.79748536
+0.90615836 0.25000000 0.79746439
+0.90713587 0.25000000 0.79744279
+0.90811339 0.25000000 0.79742082
+0.90909091 0.25000000 0.79739846
+0.91006843 0.25000000 0.79737542
+0.91104594 0.25000000 0.79735195
+0.91202346 0.25000000 0.79732805
+0.91300098 0.25000000 0.79730343
+0.91397849 0.25000000 0.79727831
+0.91495601 0.25000000 0.79725272
+0.91593353 0.25000000 0.79722635
+0.91691105 0.25000000 0.79719941
+0.91788856 0.25000000 0.79717194
+0.91886608 0.25000000 0.79714363
+0.91984360 0.25000000 0.79711467
+0.92082111 0.25000000 0.79708512
+0.92179863 0.25000000 0.79705464
+0.92277615 0.25000000 0.79702344
+0.92375367 0.25000000 0.79699156
+0.92473118 0.25000000 0.79695865
+0.92570870 0.25000000 0.79692493
+0.92668622 0.25000000 0.79689046
+0.92766373 0.25000000 0.79685481
+0.92864125 0.25000000 0.79681828
+0.92961877 0.25000000 0.79678089
+0.93059629 0.25000000 0.79674213
+0.93157380 0.25000000 0.79670242
+0.93255132 0.25000000 0.79666168
+0.93352884 0.25000000 0.79661945
+0.93450635 0.25000000 0.79657614
+0.93548387 0.25000000 0.79653155
+0.93646139 0.25000000 0.79648538
+0.93743891 0.25000000 0.79643797
+0.93841642 0.25000000 0.79638897
+0.93939394 0.25000000 0.79633829
+0.94037146 0.25000000 0.79628616
+0.94134897 0.25000000 0.79623206
+0.94232649 0.25000000 0.79617617
+0.94330401 0.25000000 0.79611860
+0.94428152 0.25000000 0.79605856
+0.94525904 0.25000000 0.79599664
+0.94623656 0.25000000 0.79593249
+0.94721408 0.25000000 0.79586572
+0.94819159 0.25000000 0.79579673
+0.94916911 0.25000000 0.79572481
+0.95014663 0.25000000 0.79565013
+0.95112414 0.25000000 0.79557268
+0.95210166 0.25000000 0.79549161
+0.95307918 0.25000000 0.79540752
+0.95405670 0.25000000 0.79531963
+0.95503421 0.25000000 0.79522790
+0.95601173 0.25000000 0.79513236
+0.95698925 0.25000000 0.79503193
+0.95796676 0.25000000 0.79492728
+0.95894428 0.25000000 0.79481726
+0.95992180 0.25000000 0.79470198
+0.96089932 0.25000000 0.79458101
+0.96187683 0.25000000 0.79445345
+0.96285435 0.25000000 0.79431971
+0.96383187 0.25000000 0.79417785
+0.96480938 0.25000000 0.79402872
+0.96578690 0.25000000 0.79387044
+0.96676442 0.25000000 0.79370311
+0.96774194 0.25000000 0.79352532
+0.96871945 0.25000000 0.79333630
+0.96969697 0.25000000 0.79313501
+0.97067449 0.25000000 0.79291987
+0.97165200 0.25000000 0.79268996
+0.97262952 0.25000000 0.79244291
+0.97360704 0.25000000 0.79217766
+0.97458456 0.25000000 0.79189110
+0.97556207 0.25000000 0.79158154
+0.97653959 0.25000000 0.79124522
+0.97751711 0.25000000 0.79090029
+0.97849462 0.25000000 0.79054673
+0.97947214 0.25000000 0.79018995
+0.98044966 0.25000000 0.78981442
+0.98142717 0.25000000 0.78944502
+0.98240469 0.25000000 0.78905221
+0.98338221 0.25000000 0.78865750
+0.98435973 0.25000000 0.78825020
+0.98533724 0.25000000 0.78781850
+0.98631476 0.25000000 0.78739050
+0.98729228 0.25000000 0.78694035
+0.98826979 0.25000000 0.78646407
+0.98924731 0.25000000 0.78597481
+0.99022483 0.25000000 0.78546981
+0.99120235 0.25000000 0.78493388
+0.99217986 0.25000000 0.78436450
+0.99315738 0.25000000 0.78375795
+0.99413490 0.25000000 0.78310826
+0.99511241 0.25000000 0.78240496
+0.99608993 0.25000000 0.78162741
+0.99706745 0.25000000 0.78072789
+0.99804497 0.25000000 0.77969339
+0.99902248 0.25000000 0.77832850
+1.00000000 nan nan
diff --git a/examples/mamdani/SimpleDimmerInverse.fll b/examples/mamdani/SimpleDimmerInverse.fll
new file mode 100644
index 0000000..fd6b945
--- /dev/null
+++ b/examples/mamdani/SimpleDimmerInverse.fll
@@ -0,0 +1,40 @@
+Engine: simple-dimmer
+InputVariable: Ambient
+ enabled: true
+ range: 0.000 1.000
+ term: DARK Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: BRIGHT Triangle 0.500 0.750 1.000
+OutputVariable: Power
+ enabled: true
+ range: 0.000 1.000
+ accumulation: Maximum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: HIGH Triangle 0.500 0.750 1.000
+OutputVariable: InversePower
+ enabled: true
+ range: 0.000 1.000
+ accumulation: Maximum
+ defuzzifier: Centroid 500
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Cosine 0.200 0.500
+ term: MEDIUM Cosine 0.500 0.500
+ term: HIGH Cosine 0.800 0.500
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: Minimum
+ rule: if Ambient is DARK then Power is HIGH
+ rule: if Ambient is MEDIUM then Power is MEDIUM
+ rule: if Ambient is BRIGHT then Power is LOW
+ rule: if Power is LOW then InversePower is HIGH
+ rule: if Power is MEDIUM then InversePower is MEDIUM
+ rule: if Power is HIGH then InversePower is LOW \ No newline at end of file
diff --git a/examples/mamdani/SimpleDimmerInverse.java b/examples/mamdani/SimpleDimmerInverse.java
new file mode 100644
index 0000000..0bdde89
--- /dev/null
+++ b/examples/mamdani/SimpleDimmerInverse.java
@@ -0,0 +1,71 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class SimpleDimmerInverse{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("simple-dimmer");
+
+InputVariable inputVariable = new InputVariable();
+inputVariable.setEnabled(true);
+inputVariable.setName("Ambient");
+inputVariable.setRange(0.000, 1.000);
+inputVariable.addTerm(new Triangle("DARK", 0.000, 0.250, 0.500));
+inputVariable.addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+inputVariable.addTerm(new Triangle("BRIGHT", 0.500, 0.750, 1.000));
+engine.addInputVariable(inputVariable);
+
+OutputVariable outputVariable1 = new OutputVariable();
+outputVariable1.setEnabled(true);
+outputVariable1.setName("Power");
+outputVariable1.setRange(0.000, 1.000);
+outputVariable1.fuzzyOutput().setAccumulation(new Maximum());
+outputVariable1.setDefuzzifier(new Centroid(200));
+outputVariable1.setDefaultValue(Double.NaN);
+outputVariable1.setLockPreviousOutputValue(false);
+outputVariable1.setLockOutputValueInRange(false);
+outputVariable1.addTerm(new Triangle("LOW", 0.000, 0.250, 0.500));
+outputVariable1.addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+outputVariable1.addTerm(new Triangle("HIGH", 0.500, 0.750, 1.000));
+engine.addOutputVariable(outputVariable1);
+
+OutputVariable outputVariable2 = new OutputVariable();
+outputVariable2.setEnabled(true);
+outputVariable2.setName("InversePower");
+outputVariable2.setRange(0.000, 1.000);
+outputVariable2.fuzzyOutput().setAccumulation(new Maximum());
+outputVariable2.setDefuzzifier(new Centroid(500));
+outputVariable2.setDefaultValue(Double.NaN);
+outputVariable2.setLockPreviousOutputValue(false);
+outputVariable2.setLockOutputValueInRange(false);
+outputVariable2.addTerm(new Cosine("LOW", 0.200, 0.500));
+outputVariable2.addTerm(new Cosine("MEDIUM", 0.500, 0.500));
+outputVariable2.addTerm(new Cosine("HIGH", 0.800, 0.500));
+engine.addOutputVariable(outputVariable2);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(null);
+ruleBlock.setDisjunction(null);
+ruleBlock.setActivation(new Minimum());
+ruleBlock.addRule(Rule.parse("if Ambient is DARK then Power is HIGH", engine));
+ruleBlock.addRule(Rule.parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
+ruleBlock.addRule(Rule.parse("if Ambient is BRIGHT then Power is LOW", engine));
+ruleBlock.addRule(Rule.parse("if Power is LOW then InversePower is HIGH", engine));
+ruleBlock.addRule(Rule.parse("if Power is MEDIUM then InversePower is MEDIUM", engine));
+ruleBlock.addRule(Rule.parse("if Power is HIGH then InversePower is LOW", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/mamdani/octave/COPYING b/examples/mamdani/octave/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/examples/mamdani/octave/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/examples/mamdani/octave/DESCRIPTION b/examples/mamdani/octave/DESCRIPTION
new file mode 100644
index 0000000..35df57d
--- /dev/null
+++ b/examples/mamdani/octave/DESCRIPTION
@@ -0,0 +1,12 @@
+Name: fuzzy-logic-toolkit
+Version: 0.4.2
+Date: 2012-10-02
+Author: L. Markowsky <lmarkov@users.sourceforge.net>
+Maintainer: L. Markowsky <lmarkov@users.sourceforge.net>
+Title: Octave Fuzzy Logic Toolkit
+Description: A mostly MATLAB-compatible fuzzy logic toolkit for Octave.
+Depends: octave (>= 3.2.4)
+Autoload: no
+License: GPLv3+
+Url: http://octave.sf.net
+ http://sf.net/projects/octave-fuzzy
diff --git a/examples/mamdani/octave/investment_portfolio.cpp b/examples/mamdani/octave/investment_portfolio.cpp
new file mode 100644
index 0000000..9ccadc9
--- /dev/null
+++ b/examples/mamdani/octave/investment_portfolio.cpp
@@ -0,0 +1,52 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("Investment-Portfolio");
+
+InputVariable* inputVariable1 = new InputVariable;
+inputVariable1->setEnabled(true);
+inputVariable1->setName("Age");
+inputVariable1->setRange(20.000, 100.000);
+inputVariable1->addTerm(new ZShape("Young", 30.000, 90.000));
+inputVariable1->addTerm(new SShape("Old", 30.000, 90.000));
+engine->addInputVariable(inputVariable1);
+
+InputVariable* inputVariable2 = new InputVariable;
+inputVariable2->setEnabled(true);
+inputVariable2->setName("RiskTolerance");
+inputVariable2->setRange(0.000, 10.000);
+inputVariable2->addTerm(new ZShape("Low", 2.000, 8.000));
+inputVariable2->addTerm(new SShape("High", 2.000, 8.000));
+engine->addInputVariable(inputVariable2);
+
+OutputVariable* outputVariable = new OutputVariable;
+outputVariable->setEnabled(true);
+outputVariable->setName("PercentageInStocks");
+outputVariable->setRange(0.000, 100.000);
+outputVariable->fuzzyOutput()->setAccumulation(new EinsteinSum);
+outputVariable->setDefuzzifier(new Centroid(200));
+outputVariable->setDefaultValue(fl::nan);
+outputVariable->setLockPreviousOutputValue(false);
+outputVariable->setLockOutputValueInRange(false);
+outputVariable->addTerm(new Gaussian("AboutFifteen", 15.000, 10.000));
+outputVariable->addTerm(new Gaussian("AboutFifty", 50.000, 10.000));
+outputVariable->addTerm(new Gaussian("AboutEightyFive", 85.000, 10.000));
+engine->addOutputVariable(outputVariable);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(new EinsteinProduct);
+ruleBlock->setDisjunction(new EinsteinSum);
+ruleBlock->setActivation(new EinsteinProduct);
+ruleBlock->addRule(fl::Rule::parse("if Age is Young or RiskTolerance is High then PercentageInStocks is AboutEightyFive", engine));
+ruleBlock->addRule(fl::Rule::parse("if Age is Old or RiskTolerance is Low then PercentageInStocks is AboutFifteen", engine));
+ruleBlock->addRule(fl::Rule::parse("if Age is not extremely Old and RiskTolerance is not extremely Low then PercentageInStocks is AboutFifty with 0.500", engine));
+ruleBlock->addRule(fl::Rule::parse("if Age is not extremely Young and RiskTolerance is not extremely High then PercentageInStocks is AboutFifty with 0.500", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/mamdani/octave/investment_portfolio.fcl b/examples/mamdani/octave/investment_portfolio.fcl
new file mode 100644
index 0000000..590ab3b
--- /dev/null
+++ b/examples/mamdani/octave/investment_portfolio.fcl
@@ -0,0 +1,44 @@
+FUNCTION_BLOCK Investment-Portfolio
+
+VAR_INPUT
+ Age: REAL;
+ RiskTolerance: REAL;
+END_VAR
+
+VAR_OUTPUT
+ PercentageInStocks: REAL;
+END_VAR
+
+FUZZIFY Age
+ RANGE := (20.000 .. 100.000);
+ TERM Young := ZShape 30.000 90.000;
+ TERM Old := SShape 30.000 90.000;
+END_FUZZIFY
+
+FUZZIFY RiskTolerance
+ RANGE := (0.000 .. 10.000);
+ TERM Low := ZShape 2.000 8.000;
+ TERM High := SShape 2.000 8.000;
+END_FUZZIFY
+
+DEFUZZIFY PercentageInStocks
+ RANGE := (0.000 .. 100.000);
+ TERM AboutFifteen := Gaussian 15.000 10.000;
+ TERM AboutFifty := Gaussian 50.000 10.000;
+ TERM AboutEightyFive := Gaussian 85.000 10.000;
+ METHOD : COG;
+ ACCU : ESUM;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ AND : EPROD;
+ OR : ESUM;
+ ACT : EPROD;
+ RULE 1 : if Age is Young or RiskTolerance is High then PercentageInStocks is AboutEightyFive
+ RULE 2 : if Age is Old or RiskTolerance is Low then PercentageInStocks is AboutFifteen
+ RULE 3 : if Age is not extremely Old and RiskTolerance is not extremely Low then PercentageInStocks is AboutFifty with 0.500
+ RULE 4 : if Age is not extremely Young and RiskTolerance is not extremely High then PercentageInStocks is AboutFifty with 0.500
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/mamdani/octave/investment_portfolio.fis b/examples/mamdani/octave/investment_portfolio.fis
new file mode 100644
index 0000000..311e728
--- /dev/null
+++ b/examples/mamdani/octave/investment_portfolio.fis
@@ -0,0 +1,39 @@
+[System]
+Name='Investment-Portfolio'
+Type='mamdani'
+NumInputs=2
+NumOutputs=1
+NumRules=4
+AndMethod='einstein_product'
+OrMethod='einstein_sum'
+ImpMethod='einstein_product'
+AggMethod='einstein_sum'
+DefuzzMethod='centroid'
+
+[Input1]
+Name='Age'
+Range=[20.000 100.000]
+NumMFs=2
+MF1='Young':'zmf',[30.000 90.000]
+MF2='Old':'smf',[30.000 90.000]
+
+[Input2]
+Name='RiskTolerance'
+Range=[0.000 10.000]
+NumMFs=2
+MF1='Low':'zmf',[2.000 8.000]
+MF2='High':'smf',[2.000 8.000]
+
+[Output1]
+Name='PercentageInStocks'
+Range=[0.000 100.000]
+NumMFs=3
+MF1='AboutFifteen':'gaussmf',[10.000 15.000]
+MF2='AboutFifty':'gaussmf',[10.000 50.000]
+MF3='AboutEightyFive':'gaussmf',[10.000 85.000]
+
+[Rules]
+1.000 2.000 , 3.000 (1.000) : 2
+2.000 1.000 , 1.000 (1.000) : 2
+-2.300 -1.300 , 2.000 (0.500) : 1
+-1.300 -2.300 , 2.000 (0.500) : 1
diff --git a/examples/mamdani/octave/investment_portfolio.fld b/examples/mamdani/octave/investment_portfolio.fld
new file mode 100644
index 0000000..648b0be
--- /dev/null
+++ b/examples/mamdani/octave/investment_portfolio.fld
@@ -0,0 +1,1026 @@
+#@Engine: Investment-Portfolio;
+#@InputVariable: Age; @InputVariable: RiskTolerance; @OutputVariable: PercentageInStocks;
+20.00000000 0.00000000 50.00000000
+20.00000000 0.32258065 50.00000000
+20.00000000 0.64516129 50.00000000
+20.00000000 0.96774194 50.00000000
+20.00000000 1.29032258 50.00000000
+20.00000000 1.61290323 50.00000000
+20.00000000 1.93548387 50.00000000
+20.00000000 2.25806452 50.07664849
+20.00000000 2.58064516 50.39007638
+20.00000000 2.90322581 50.95232681
+20.00000000 3.22580645 51.77492832
+20.00000000 3.54838710 52.87098013
+20.00000000 3.87096774 54.25013613
+20.00000000 4.19354839 55.91006054
+20.00000000 4.51612903 57.82311764
+20.00000000 4.83870968 59.91799668
+20.00000000 5.16129032 62.04316294
+20.00000000 5.48387097 64.00662112
+20.00000000 5.80645161 65.82068208
+20.00000000 6.12903226 67.49497664
+20.00000000 6.45161290 69.01370662
+20.00000000 6.77419355 70.34164582
+20.00000000 7.09677419 71.43161596
+20.00000000 7.41935484 72.23344208
+20.00000000 7.74193548 72.70359583
+20.00000000 8.06451613 72.82131403
+20.00000000 8.38709677 72.82131403
+20.00000000 8.70967742 72.82131403
+20.00000000 9.03225806 72.82131403
+20.00000000 9.35483871 72.82131403
+20.00000000 9.67741935 72.82131403
+20.00000000 10.00000000 72.82131403
+22.58064516 0.00000000 50.00000000
+22.58064516 0.32258065 50.00000000
+22.58064516 0.64516129 50.00000000
+22.58064516 0.96774194 50.00000000
+22.58064516 1.29032258 50.00000000
+22.58064516 1.61290323 50.00000000
+22.58064516 1.93548387 50.00000000
+22.58064516 2.25806452 50.07664849
+22.58064516 2.58064516 50.39007638
+22.58064516 2.90322581 50.95232681
+22.58064516 3.22580645 51.77492832
+22.58064516 3.54838710 52.87098013
+22.58064516 3.87096774 54.25013613
+22.58064516 4.19354839 55.91006054
+22.58064516 4.51612903 57.82311764
+22.58064516 4.83870968 59.91799668
+22.58064516 5.16129032 62.04316294
+22.58064516 5.48387097 64.00662112
+22.58064516 5.80645161 65.82068208
+22.58064516 6.12903226 67.49497664
+22.58064516 6.45161290 69.01370662
+22.58064516 6.77419355 70.34164582
+22.58064516 7.09677419 71.43161596
+22.58064516 7.41935484 72.23344208
+22.58064516 7.74193548 72.70359583
+22.58064516 8.06451613 72.82131403
+22.58064516 8.38709677 72.82131403
+22.58064516 8.70967742 72.82131403
+22.58064516 9.03225806 72.82131403
+22.58064516 9.35483871 72.82131403
+22.58064516 9.67741935 72.82131403
+22.58064516 10.00000000 72.82131403
+25.16129032 0.00000000 50.00000000
+25.16129032 0.32258065 50.00000000
+25.16129032 0.64516129 50.00000000
+25.16129032 0.96774194 50.00000000
+25.16129032 1.29032258 50.00000000
+25.16129032 1.61290323 50.00000000
+25.16129032 1.93548387 50.00000000
+25.16129032 2.25806452 50.07664849
+25.16129032 2.58064516 50.39007638
+25.16129032 2.90322581 50.95232681
+25.16129032 3.22580645 51.77492832
+25.16129032 3.54838710 52.87098013
+25.16129032 3.87096774 54.25013613
+25.16129032 4.19354839 55.91006054
+25.16129032 4.51612903 57.82311764
+25.16129032 4.83870968 59.91799668
+25.16129032 5.16129032 62.04316294
+25.16129032 5.48387097 64.00662112
+25.16129032 5.80645161 65.82068208
+25.16129032 6.12903226 67.49497664
+25.16129032 6.45161290 69.01370662
+25.16129032 6.77419355 70.34164582
+25.16129032 7.09677419 71.43161596
+25.16129032 7.41935484 72.23344208
+25.16129032 7.74193548 72.70359583
+25.16129032 8.06451613 72.82131403
+25.16129032 8.38709677 72.82131403
+25.16129032 8.70967742 72.82131403
+25.16129032 9.03225806 72.82131403
+25.16129032 9.35483871 72.82131403
+25.16129032 9.67741935 72.82131403
+25.16129032 10.00000000 72.82131403
+27.74193548 0.00000000 50.00000000
+27.74193548 0.32258065 50.00000000
+27.74193548 0.64516129 50.00000000
+27.74193548 0.96774194 50.00000000
+27.74193548 1.29032258 50.00000000
+27.74193548 1.61290323 50.00000000
+27.74193548 1.93548387 50.00000000
+27.74193548 2.25806452 50.07664849
+27.74193548 2.58064516 50.39007638
+27.74193548 2.90322581 50.95232681
+27.74193548 3.22580645 51.77492832
+27.74193548 3.54838710 52.87098013
+27.74193548 3.87096774 54.25013613
+27.74193548 4.19354839 55.91006054
+27.74193548 4.51612903 57.82311764
+27.74193548 4.83870968 59.91799668
+27.74193548 5.16129032 62.04316294
+27.74193548 5.48387097 64.00662112
+27.74193548 5.80645161 65.82068208
+27.74193548 6.12903226 67.49497664
+27.74193548 6.45161290 69.01370662
+27.74193548 6.77419355 70.34164582
+27.74193548 7.09677419 71.43161596
+27.74193548 7.41935484 72.23344208
+27.74193548 7.74193548 72.70359583
+27.74193548 8.06451613 72.82131403
+27.74193548 8.38709677 72.82131403
+27.74193548 8.70967742 72.82131403
+27.74193548 9.03225806 72.82131403
+27.74193548 9.35483871 72.82131403
+27.74193548 9.67741935 72.82131403
+27.74193548 10.00000000 72.82131403
+30.32258065 0.00000000 49.99880392
+30.32258065 0.32258065 49.99880392
+30.32258065 0.64516129 49.99880392
+30.32258065 0.96774194 49.99880392
+30.32258065 1.29032258 49.99880392
+30.32258065 1.61290323 49.99880392
+30.32258065 1.93548387 49.99880392
+30.32258065 2.25806452 50.07545238
+30.32258065 2.58064516 50.38887965
+30.32258065 2.90322581 50.95112699
+30.32258065 3.22580645 51.77371992
+30.32258065 3.54838710 52.86975395
+30.32258065 3.87096774 54.24887943
+30.32258065 4.19354839 55.90875847
+30.32258065 4.51612903 57.82175684
+30.32258065 4.83870968 59.91657184
+30.32258065 5.16129032 62.04168233
+30.32258065 5.48387097 64.00508502
+30.32258065 5.80645161 65.81908993
+30.32258065 6.12903226 67.49332917
+30.32258065 6.45161290 69.01200609
+30.32258065 6.77419355 70.33989666
+30.32258065 7.09677419 71.42982533
+30.32258065 7.41935484 72.23162005
+30.32258065 7.74193548 72.70175504
+30.32258065 8.06451613 72.81946849
+30.32258065 8.38709677 72.81946849
+30.32258065 8.70967742 72.81946849
+30.32258065 9.03225806 72.81946849
+30.32258065 9.35483871 72.81946849
+30.32258065 9.67741935 72.81946849
+30.32258065 10.00000000 72.81946849
+32.90322581 0.00000000 49.90295798
+32.90322581 0.32258065 49.90295798
+32.90322581 0.64516129 49.90295798
+32.90322581 0.96774194 49.90295798
+32.90322581 1.29032258 49.90295798
+32.90322581 1.61290323 49.90295798
+32.90322581 1.93548387 49.90295798
+32.90322581 2.25806452 49.97960702
+32.90322581 2.58064516 50.29299482
+32.90322581 2.90322581 50.85501365
+32.90322581 3.22580645 51.67694728
+32.90322581 3.54838710 52.77159622
+32.90322581 3.87096774 54.14832785
+32.90322581 4.19354839 55.80464007
+32.90322581 4.51612903 57.71302139
+32.90322581 4.83870968 59.80281425
+32.90322581 5.16129032 61.92356979
+32.90322581 5.48387097 63.88261418
+32.90322581 5.80645161 65.69219320
+32.90322581 6.12903226 67.36205805
+32.90322581 6.45161290 68.87652195
+32.90322581 6.77419355 70.20054895
+32.90322581 7.09677419 71.28718186
+32.90322581 7.41935484 72.08648082
+32.90322581 7.74193548 72.55512448
+32.90322581 8.06451613 72.67246132
+32.90322581 8.38709677 72.67246132
+32.90322581 8.70967742 72.67246132
+32.90322581 9.03225806 72.67246132
+32.90322581 9.35483871 72.67246132
+32.90322581 9.67741935 72.67246132
+32.90322581 10.00000000 72.67246132
+35.48387097 0.00000000 49.65230424
+35.48387097 0.32258065 49.65230424
+35.48387097 0.64516129 49.65230424
+35.48387097 0.96774194 49.65230424
+35.48387097 1.29032258 49.65230424
+35.48387097 1.61290323 49.65230424
+35.48387097 1.93548387 49.65230424
+35.48387097 2.25806452 49.72897859
+35.48387097 2.58064516 50.04236049
+35.48387097 2.90322581 50.60395669
+35.48387097 3.22580645 51.42442479
+35.48387097 3.54838710 52.51580620
+35.48387097 3.87096774 53.88675089
+35.48387097 4.19354839 55.53436093
+35.48387097 4.51612903 57.43147904
+35.48387097 4.83870968 59.50912954
+35.48387097 5.16129032 61.61952428
+35.48387097 5.48387097 63.56796052
+35.48387097 5.80645161 65.36655988
+35.48387097 6.12903226 67.02542761
+35.48387097 6.45161290 68.52927075
+35.48387097 6.77419355 69.84352090
+35.48387097 7.09677419 70.92180186
+35.48387097 7.41935484 71.71475942
+35.48387097 7.74193548 72.17961322
+35.48387097 8.06451613 72.29599292
+35.48387097 8.38709677 72.29599292
+35.48387097 8.70967742 72.29599292
+35.48387097 9.03225806 72.29599292
+35.48387097 9.35483871 72.29599292
+35.48387097 9.67741935 72.29599292
+35.48387097 10.00000000 72.29599292
+38.06451613 0.00000000 49.24309895
+38.06451613 0.32258065 49.24309895
+38.06451613 0.64516129 49.24309895
+38.06451613 0.96774194 49.24309895
+38.06451613 1.29032258 49.24309895
+38.06451613 1.61290323 49.24309895
+38.06451613 1.93548387 49.24309895
+38.06451613 2.25806452 49.31988482
+38.06451613 2.58064516 49.63354393
+38.06451613 2.90322581 50.19496500
+38.06451613 3.22580645 51.01379991
+38.06451613 3.54838710 52.10088544
+38.06451613 3.87096774 53.46376445
+38.06451613 4.19354839 55.09898884
+38.06451613 4.51612903 56.98007353
+38.06451613 4.83870968 59.04077124
+38.06451613 5.16129032 61.13722688
+38.06451613 5.48387097 63.07064236
+38.06451613 5.80645161 64.85305357
+38.06451613 6.12903226 66.49534778
+38.06451613 6.45161290 67.98296760
+38.06451613 6.77419355 69.28218358
+38.06451613 7.09677419 70.34756047
+38.06451613 7.41935484 71.13072959
+38.06451613 7.74193548 71.58971545
+38.06451613 8.06451613 71.70461300
+38.06451613 8.38709677 71.70461300
+38.06451613 8.70967742 71.70461300
+38.06451613 9.03225806 71.70461300
+38.06451613 9.35483871 71.70461300
+38.06451613 9.67741935 71.70461300
+38.06451613 10.00000000 71.70461300
+40.64516129 0.00000000 48.66974302
+40.64516129 0.32258065 48.66974302
+40.64516129 0.64516129 48.66974302
+40.64516129 0.96774194 48.66974302
+40.64516129 1.29032258 48.66974302
+40.64516129 1.61290323 48.66974302
+40.64516129 1.93548387 48.66974302
+40.64516129 2.25806452 48.74681972
+40.64516129 2.58064516 49.06141626
+40.64516129 2.90322581 49.62357390
+40.64516129 3.22580645 50.44156177
+40.64516129 3.54838710 51.52458831
+40.64516129 3.87096774 52.87875978
+40.64516129 4.19354839 54.50003124
+40.64516129 4.51612903 56.36302984
+40.64516129 4.83870968 58.40529847
+40.64516129 5.16129032 60.48775451
+40.64516129 5.48387097 62.40444567
+40.64516129 5.80645161 64.16746517
+40.64516129 6.12903226 65.78913336
+40.64516129 6.45161290 67.25614371
+40.64516129 6.77419355 68.53604701
+40.64516129 7.09677419 69.58475383
+40.64516129 7.41935484 70.35521241
+40.64516129 7.74193548 70.80658497
+40.64516129 8.06451613 70.91955552
+40.64516129 8.38709677 70.91955552
+40.64516129 8.70967742 70.91955552
+40.64516129 9.03225806 70.91955552
+40.64516129 9.35483871 70.91955552
+40.64516129 9.67741935 70.91955552
+40.64516129 10.00000000 70.91955552
+43.22580645 0.00000000 47.92553362
+43.22580645 0.32258065 47.92553362
+43.22580645 0.64516129 47.92553362
+43.22580645 0.96774194 47.92553362
+43.22580645 1.29032258 47.92553362
+43.22580645 1.61290323 47.92553362
+43.22580645 1.93548387 47.92553362
+43.22580645 2.25806452 48.00319612
+43.22580645 2.58064516 48.31985647
+43.22580645 2.90322581 48.88447571
+43.22580645 3.22580645 49.70355442
+43.22580645 3.54838710 50.78426142
+43.22580645 3.87096774 52.13099528
+43.22580645 4.19354839 53.73918510
+43.22580645 4.51612903 55.58515207
+43.22580645 4.83870968 57.61132963
+43.22580645 5.16129032 59.68382184
+43.22580645 5.48387097 61.58536931
+43.22580645 5.80645161 63.32828142
+43.22580645 6.12903226 64.92718203
+43.22580645 6.45161290 66.37069947
+43.22580645 6.77419355 67.62820397
+43.22580645 7.09677419 68.65739074
+43.22580645 7.41935484 69.41289095
+43.22580645 7.74193548 69.85526918
+43.22580645 8.06451613 69.96596156
+43.22580645 8.38709677 69.96596156
+43.22580645 8.70967742 69.96596156
+43.22580645 9.03225806 69.96596156
+43.22580645 9.35483871 69.96596156
+43.22580645 9.67741935 69.96596156
+43.22580645 10.00000000 69.96596156
+45.80645161 0.00000000 47.00393487
+45.80645161 0.32258065 47.00393487
+45.80645161 0.64516129 47.00393487
+45.80645161 0.96774194 47.00393487
+45.80645161 1.29032258 47.00393487
+45.80645161 1.61290323 47.00393487
+45.80645161 1.93548387 47.00393487
+45.80645161 2.25806452 47.08260248
+45.80645161 2.58064516 47.40295027
+45.80645161 2.90322581 47.97260761
+45.80645161 3.22580645 48.79588816
+45.80645161 3.54838710 49.87749533
+45.80645161 3.87096774 51.21988342
+45.80645161 4.19354839 52.81813027
+45.80645161 4.51612903 54.65098576
+45.80645161 4.83870968 56.66698079
+45.80645161 5.16129032 58.73758982
+45.80645161 5.48387097 60.62911442
+45.80645161 5.80645161 62.35401414
+45.80645161 6.12903226 63.93019461
+45.80645161 6.45161290 65.34904000
+45.80645161 6.77419355 66.58237935
+45.80645161 7.09677419 67.59018730
+45.80645161 7.41935484 68.32916295
+45.80645161 7.74193548 68.76155861
+45.80645161 8.06451613 68.86971710
+45.80645161 8.38709677 68.86971710
+45.80645161 8.70967742 68.86971710
+45.80645161 9.03225806 68.86971710
+45.80645161 9.35483871 68.86971710
+45.80645161 9.67741935 68.86971710
+45.80645161 10.00000000 68.86971710
+48.38709677 0.00000000 45.90059861
+48.38709677 0.32258065 45.90059861
+48.38709677 0.64516129 45.90059861
+48.38709677 0.96774194 45.90059861
+48.38709677 1.29032258 45.90059861
+48.38709677 1.61290323 45.90059861
+48.38709677 1.93548387 45.90059861
+48.38709677 2.25806452 45.98080335
+48.38709677 2.58064516 46.30690509
+48.38709677 2.90322581 46.88490696
+48.38709677 3.22580645 47.71644736
+48.38709677 3.54838710 48.80327906
+48.38709677 3.87096774 50.14566326
+48.38709677 4.19354839 51.73856779
+48.38709677 4.51612903 53.56406480
+48.38709677 4.83870968 55.57822661
+48.38709677 5.16129032 57.65828336
+48.38709677 5.48387097 59.54837018
+48.38709677 5.80645161 61.26036274
+48.38709677 6.12903226 62.81628542
+48.38709677 6.45161290 64.21114285
+48.38709677 6.77419355 65.41994481
+48.38709677 7.09677419 66.40551444
+48.38709677 7.41935484 67.12705985
+48.38709677 7.74193548 67.54884508
+48.38709677 8.06451613 67.65430104
+48.38709677 8.38709677 67.65430104
+48.38709677 8.70967742 67.65430104
+48.38709677 9.03225806 67.65430104
+48.38709677 9.35483871 67.65430104
+48.38709677 9.67741935 67.65430104
+48.38709677 10.00000000 67.65430104
+50.96774194 0.00000000 44.61641577
+50.96774194 0.32258065 44.61641577
+50.96774194 0.64516129 44.61641577
+50.96774194 0.96774194 44.61641577
+50.96774194 1.29032258 44.61641577
+50.96774194 1.61290323 44.61641577
+50.96774194 1.93548387 44.61641577
+50.96774194 2.25806452 44.69876030
+50.96774194 2.58064516 45.03294688
+50.96774194 2.90322581 45.62298535
+50.96774194 3.22580645 46.46723847
+50.96774194 3.54838710 47.56391012
+50.96774194 3.87096774 48.91074345
+50.96774194 4.19354839 50.50284021
+50.96774194 4.51612903 52.32663397
+50.96774194 4.83870968 54.34758826
+50.96774194 5.16129032 56.44995468
+50.96774194 5.48387097 58.35016147
+50.96774194 5.80645161 60.05744033
+50.96774194 6.12903226 61.59819880
+50.96774194 6.45161290 62.97178502
+50.96774194 6.77419355 64.15714114
+50.96774194 7.09677419 65.12059667
+50.96774194 7.41935484 65.82440942
+50.96774194 7.74193548 66.23526465
+50.96774194 8.06451613 66.33792129
+50.96774194 8.38709677 66.33792129
+50.96774194 8.70967742 66.33792129
+50.96774194 9.03225806 66.33792129
+50.96774194 9.35483871 66.33792129
+50.96774194 9.67741935 66.33792129
+50.96774194 10.00000000 66.33792129
+53.54838710 0.00000000 43.16186397
+53.54838710 0.32258065 43.16186397
+53.54838710 0.64516129 43.16186397
+53.54838710 0.96774194 43.16186397
+53.54838710 1.29032258 43.16186397
+53.54838710 1.61290323 43.16186397
+53.54838710 1.93548387 43.16186397
+53.54838710 2.25806452 43.24693567
+53.54838710 2.58064516 43.59144915
+53.54838710 2.90322581 44.19696211
+53.54838710 3.22580645 45.05782673
+53.54838710 3.54838710 46.16794938
+53.54838710 3.87096774 47.52208653
+53.54838710 4.19354839 49.11561738
+53.54838710 4.51612903 50.94043496
+53.54838710 4.83870968 52.97375509
+53.54838710 5.16129032 55.10984868
+53.54838710 5.48387097 57.03353782
+53.54838710 5.80645161 58.74723142
+53.54838710 6.12903226 60.28074724
+53.54838710 6.45161290 61.63802885
+53.54838710 6.77419355 62.80260996
+53.54838710 7.09677419 63.74506644
+53.54838710 7.41935484 64.43139325
+53.54838710 7.74193548 64.83124074
+53.54838710 8.06451613 64.93106623
+53.54838710 8.38709677 64.93106623
+53.54838710 8.70967742 64.93106623
+53.54838710 9.03225806 64.93106623
+53.54838710 9.35483871 64.93106623
+53.54838710 9.67741935 64.93106623
+53.54838710 10.00000000 64.93106623
+56.12903226 0.00000000 41.56275742
+56.12903226 0.32258065 41.56275742
+56.12903226 0.64516129 41.56275742
+56.12903226 0.96774194 41.56275742
+56.12903226 1.29032258 41.56275742
+56.12903226 1.61290323 41.56275742
+56.12903226 1.93548387 41.56275742
+56.12903226 2.25806452 41.65098310
+56.12903226 2.58064516 42.00739488
+56.12903226 2.90322581 42.63056788
+56.12903226 3.22580645 43.51001484
+56.12903226 3.54838710 44.63446668
+56.12903226 3.87096774 45.99502950
+56.12903226 4.19354839 47.58723244
+56.12903226 4.51612903 49.40932005
+56.12903226 4.83870968 51.45296580
+56.12903226 5.16129032 53.62799552
+56.12903226 5.48387097 55.58793124
+56.12903226 5.80645161 57.32139748
+56.12903226 6.12903226 58.85847793
+56.12903226 6.45161290 60.20693213
+56.12903226 6.77419355 61.35519439
+56.12903226 7.09677419 62.27884289
+56.12903226 7.41935484 62.94847543
+56.12903226 7.74193548 63.33747330
+56.12903226 8.06451613 63.43446352
+56.12903226 8.38709677 63.43446352
+56.12903226 8.70967742 63.43446352
+56.12903226 9.03225806 63.43446352
+56.12903226 9.35483871 63.43446352
+56.12903226 9.67741935 63.43446352
+56.12903226 10.00000000 63.43446352
+58.70967742 0.00000000 39.86708229
+58.70967742 0.32258065 39.86708229
+58.70967742 0.64516129 39.86708229
+58.70967742 0.96774194 39.86708229
+58.70967742 1.29032258 39.86708229
+58.70967742 1.61290323 39.86708229
+58.70967742 1.93548387 39.86708229
+58.70967742 2.25806452 39.95851324
+58.70967742 2.58064516 40.32688461
+58.70967742 2.90322581 40.96728935
+58.70967742 3.22580645 41.86364269
+58.70967742 3.54838710 42.99862876
+58.70967742 3.87096774 44.35883597
+58.70967742 4.19354839 45.93926995
+58.70967742 4.51612903 47.74461410
+58.70967742 4.83870968 49.78326881
+58.70967742 5.16129032 51.98897073
+58.70967742 5.48387097 53.99267848
+58.70967742 5.80645161 55.75955980
+58.70967742 6.12903226 57.31349232
+58.70967742 6.45161290 58.66332782
+58.70967742 6.77419355 59.80184437
+58.70967742 7.09677419 60.71018916
+58.70967742 7.41935484 61.36458028
+58.70967742 7.74193548 61.74313870
+58.70967742 8.06451613 61.83734579
+58.70967742 8.38709677 61.83734579
+58.70967742 8.70967742 61.83734579
+58.70967742 9.03225806 61.83734579
+58.70967742 9.35483871 61.83734579
+58.70967742 9.67741935 61.83734579
+58.70967742 10.00000000 61.83734579
+61.29032258 0.00000000 38.16265421
+61.29032258 0.32258065 38.16265421
+61.29032258 0.64516129 38.16265421
+61.29032258 0.96774194 38.16265421
+61.29032258 1.29032258 38.16265421
+61.29032258 1.61290323 38.16265421
+61.29032258 1.93548387 38.16265421
+61.29032258 2.25806452 38.25686130
+61.29032258 2.58064516 38.63541972
+61.29032258 2.90322581 39.28981084
+61.29032258 3.22580645 40.19815563
+61.29032258 3.54838710 41.33667218
+61.29032258 3.87096774 42.68650768
+61.29032258 4.19354839 44.24044020
+61.29032258 4.51612903 46.00732152
+61.29032258 4.83870968 48.01102927
+61.29032258 5.16129032 50.21673119
+61.29032258 5.48387097 52.25538590
+61.29032258 5.80645161 54.06073005
+61.29032258 6.12903226 55.64116403
+61.29032258 6.45161290 57.00137124
+61.29032258 6.77419355 58.13635731
+61.29032258 7.09677419 59.03271065
+61.29032258 7.41935484 59.67311539
+61.29032258 7.74193548 60.04148676
+61.29032258 8.06451613 60.13291771
+61.29032258 8.38709677 60.13291771
+61.29032258 8.70967742 60.13291771
+61.29032258 9.03225806 60.13291771
+61.29032258 9.35483871 60.13291771
+61.29032258 9.67741935 60.13291771
+61.29032258 10.00000000 60.13291771
+63.87096774 0.00000000 36.56553648
+63.87096774 0.32258065 36.56553648
+63.87096774 0.64516129 36.56553648
+63.87096774 0.96774194 36.56553648
+63.87096774 1.29032258 36.56553648
+63.87096774 1.61290323 36.56553648
+63.87096774 1.93548387 36.56553648
+63.87096774 2.25806452 36.66252670
+63.87096774 2.58064516 37.05152457
+63.87096774 2.90322581 37.72115711
+63.87096774 3.22580645 38.64480561
+63.87096774 3.54838710 39.79306787
+63.87096774 3.87096774 41.14152207
+63.87096774 4.19354839 42.67860252
+63.87096774 4.51612903 44.41206876
+63.87096774 4.83870968 46.37200448
+63.87096774 5.16129032 48.54703420
+63.87096774 5.48387097 50.59067995
+63.87096774 5.80645161 52.41276756
+63.87096774 6.12903226 54.00497050
+63.87096774 6.45161290 55.36553332
+63.87096774 6.77419355 56.48998516
+63.87096774 7.09677419 57.36943212
+63.87096774 7.41935484 57.99260512
+63.87096774 7.74193548 58.34901690
+63.87096774 8.06451613 58.43724258
+63.87096774 8.38709677 58.43724258
+63.87096774 8.70967742 58.43724258
+63.87096774 9.03225806 58.43724258
+63.87096774 9.35483871 58.43724258
+63.87096774 9.67741935 58.43724258
+63.87096774 10.00000000 58.43724258
+66.45161290 0.00000000 35.06893377
+66.45161290 0.32258065 35.06893377
+66.45161290 0.64516129 35.06893377
+66.45161290 0.96774194 35.06893377
+66.45161290 1.29032258 35.06893377
+66.45161290 1.61290323 35.06893377
+66.45161290 1.93548387 35.06893377
+66.45161290 2.25806452 35.16875926
+66.45161290 2.58064516 35.56860675
+66.45161290 2.90322581 36.25493356
+66.45161290 3.22580645 37.19739004
+66.45161290 3.54838710 38.36197115
+66.45161290 3.87096774 39.71925276
+66.45161290 4.19354839 41.25276858
+66.45161290 4.51612903 42.96646218
+66.45161290 4.83870968 44.89015132
+66.45161290 5.16129032 47.02624491
+66.45161290 5.48387097 49.05956504
+66.45161290 5.80645161 50.88438262
+66.45161290 6.12903226 52.47791347
+66.45161290 6.45161290 53.83205062
+66.45161290 6.77419355 54.94217327
+66.45161290 7.09677419 55.80303789
+66.45161290 7.41935484 56.40855085
+66.45161290 7.74193548 56.75306433
+66.45161290 8.06451613 56.83813603
+66.45161290 8.38709677 56.83813603
+66.45161290 8.70967742 56.83813603
+66.45161290 9.03225806 56.83813603
+66.45161290 9.35483871 56.83813603
+66.45161290 9.67741935 56.83813603
+66.45161290 10.00000000 56.83813603
+69.03225806 0.00000000 33.66207871
+69.03225806 0.32258065 33.66207871
+69.03225806 0.64516129 33.66207871
+69.03225806 0.96774194 33.66207871
+69.03225806 1.29032258 33.66207871
+69.03225806 1.61290323 33.66207871
+69.03225806 1.93548387 33.66207871
+69.03225806 2.25806452 33.76473535
+69.03225806 2.58064516 34.17559058
+69.03225806 2.90322581 34.87940333
+69.03225806 3.22580645 35.84285886
+69.03225806 3.54838710 37.02821498
+69.03225806 3.87096774 38.40180120
+69.03225806 4.19354839 39.94255967
+69.03225806 4.51612903 41.64983853
+69.03225806 4.83870968 43.55004532
+69.03225806 5.16129032 45.65241174
+69.03225806 5.48387097 47.67336603
+69.03225806 5.80645161 49.49715979
+69.03225806 6.12903226 51.08925655
+69.03225806 6.45161290 52.43608988
+69.03225806 6.77419355 53.53276153
+69.03225806 7.09677419 54.37701465
+69.03225806 7.41935484 54.96705312
+69.03225806 7.74193548 55.30123970
+69.03225806 8.06451613 55.38358423
+69.03225806 8.38709677 55.38358423
+69.03225806 8.70967742 55.38358423
+69.03225806 9.03225806 55.38358423
+69.03225806 9.35483871 55.38358423
+69.03225806 9.67741935 55.38358423
+69.03225806 10.00000000 55.38358423
+71.61290323 0.00000000 32.34569896
+71.61290323 0.32258065 32.34569896
+71.61290323 0.64516129 32.34569896
+71.61290323 0.96774194 32.34569896
+71.61290323 1.29032258 32.34569896
+71.61290323 1.61290323 32.34569896
+71.61290323 1.93548387 32.34569896
+71.61290323 2.25806452 32.45115492
+71.61290323 2.58064516 32.87294015
+71.61290323 2.90322581 33.59448556
+71.61290323 3.22580645 34.58005519
+71.61290323 3.54838710 35.78885715
+71.61290323 3.87096774 37.18371458
+71.61290323 4.19354839 38.73963726
+71.61290323 4.51612903 40.45162982
+71.61290323 4.83870968 42.34171664
+71.61290323 5.16129032 44.42177339
+71.61290323 5.48387097 46.43593520
+71.61290323 5.80645161 48.26143221
+71.61290323 6.12903226 49.85433674
+71.61290323 6.45161290 51.19672094
+71.61290323 6.77419355 52.28355264
+71.61290323 7.09677419 53.11509304
+71.61290323 7.41935484 53.69309491
+71.61290323 7.74193548 54.01919665
+71.61290323 8.06451613 54.09940139
+71.61290323 8.38709677 54.09940139
+71.61290323 8.70967742 54.09940139
+71.61290323 9.03225806 54.09940139
+71.61290323 9.35483871 54.09940139
+71.61290323 9.67741935 54.09940139
+71.61290323 10.00000000 54.09940139
+74.19354839 0.00000000 31.13028290
+74.19354839 0.32258065 31.13028290
+74.19354839 0.64516129 31.13028290
+74.19354839 0.96774194 31.13028290
+74.19354839 1.29032258 31.13028290
+74.19354839 1.61290323 31.13028290
+74.19354839 1.93548387 31.13028290
+74.19354839 2.25806452 31.23844139
+74.19354839 2.58064516 31.67083705
+74.19354839 2.90322581 32.40981270
+74.19354839 3.22580645 33.41762065
+74.19354839 3.54838710 34.65096000
+74.19354839 3.87096774 36.06980539
+74.19354839 4.19354839 37.64598586
+74.19354839 4.51612903 39.37088558
+74.19354839 4.83870968 41.26241018
+74.19354839 5.16129032 43.33301921
+74.19354839 5.48387097 45.34901424
+74.19354839 5.80645161 47.18186973
+74.19354839 6.12903226 48.78011658
+74.19354839 6.45161290 50.12250467
+74.19354839 6.77419355 51.20411184
+74.19354839 7.09677419 52.02739239
+74.19354839 7.41935484 52.59704973
+74.19354839 7.74193548 52.91739752
+74.19354839 8.06451613 52.99606513
+74.19354839 8.38709677 52.99606513
+74.19354839 8.70967742 52.99606513
+74.19354839 9.03225806 52.99606513
+74.19354839 9.35483871 52.99606513
+74.19354839 9.67741935 52.99606513
+74.19354839 10.00000000 52.99606513
+76.77419355 0.00000000 30.03403844
+76.77419355 0.32258065 30.03403844
+76.77419355 0.64516129 30.03403844
+76.77419355 0.96774194 30.03403844
+76.77419355 1.29032258 30.03403844
+76.77419355 1.61290323 30.03403844
+76.77419355 1.93548387 30.03403844
+76.77419355 2.25806452 30.14473082
+76.77419355 2.58064516 30.58710905
+76.77419355 2.90322581 31.34260926
+76.77419355 3.22580645 32.37179603
+76.77419355 3.54838710 33.62930053
+76.77419355 3.87096774 35.07281797
+76.77419355 4.19354839 36.67171858
+76.77419355 4.51612903 38.41463069
+76.77419355 4.83870968 40.31617816
+76.77419355 5.16129032 42.38867037
+76.77419355 5.48387097 44.41484793
+76.77419355 5.80645161 46.26081490
+76.77419355 6.12903226 47.86900472
+76.77419355 6.45161290 49.21573858
+76.77419355 6.77419355 50.29644558
+76.77419355 7.09677419 51.11552429
+76.77419355 7.41935484 51.68014353
+76.77419355 7.74193548 51.99680388
+76.77419355 8.06451613 52.07446638
+76.77419355 8.38709677 52.07446638
+76.77419355 8.70967742 52.07446638
+76.77419355 9.03225806 52.07446638
+76.77419355 9.35483871 52.07446638
+76.77419355 9.67741935 52.07446638
+76.77419355 10.00000000 52.07446638
+79.35483871 0.00000000 29.08044448
+79.35483871 0.32258065 29.08044448
+79.35483871 0.64516129 29.08044448
+79.35483871 0.96774194 29.08044448
+79.35483871 1.29032258 29.08044448
+79.35483871 1.61290323 29.08044448
+79.35483871 1.93548387 29.08044448
+79.35483871 2.25806452 29.19341503
+79.35483871 2.58064516 29.64478759
+79.35483871 2.90322581 30.41524617
+79.35483871 3.22580645 31.46395299
+79.35483871 3.54838710 32.74385629
+79.35483871 3.87096774 34.21086664
+79.35483871 4.19354839 35.83253483
+79.35483871 4.51612903 37.59555433
+79.35483871 4.83870968 39.51224549
+79.35483871 5.16129032 41.59470153
+79.35483871 5.48387097 43.63697016
+79.35483871 5.80645161 45.49996876
+79.35483871 6.12903226 47.12124022
+79.35483871 6.45161290 48.47541169
+79.35483871 6.77419355 49.55843823
+79.35483871 7.09677419 50.37642610
+79.35483871 7.41935484 50.93858374
+79.35483871 7.74193548 51.25318028
+79.35483871 8.06451613 51.33025698
+79.35483871 8.38709677 51.33025698
+79.35483871 8.70967742 51.33025698
+79.35483871 9.03225806 51.33025698
+79.35483871 9.35483871 51.33025698
+79.35483871 9.67741935 51.33025698
+79.35483871 10.00000000 51.33025698
+81.93548387 0.00000000 28.29538700
+81.93548387 0.32258065 28.29538700
+81.93548387 0.64516129 28.29538700
+81.93548387 0.96774194 28.29538700
+81.93548387 1.29032258 28.29538700
+81.93548387 1.61290323 28.29538700
+81.93548387 1.93548387 28.29538700
+81.93548387 2.25806452 28.41028455
+81.93548387 2.58064516 28.86927041
+81.93548387 2.90322581 29.65243953
+81.93548387 3.22580645 30.71781642
+81.93548387 3.54838710 32.01703240
+81.93548387 3.87096774 33.50465222
+81.93548387 4.19354839 35.14694643
+81.93548387 4.51612903 36.92935764
+81.93548387 4.83870968 38.86277312
+81.93548387 5.16129032 40.95922876
+81.93548387 5.48387097 43.01992647
+81.93548387 5.80645161 44.90101116
+81.93548387 6.12903226 46.53623555
+81.93548387 6.45161290 47.89911456
+81.93548387 6.77419355 48.98620009
+81.93548387 7.09677419 49.80503500
+81.93548387 7.41935484 50.36645607
+81.93548387 7.74193548 50.68011518
+81.93548387 8.06451613 50.75690105
+81.93548387 8.38709677 50.75690105
+81.93548387 8.70967742 50.75690105
+81.93548387 9.03225806 50.75690105
+81.93548387 9.35483871 50.75690105
+81.93548387 9.67741935 50.75690105
+81.93548387 10.00000000 50.75690105
+84.51612903 0.00000000 27.70400708
+84.51612903 0.32258065 27.70400708
+84.51612903 0.64516129 27.70400708
+84.51612903 0.96774194 27.70400708
+84.51612903 1.29032258 27.70400708
+84.51612903 1.61290323 27.70400708
+84.51612903 1.93548387 27.70400708
+84.51612903 2.25806452 27.82038678
+84.51612903 2.58064516 28.28524058
+84.51612903 2.90322581 29.07819814
+84.51612903 3.22580645 30.15647910
+84.51612903 3.54838710 31.47072925
+84.51612903 3.87096774 32.97457239
+84.51612903 4.19354839 34.63344012
+84.51612903 4.51612903 36.43203948
+84.51612903 4.83870968 38.38047572
+84.51612903 5.16129032 40.49087046
+84.51612903 5.48387097 42.56852096
+84.51612903 5.80645161 44.46563907
+84.51612903 6.12903226 46.11324911
+84.51612903 6.45161290 47.48419380
+84.51612903 6.77419355 48.57557521
+84.51612903 7.09677419 49.39604331
+84.51612903 7.41935484 49.95763951
+84.51612903 7.74193548 50.27102141
+84.51612903 8.06451613 50.34769576
+84.51612903 8.38709677 50.34769576
+84.51612903 8.70967742 50.34769576
+84.51612903 9.03225806 50.34769576
+84.51612903 9.35483871 50.34769576
+84.51612903 9.67741935 50.34769576
+84.51612903 10.00000000 50.34769576
+87.09677419 0.00000000 27.32753868
+87.09677419 0.32258065 27.32753868
+87.09677419 0.64516129 27.32753868
+87.09677419 0.96774194 27.32753868
+87.09677419 1.29032258 27.32753868
+87.09677419 1.61290323 27.32753868
+87.09677419 1.93548387 27.32753868
+87.09677419 2.25806452 27.44487552
+87.09677419 2.58064516 27.91351918
+87.09677419 2.90322581 28.71281814
+87.09677419 3.22580645 29.79945105
+87.09677419 3.54838710 31.12347805
+87.09677419 3.87096774 32.63794195
+87.09677419 4.19354839 34.30780680
+87.09677419 4.51612903 36.11738582
+87.09677419 4.83870968 38.07643021
+87.09677419 5.16129032 40.19718575
+87.09677419 5.48387097 42.28697861
+87.09677419 5.80645161 44.19535993
+87.09677419 6.12903226 45.85167215
+87.09677419 6.45161290 47.22840378
+87.09677419 6.77419355 48.32305272
+87.09677419 7.09677419 49.14498635
+87.09677419 7.41935484 49.70700518
+87.09677419 7.74193548 50.02039298
+87.09677419 8.06451613 50.09704202
+87.09677419 8.38709677 50.09704202
+87.09677419 8.70967742 50.09704202
+87.09677419 9.03225806 50.09704202
+87.09677419 9.35483871 50.09704202
+87.09677419 9.67741935 50.09704202
+87.09677419 10.00000000 50.09704202
+89.67741935 0.00000000 27.18053151
+89.67741935 0.32258065 27.18053151
+89.67741935 0.64516129 27.18053151
+89.67741935 0.96774194 27.18053151
+89.67741935 1.29032258 27.18053151
+89.67741935 1.61290323 27.18053151
+89.67741935 1.93548387 27.18053151
+89.67741935 2.25806452 27.29824496
+89.67741935 2.58064516 27.76837995
+89.67741935 2.90322581 28.57017467
+89.67741935 3.22580645 29.66010334
+89.67741935 3.54838710 30.98799391
+89.67741935 3.87096774 32.50667083
+89.67741935 4.19354839 34.18091007
+89.67741935 4.51612903 35.99491498
+89.67741935 4.83870968 37.95831767
+89.67741935 5.16129032 40.08342816
+89.67741935 5.48387097 42.17824316
+89.67741935 5.80645161 44.09124153
+89.67741935 6.12903226 45.75112057
+89.67741935 6.45161290 47.13024605
+89.67741935 6.77419355 48.22628008
+89.67741935 7.09677419 49.04887301
+89.67741935 7.41935484 49.61112035
+89.67741935 7.74193548 49.92454762
+89.67741935 8.06451613 50.00119608
+89.67741935 8.38709677 50.00119608
+89.67741935 8.70967742 50.00119608
+89.67741935 9.03225806 50.00119608
+89.67741935 9.35483871 50.00119608
+89.67741935 9.67741935 50.00119608
+89.67741935 10.00000000 50.00119608
+92.25806452 0.00000000 27.17868597
+92.25806452 0.32258065 27.17868597
+92.25806452 0.64516129 27.17868597
+92.25806452 0.96774194 27.17868597
+92.25806452 1.29032258 27.17868597
+92.25806452 1.61290323 27.17868597
+92.25806452 1.93548387 27.17868597
+92.25806452 2.25806452 27.29640417
+92.25806452 2.58064516 27.76655792
+92.25806452 2.90322581 28.56838404
+92.25806452 3.22580645 29.65835418
+92.25806452 3.54838710 30.98629338
+92.25806452 3.87096774 32.50502336
+92.25806452 4.19354839 34.17931792
+92.25806452 4.51612903 35.99337888
+92.25806452 4.83870968 37.95683706
+92.25806452 5.16129032 40.08200332
+92.25806452 5.48387097 42.17688236
+92.25806452 5.80645161 44.08993946
+92.25806452 6.12903226 45.74986387
+92.25806452 6.45161290 47.12901987
+92.25806452 6.77419355 48.22507168
+92.25806452 7.09677419 49.04767319
+92.25806452 7.41935484 49.60992362
+92.25806452 7.74193548 49.92335151
+92.25806452 8.06451613 50.00000000
+92.25806452 8.38709677 50.00000000
+92.25806452 8.70967742 50.00000000
+92.25806452 9.03225806 50.00000000
+92.25806452 9.35483871 50.00000000
+92.25806452 9.67741935 50.00000000
+92.25806452 10.00000000 50.00000000
+94.83870968 0.00000000 27.17868597
+94.83870968 0.32258065 27.17868597
+94.83870968 0.64516129 27.17868597
+94.83870968 0.96774194 27.17868597
+94.83870968 1.29032258 27.17868597
+94.83870968 1.61290323 27.17868597
+94.83870968 1.93548387 27.17868597
+94.83870968 2.25806452 27.29640417
+94.83870968 2.58064516 27.76655792
+94.83870968 2.90322581 28.56838404
+94.83870968 3.22580645 29.65835418
+94.83870968 3.54838710 30.98629338
+94.83870968 3.87096774 32.50502336
+94.83870968 4.19354839 34.17931792
+94.83870968 4.51612903 35.99337888
+94.83870968 4.83870968 37.95683706
+94.83870968 5.16129032 40.08200332
+94.83870968 5.48387097 42.17688236
+94.83870968 5.80645161 44.08993946
+94.83870968 6.12903226 45.74986387
+94.83870968 6.45161290 47.12901987
+94.83870968 6.77419355 48.22507168
+94.83870968 7.09677419 49.04767319
+94.83870968 7.41935484 49.60992362
+94.83870968 7.74193548 49.92335151
+94.83870968 8.06451613 50.00000000
+94.83870968 8.38709677 50.00000000
+94.83870968 8.70967742 50.00000000
+94.83870968 9.03225806 50.00000000
+94.83870968 9.35483871 50.00000000
+94.83870968 9.67741935 50.00000000
+94.83870968 10.00000000 50.00000000
+97.41935484 0.00000000 27.17868597
+97.41935484 0.32258065 27.17868597
+97.41935484 0.64516129 27.17868597
+97.41935484 0.96774194 27.17868597
+97.41935484 1.29032258 27.17868597
+97.41935484 1.61290323 27.17868597
+97.41935484 1.93548387 27.17868597
+97.41935484 2.25806452 27.29640417
+97.41935484 2.58064516 27.76655792
+97.41935484 2.90322581 28.56838404
+97.41935484 3.22580645 29.65835418
+97.41935484 3.54838710 30.98629338
+97.41935484 3.87096774 32.50502336
+97.41935484 4.19354839 34.17931792
+97.41935484 4.51612903 35.99337888
+97.41935484 4.83870968 37.95683706
+97.41935484 5.16129032 40.08200332
+97.41935484 5.48387097 42.17688236
+97.41935484 5.80645161 44.08993946
+97.41935484 6.12903226 45.74986387
+97.41935484 6.45161290 47.12901987
+97.41935484 6.77419355 48.22507168
+97.41935484 7.09677419 49.04767319
+97.41935484 7.41935484 49.60992362
+97.41935484 7.74193548 49.92335151
+97.41935484 8.06451613 50.00000000
+97.41935484 8.38709677 50.00000000
+97.41935484 8.70967742 50.00000000
+97.41935484 9.03225806 50.00000000
+97.41935484 9.35483871 50.00000000
+97.41935484 9.67741935 50.00000000
+97.41935484 10.00000000 50.00000000
+100.00000000 0.00000000 27.17868597
+100.00000000 0.32258065 27.17868597
+100.00000000 0.64516129 27.17868597
+100.00000000 0.96774194 27.17868597
+100.00000000 1.29032258 27.17868597
+100.00000000 1.61290323 27.17868597
+100.00000000 1.93548387 27.17868597
+100.00000000 2.25806452 27.29640417
+100.00000000 2.58064516 27.76655792
+100.00000000 2.90322581 28.56838404
+100.00000000 3.22580645 29.65835418
+100.00000000 3.54838710 30.98629338
+100.00000000 3.87096774 32.50502336
+100.00000000 4.19354839 34.17931792
+100.00000000 4.51612903 35.99337888
+100.00000000 4.83870968 37.95683706
+100.00000000 5.16129032 40.08200332
+100.00000000 5.48387097 42.17688236
+100.00000000 5.80645161 44.08993946
+100.00000000 6.12903226 45.74986387
+100.00000000 6.45161290 47.12901987
+100.00000000 6.77419355 48.22507168
+100.00000000 7.09677419 49.04767319
+100.00000000 7.41935484 49.60992362
+100.00000000 7.74193548 49.92335151
+100.00000000 8.06451613 50.00000000
+100.00000000 8.38709677 50.00000000
+100.00000000 8.70967742 50.00000000
+100.00000000 9.03225806 50.00000000
+100.00000000 9.35483871 50.00000000
+100.00000000 9.67741935 50.00000000
+100.00000000 10.00000000 50.00000000
diff --git a/examples/mamdani/octave/investment_portfolio.fll b/examples/mamdani/octave/investment_portfolio.fll
new file mode 100644
index 0000000..4bb14e1
--- /dev/null
+++ b/examples/mamdani/octave/investment_portfolio.fll
@@ -0,0 +1,31 @@
+Engine: Investment-Portfolio
+InputVariable: Age
+ enabled: true
+ range: 20.000 100.000
+ term: Young ZShape 30.000 90.000
+ term: Old SShape 30.000 90.000
+InputVariable: RiskTolerance
+ enabled: true
+ range: 0.000 10.000
+ term: Low ZShape 2.000 8.000
+ term: High SShape 2.000 8.000
+OutputVariable: PercentageInStocks
+ enabled: true
+ range: 0.000 100.000
+ accumulation: EinsteinSum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: AboutFifteen Gaussian 15.000 10.000
+ term: AboutFifty Gaussian 50.000 10.000
+ term: AboutEightyFive Gaussian 85.000 10.000
+RuleBlock:
+ enabled: true
+ conjunction: EinsteinProduct
+ disjunction: EinsteinSum
+ activation: EinsteinProduct
+ rule: if Age is Young or RiskTolerance is High then PercentageInStocks is AboutEightyFive
+ rule: if Age is Old or RiskTolerance is Low then PercentageInStocks is AboutFifteen
+ rule: if Age is not extremely Old and RiskTolerance is not extremely Low then PercentageInStocks is AboutFifty with 0.500
+ rule: if Age is not extremely Young and RiskTolerance is not extremely High then PercentageInStocks is AboutFifty with 0.500 \ No newline at end of file
diff --git a/examples/mamdani/octave/investment_portfolio.java b/examples/mamdani/octave/investment_portfolio.java
new file mode 100644
index 0000000..09084f1
--- /dev/null
+++ b/examples/mamdani/octave/investment_portfolio.java
@@ -0,0 +1,62 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class investment_portfolio{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("Investment-Portfolio");
+
+InputVariable inputVariable1 = new InputVariable();
+inputVariable1.setEnabled(true);
+inputVariable1.setName("Age");
+inputVariable1.setRange(20.000, 100.000);
+inputVariable1.addTerm(new ZShape("Young", 30.000, 90.000));
+inputVariable1.addTerm(new SShape("Old", 30.000, 90.000));
+engine.addInputVariable(inputVariable1);
+
+InputVariable inputVariable2 = new InputVariable();
+inputVariable2.setEnabled(true);
+inputVariable2.setName("RiskTolerance");
+inputVariable2.setRange(0.000, 10.000);
+inputVariable2.addTerm(new ZShape("Low", 2.000, 8.000));
+inputVariable2.addTerm(new SShape("High", 2.000, 8.000));
+engine.addInputVariable(inputVariable2);
+
+OutputVariable outputVariable = new OutputVariable();
+outputVariable.setEnabled(true);
+outputVariable.setName("PercentageInStocks");
+outputVariable.setRange(0.000, 100.000);
+outputVariable.fuzzyOutput().setAccumulation(new EinsteinSum());
+outputVariable.setDefuzzifier(new Centroid(200));
+outputVariable.setDefaultValue(Double.NaN);
+outputVariable.setLockPreviousOutputValue(false);
+outputVariable.setLockOutputValueInRange(false);
+outputVariable.addTerm(new Gaussian("AboutFifteen", 15.000, 10.000));
+outputVariable.addTerm(new Gaussian("AboutFifty", 50.000, 10.000));
+outputVariable.addTerm(new Gaussian("AboutEightyFive", 85.000, 10.000));
+engine.addOutputVariable(outputVariable);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(new EinsteinProduct());
+ruleBlock.setDisjunction(new EinsteinSum());
+ruleBlock.setActivation(new EinsteinProduct());
+ruleBlock.addRule(Rule.parse("if Age is Young or RiskTolerance is High then PercentageInStocks is AboutEightyFive", engine));
+ruleBlock.addRule(Rule.parse("if Age is Old or RiskTolerance is Low then PercentageInStocks is AboutFifteen", engine));
+ruleBlock.addRule(Rule.parse("if Age is not extremely Old and RiskTolerance is not extremely Low then PercentageInStocks is AboutFifty with 0.500", engine));
+ruleBlock.addRule(Rule.parse("if Age is not extremely Young and RiskTolerance is not extremely High then PercentageInStocks is AboutFifty with 0.500", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/mamdani/octave/mamdani_tip_calculator.cpp b/examples/mamdani/octave/mamdani_tip_calculator.cpp
new file mode 100644
index 0000000..cd57bf7
--- /dev/null
+++ b/examples/mamdani/octave/mamdani_tip_calculator.cpp
@@ -0,0 +1,66 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("Mamdani-Tip-Calculator");
+
+InputVariable* inputVariable1 = new InputVariable;
+inputVariable1->setEnabled(true);
+inputVariable1->setName("FoodQuality");
+inputVariable1->setRange(1.000, 10.000);
+inputVariable1->addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable1->addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine->addInputVariable(inputVariable1);
+
+InputVariable* inputVariable2 = new InputVariable;
+inputVariable2->setEnabled(true);
+inputVariable2->setName("Service");
+inputVariable2->setRange(1.000, 10.000);
+inputVariable2->addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable2->addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine->addInputVariable(inputVariable2);
+
+OutputVariable* outputVariable1 = new OutputVariable;
+outputVariable1->setEnabled(true);
+outputVariable1->setName("Tip");
+outputVariable1->setRange(0.000, 30.000);
+outputVariable1->fuzzyOutput()->setAccumulation(new AlgebraicSum);
+outputVariable1->setDefuzzifier(new Centroid(200));
+outputVariable1->setDefaultValue(fl::nan);
+outputVariable1->setLockPreviousOutputValue(false);
+outputVariable1->setLockOutputValueInRange(false);
+outputVariable1->addTerm(new Gaussian("AboutTenPercent", 10.000, 2.000));
+outputVariable1->addTerm(new Gaussian("AboutFifteenPercent", 15.000, 2.000));
+outputVariable1->addTerm(new Gaussian("AboutTwentyPercent", 20.000, 2.000));
+engine->addOutputVariable(outputVariable1);
+
+OutputVariable* outputVariable2 = new OutputVariable;
+outputVariable2->setEnabled(true);
+outputVariable2->setName("CheckPlusTip");
+outputVariable2->setRange(1.000, 1.300);
+outputVariable2->fuzzyOutput()->setAccumulation(new AlgebraicSum);
+outputVariable2->setDefuzzifier(new Centroid(200));
+outputVariable2->setDefaultValue(fl::nan);
+outputVariable2->setLockPreviousOutputValue(false);
+outputVariable2->setLockOutputValueInRange(false);
+outputVariable2->addTerm(new Gaussian("PlusAboutTenPercent", 1.100, 0.020));
+outputVariable2->addTerm(new Gaussian("PlusAboutFifteenPercent", 1.150, 0.020));
+outputVariable2->addTerm(new Gaussian("PlusAboutTwentyPercent", 1.200, 0.020));
+engine->addOutputVariable(outputVariable2);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(new AlgebraicProduct);
+ruleBlock->setDisjunction(new Maximum);
+ruleBlock->setActivation(new Minimum);
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Bad and Service is Bad then Tip is AboutTenPercent and CheckPlusTip is PlusAboutTenPercent", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Bad and Service is Good then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Good and Service is Bad then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Good and Service is Good then Tip is AboutTwentyPercent and CheckPlusTip is PlusAboutTwentyPercent", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/mamdani/octave/mamdani_tip_calculator.fcl b/examples/mamdani/octave/mamdani_tip_calculator.fcl
new file mode 100644
index 0000000..3ea903a
--- /dev/null
+++ b/examples/mamdani/octave/mamdani_tip_calculator.fcl
@@ -0,0 +1,55 @@
+FUNCTION_BLOCK Mamdani-Tip-Calculator
+
+VAR_INPUT
+ FoodQuality: REAL;
+ Service: REAL;
+END_VAR
+
+VAR_OUTPUT
+ Tip: REAL;
+ CheckPlusTip: REAL;
+END_VAR
+
+FUZZIFY FoodQuality
+ RANGE := (1.000 .. 10.000);
+ TERM Bad := Trapezoid 0.000 1.000 3.000 7.000;
+ TERM Good := Trapezoid 3.000 7.000 10.000 11.000;
+END_FUZZIFY
+
+FUZZIFY Service
+ RANGE := (1.000 .. 10.000);
+ TERM Bad := Trapezoid 0.000 1.000 3.000 7.000;
+ TERM Good := Trapezoid 3.000 7.000 10.000 11.000;
+END_FUZZIFY
+
+DEFUZZIFY Tip
+ RANGE := (0.000 .. 30.000);
+ TERM AboutTenPercent := Gaussian 10.000 2.000;
+ TERM AboutFifteenPercent := Gaussian 15.000 2.000;
+ TERM AboutTwentyPercent := Gaussian 20.000 2.000;
+ METHOD : COG;
+ ACCU : ASUM;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY CheckPlusTip
+ RANGE := (1.000 .. 1.300);
+ TERM PlusAboutTenPercent := Gaussian 1.100 0.020;
+ TERM PlusAboutFifteenPercent := Gaussian 1.150 0.020;
+ TERM PlusAboutTwentyPercent := Gaussian 1.200 0.020;
+ METHOD : COG;
+ ACCU : ASUM;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ AND : PROD;
+ OR : MAX;
+ ACT : MIN;
+ RULE 1 : if FoodQuality is Bad and Service is Bad then Tip is AboutTenPercent and CheckPlusTip is PlusAboutTenPercent
+ RULE 2 : if FoodQuality is Bad and Service is Good then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent
+ RULE 3 : if FoodQuality is Good and Service is Bad then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent
+ RULE 4 : if FoodQuality is Good and Service is Good then Tip is AboutTwentyPercent and CheckPlusTip is PlusAboutTwentyPercent
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/mamdani/octave/mamdani_tip_calculator.fis b/examples/mamdani/octave/mamdani_tip_calculator.fis
new file mode 100644
index 0000000..42cf1df
--- /dev/null
+++ b/examples/mamdani/octave/mamdani_tip_calculator.fis
@@ -0,0 +1,47 @@
+[System]
+Name='Mamdani-Tip-Calculator'
+Type='mamdani'
+NumInputs=2
+NumOutputs=2
+NumRules=4
+AndMethod='prod'
+OrMethod='max'
+ImpMethod='min'
+AggMethod='sum'
+DefuzzMethod='centroid'
+
+[Input1]
+Name='FoodQuality'
+Range=[1.000 10.000]
+NumMFs=2
+MF1='Bad':'trapmf',[0.000 1.000 3.000 7.000]
+MF2='Good':'trapmf',[3.000 7.000 10.000 11.000]
+
+[Input2]
+Name='Service'
+Range=[1.000 10.000]
+NumMFs=2
+MF1='Bad':'trapmf',[0.000 1.000 3.000 7.000]
+MF2='Good':'trapmf',[3.000 7.000 10.000 11.000]
+
+[Output1]
+Name='Tip'
+Range=[0.000 30.000]
+NumMFs=3
+MF1='AboutTenPercent':'gaussmf',[2.000 10.000]
+MF2='AboutFifteenPercent':'gaussmf',[2.000 15.000]
+MF3='AboutTwentyPercent':'gaussmf',[2.000 20.000]
+
+[Output2]
+Name='CheckPlusTip'
+Range=[1.000 1.300]
+NumMFs=3
+MF1='PlusAboutTenPercent':'gaussmf',[0.020 1.100]
+MF2='PlusAboutFifteenPercent':'gaussmf',[0.020 1.150]
+MF3='PlusAboutTwentyPercent':'gaussmf',[0.020 1.200]
+
+[Rules]
+1.000 1.000 , 1.000 1.000 (1.000) : 1
+1.000 2.000 , 2.000 2.000 (1.000) : 1
+2.000 1.000 , 2.000 2.000 (1.000) : 1
+2.000 2.000 , 3.000 3.000 (1.000) : 1
diff --git a/examples/mamdani/octave/mamdani_tip_calculator.fld b/examples/mamdani/octave/mamdani_tip_calculator.fld
new file mode 100644
index 0000000..9d54109
--- /dev/null
+++ b/examples/mamdani/octave/mamdani_tip_calculator.fld
@@ -0,0 +1,1026 @@
+#@Engine: Mamdani-Tip-Calculator;
+#@InputVariable: FoodQuality; @InputVariable: Service; @OutputVariable: Tip; @OutputVariable: CheckPlusTip;
+1.00000000 1.00000000 10.00000296 1.10000003
+1.00000000 1.29032258 10.00000296 1.10000003
+1.00000000 1.58064516 10.00000296 1.10000003
+1.00000000 1.87096774 10.00000296 1.10000003
+1.00000000 2.16129032 10.00000296 1.10000003
+1.00000000 2.45161290 10.00000296 1.10000003
+1.00000000 2.74193548 10.00000296 1.10000003
+1.00000000 3.03225806 10.10361204 1.10103612
+1.00000000 3.32258065 10.70846739 1.10708467
+1.00000000 3.61290323 11.13394556 1.11133946
+1.00000000 3.90322581 11.47924881 1.11479249
+1.00000000 4.19354839 11.77837052 1.11778371
+1.00000000 4.48387097 12.05010492 1.12050105
+1.00000000 4.77419355 12.30576276 1.12305763
+1.00000000 5.06451613 12.55517544 1.12555175
+1.00000000 5.35483871 12.80665986 1.12806660
+1.00000000 5.64516129 13.06809323 1.13068093
+1.00000000 5.93548387 13.35056196 1.13350562
+1.00000000 6.22580645 13.66657067 1.13666571
+1.00000000 6.51612903 14.04212491 1.14042125
+1.00000000 6.80645161 14.52492871 1.14524929
+1.00000000 7.09677419 15.00000000 1.15000000
+1.00000000 7.38709677 15.00000000 1.15000000
+1.00000000 7.67741935 15.00000000 1.15000000
+1.00000000 7.96774194 15.00000000 1.15000000
+1.00000000 8.25806452 15.00000000 1.15000000
+1.00000000 8.54838710 15.00000000 1.15000000
+1.00000000 8.83870968 15.00000000 1.15000000
+1.00000000 9.12903226 15.00000000 1.15000000
+1.00000000 9.41935484 15.00000000 1.15000000
+1.00000000 9.70967742 15.00000000 1.15000000
+1.00000000 10.00000000 15.00000000 1.15000000
+1.29032258 1.00000000 10.00000296 1.10000003
+1.29032258 1.29032258 10.00000296 1.10000003
+1.29032258 1.58064516 10.00000296 1.10000003
+1.29032258 1.87096774 10.00000296 1.10000003
+1.29032258 2.16129032 10.00000296 1.10000003
+1.29032258 2.45161290 10.00000296 1.10000003
+1.29032258 2.74193548 10.00000296 1.10000003
+1.29032258 3.03225806 10.10361204 1.10103612
+1.29032258 3.32258065 10.70846739 1.10708467
+1.29032258 3.61290323 11.13394556 1.11133946
+1.29032258 3.90322581 11.47924881 1.11479249
+1.29032258 4.19354839 11.77837052 1.11778371
+1.29032258 4.48387097 12.05010492 1.12050105
+1.29032258 4.77419355 12.30576276 1.12305763
+1.29032258 5.06451613 12.55517544 1.12555175
+1.29032258 5.35483871 12.80665986 1.12806660
+1.29032258 5.64516129 13.06809323 1.13068093
+1.29032258 5.93548387 13.35056196 1.13350562
+1.29032258 6.22580645 13.66657067 1.13666571
+1.29032258 6.51612903 14.04212491 1.14042125
+1.29032258 6.80645161 14.52492871 1.14524929
+1.29032258 7.09677419 15.00000000 1.15000000
+1.29032258 7.38709677 15.00000000 1.15000000
+1.29032258 7.67741935 15.00000000 1.15000000
+1.29032258 7.96774194 15.00000000 1.15000000
+1.29032258 8.25806452 15.00000000 1.15000000
+1.29032258 8.54838710 15.00000000 1.15000000
+1.29032258 8.83870968 15.00000000 1.15000000
+1.29032258 9.12903226 15.00000000 1.15000000
+1.29032258 9.41935484 15.00000000 1.15000000
+1.29032258 9.70967742 15.00000000 1.15000000
+1.29032258 10.00000000 15.00000000 1.15000000
+1.58064516 1.00000000 10.00000296 1.10000003
+1.58064516 1.29032258 10.00000296 1.10000003
+1.58064516 1.58064516 10.00000296 1.10000003
+1.58064516 1.87096774 10.00000296 1.10000003
+1.58064516 2.16129032 10.00000296 1.10000003
+1.58064516 2.45161290 10.00000296 1.10000003
+1.58064516 2.74193548 10.00000296 1.10000003
+1.58064516 3.03225806 10.10361204 1.10103612
+1.58064516 3.32258065 10.70846739 1.10708467
+1.58064516 3.61290323 11.13394556 1.11133946
+1.58064516 3.90322581 11.47924881 1.11479249
+1.58064516 4.19354839 11.77837052 1.11778371
+1.58064516 4.48387097 12.05010492 1.12050105
+1.58064516 4.77419355 12.30576276 1.12305763
+1.58064516 5.06451613 12.55517544 1.12555175
+1.58064516 5.35483871 12.80665986 1.12806660
+1.58064516 5.64516129 13.06809323 1.13068093
+1.58064516 5.93548387 13.35056196 1.13350562
+1.58064516 6.22580645 13.66657067 1.13666571
+1.58064516 6.51612903 14.04212491 1.14042125
+1.58064516 6.80645161 14.52492871 1.14524929
+1.58064516 7.09677419 15.00000000 1.15000000
+1.58064516 7.38709677 15.00000000 1.15000000
+1.58064516 7.67741935 15.00000000 1.15000000
+1.58064516 7.96774194 15.00000000 1.15000000
+1.58064516 8.25806452 15.00000000 1.15000000
+1.58064516 8.54838710 15.00000000 1.15000000
+1.58064516 8.83870968 15.00000000 1.15000000
+1.58064516 9.12903226 15.00000000 1.15000000
+1.58064516 9.41935484 15.00000000 1.15000000
+1.58064516 9.70967742 15.00000000 1.15000000
+1.58064516 10.00000000 15.00000000 1.15000000
+1.87096774 1.00000000 10.00000296 1.10000003
+1.87096774 1.29032258 10.00000296 1.10000003
+1.87096774 1.58064516 10.00000296 1.10000003
+1.87096774 1.87096774 10.00000296 1.10000003
+1.87096774 2.16129032 10.00000296 1.10000003
+1.87096774 2.45161290 10.00000296 1.10000003
+1.87096774 2.74193548 10.00000296 1.10000003
+1.87096774 3.03225806 10.10361204 1.10103612
+1.87096774 3.32258065 10.70846739 1.10708467
+1.87096774 3.61290323 11.13394556 1.11133946
+1.87096774 3.90322581 11.47924881 1.11479249
+1.87096774 4.19354839 11.77837052 1.11778371
+1.87096774 4.48387097 12.05010492 1.12050105
+1.87096774 4.77419355 12.30576276 1.12305763
+1.87096774 5.06451613 12.55517544 1.12555175
+1.87096774 5.35483871 12.80665986 1.12806660
+1.87096774 5.64516129 13.06809323 1.13068093
+1.87096774 5.93548387 13.35056196 1.13350562
+1.87096774 6.22580645 13.66657067 1.13666571
+1.87096774 6.51612903 14.04212491 1.14042125
+1.87096774 6.80645161 14.52492871 1.14524929
+1.87096774 7.09677419 15.00000000 1.15000000
+1.87096774 7.38709677 15.00000000 1.15000000
+1.87096774 7.67741935 15.00000000 1.15000000
+1.87096774 7.96774194 15.00000000 1.15000000
+1.87096774 8.25806452 15.00000000 1.15000000
+1.87096774 8.54838710 15.00000000 1.15000000
+1.87096774 8.83870968 15.00000000 1.15000000
+1.87096774 9.12903226 15.00000000 1.15000000
+1.87096774 9.41935484 15.00000000 1.15000000
+1.87096774 9.70967742 15.00000000 1.15000000
+1.87096774 10.00000000 15.00000000 1.15000000
+2.16129032 1.00000000 10.00000296 1.10000003
+2.16129032 1.29032258 10.00000296 1.10000003
+2.16129032 1.58064516 10.00000296 1.10000003
+2.16129032 1.87096774 10.00000296 1.10000003
+2.16129032 2.16129032 10.00000296 1.10000003
+2.16129032 2.45161290 10.00000296 1.10000003
+2.16129032 2.74193548 10.00000296 1.10000003
+2.16129032 3.03225806 10.10361204 1.10103612
+2.16129032 3.32258065 10.70846739 1.10708467
+2.16129032 3.61290323 11.13394556 1.11133946
+2.16129032 3.90322581 11.47924881 1.11479249
+2.16129032 4.19354839 11.77837052 1.11778371
+2.16129032 4.48387097 12.05010492 1.12050105
+2.16129032 4.77419355 12.30576276 1.12305763
+2.16129032 5.06451613 12.55517544 1.12555175
+2.16129032 5.35483871 12.80665986 1.12806660
+2.16129032 5.64516129 13.06809323 1.13068093
+2.16129032 5.93548387 13.35056196 1.13350562
+2.16129032 6.22580645 13.66657067 1.13666571
+2.16129032 6.51612903 14.04212491 1.14042125
+2.16129032 6.80645161 14.52492871 1.14524929
+2.16129032 7.09677419 15.00000000 1.15000000
+2.16129032 7.38709677 15.00000000 1.15000000
+2.16129032 7.67741935 15.00000000 1.15000000
+2.16129032 7.96774194 15.00000000 1.15000000
+2.16129032 8.25806452 15.00000000 1.15000000
+2.16129032 8.54838710 15.00000000 1.15000000
+2.16129032 8.83870968 15.00000000 1.15000000
+2.16129032 9.12903226 15.00000000 1.15000000
+2.16129032 9.41935484 15.00000000 1.15000000
+2.16129032 9.70967742 15.00000000 1.15000000
+2.16129032 10.00000000 15.00000000 1.15000000
+2.45161290 1.00000000 10.00000296 1.10000003
+2.45161290 1.29032258 10.00000296 1.10000003
+2.45161290 1.58064516 10.00000296 1.10000003
+2.45161290 1.87096774 10.00000296 1.10000003
+2.45161290 2.16129032 10.00000296 1.10000003
+2.45161290 2.45161290 10.00000296 1.10000003
+2.45161290 2.74193548 10.00000296 1.10000003
+2.45161290 3.03225806 10.10361204 1.10103612
+2.45161290 3.32258065 10.70846739 1.10708467
+2.45161290 3.61290323 11.13394556 1.11133946
+2.45161290 3.90322581 11.47924881 1.11479249
+2.45161290 4.19354839 11.77837052 1.11778371
+2.45161290 4.48387097 12.05010492 1.12050105
+2.45161290 4.77419355 12.30576276 1.12305763
+2.45161290 5.06451613 12.55517544 1.12555175
+2.45161290 5.35483871 12.80665986 1.12806660
+2.45161290 5.64516129 13.06809323 1.13068093
+2.45161290 5.93548387 13.35056196 1.13350562
+2.45161290 6.22580645 13.66657067 1.13666571
+2.45161290 6.51612903 14.04212491 1.14042125
+2.45161290 6.80645161 14.52492871 1.14524929
+2.45161290 7.09677419 15.00000000 1.15000000
+2.45161290 7.38709677 15.00000000 1.15000000
+2.45161290 7.67741935 15.00000000 1.15000000
+2.45161290 7.96774194 15.00000000 1.15000000
+2.45161290 8.25806452 15.00000000 1.15000000
+2.45161290 8.54838710 15.00000000 1.15000000
+2.45161290 8.83870968 15.00000000 1.15000000
+2.45161290 9.12903226 15.00000000 1.15000000
+2.45161290 9.41935484 15.00000000 1.15000000
+2.45161290 9.70967742 15.00000000 1.15000000
+2.45161290 10.00000000 15.00000000 1.15000000
+2.74193548 1.00000000 10.00000296 1.10000003
+2.74193548 1.29032258 10.00000296 1.10000003
+2.74193548 1.58064516 10.00000296 1.10000003
+2.74193548 1.87096774 10.00000296 1.10000003
+2.74193548 2.16129032 10.00000296 1.10000003
+2.74193548 2.45161290 10.00000296 1.10000003
+2.74193548 2.74193548 10.00000296 1.10000003
+2.74193548 3.03225806 10.10361204 1.10103612
+2.74193548 3.32258065 10.70846739 1.10708467
+2.74193548 3.61290323 11.13394556 1.11133946
+2.74193548 3.90322581 11.47924881 1.11479249
+2.74193548 4.19354839 11.77837052 1.11778371
+2.74193548 4.48387097 12.05010492 1.12050105
+2.74193548 4.77419355 12.30576276 1.12305763
+2.74193548 5.06451613 12.55517544 1.12555175
+2.74193548 5.35483871 12.80665986 1.12806660
+2.74193548 5.64516129 13.06809323 1.13068093
+2.74193548 5.93548387 13.35056196 1.13350562
+2.74193548 6.22580645 13.66657067 1.13666571
+2.74193548 6.51612903 14.04212491 1.14042125
+2.74193548 6.80645161 14.52492871 1.14524929
+2.74193548 7.09677419 15.00000000 1.15000000
+2.74193548 7.38709677 15.00000000 1.15000000
+2.74193548 7.67741935 15.00000000 1.15000000
+2.74193548 7.96774194 15.00000000 1.15000000
+2.74193548 8.25806452 15.00000000 1.15000000
+2.74193548 8.54838710 15.00000000 1.15000000
+2.74193548 8.83870968 15.00000000 1.15000000
+2.74193548 9.12903226 15.00000000 1.15000000
+2.74193548 9.41935484 15.00000000 1.15000000
+2.74193548 9.70967742 15.00000000 1.15000000
+2.74193548 10.00000000 15.00000000 1.15000000
+3.03225806 1.00000000 10.10361204 1.10103612
+3.03225806 1.29032258 10.10361204 1.10103612
+3.03225806 1.58064516 10.10361204 1.10103612
+3.03225806 1.87096774 10.10361204 1.10103612
+3.03225806 2.16129032 10.10361204 1.10103612
+3.03225806 2.45161290 10.10361204 1.10103612
+3.03225806 2.74193548 10.10361204 1.10103612
+3.03225806 3.03225806 10.20435811 1.10204358
+3.03225806 3.32258065 10.79601822 1.10796018
+3.03225806 3.61290323 11.21535874 1.11215359
+3.03225806 3.90322581 11.55784646 1.11557846
+3.03225806 4.19354839 11.85579036 1.11855790
+3.03225806 4.48387097 12.12724043 1.12127240
+3.03225806 4.77419355 12.38405258 1.12384053
+3.03225806 5.06451613 12.63499742 1.12634997
+3.03225806 5.35483871 12.88858563 1.12888586
+3.03225806 5.64516129 13.15323067 1.13153231
+3.03225806 5.93548387 13.43888099 1.13438881
+3.03225806 6.22580645 13.75926546 1.13759265
+3.03225806 6.51612903 14.13934485 1.14139345
+3.03225806 6.80645161 14.62674650 1.14626746
+3.03225806 7.09677419 15.10357489 1.15103575
+3.03225806 7.38709677 15.10357489 1.15103575
+3.03225806 7.67741935 15.10357489 1.15103575
+3.03225806 7.96774194 15.10357489 1.15103575
+3.03225806 8.25806452 15.10357489 1.15103575
+3.03225806 8.54838710 15.10357489 1.15103575
+3.03225806 8.83870968 15.10357489 1.15103575
+3.03225806 9.12903226 15.10357489 1.15103575
+3.03225806 9.41935484 15.10357489 1.15103575
+3.03225806 9.70967742 15.10357489 1.15103575
+3.03225806 10.00000000 15.10357489 1.15103575
+3.32258065 1.00000000 10.70846739 1.10708467
+3.32258065 1.29032258 10.70846739 1.10708467
+3.32258065 1.58064516 10.70846739 1.10708467
+3.32258065 1.87096774 10.70846739 1.10708467
+3.32258065 2.16129032 10.70846739 1.10708467
+3.32258065 2.45161290 10.70846739 1.10708467
+3.32258065 2.74193548 10.70846739 1.10708467
+3.32258065 3.03225806 10.79601822 1.10796018
+3.32258065 3.32258065 11.32266175 1.11322662
+3.32258065 3.61290323 11.71291316 1.11712913
+3.32258065 3.90322581 12.04341522 1.12043415
+3.32258065 4.19354839 12.33970940 1.12339709
+3.32258065 4.48387097 12.61573315 1.12615733
+3.32258065 4.77419355 12.88122387 1.12881224
+3.32258065 5.06451613 13.14483502 1.13144835
+3.32258065 5.35483871 13.41408247 1.13414082
+3.32258065 5.64516129 13.69613892 1.13696139
+3.32258065 5.93548387 14.00077769 1.14000778
+3.32258065 6.22580645 14.34225854 1.14342259
+3.32258065 6.51612903 14.73996425 1.14739964
+3.32258065 6.80645161 15.23916402 1.15239164
+3.32258065 7.09677419 15.70844950 1.15708449
+3.32258065 7.38709677 15.70844950 1.15708449
+3.32258065 7.67741935 15.70844950 1.15708449
+3.32258065 7.96774194 15.70844950 1.15708449
+3.32258065 8.25806452 15.70844950 1.15708449
+3.32258065 8.54838710 15.70844950 1.15708449
+3.32258065 8.83870968 15.70844950 1.15708449
+3.32258065 9.12903226 15.70844950 1.15708449
+3.32258065 9.41935484 15.70844950 1.15708449
+3.32258065 9.70967742 15.70844950 1.15708449
+3.32258065 10.00000000 15.70844950 1.15708449
+3.61290323 1.00000000 11.13394556 1.11133946
+3.61290323 1.29032258 11.13394556 1.11133946
+3.61290323 1.58064516 11.13394556 1.11133946
+3.61290323 1.87096774 11.13394556 1.11133946
+3.61290323 2.16129032 11.13394556 1.11133946
+3.61290323 2.45161290 11.13394556 1.11133946
+3.61290323 2.74193548 11.13394556 1.11133946
+3.61290323 3.03225806 11.21535874 1.11215359
+3.61290323 3.32258065 11.71291316 1.11712913
+3.61290323 3.61290323 12.09048689 1.12090487
+3.61290323 3.90322581 12.41795109 1.12417951
+3.61290323 4.19354839 12.71702039 1.12717020
+3.61290323 4.48387097 12.99911163 1.12999112
+3.61290323 4.77419355 13.27378061 1.13273781
+3.61290323 5.06451613 13.54771797 1.13547718
+3.61290323 5.35483871 13.82751223 1.13827512
+3.61290323 5.64516129 14.12018766 1.14120188
+3.61290323 5.93548387 14.43537168 1.14435372
+3.61290323 6.22580645 14.78491413 1.14784914
+3.61290323 6.51612903 15.18700487 1.15187005
+3.61290323 6.80645161 15.68154801 1.15681548
+3.61290323 7.09677419 16.13382374 1.16133824
+3.61290323 7.38709677 16.13382374 1.16133824
+3.61290323 7.67741935 16.13382374 1.16133824
+3.61290323 7.96774194 16.13382374 1.16133824
+3.61290323 8.25806452 16.13382374 1.16133824
+3.61290323 8.54838710 16.13382374 1.16133824
+3.61290323 8.83870968 16.13382374 1.16133824
+3.61290323 9.12903226 16.13382374 1.16133824
+3.61290323 9.41935484 16.13382374 1.16133824
+3.61290323 9.70967742 16.13382374 1.16133824
+3.61290323 10.00000000 16.13382374 1.16133824
+3.90322581 1.00000000 11.47924881 1.11479249
+3.90322581 1.29032258 11.47924881 1.11479249
+3.90322581 1.58064516 11.47924881 1.11479249
+3.90322581 1.87096774 11.47924881 1.11479249
+3.90322581 2.16129032 11.47924881 1.11479249
+3.90322581 2.45161290 11.47924881 1.11479249
+3.90322581 2.74193548 11.47924881 1.11479249
+3.90322581 3.03225806 11.55784646 1.11557846
+3.90322581 3.32258065 12.04341522 1.12043415
+3.90322581 3.61290323 12.41795109 1.12417951
+3.90322581 3.90322581 12.74629906 1.12746299
+3.90322581 4.19354839 13.04969635 1.13049696
+3.90322581 4.48387097 13.33797049 1.13337970
+3.90322581 4.77419355 13.62015959 1.13620160
+3.90322581 5.06451613 13.90194660 1.13901947
+3.90322581 5.35483871 14.18888316 1.14188883
+3.90322581 5.64516129 14.48954068 1.14489541
+3.90322581 5.93548387 14.80982202 1.14809822
+3.90322581 6.22580645 15.16074884 1.15160749
+3.90322581 6.51612903 15.56087142 1.15560871
+3.90322581 6.80645161 16.04390018 1.16043900
+3.90322581 7.09677419 16.47922769 1.16479228
+3.90322581 7.38709677 16.47922769 1.16479228
+3.90322581 7.67741935 16.47922769 1.16479228
+3.90322581 7.96774194 16.47922769 1.16479228
+3.90322581 8.25806452 16.47922769 1.16479228
+3.90322581 8.54838710 16.47922769 1.16479228
+3.90322581 8.83870968 16.47922769 1.16479228
+3.90322581 9.12903226 16.47922769 1.16479228
+3.90322581 9.41935484 16.47922769 1.16479228
+3.90322581 9.70967742 16.47922769 1.16479228
+3.90322581 10.00000000 16.47922769 1.16479228
+4.19354839 1.00000000 11.77837052 1.11778371
+4.19354839 1.29032258 11.77837052 1.11778371
+4.19354839 1.58064516 11.77837052 1.11778371
+4.19354839 1.87096774 11.77837052 1.11778371
+4.19354839 2.16129032 11.77837052 1.11778371
+4.19354839 2.45161290 11.77837052 1.11778371
+4.19354839 2.74193548 11.77837052 1.11778371
+4.19354839 3.03225806 11.85579036 1.11855790
+4.19354839 3.32258065 12.33970940 1.12339709
+4.19354839 3.61290323 12.71702039 1.12717020
+4.19354839 3.90322581 13.04969635 1.13049696
+4.19354839 4.19354839 13.35789542 1.13357895
+4.19354839 4.48387097 13.65214664 1.13652147
+4.19354839 4.77419355 13.94035790 1.13940358
+4.19354839 5.06451613 14.22819712 1.14228197
+4.19354839 5.35483871 14.52045260 1.14520453
+4.19354839 5.64516129 14.82442596 1.14824426
+4.19354839 5.93548387 15.14611095 1.15146111
+4.19354839 6.22580645 15.49584016 1.15495840
+4.19354839 6.51612903 15.88989883 1.15889899
+4.19354839 6.80645161 16.36071096 1.16360711
+4.19354839 7.09677419 16.77845274 1.16778453
+4.19354839 7.38709677 16.77845274 1.16778453
+4.19354839 7.67741935 16.77845274 1.16778453
+4.19354839 7.96774194 16.77845274 1.16778453
+4.19354839 8.25806452 16.77845274 1.16778453
+4.19354839 8.54838710 16.77845274 1.16778453
+4.19354839 8.83870968 16.77845274 1.16778453
+4.19354839 9.12903226 16.77845274 1.16778453
+4.19354839 9.41935484 16.77845274 1.16778453
+4.19354839 9.70967742 16.77845274 1.16778453
+4.19354839 10.00000000 16.77845274 1.16778453
+4.48387097 1.00000000 12.05010492 1.12050105
+4.48387097 1.29032258 12.05010492 1.12050105
+4.48387097 1.58064516 12.05010492 1.12050105
+4.48387097 1.87096774 12.05010492 1.12050105
+4.48387097 2.16129032 12.05010492 1.12050105
+4.48387097 2.45161290 12.05010492 1.12050105
+4.48387097 2.74193548 12.05010492 1.12050105
+4.48387097 3.03225806 12.12724043 1.12127240
+4.48387097 3.32258065 12.61573315 1.12615733
+4.48387097 3.61290323 12.99911163 1.12999112
+4.48387097 3.90322581 13.33797049 1.13337970
+4.48387097 4.19354839 13.65214664 1.13652147
+4.48387097 4.48387097 13.95167976 1.13951680
+4.48387097 4.77419355 14.24536545 1.14245365
+4.48387097 5.06451613 14.53742599 1.14537426
+4.48387097 5.35483871 14.83253803 1.14832538
+4.48387097 5.64516129 15.13703643 1.15137036
+4.48387097 5.93548387 15.45709896 1.15457099
+4.48387097 6.22580645 15.80333467 1.15803335
+4.48387097 6.51612903 16.18964589 1.16189646
+4.48387097 6.80645161 16.64650295 1.16646503
+4.48387097 7.09677419 17.05002382 1.17050024
+4.48387097 7.38709677 17.05002382 1.17050024
+4.48387097 7.67741935 17.05002382 1.17050024
+4.48387097 7.96774194 17.05002382 1.17050024
+4.48387097 8.25806452 17.05002382 1.17050024
+4.48387097 8.54838710 17.05002382 1.17050024
+4.48387097 8.83870968 17.05002382 1.17050024
+4.48387097 9.12903226 17.05002382 1.17050024
+4.48387097 9.41935484 17.05002382 1.17050024
+4.48387097 9.70967742 17.05002382 1.17050024
+4.48387097 10.00000000 17.05002382 1.17050024
+4.77419355 1.00000000 12.30576276 1.12305763
+4.77419355 1.29032258 12.30576276 1.12305763
+4.77419355 1.58064516 12.30576276 1.12305763
+4.77419355 1.87096774 12.30576276 1.12305763
+4.77419355 2.16129032 12.30576276 1.12305763
+4.77419355 2.45161290 12.30576276 1.12305763
+4.77419355 2.74193548 12.30576276 1.12305763
+4.77419355 3.03225806 12.38405258 1.12384053
+4.77419355 3.32258065 12.88122387 1.12881224
+4.77419355 3.61290323 13.27378061 1.13273781
+4.77419355 3.90322581 13.62015959 1.13620160
+4.77419355 4.19354839 13.94035790 1.13940358
+4.77419355 4.48387097 14.24536545 1.14245365
+4.77419355 4.77419355 14.54225355 1.14542254
+4.77419355 5.06451613 14.83618630 1.14836186
+4.77419355 5.35483871 15.13221695 1.15132217
+4.77419355 5.64516129 15.43597664 1.15435977
+4.77419355 5.93548387 15.75365034 1.15753650
+4.77419355 6.22580645 16.09439857 1.16094399
+4.77419355 6.51612903 16.47201646 1.16472016
+4.77419355 6.80645161 16.91532876 1.16915329
+4.77419355 7.09677419 17.30571907 1.17305719
+4.77419355 7.38709677 17.30571907 1.17305719
+4.77419355 7.67741935 17.30571907 1.17305719
+4.77419355 7.96774194 17.30571907 1.17305719
+4.77419355 8.25806452 17.30571907 1.17305719
+4.77419355 8.54838710 17.30571907 1.17305719
+4.77419355 8.83870968 17.30571907 1.17305719
+4.77419355 9.12903226 17.30571907 1.17305719
+4.77419355 9.41935484 17.30571907 1.17305719
+4.77419355 9.70967742 17.30571907 1.17305719
+4.77419355 10.00000000 17.30571907 1.17305719
+5.06451613 1.00000000 12.55517544 1.12555175
+5.06451613 1.29032258 12.55517544 1.12555175
+5.06451613 1.58064516 12.55517544 1.12555175
+5.06451613 1.87096774 12.55517544 1.12555175
+5.06451613 2.16129032 12.55517544 1.12555175
+5.06451613 2.45161290 12.55517544 1.12555175
+5.06451613 2.74193548 12.55517544 1.12555175
+5.06451613 3.03225806 12.63499742 1.12634997
+5.06451613 3.32258065 13.14483502 1.13144835
+5.06451613 3.61290323 13.54771797 1.13547718
+5.06451613 3.90322581 13.90194660 1.13901947
+5.06451613 4.19354839 14.22819712 1.14228197
+5.06451613 4.48387097 14.53742599 1.14537426
+5.06451613 4.77419355 14.83618630 1.14836186
+5.06451613 5.06451613 15.13082220 1.15130822
+5.06451613 5.35483871 15.42613481 1.15426135
+5.06451613 5.64516129 15.72760843 1.15727608
+5.06451613 5.93548387 16.04091807 1.16040918
+5.06451613 6.22580645 16.37497163 1.16374972
+5.06451613 6.51612903 16.74347970 1.16743480
+5.06451613 6.80645161 17.17503189 1.17175032
+5.06451613 7.09677419 17.55554644 1.17555546
+5.06451613 7.38709677 17.55554644 1.17555546
+5.06451613 7.67741935 17.55554644 1.17555546
+5.06451613 7.96774194 17.55554644 1.17555546
+5.06451613 8.25806452 17.55554644 1.17555546
+5.06451613 8.54838710 17.55554644 1.17555546
+5.06451613 8.83870968 17.55554644 1.17555546
+5.06451613 9.12903226 17.55554644 1.17555546
+5.06451613 9.41935484 17.55554644 1.17555546
+5.06451613 9.70967742 17.55554644 1.17555546
+5.06451613 10.00000000 17.55554644 1.17555546
+5.35483871 1.00000000 12.80665986 1.12806660
+5.35483871 1.29032258 12.80665986 1.12806660
+5.35483871 1.58064516 12.80665986 1.12806660
+5.35483871 1.87096774 12.80665986 1.12806660
+5.35483871 2.16129032 12.80665986 1.12806660
+5.35483871 2.45161290 12.80665986 1.12806660
+5.35483871 2.74193548 12.80665986 1.12806660
+5.35483871 3.03225806 12.88858563 1.12888586
+5.35483871 3.32258065 13.41408247 1.13414082
+5.35483871 3.61290323 13.82751223 1.13827512
+5.35483871 3.90322581 14.18888316 1.14188883
+5.35483871 4.19354839 14.52045260 1.14520453
+5.35483871 4.48387097 14.83253803 1.14832538
+5.35483871 4.77419355 15.13221695 1.15132217
+5.35483871 5.06451613 15.42613481 1.15426135
+5.35483871 5.35483871 15.71936190 1.15719362
+5.35483871 5.64516129 16.01779116 1.16017791
+5.35483871 5.93548387 16.32590382 1.16325904
+5.35483871 6.22580645 16.65335849 1.16653358
+5.35483871 6.51612903 17.01334871 1.17013349
+5.35483871 6.80645161 17.43409709 1.17434097
+5.35483871 7.09677419 17.80639865 1.17806399
+5.35483871 7.38709677 17.80639865 1.17806399
+5.35483871 7.67741935 17.80639865 1.17806399
+5.35483871 7.96774194 17.80639865 1.17806399
+5.35483871 8.25806452 17.80639865 1.17806399
+5.35483871 8.54838710 17.80639865 1.17806399
+5.35483871 8.83870968 17.80639865 1.17806399
+5.35483871 9.12903226 17.80639865 1.17806399
+5.35483871 9.41935484 17.80639865 1.17806399
+5.35483871 9.70967742 17.80639865 1.17806399
+5.35483871 10.00000000 17.80639865 1.17806399
+5.64516129 1.00000000 13.06809323 1.13068093
+5.64516129 1.29032258 13.06809323 1.13068093
+5.64516129 1.58064516 13.06809323 1.13068093
+5.64516129 1.87096774 13.06809323 1.13068093
+5.64516129 2.16129032 13.06809323 1.13068093
+5.64516129 2.45161290 13.06809323 1.13068093
+5.64516129 2.74193548 13.06809323 1.13068093
+5.64516129 3.03225806 13.15323067 1.13153231
+5.64516129 3.32258065 13.69613892 1.13696139
+5.64516129 3.61290323 14.12018766 1.14120188
+5.64516129 3.90322581 14.48954068 1.14489541
+5.64516129 4.19354839 14.82442596 1.14824426
+5.64516129 4.48387097 15.13703643 1.15137036
+5.64516129 4.77419355 15.43597664 1.15435977
+5.64516129 5.06451613 15.72760843 1.15727608
+5.64516129 5.35483871 16.01779116 1.16017791
+5.64516129 5.64516129 16.31159861 1.16311599
+5.64516129 5.93548387 16.61373257 1.16613733
+5.64516129 6.22580645 16.93399499 1.16933995
+5.64516129 6.51612903 17.28681907 1.17286819
+5.64516129 6.80645161 17.70002087 1.17700021
+5.64516129 7.09677419 18.06809818 1.18068098
+5.64516129 7.38709677 18.06809818 1.18068098
+5.64516129 7.67741935 18.06809818 1.18068098
+5.64516129 7.96774194 18.06809818 1.18068098
+5.64516129 8.25806452 18.06809818 1.18068098
+5.64516129 8.54838710 18.06809818 1.18068098
+5.64516129 8.83870968 18.06809818 1.18068098
+5.64516129 9.12903226 18.06809818 1.18068098
+5.64516129 9.41935484 18.06809818 1.18068098
+5.64516129 9.70967742 18.06809818 1.18068098
+5.64516129 10.00000000 18.06809818 1.18068098
+5.93548387 1.00000000 13.35056196 1.13350562
+5.93548387 1.29032258 13.35056196 1.13350562
+5.93548387 1.58064516 13.35056196 1.13350562
+5.93548387 1.87096774 13.35056196 1.13350562
+5.93548387 2.16129032 13.35056196 1.13350562
+5.93548387 2.45161290 13.35056196 1.13350562
+5.93548387 2.74193548 13.35056196 1.13350562
+5.93548387 3.03225806 13.43888099 1.13438881
+5.93548387 3.32258065 14.00077769 1.14000778
+5.93548387 3.61290323 14.43537168 1.14435372
+5.93548387 3.90322581 14.80982202 1.14809822
+5.93548387 4.19354839 15.14611095 1.15146111
+5.93548387 4.48387097 15.45709896 1.15457099
+5.93548387 4.77419355 15.75365034 1.15753650
+5.93548387 5.06451613 16.04091807 1.16040918
+5.93548387 5.35483871 16.32590382 1.16325904
+5.93548387 5.64516129 16.61373257 1.16613733
+5.93548387 5.93548387 16.91101948 1.16911019
+5.93548387 6.22580645 17.22556302 1.17225563
+5.93548387 6.51612903 17.57263541 1.17572635
+5.93548387 6.80645161 17.98210647 1.17982106
+5.93548387 7.09677419 18.34996260 1.18349963
+5.93548387 7.38709677 18.34996260 1.18349963
+5.93548387 7.67741935 18.34996260 1.18349963
+5.93548387 7.96774194 18.34996260 1.18349963
+5.93548387 8.25806452 18.34996260 1.18349963
+5.93548387 8.54838710 18.34996260 1.18349963
+5.93548387 8.83870968 18.34996260 1.18349963
+5.93548387 9.12903226 18.34996260 1.18349963
+5.93548387 9.41935484 18.34996260 1.18349963
+5.93548387 9.70967742 18.34996260 1.18349963
+5.93548387 10.00000000 18.34996260 1.18349963
+6.22580645 1.00000000 13.66657067 1.13666571
+6.22580645 1.29032258 13.66657067 1.13666571
+6.22580645 1.58064516 13.66657067 1.13666571
+6.22580645 1.87096774 13.66657067 1.13666571
+6.22580645 2.16129032 13.66657067 1.13666571
+6.22580645 2.45161290 13.66657067 1.13666571
+6.22580645 2.74193548 13.66657067 1.13666571
+6.22580645 3.03225806 13.75926546 1.13759265
+6.22580645 3.32258065 14.34225854 1.14342259
+6.22580645 3.61290323 14.78491413 1.14784914
+6.22580645 3.90322581 15.16074884 1.15160749
+6.22580645 4.19354839 15.49584016 1.15495840
+6.22580645 4.48387097 15.80333467 1.15803335
+6.22580645 4.77419355 16.09439857 1.16094399
+6.22580645 5.06451613 16.37497163 1.16374972
+6.22580645 5.35483871 16.65335849 1.16653358
+6.22580645 5.64516129 16.93399499 1.16933995
+6.22580645 5.93548387 17.22556302 1.17225563
+6.22580645 6.22580645 17.53669460 1.17536695
+6.22580645 6.51612903 17.88214034 1.17882140
+6.22580645 6.80645161 18.29211153 1.18292112
+6.22580645 7.09677419 18.66701771 1.18667018
+6.22580645 7.38709677 18.66701771 1.18667018
+6.22580645 7.67741935 18.66701771 1.18667018
+6.22580645 7.96774194 18.66701771 1.18667018
+6.22580645 8.25806452 18.66701771 1.18667018
+6.22580645 8.54838710 18.66701771 1.18667018
+6.22580645 8.83870968 18.66701771 1.18667018
+6.22580645 9.12903226 18.66701771 1.18667018
+6.22580645 9.41935484 18.66701771 1.18667018
+6.22580645 9.70967742 18.66701771 1.18667018
+6.22580645 10.00000000 18.66701771 1.18667018
+6.51612903 1.00000000 14.04212491 1.14042125
+6.51612903 1.29032258 14.04212491 1.14042125
+6.51612903 1.58064516 14.04212491 1.14042125
+6.51612903 1.87096774 14.04212491 1.14042125
+6.51612903 2.16129032 14.04212491 1.14042125
+6.51612903 2.45161290 14.04212491 1.14042125
+6.51612903 2.74193548 14.04212491 1.14042125
+6.51612903 3.03225806 14.13934485 1.14139345
+6.51612903 3.32258065 14.73996425 1.14739964
+6.51612903 3.61290323 15.18700487 1.15187005
+6.51612903 3.90322581 15.56087142 1.15560871
+6.51612903 4.19354839 15.88989883 1.15889899
+6.51612903 4.48387097 16.18964589 1.16189646
+6.51612903 4.77419355 16.47201646 1.16472016
+6.51612903 5.06451613 16.74347970 1.16743480
+6.51612903 5.35483871 17.01334871 1.17013349
+6.51612903 5.64516129 17.28681907 1.17286819
+6.51612903 5.93548387 17.57263541 1.17572635
+6.51612903 6.22580645 17.88214034 1.17882140
+6.51612903 6.51612903 18.22999587 1.18229996
+6.51612903 6.80645161 18.65108897 1.18651089
+6.51612903 7.09677419 19.04189908 1.19041899
+6.51612903 7.38709677 19.04189908 1.19041899
+6.51612903 7.67741935 19.04189908 1.19041899
+6.51612903 7.96774194 19.04189908 1.19041899
+6.51612903 8.25806452 19.04189908 1.19041899
+6.51612903 8.54838710 19.04189908 1.19041899
+6.51612903 8.83870968 19.04189908 1.19041899
+6.51612903 9.12903226 19.04189908 1.19041899
+6.51612903 9.41935484 19.04189908 1.19041899
+6.51612903 9.70967742 19.04189908 1.19041899
+6.51612903 10.00000000 19.04189908 1.19041899
+6.80645161 1.00000000 14.52492871 1.14524929
+6.80645161 1.29032258 14.52492871 1.14524929
+6.80645161 1.58064516 14.52492871 1.14524929
+6.80645161 1.87096774 14.52492871 1.14524929
+6.80645161 2.16129032 14.52492871 1.14524929
+6.80645161 2.45161290 14.52492871 1.14524929
+6.80645161 2.74193548 14.52492871 1.14524929
+6.80645161 3.03225806 14.62674650 1.14626746
+6.80645161 3.32258065 15.23916402 1.15239164
+6.80645161 3.61290323 15.68154801 1.15681548
+6.80645161 3.90322581 16.04390018 1.16043900
+6.80645161 4.19354839 16.36071096 1.16360711
+6.80645161 4.48387097 16.64650295 1.16646503
+6.80645161 4.77419355 16.91532876 1.16915329
+6.80645161 5.06451613 17.17503189 1.17175032
+6.80645161 5.35483871 17.43409709 1.17434097
+6.80645161 5.64516129 17.70002087 1.17700021
+6.80645161 5.93548387 17.98210647 1.17982106
+6.80645161 6.22580645 18.29211153 1.18292112
+6.80645161 6.51612903 18.65108897 1.18651089
+6.80645161 6.80645161 19.09888025 1.19098880
+6.80645161 7.09677419 19.52496415 1.19524964
+6.80645161 7.38709677 19.52496415 1.19524964
+6.80645161 7.67741935 19.52496415 1.19524964
+6.80645161 7.96774194 19.52496415 1.19524964
+6.80645161 8.25806452 19.52496415 1.19524964
+6.80645161 8.54838710 19.52496415 1.19524964
+6.80645161 8.83870968 19.52496415 1.19524964
+6.80645161 9.12903226 19.52496415 1.19524964
+6.80645161 9.41935484 19.52496415 1.19524964
+6.80645161 9.70967742 19.52496415 1.19524964
+6.80645161 10.00000000 19.52496415 1.19524964
+7.09677419 1.00000000 15.00000000 1.15000000
+7.09677419 1.29032258 15.00000000 1.15000000
+7.09677419 1.58064516 15.00000000 1.15000000
+7.09677419 1.87096774 15.00000000 1.15000000
+7.09677419 2.16129032 15.00000000 1.15000000
+7.09677419 2.45161290 15.00000000 1.15000000
+7.09677419 2.74193548 15.00000000 1.15000000
+7.09677419 3.03225806 15.10357489 1.15103575
+7.09677419 3.32258065 15.70844950 1.15708449
+7.09677419 3.61290323 16.13382374 1.16133824
+7.09677419 3.90322581 16.47922769 1.16479228
+7.09677419 4.19354839 16.77845274 1.16778453
+7.09677419 4.48387097 17.05002382 1.17050024
+7.09677419 4.77419355 17.30571907 1.17305719
+7.09677419 5.06451613 17.55554644 1.17555546
+7.09677419 5.35483871 17.80639865 1.17806399
+7.09677419 5.64516129 18.06809818 1.18068098
+7.09677419 5.93548387 18.34996260 1.18349963
+7.09677419 6.22580645 18.66701771 1.18667018
+7.09677419 6.51612903 19.04189908 1.19041899
+7.09677419 6.80645161 19.52496415 1.19524964
+7.09677419 7.09677419 19.99999704 1.19999997
+7.09677419 7.38709677 19.99999704 1.19999997
+7.09677419 7.67741935 19.99999704 1.19999997
+7.09677419 7.96774194 19.99999704 1.19999997
+7.09677419 8.25806452 19.99999704 1.19999997
+7.09677419 8.54838710 19.99999704 1.19999997
+7.09677419 8.83870968 19.99999704 1.19999997
+7.09677419 9.12903226 19.99999704 1.19999997
+7.09677419 9.41935484 19.99999704 1.19999997
+7.09677419 9.70967742 19.99999704 1.19999997
+7.09677419 10.00000000 19.99999704 1.19999997
+7.38709677 1.00000000 15.00000000 1.15000000
+7.38709677 1.29032258 15.00000000 1.15000000
+7.38709677 1.58064516 15.00000000 1.15000000
+7.38709677 1.87096774 15.00000000 1.15000000
+7.38709677 2.16129032 15.00000000 1.15000000
+7.38709677 2.45161290 15.00000000 1.15000000
+7.38709677 2.74193548 15.00000000 1.15000000
+7.38709677 3.03225806 15.10357489 1.15103575
+7.38709677 3.32258065 15.70844950 1.15708449
+7.38709677 3.61290323 16.13382374 1.16133824
+7.38709677 3.90322581 16.47922769 1.16479228
+7.38709677 4.19354839 16.77845274 1.16778453
+7.38709677 4.48387097 17.05002382 1.17050024
+7.38709677 4.77419355 17.30571907 1.17305719
+7.38709677 5.06451613 17.55554644 1.17555546
+7.38709677 5.35483871 17.80639865 1.17806399
+7.38709677 5.64516129 18.06809818 1.18068098
+7.38709677 5.93548387 18.34996260 1.18349963
+7.38709677 6.22580645 18.66701771 1.18667018
+7.38709677 6.51612903 19.04189908 1.19041899
+7.38709677 6.80645161 19.52496415 1.19524964
+7.38709677 7.09677419 19.99999704 1.19999997
+7.38709677 7.38709677 19.99999704 1.19999997
+7.38709677 7.67741935 19.99999704 1.19999997
+7.38709677 7.96774194 19.99999704 1.19999997
+7.38709677 8.25806452 19.99999704 1.19999997
+7.38709677 8.54838710 19.99999704 1.19999997
+7.38709677 8.83870968 19.99999704 1.19999997
+7.38709677 9.12903226 19.99999704 1.19999997
+7.38709677 9.41935484 19.99999704 1.19999997
+7.38709677 9.70967742 19.99999704 1.19999997
+7.38709677 10.00000000 19.99999704 1.19999997
+7.67741935 1.00000000 15.00000000 1.15000000
+7.67741935 1.29032258 15.00000000 1.15000000
+7.67741935 1.58064516 15.00000000 1.15000000
+7.67741935 1.87096774 15.00000000 1.15000000
+7.67741935 2.16129032 15.00000000 1.15000000
+7.67741935 2.45161290 15.00000000 1.15000000
+7.67741935 2.74193548 15.00000000 1.15000000
+7.67741935 3.03225806 15.10357489 1.15103575
+7.67741935 3.32258065 15.70844950 1.15708449
+7.67741935 3.61290323 16.13382374 1.16133824
+7.67741935 3.90322581 16.47922769 1.16479228
+7.67741935 4.19354839 16.77845274 1.16778453
+7.67741935 4.48387097 17.05002382 1.17050024
+7.67741935 4.77419355 17.30571907 1.17305719
+7.67741935 5.06451613 17.55554644 1.17555546
+7.67741935 5.35483871 17.80639865 1.17806399
+7.67741935 5.64516129 18.06809818 1.18068098
+7.67741935 5.93548387 18.34996260 1.18349963
+7.67741935 6.22580645 18.66701771 1.18667018
+7.67741935 6.51612903 19.04189908 1.19041899
+7.67741935 6.80645161 19.52496415 1.19524964
+7.67741935 7.09677419 19.99999704 1.19999997
+7.67741935 7.38709677 19.99999704 1.19999997
+7.67741935 7.67741935 19.99999704 1.19999997
+7.67741935 7.96774194 19.99999704 1.19999997
+7.67741935 8.25806452 19.99999704 1.19999997
+7.67741935 8.54838710 19.99999704 1.19999997
+7.67741935 8.83870968 19.99999704 1.19999997
+7.67741935 9.12903226 19.99999704 1.19999997
+7.67741935 9.41935484 19.99999704 1.19999997
+7.67741935 9.70967742 19.99999704 1.19999997
+7.67741935 10.00000000 19.99999704 1.19999997
+7.96774194 1.00000000 15.00000000 1.15000000
+7.96774194 1.29032258 15.00000000 1.15000000
+7.96774194 1.58064516 15.00000000 1.15000000
+7.96774194 1.87096774 15.00000000 1.15000000
+7.96774194 2.16129032 15.00000000 1.15000000
+7.96774194 2.45161290 15.00000000 1.15000000
+7.96774194 2.74193548 15.00000000 1.15000000
+7.96774194 3.03225806 15.10357489 1.15103575
+7.96774194 3.32258065 15.70844950 1.15708449
+7.96774194 3.61290323 16.13382374 1.16133824
+7.96774194 3.90322581 16.47922769 1.16479228
+7.96774194 4.19354839 16.77845274 1.16778453
+7.96774194 4.48387097 17.05002382 1.17050024
+7.96774194 4.77419355 17.30571907 1.17305719
+7.96774194 5.06451613 17.55554644 1.17555546
+7.96774194 5.35483871 17.80639865 1.17806399
+7.96774194 5.64516129 18.06809818 1.18068098
+7.96774194 5.93548387 18.34996260 1.18349963
+7.96774194 6.22580645 18.66701771 1.18667018
+7.96774194 6.51612903 19.04189908 1.19041899
+7.96774194 6.80645161 19.52496415 1.19524964
+7.96774194 7.09677419 19.99999704 1.19999997
+7.96774194 7.38709677 19.99999704 1.19999997
+7.96774194 7.67741935 19.99999704 1.19999997
+7.96774194 7.96774194 19.99999704 1.19999997
+7.96774194 8.25806452 19.99999704 1.19999997
+7.96774194 8.54838710 19.99999704 1.19999997
+7.96774194 8.83870968 19.99999704 1.19999997
+7.96774194 9.12903226 19.99999704 1.19999997
+7.96774194 9.41935484 19.99999704 1.19999997
+7.96774194 9.70967742 19.99999704 1.19999997
+7.96774194 10.00000000 19.99999704 1.19999997
+8.25806452 1.00000000 15.00000000 1.15000000
+8.25806452 1.29032258 15.00000000 1.15000000
+8.25806452 1.58064516 15.00000000 1.15000000
+8.25806452 1.87096774 15.00000000 1.15000000
+8.25806452 2.16129032 15.00000000 1.15000000
+8.25806452 2.45161290 15.00000000 1.15000000
+8.25806452 2.74193548 15.00000000 1.15000000
+8.25806452 3.03225806 15.10357489 1.15103575
+8.25806452 3.32258065 15.70844950 1.15708449
+8.25806452 3.61290323 16.13382374 1.16133824
+8.25806452 3.90322581 16.47922769 1.16479228
+8.25806452 4.19354839 16.77845274 1.16778453
+8.25806452 4.48387097 17.05002382 1.17050024
+8.25806452 4.77419355 17.30571907 1.17305719
+8.25806452 5.06451613 17.55554644 1.17555546
+8.25806452 5.35483871 17.80639865 1.17806399
+8.25806452 5.64516129 18.06809818 1.18068098
+8.25806452 5.93548387 18.34996260 1.18349963
+8.25806452 6.22580645 18.66701771 1.18667018
+8.25806452 6.51612903 19.04189908 1.19041899
+8.25806452 6.80645161 19.52496415 1.19524964
+8.25806452 7.09677419 19.99999704 1.19999997
+8.25806452 7.38709677 19.99999704 1.19999997
+8.25806452 7.67741935 19.99999704 1.19999997
+8.25806452 7.96774194 19.99999704 1.19999997
+8.25806452 8.25806452 19.99999704 1.19999997
+8.25806452 8.54838710 19.99999704 1.19999997
+8.25806452 8.83870968 19.99999704 1.19999997
+8.25806452 9.12903226 19.99999704 1.19999997
+8.25806452 9.41935484 19.99999704 1.19999997
+8.25806452 9.70967742 19.99999704 1.19999997
+8.25806452 10.00000000 19.99999704 1.19999997
+8.54838710 1.00000000 15.00000000 1.15000000
+8.54838710 1.29032258 15.00000000 1.15000000
+8.54838710 1.58064516 15.00000000 1.15000000
+8.54838710 1.87096774 15.00000000 1.15000000
+8.54838710 2.16129032 15.00000000 1.15000000
+8.54838710 2.45161290 15.00000000 1.15000000
+8.54838710 2.74193548 15.00000000 1.15000000
+8.54838710 3.03225806 15.10357489 1.15103575
+8.54838710 3.32258065 15.70844950 1.15708449
+8.54838710 3.61290323 16.13382374 1.16133824
+8.54838710 3.90322581 16.47922769 1.16479228
+8.54838710 4.19354839 16.77845274 1.16778453
+8.54838710 4.48387097 17.05002382 1.17050024
+8.54838710 4.77419355 17.30571907 1.17305719
+8.54838710 5.06451613 17.55554644 1.17555546
+8.54838710 5.35483871 17.80639865 1.17806399
+8.54838710 5.64516129 18.06809818 1.18068098
+8.54838710 5.93548387 18.34996260 1.18349963
+8.54838710 6.22580645 18.66701771 1.18667018
+8.54838710 6.51612903 19.04189908 1.19041899
+8.54838710 6.80645161 19.52496415 1.19524964
+8.54838710 7.09677419 19.99999704 1.19999997
+8.54838710 7.38709677 19.99999704 1.19999997
+8.54838710 7.67741935 19.99999704 1.19999997
+8.54838710 7.96774194 19.99999704 1.19999997
+8.54838710 8.25806452 19.99999704 1.19999997
+8.54838710 8.54838710 19.99999704 1.19999997
+8.54838710 8.83870968 19.99999704 1.19999997
+8.54838710 9.12903226 19.99999704 1.19999997
+8.54838710 9.41935484 19.99999704 1.19999997
+8.54838710 9.70967742 19.99999704 1.19999997
+8.54838710 10.00000000 19.99999704 1.19999997
+8.83870968 1.00000000 15.00000000 1.15000000
+8.83870968 1.29032258 15.00000000 1.15000000
+8.83870968 1.58064516 15.00000000 1.15000000
+8.83870968 1.87096774 15.00000000 1.15000000
+8.83870968 2.16129032 15.00000000 1.15000000
+8.83870968 2.45161290 15.00000000 1.15000000
+8.83870968 2.74193548 15.00000000 1.15000000
+8.83870968 3.03225806 15.10357489 1.15103575
+8.83870968 3.32258065 15.70844950 1.15708449
+8.83870968 3.61290323 16.13382374 1.16133824
+8.83870968 3.90322581 16.47922769 1.16479228
+8.83870968 4.19354839 16.77845274 1.16778453
+8.83870968 4.48387097 17.05002382 1.17050024
+8.83870968 4.77419355 17.30571907 1.17305719
+8.83870968 5.06451613 17.55554644 1.17555546
+8.83870968 5.35483871 17.80639865 1.17806399
+8.83870968 5.64516129 18.06809818 1.18068098
+8.83870968 5.93548387 18.34996260 1.18349963
+8.83870968 6.22580645 18.66701771 1.18667018
+8.83870968 6.51612903 19.04189908 1.19041899
+8.83870968 6.80645161 19.52496415 1.19524964
+8.83870968 7.09677419 19.99999704 1.19999997
+8.83870968 7.38709677 19.99999704 1.19999997
+8.83870968 7.67741935 19.99999704 1.19999997
+8.83870968 7.96774194 19.99999704 1.19999997
+8.83870968 8.25806452 19.99999704 1.19999997
+8.83870968 8.54838710 19.99999704 1.19999997
+8.83870968 8.83870968 19.99999704 1.19999997
+8.83870968 9.12903226 19.99999704 1.19999997
+8.83870968 9.41935484 19.99999704 1.19999997
+8.83870968 9.70967742 19.99999704 1.19999997
+8.83870968 10.00000000 19.99999704 1.19999997
+9.12903226 1.00000000 15.00000000 1.15000000
+9.12903226 1.29032258 15.00000000 1.15000000
+9.12903226 1.58064516 15.00000000 1.15000000
+9.12903226 1.87096774 15.00000000 1.15000000
+9.12903226 2.16129032 15.00000000 1.15000000
+9.12903226 2.45161290 15.00000000 1.15000000
+9.12903226 2.74193548 15.00000000 1.15000000
+9.12903226 3.03225806 15.10357489 1.15103575
+9.12903226 3.32258065 15.70844950 1.15708449
+9.12903226 3.61290323 16.13382374 1.16133824
+9.12903226 3.90322581 16.47922769 1.16479228
+9.12903226 4.19354839 16.77845274 1.16778453
+9.12903226 4.48387097 17.05002382 1.17050024
+9.12903226 4.77419355 17.30571907 1.17305719
+9.12903226 5.06451613 17.55554644 1.17555546
+9.12903226 5.35483871 17.80639865 1.17806399
+9.12903226 5.64516129 18.06809818 1.18068098
+9.12903226 5.93548387 18.34996260 1.18349963
+9.12903226 6.22580645 18.66701771 1.18667018
+9.12903226 6.51612903 19.04189908 1.19041899
+9.12903226 6.80645161 19.52496415 1.19524964
+9.12903226 7.09677419 19.99999704 1.19999997
+9.12903226 7.38709677 19.99999704 1.19999997
+9.12903226 7.67741935 19.99999704 1.19999997
+9.12903226 7.96774194 19.99999704 1.19999997
+9.12903226 8.25806452 19.99999704 1.19999997
+9.12903226 8.54838710 19.99999704 1.19999997
+9.12903226 8.83870968 19.99999704 1.19999997
+9.12903226 9.12903226 19.99999704 1.19999997
+9.12903226 9.41935484 19.99999704 1.19999997
+9.12903226 9.70967742 19.99999704 1.19999997
+9.12903226 10.00000000 19.99999704 1.19999997
+9.41935484 1.00000000 15.00000000 1.15000000
+9.41935484 1.29032258 15.00000000 1.15000000
+9.41935484 1.58064516 15.00000000 1.15000000
+9.41935484 1.87096774 15.00000000 1.15000000
+9.41935484 2.16129032 15.00000000 1.15000000
+9.41935484 2.45161290 15.00000000 1.15000000
+9.41935484 2.74193548 15.00000000 1.15000000
+9.41935484 3.03225806 15.10357489 1.15103575
+9.41935484 3.32258065 15.70844950 1.15708449
+9.41935484 3.61290323 16.13382374 1.16133824
+9.41935484 3.90322581 16.47922769 1.16479228
+9.41935484 4.19354839 16.77845274 1.16778453
+9.41935484 4.48387097 17.05002382 1.17050024
+9.41935484 4.77419355 17.30571907 1.17305719
+9.41935484 5.06451613 17.55554644 1.17555546
+9.41935484 5.35483871 17.80639865 1.17806399
+9.41935484 5.64516129 18.06809818 1.18068098
+9.41935484 5.93548387 18.34996260 1.18349963
+9.41935484 6.22580645 18.66701771 1.18667018
+9.41935484 6.51612903 19.04189908 1.19041899
+9.41935484 6.80645161 19.52496415 1.19524964
+9.41935484 7.09677419 19.99999704 1.19999997
+9.41935484 7.38709677 19.99999704 1.19999997
+9.41935484 7.67741935 19.99999704 1.19999997
+9.41935484 7.96774194 19.99999704 1.19999997
+9.41935484 8.25806452 19.99999704 1.19999997
+9.41935484 8.54838710 19.99999704 1.19999997
+9.41935484 8.83870968 19.99999704 1.19999997
+9.41935484 9.12903226 19.99999704 1.19999997
+9.41935484 9.41935484 19.99999704 1.19999997
+9.41935484 9.70967742 19.99999704 1.19999997
+9.41935484 10.00000000 19.99999704 1.19999997
+9.70967742 1.00000000 15.00000000 1.15000000
+9.70967742 1.29032258 15.00000000 1.15000000
+9.70967742 1.58064516 15.00000000 1.15000000
+9.70967742 1.87096774 15.00000000 1.15000000
+9.70967742 2.16129032 15.00000000 1.15000000
+9.70967742 2.45161290 15.00000000 1.15000000
+9.70967742 2.74193548 15.00000000 1.15000000
+9.70967742 3.03225806 15.10357489 1.15103575
+9.70967742 3.32258065 15.70844950 1.15708449
+9.70967742 3.61290323 16.13382374 1.16133824
+9.70967742 3.90322581 16.47922769 1.16479228
+9.70967742 4.19354839 16.77845274 1.16778453
+9.70967742 4.48387097 17.05002382 1.17050024
+9.70967742 4.77419355 17.30571907 1.17305719
+9.70967742 5.06451613 17.55554644 1.17555546
+9.70967742 5.35483871 17.80639865 1.17806399
+9.70967742 5.64516129 18.06809818 1.18068098
+9.70967742 5.93548387 18.34996260 1.18349963
+9.70967742 6.22580645 18.66701771 1.18667018
+9.70967742 6.51612903 19.04189908 1.19041899
+9.70967742 6.80645161 19.52496415 1.19524964
+9.70967742 7.09677419 19.99999704 1.19999997
+9.70967742 7.38709677 19.99999704 1.19999997
+9.70967742 7.67741935 19.99999704 1.19999997
+9.70967742 7.96774194 19.99999704 1.19999997
+9.70967742 8.25806452 19.99999704 1.19999997
+9.70967742 8.54838710 19.99999704 1.19999997
+9.70967742 8.83870968 19.99999704 1.19999997
+9.70967742 9.12903226 19.99999704 1.19999997
+9.70967742 9.41935484 19.99999704 1.19999997
+9.70967742 9.70967742 19.99999704 1.19999997
+9.70967742 10.00000000 19.99999704 1.19999997
+10.00000000 1.00000000 15.00000000 1.15000000
+10.00000000 1.29032258 15.00000000 1.15000000
+10.00000000 1.58064516 15.00000000 1.15000000
+10.00000000 1.87096774 15.00000000 1.15000000
+10.00000000 2.16129032 15.00000000 1.15000000
+10.00000000 2.45161290 15.00000000 1.15000000
+10.00000000 2.74193548 15.00000000 1.15000000
+10.00000000 3.03225806 15.10357489 1.15103575
+10.00000000 3.32258065 15.70844950 1.15708449
+10.00000000 3.61290323 16.13382374 1.16133824
+10.00000000 3.90322581 16.47922769 1.16479228
+10.00000000 4.19354839 16.77845274 1.16778453
+10.00000000 4.48387097 17.05002382 1.17050024
+10.00000000 4.77419355 17.30571907 1.17305719
+10.00000000 5.06451613 17.55554644 1.17555546
+10.00000000 5.35483871 17.80639865 1.17806399
+10.00000000 5.64516129 18.06809818 1.18068098
+10.00000000 5.93548387 18.34996260 1.18349963
+10.00000000 6.22580645 18.66701771 1.18667018
+10.00000000 6.51612903 19.04189908 1.19041899
+10.00000000 6.80645161 19.52496415 1.19524964
+10.00000000 7.09677419 19.99999704 1.19999997
+10.00000000 7.38709677 19.99999704 1.19999997
+10.00000000 7.67741935 19.99999704 1.19999997
+10.00000000 7.96774194 19.99999704 1.19999997
+10.00000000 8.25806452 19.99999704 1.19999997
+10.00000000 8.54838710 19.99999704 1.19999997
+10.00000000 8.83870968 19.99999704 1.19999997
+10.00000000 9.12903226 19.99999704 1.19999997
+10.00000000 9.41935484 19.99999704 1.19999997
+10.00000000 9.70967742 19.99999704 1.19999997
+10.00000000 10.00000000 19.99999704 1.19999997
diff --git a/examples/mamdani/octave/mamdani_tip_calculator.fll b/examples/mamdani/octave/mamdani_tip_calculator.fll
new file mode 100644
index 0000000..b6c1920
--- /dev/null
+++ b/examples/mamdani/octave/mamdani_tip_calculator.fll
@@ -0,0 +1,42 @@
+Engine: Mamdani-Tip-Calculator
+InputVariable: FoodQuality
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+InputVariable: Service
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+OutputVariable: Tip
+ enabled: true
+ range: 0.000 30.000
+ accumulation: AlgebraicSum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: AboutTenPercent Gaussian 10.000 2.000
+ term: AboutFifteenPercent Gaussian 15.000 2.000
+ term: AboutTwentyPercent Gaussian 20.000 2.000
+OutputVariable: CheckPlusTip
+ enabled: true
+ range: 1.000 1.300
+ accumulation: AlgebraicSum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: PlusAboutTenPercent Gaussian 1.100 0.020
+ term: PlusAboutFifteenPercent Gaussian 1.150 0.020
+ term: PlusAboutTwentyPercent Gaussian 1.200 0.020
+RuleBlock:
+ enabled: true
+ conjunction: AlgebraicProduct
+ disjunction: Maximum
+ activation: Minimum
+ rule: if FoodQuality is Bad and Service is Bad then Tip is AboutTenPercent and CheckPlusTip is PlusAboutTenPercent
+ rule: if FoodQuality is Bad and Service is Good then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent
+ rule: if FoodQuality is Good and Service is Bad then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent
+ rule: if FoodQuality is Good and Service is Good then Tip is AboutTwentyPercent and CheckPlusTip is PlusAboutTwentyPercent \ No newline at end of file
diff --git a/examples/mamdani/octave/mamdani_tip_calculator.java b/examples/mamdani/octave/mamdani_tip_calculator.java
new file mode 100644
index 0000000..bea319b
--- /dev/null
+++ b/examples/mamdani/octave/mamdani_tip_calculator.java
@@ -0,0 +1,76 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class mamdani_tip_calculator{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("Mamdani-Tip-Calculator");
+
+InputVariable inputVariable1 = new InputVariable();
+inputVariable1.setEnabled(true);
+inputVariable1.setName("FoodQuality");
+inputVariable1.setRange(1.000, 10.000);
+inputVariable1.addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable1.addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine.addInputVariable(inputVariable1);
+
+InputVariable inputVariable2 = new InputVariable();
+inputVariable2.setEnabled(true);
+inputVariable2.setName("Service");
+inputVariable2.setRange(1.000, 10.000);
+inputVariable2.addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable2.addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine.addInputVariable(inputVariable2);
+
+OutputVariable outputVariable1 = new OutputVariable();
+outputVariable1.setEnabled(true);
+outputVariable1.setName("Tip");
+outputVariable1.setRange(0.000, 30.000);
+outputVariable1.fuzzyOutput().setAccumulation(new AlgebraicSum());
+outputVariable1.setDefuzzifier(new Centroid(200));
+outputVariable1.setDefaultValue(Double.NaN);
+outputVariable1.setLockPreviousOutputValue(false);
+outputVariable1.setLockOutputValueInRange(false);
+outputVariable1.addTerm(new Gaussian("AboutTenPercent", 10.000, 2.000));
+outputVariable1.addTerm(new Gaussian("AboutFifteenPercent", 15.000, 2.000));
+outputVariable1.addTerm(new Gaussian("AboutTwentyPercent", 20.000, 2.000));
+engine.addOutputVariable(outputVariable1);
+
+OutputVariable outputVariable2 = new OutputVariable();
+outputVariable2.setEnabled(true);
+outputVariable2.setName("CheckPlusTip");
+outputVariable2.setRange(1.000, 1.300);
+outputVariable2.fuzzyOutput().setAccumulation(new AlgebraicSum());
+outputVariable2.setDefuzzifier(new Centroid(200));
+outputVariable2.setDefaultValue(Double.NaN);
+outputVariable2.setLockPreviousOutputValue(false);
+outputVariable2.setLockOutputValueInRange(false);
+outputVariable2.addTerm(new Gaussian("PlusAboutTenPercent", 1.100, 0.020));
+outputVariable2.addTerm(new Gaussian("PlusAboutFifteenPercent", 1.150, 0.020));
+outputVariable2.addTerm(new Gaussian("PlusAboutTwentyPercent", 1.200, 0.020));
+engine.addOutputVariable(outputVariable2);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(new AlgebraicProduct());
+ruleBlock.setDisjunction(new Maximum());
+ruleBlock.setActivation(new Minimum());
+ruleBlock.addRule(Rule.parse("if FoodQuality is Bad and Service is Bad then Tip is AboutTenPercent and CheckPlusTip is PlusAboutTenPercent", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Bad and Service is Good then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Good and Service is Bad then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Good and Service is Good then Tip is AboutTwentyPercent and CheckPlusTip is PlusAboutTwentyPercent", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/original/mamdani/AllTerms.fis b/examples/original/mamdani/AllTerms.fis
new file mode 100644
index 0000000..04a36f1
--- /dev/null
+++ b/examples/original/mamdani/AllTerms.fis
@@ -0,0 +1,84 @@
+[System]
+Name='qtfuzzylite'
+Type='mamdani'
+NumInputs=1
+NumOutputs=1
+NumRules=16
+AndMethod='min'
+OrMethod='max'
+ImpMethod='min'
+AggMethod='max'
+DefuzzMethod='centroid'
+
+[Input1]
+Name='AllInputTerms'
+Range=[0.000 6.500]
+NumMFs=20
+MF1='A':'sigmf',[-20.000 0.500]
+MF2='B':'zmf',[0.000 1.000]
+MF3='C':'rampmf',[1.000 0.000]
+MF4='D':'trimf',[0.500 1.000 1.500]
+MF5='E':'trapmf',[1.000 1.250 1.750 2.000]
+MF6='F':'concavemf',[0.850 0.250]
+MF7='G':'rectmf',[1.750 2.250]
+MF8='H':'discretemf',[2.000 0.000 2.250 1.000 2.500 0.500 2.750 1.000 3.000 0.000]
+MF9='I':'gaussmf',[0.200 3.000]
+MF10='J':'cosinemf',[3.250 0.650]
+MF11='K':'gauss2mf',[0.100 3.500 0.300 3.300]
+MF12='L':'spikemf',[3.640 1.040]
+MF13='M':'gbellmf',[0.250 3.000 4.000]
+MF14='N':'pimf',[4.000 4.500 4.500 5.000]
+MF15='O':'concavemf',[5.650 6.250]
+MF16='P':'dsigmf',[10.000 4.750 30.000 5.250]
+MF17='Q':'psigmf',[20.000 5.250 -10.000 5.750]
+MF18='R':'rampmf',[5.500 6.500]
+MF19='S':'smf',[5.500 6.500]
+MF20='T':'sigmf',[20.000 6.000]
+
+[Output1]
+Name='AllOutputTerms'
+Range=[0.000 6.500]
+NumMFs=16
+MF1='A':'sigmf',[-20.000 0.500]
+MF2='B':'zmf',[0.000 1.000]
+MF3='C':'rampmf',[1.000 0.000]
+MF4='D':'trimf',[0.500 1.000 1.500]
+MF5='E':'trapmf',[1.000 1.250 1.750 2.000]
+MF6='F':'concavemf',[0.850 0.250]
+MF7='G':'rectmf',[1.750 2.250]
+MF8='H':'discretemf',[2.000 0.000 2.250 1.000 2.500 0.500 2.750 1.000 3.000 0.000]
+MF9='I':'gaussmf',[0.200 3.000]
+MF10='J':'cosinemf',[3.250 0.650]
+MF11='K':'gauss2mf',[0.100 3.500 0.300 3.300]
+MF12='L':'spikemf',[3.640 1.040]
+MF13='M':'gbellmf',[0.250 3.000 4.000]
+MF14='N':'pimf',[4.000 4.500 4.500 5.000]
+MF15='O':'concavemf',[5.650 6.250]
+MF16='P':'dsigmf',[10.000 4.750 30.000 5.250]
+MF17='Q':'psigmf',[20.000 5.250 -10.000 5.750]
+MF18='R':'rampmf',[5.500 6.500]
+MF19='S':'smf',[5.500 6.500]
+MF20='T':'sigmf',[20.000 6.000]
+
+
+[Rules]
+1.000 , 20.000 (1.000) : 1
+2.000 , 19.000 (1.000) : 1
+3.000 , 18.000 (1.000) : 1
+4.000 , 17.000 (1.000) : 1
+5.000 , 16.000 (1.000) : 1
+6.000 , 15.000 (1.000) : 1
+7.000 , 14.000 (1.000) : 1
+8.000 , 13.000 (1.000) : 1
+9.000 , 12.000 (1.000) : 1
+10.000 , 11.000 (1.000) : 1
+11.000 , 10.000 (1.000) : 1
+12.000 , 9.000 (1.000) : 1
+13.000 , 8.000 (1.000) : 1
+14.000 , 7.000 (1.000) : 1
+15.000 , 6.000 (1.000) : 1
+16.000 , 5.000 (1.000) : 1
+17.000 , 4.000 (1.000) : 1
+18.000 , 3.000 (1.000) : 1
+19.000 , 2.000 (1.000) : 1
+20.000 , 1.000 (1.000) : 1
diff --git a/examples/original/mamdani/AllTerms.fll b/examples/original/mamdani/AllTerms.fll
new file mode 100644
index 0000000..58d5705
--- /dev/null
+++ b/examples/original/mamdani/AllTerms.fll
@@ -0,0 +1,77 @@
+Engine: qtfuzzylite
+InputVariable: AllInputTerms
+ enabled: true
+ range: 0.000 6.500
+ term: A Sigmoid 0.500 -20.000
+ term: B ZShape 0.000 1.000
+ term: C Ramp 1.000 0.000
+ term: D Triangle 0.500 1.000 1.500
+ term: E Trapezoid 1.000 1.250 1.750 2.000
+ term: F Concave 0.850 0.250
+ term: G Rectangle 1.750 2.250
+ term: H Discrete 2.000 0.000 2.250 1.000 2.500 0.500 2.750 1.000 3.000 0.000
+ term: I Gaussian 3.000 0.200
+ term: J Cosine 3.250 0.650
+ term: K GaussianProduct 3.500 0.100 3.300 0.300
+ term: L Spike 3.640 1.040
+ term: M Bell 4.000 0.250 3.000
+ term: N PiShape 4.000 4.500 4.500 5.000
+ term: O Concave 5.650 6.250
+ term: P SigmoidDifference 4.750 10.000 30.000 5.250
+ term: Q SigmoidProduct 5.250 20.000 -10.000 5.750
+ term: R Ramp 5.500 6.500
+ term: S SShape 5.500 6.500
+ term: T Sigmoid 6.000 20.000
+OutputVariable: AllOutputTerms
+ enabled: true
+ range: 0.000 6.500
+ accumulation: Maximum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: A Sigmoid 0.500 -20.000
+ term: B ZShape 0.000 1.000
+ term: C Ramp 1.000 0.000
+ term: D Triangle 0.500 1.000 1.500
+ term: E Trapezoid 1.000 1.250 1.750 2.000
+ term: F Concave 0.850 0.250
+ term: G Rectangle 1.750 2.250
+ term: H Discrete 2.000 0.000 2.250 1.000 2.500 0.500 2.750 1.000 3.000 0.000
+ term: I Gaussian 3.000 0.200
+ term: J Cosine 3.250 0.650
+ term: K GaussianProduct 3.500 0.100 3.300 0.300
+ term: L Spike 3.640 1.040
+ term: M Bell 4.000 0.250 3.000
+ term: N PiShape 4.000 4.500 4.500 5.000
+ term: O Concave 5.650 6.250
+ term: P SigmoidDifference 4.750 10.000 30.000 5.250
+ term: Q SigmoidProduct 5.250 20.000 -10.000 5.750
+ term: R Ramp 5.500 6.500
+ term: S SShape 5.500 6.500
+ term: T Sigmoid 6.000 20.000
+RuleBlock:
+ enabled: true
+ conjunction: Minimum
+ disjunction: Maximum
+ activation: Minimum
+ rule: if AllInputTerms is A then AllOutputTerms is T
+ rule: if AllInputTerms is B then AllOutputTerms is S
+ rule: if AllInputTerms is C then AllOutputTerms is R
+ rule: if AllInputTerms is D then AllOutputTerms is Q
+ rule: if AllInputTerms is E then AllOutputTerms is P
+ rule: if AllInputTerms is F then AllOutputTerms is O
+ rule: if AllInputTerms is G then AllOutputTerms is N
+ rule: if AllInputTerms is H then AllOutputTerms is M
+ rule: if AllInputTerms is I then AllOutputTerms is L
+ rule: if AllInputTerms is J then AllOutputTerms is K
+ rule: if AllInputTerms is K then AllOutputTerms is J
+ rule: if AllInputTerms is L then AllOutputTerms is I
+ rule: if AllInputTerms is M then AllOutputTerms is H
+ rule: if AllInputTerms is N then AllOutputTerms is G
+ rule: if AllInputTerms is O then AllOutputTerms is F
+ rule: if AllInputTerms is P then AllOutputTerms is E
+ rule: if AllInputTerms is Q then AllOutputTerms is D
+ rule: if AllInputTerms is R then AllOutputTerms is C
+ rule: if AllInputTerms is S then AllOutputTerms is B
+ rule: if AllInputTerms is T then AllOutputTerms is A \ No newline at end of file
diff --git a/examples/original/mamdani/Laundry.fll b/examples/original/mamdani/Laundry.fll
new file mode 100644
index 0000000..cc002bb
--- /dev/null
+++ b/examples/original/mamdani/Laundry.fll
@@ -0,0 +1,43 @@
+Engine: Laundry
+InputVariable: Load
+ enabled: true
+ range: 0.000 6.000
+ term: small Discrete 0.000 1.000 1.000 1.000 2.000 0.800 5.000 0.000
+ term: normal Discrete 3.000 0.000 4.000 1.000 6.000 0.000
+InputVariable: Dirt
+ enabled: true
+ range: 0.000 6.000
+ term: low Discrete 0.000 1.000 2.000 0.800 5.000 0.000
+ term: high Discrete 1.000 0.000 2.000 0.200 4.000 0.800 6.000 1.000
+OutputVariable: Detergent
+ enabled: true
+ range: 0.000 80.000
+ accumulation: Maximum
+ defuzzifier: MeanOfMaximum 500
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: less_than_usual Discrete 10.000 0.000 40.000 1.000 50.000 0.000
+ term: usual Discrete 40.000 0.000 50.000 1.000 60.000 1.000 80.000 0.000
+ term: more_than_usual Discrete 50.000 0.000 80.000 1.000
+OutputVariable: Cycle
+ enabled: true
+ range: 0.000 20.000
+ accumulation: Maximum
+ defuzzifier: MeanOfMaximum 500
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: short Discrete 0.000 1.000 10.000 1.000 20.000 0.000
+ term: long Discrete 10.000 0.000 20.000 1.000
+RuleBlock:
+ enabled: true
+ conjunction: Minimum
+ disjunction: Maximum
+ activation: Minimum
+ rule: if Load is small and Dirt is not high then Detergent is less_than_usual
+ rule: if Load is small and Dirt is high then Detergent is usual
+ rule: if Load is normal and Dirt is low then Detergent is less_than_usual
+ rule: if Load is normal and Dirt is high then Detergent is more_than_usual
+ rule: if Detergent is usual or Detergent is less_than_usual then Cycle is short
+ rule: if Detergent is more_than_usual then Cycle is long \ No newline at end of file
diff --git a/examples/original/mamdani/SimpleDimmer.fis b/examples/original/mamdani/SimpleDimmer.fis
new file mode 100644
index 0000000..d3d229a
--- /dev/null
+++ b/examples/original/mamdani/SimpleDimmer.fis
@@ -0,0 +1,39 @@
+[System]
+Name='simple-dimmer'
+Type='mamdani'
+Version=3.0
+NumInputs=1
+NumOutputs=1
+NumRules=3
+AndMethod=''
+OrMethod=''
+ImpMethod='min'
+AggMethod='max'
+DefuzzMethod='centroid'
+
+[Input1]
+Name='Ambient'
+Range=[0.000 1.000]
+NumMFs=3
+MF1='DARK':'trimf',[0.000 0.250 0.500]
+MF2='MEDIUM':'trimf',[0.250 0.500 0.750]
+MF3='BRIGHT':'trimf',[0.500 0.750 1.000]
+
+
+[Output1]
+Name='Power'
+Range=[0.000 1.000]
+Default=nan
+LockPrevious=0
+LockRange=0
+NumMFs=3
+MF1='LOW':'trimf',[0.000 0.250 0.500]
+MF2='MEDIUM':'trimf',[0.250 0.500 0.750]
+MF3='HIGH':'trimf',[0.500 0.750 1.000]
+
+
+[Rules]
+1 , 3 (1) : 1
+2 , 2 (1) : 1
+3 , 1 (1) : 1
+
diff --git a/examples/original/mamdani/SimpleDimmer.fll b/examples/original/mamdani/SimpleDimmer.fll
new file mode 100644
index 0000000..3a4f8f9
--- /dev/null
+++ b/examples/original/mamdani/SimpleDimmer.fll
@@ -0,0 +1,26 @@
+Engine: simple-dimmer
+InputVariable: Ambient
+ enabled: true
+ range: 0.000 1.000
+ term: DARK Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: BRIGHT Triangle 0.500 0.750 1.000
+OutputVariable: Power
+ enabled: true
+ range: 0.000 1.000
+ accumulation: Maximum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: HIGH Triangle 0.500 0.750 1.000
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: Minimum
+ rule: if Ambient is DARK then Power is HIGH
+ rule: if Ambient is MEDIUM then Power is MEDIUM
+ rule: if Ambient is BRIGHT then Power is LOW \ No newline at end of file
diff --git a/examples/original/mamdani/SimpleDimmerInverse.fll b/examples/original/mamdani/SimpleDimmerInverse.fll
new file mode 100644
index 0000000..fd6b945
--- /dev/null
+++ b/examples/original/mamdani/SimpleDimmerInverse.fll
@@ -0,0 +1,40 @@
+Engine: simple-dimmer
+InputVariable: Ambient
+ enabled: true
+ range: 0.000 1.000
+ term: DARK Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: BRIGHT Triangle 0.500 0.750 1.000
+OutputVariable: Power
+ enabled: true
+ range: 0.000 1.000
+ accumulation: Maximum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: HIGH Triangle 0.500 0.750 1.000
+OutputVariable: InversePower
+ enabled: true
+ range: 0.000 1.000
+ accumulation: Maximum
+ defuzzifier: Centroid 500
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Cosine 0.200 0.500
+ term: MEDIUM Cosine 0.500 0.500
+ term: HIGH Cosine 0.800 0.500
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: Minimum
+ rule: if Ambient is DARK then Power is HIGH
+ rule: if Ambient is MEDIUM then Power is MEDIUM
+ rule: if Ambient is BRIGHT then Power is LOW
+ rule: if Power is LOW then InversePower is HIGH
+ rule: if Power is MEDIUM then InversePower is MEDIUM
+ rule: if Power is HIGH then InversePower is LOW \ No newline at end of file
diff --git a/examples/original/mamdani/octave/COPYING b/examples/original/mamdani/octave/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/examples/original/mamdani/octave/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/examples/original/mamdani/octave/DESCRIPTION b/examples/original/mamdani/octave/DESCRIPTION
new file mode 100644
index 0000000..35df57d
--- /dev/null
+++ b/examples/original/mamdani/octave/DESCRIPTION
@@ -0,0 +1,12 @@
+Name: fuzzy-logic-toolkit
+Version: 0.4.2
+Date: 2012-10-02
+Author: L. Markowsky <lmarkov@users.sourceforge.net>
+Maintainer: L. Markowsky <lmarkov@users.sourceforge.net>
+Title: Octave Fuzzy Logic Toolkit
+Description: A mostly MATLAB-compatible fuzzy logic toolkit for Octave.
+Depends: octave (>= 3.2.4)
+Autoload: no
+License: GPLv3+
+Url: http://octave.sf.net
+ http://sf.net/projects/octave-fuzzy
diff --git a/examples/original/mamdani/octave/investment_portfolio.fis b/examples/original/mamdani/octave/investment_portfolio.fis
new file mode 100644
index 0000000..49a01fd
--- /dev/null
+++ b/examples/original/mamdani/octave/investment_portfolio.fis
@@ -0,0 +1,64 @@
+## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
+##
+## This file is part of the fuzzy-logic-toolkit.
+##
+## The fuzzy-logic-toolkit is free software; you can redistribute it
+## and/or modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 3 of
+## the License, or (at your option) any later version.
+##
+## The fuzzy-logic-toolkit is distributed in the hope that it will be
+## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with the fuzzy-logic-toolkit; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+## Author: L. Markowsky
+## Keywords: fuzzy-logic-toolkit fis
+## Directory: fuzzy-logic-toolkit/inst/
+## Filename: investment_portfolio.fis
+## Last-Modified: 28 Aug 2012
+
+[System]
+Name='Investment-Portfolio'
+Type='mamdani'
+Version=2.0
+NumInputs=2
+NumOutputs=1
+NumRules=4
+AndMethod='einstein_product'
+OrMethod='einstein_sum'
+ImpMethod='einstein_product'
+AggMethod='einstein_sum'
+DefuzzMethod='centroid'
+
+[Input1]
+Name='Age'
+Range=[20 100]
+NumMFs=2
+MF1='Young':'zmf',[30 90]
+MF2='Old':'smf',[30 90]
+
+[Input2]
+Name='Risk-Tolerance'
+Range=[0 10]
+NumMFs=2
+MF1='Low':'zmf',[2 8]
+MF2='High':'smf',[2 8]
+
+[Output1]
+Name='Percentage-In-Stocks'
+Range=[0 100]
+NumMFs=3
+MF1='About-Fifteen':'gaussmf',[10 15]
+MF2='About-Fifty':'gaussmf',[10 50]
+MF3='About-Eighty-Five':'gaussmf',[10 85]
+
+[Rules]
+1 2, 3 (1) : 2
+2 1, 1 (1) : 2
+-2.3 -1.3, 2 (0.5) : 1
+-1.3 -2.3, 2 (0.5) : 1
diff --git a/examples/original/mamdani/octave/investment_portfolio.fll b/examples/original/mamdani/octave/investment_portfolio.fll
new file mode 100644
index 0000000..4bb14e1
--- /dev/null
+++ b/examples/original/mamdani/octave/investment_portfolio.fll
@@ -0,0 +1,31 @@
+Engine: Investment-Portfolio
+InputVariable: Age
+ enabled: true
+ range: 20.000 100.000
+ term: Young ZShape 30.000 90.000
+ term: Old SShape 30.000 90.000
+InputVariable: RiskTolerance
+ enabled: true
+ range: 0.000 10.000
+ term: Low ZShape 2.000 8.000
+ term: High SShape 2.000 8.000
+OutputVariable: PercentageInStocks
+ enabled: true
+ range: 0.000 100.000
+ accumulation: EinsteinSum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: AboutFifteen Gaussian 15.000 10.000
+ term: AboutFifty Gaussian 50.000 10.000
+ term: AboutEightyFive Gaussian 85.000 10.000
+RuleBlock:
+ enabled: true
+ conjunction: EinsteinProduct
+ disjunction: EinsteinSum
+ activation: EinsteinProduct
+ rule: if Age is Young or RiskTolerance is High then PercentageInStocks is AboutEightyFive
+ rule: if Age is Old or RiskTolerance is Low then PercentageInStocks is AboutFifteen
+ rule: if Age is not extremely Old and RiskTolerance is not extremely Low then PercentageInStocks is AboutFifty with 0.500
+ rule: if Age is not extremely Young and RiskTolerance is not extremely High then PercentageInStocks is AboutFifty with 0.500 \ No newline at end of file
diff --git a/examples/original/mamdani/octave/mamdani_tip_calculator.fis b/examples/original/mamdani/octave/mamdani_tip_calculator.fis
new file mode 100644
index 0000000..7029c58
--- /dev/null
+++ b/examples/original/mamdani/octave/mamdani_tip_calculator.fis
@@ -0,0 +1,72 @@
+## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
+##
+## This file is part of the fuzzy-logic-toolkit.
+##
+## The fuzzy-logic-toolkit is free software; you can redistribute it
+## and/or modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 3 of
+## the License, or (at your option) any later version.
+##
+## The fuzzy-logic-toolkit is distributed in the hope that it will be
+## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with the fuzzy-logic-toolkit; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+## Author: L. Markowsky
+## Keywords: fuzzy-logic-toolkit fis
+## Directory: fuzzy-logic-toolkit/inst/
+## Filename: mamdani_tip_calculator.fis
+## Last-Modified: 28 Aug 2012
+
+[System]
+Name='Mamdani-Tip-Calculator'
+Type='mamdani'
+Version=2.0
+NumInputs=2
+NumOutputs=2
+NumRules=4
+AndMethod='prod'
+OrMethod='max'
+ImpMethod='min'
+AggMethod='sum'
+DefuzzMethod='centroid'
+
+[Input1]
+Name='Food-Quality'
+Range=[1 10]
+NumMFs=2
+MF1='Bad':'trapmf',[0 1 3 7]
+MF2='Good':'trapmf',[3 7 10 11]
+
+[Input2]
+Name='Service'
+Range=[1 10]
+NumMFs=2
+MF1='Bad':'trapmf',[0 1 3 7]
+MF2='Good':'trapmf',[3 7 10 11]
+
+[Output1]
+Name='Tip'
+Range=[0 30]
+NumMFs=3
+MF1='About-Ten-Percent':'gaussmf',[2 10]
+MF2='About-Fifteen-Percent':'gaussmf',[2 15]
+MF3='About-Twenty-Percent':'gaussmf',[2 20]
+
+[Output2]
+Name='Check-Plus-Tip'
+Range=[1 1.3]
+NumMFs=3
+MF1='Plus-About-Ten-Percent':'gaussmf',[0.02 1.10]
+MF2='Plus-About-Fifteen-Percent':'gaussmf',[0.02 1.15]
+MF3='Plus-About-Twenty-Percent':'gaussmf',[0.02 1.20]
+
+[Rules]
+1 1, 1 1 (1) : 1
+1 2, 2 2 (1) : 1
+2 1, 2 2 (1) : 1
+2 2, 3 3 (1) : 1
diff --git a/examples/original/mamdani/octave/mamdani_tip_calculator.fll b/examples/original/mamdani/octave/mamdani_tip_calculator.fll
new file mode 100644
index 0000000..b6c1920
--- /dev/null
+++ b/examples/original/mamdani/octave/mamdani_tip_calculator.fll
@@ -0,0 +1,42 @@
+Engine: Mamdani-Tip-Calculator
+InputVariable: FoodQuality
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+InputVariable: Service
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+OutputVariable: Tip
+ enabled: true
+ range: 0.000 30.000
+ accumulation: AlgebraicSum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: AboutTenPercent Gaussian 10.000 2.000
+ term: AboutFifteenPercent Gaussian 15.000 2.000
+ term: AboutTwentyPercent Gaussian 20.000 2.000
+OutputVariable: CheckPlusTip
+ enabled: true
+ range: 1.000 1.300
+ accumulation: AlgebraicSum
+ defuzzifier: Centroid 200
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: PlusAboutTenPercent Gaussian 1.100 0.020
+ term: PlusAboutFifteenPercent Gaussian 1.150 0.020
+ term: PlusAboutTwentyPercent Gaussian 1.200 0.020
+RuleBlock:
+ enabled: true
+ conjunction: AlgebraicProduct
+ disjunction: Maximum
+ activation: Minimum
+ rule: if FoodQuality is Bad and Service is Bad then Tip is AboutTenPercent and CheckPlusTip is PlusAboutTenPercent
+ rule: if FoodQuality is Bad and Service is Good then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent
+ rule: if FoodQuality is Good and Service is Bad then Tip is AboutFifteenPercent and CheckPlusTip is PlusAboutFifteenPercent
+ rule: if FoodQuality is Good and Service is Good then Tip is AboutTwentyPercent and CheckPlusTip is PlusAboutTwentyPercent \ No newline at end of file
diff --git a/examples/original/takagi-sugeno/SimpleDimmer.fis b/examples/original/takagi-sugeno/SimpleDimmer.fis
new file mode 100644
index 0000000..bb4e638
--- /dev/null
+++ b/examples/original/takagi-sugeno/SimpleDimmer.fis
@@ -0,0 +1,41 @@
+[System]
+Name='simple-dimmer'
+Type='sugeno'
+Version=4.0
+NumInputs=1
+NumOutputs=1
+NumRules=3
+AndMethod='min'
+OrMethod='max'
+ImpMethod='prod'
+AggMethod='sum'
+DefuzzMethod='wtaver'
+
+[Input1]
+Enabled=1
+Name='Ambient'
+Range=[0.000 1.000]
+NumMFs=3
+MF1='DARK':'trimf',[0.000 0.250 0.500]
+MF2='MEDIUM':'trimf',[0.250 0.500 0.750]
+MF3='BRIGHT':'trimf',[0.500 0.750 1.000]
+
+
+[Output1]
+Enabled=1
+Name='Power'
+Range=[0.000 1.000]
+Default=nan
+LockPrevious=0
+LockRange=0
+NumMFs=3
+MF1='LOW':'constant',[0.250]
+MF2='MEDIUM':'constant',[0.500]
+MF3='HIGH':'constant',[0.750]
+
+
+[Rules]
+1.000 , 3.000 (1) : 1
+2.000 , 2.000 (1) : 1
+3.000 , 1.000 (1) : 1
+
diff --git a/examples/original/takagi-sugeno/SimpleDimmer.fll b/examples/original/takagi-sugeno/SimpleDimmer.fll
new file mode 100644
index 0000000..15050ee
--- /dev/null
+++ b/examples/original/takagi-sugeno/SimpleDimmer.fll
@@ -0,0 +1,26 @@
+Engine: simple-dimmer
+InputVariable: Ambient
+ enabled: true
+ range: 0.000 1.000
+ term: DARK Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: BRIGHT Triangle 0.500 0.750 1.000
+OutputVariable: Power
+ enabled: true
+ range: 0.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Constant 0.250
+ term: MEDIUM Constant 0.500
+ term: HIGH Constant 0.750
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: none
+ rule: if Ambient is DARK then Power is HIGH
+ rule: if Ambient is MEDIUM then Power is MEDIUM
+ rule: if Ambient is BRIGHT then Power is LOW
diff --git a/examples/original/takagi-sugeno/approximation.fis b/examples/original/takagi-sugeno/approximation.fis
new file mode 100644
index 0000000..3627ccf
--- /dev/null
+++ b/examples/original/takagi-sugeno/approximation.fis
@@ -0,0 +1,80 @@
+[System]
+Name='approximation of sin(x)/x'
+Type='sugeno'
+Version=4.0
+NumInputs=1
+NumOutputs=3
+NumRules=10
+AndMethod=''
+OrMethod=''
+ImpMethod='prod'
+AggMethod='sum'
+DefuzzMethod='wtaver'
+
+[Input1]
+Enabled=1
+Name='inputX'
+Range=[0.000 10.000]
+NumMFs=9
+MF1='NEAR_1':'trimf',[0.000 1.000 2.000]
+MF2='NEAR_2':'trimf',[1.000 2.000 3.000]
+MF3='NEAR_3':'trimf',[2.000 3.000 4.000]
+MF4='NEAR_4':'trimf',[3.000 4.000 5.000]
+MF5='NEAR_5':'trimf',[4.000 5.000 6.000]
+MF6='NEAR_6':'trimf',[5.000 6.000 7.000]
+MF7='NEAR_7':'trimf',[6.000 7.000 8.000]
+MF8='NEAR_8':'trimf',[7.000 8.000 9.000]
+MF9='NEAR_9':'trimf',[8.000 9.000 10.000]
+
+
+[Output1]
+Enabled=1
+Name='outputFx'
+Range=[-1.000 1.000]
+Default=nan
+LockPrevious=1
+LockRange=0
+NumMFs=9
+MF1='f1':'constant',[0.840]
+MF2='f2':'constant',[0.450]
+MF3='f3':'constant',[0.040]
+MF4='f4':'constant',[-0.180]
+MF5='f5':'constant',[-0.190]
+MF6='f6':'constant',[-0.040]
+MF7='f7':'constant',[0.090]
+MF8='f8':'constant',[0.120]
+MF9='f9':'constant',[0.040]
+
+[Output2]
+Enabled=1
+Name='trueFx'
+Range=[-1.000 1.000]
+Default=nan
+LockPrevious=1
+LockRange=0
+NumMFs=1
+MF1='fx':'function',[sin ( inputX ) /inputX]
+
+[Output3]
+Enabled=1
+Name='diffFx'
+Range=[-1.000 1.000]
+Default=nan
+LockPrevious=0
+LockRange=0
+NumMFs=1
+MF1='diff':'function',[fabs ( outputFx-trueFx )]
+
+
+[Rules]
+1.000 , 1.000 0.000 0.000 (1.000) : 1
+2.000 , 2.000 0.000 0.000 (1.000) : 1
+3.000 , 3.000 0.000 0.000 (1.000) : 1
+4.000 , 4.000 0.000 0.000 (1.000) : 1
+5.000 , 5.000 0.000 0.000 (1.000) : 1
+6.000 , 6.000 0.000 0.000 (1.000) : 1
+7.000 , 7.000 0.000 0.000 (1.000) : 1
+8.000 , 8.000 0.000 0.000 (1.000) : 1
+9.000 , 9.000 0.000 0.000 (1.000) : 1
+0.990 , 0.000 1.000 1.000 (1.000) : 1
+
diff --git a/examples/original/takagi-sugeno/approximation.fll b/examples/original/takagi-sugeno/approximation.fll
new file mode 100644
index 0000000..66fb813
--- /dev/null
+++ b/examples/original/takagi-sugeno/approximation.fll
@@ -0,0 +1,63 @@
+Engine: approximation of sin(x)/x
+InputVariable: inputX
+ enabled: true
+ range: 0.000 10.000
+ term: NEAR_1 Triangle 0.000 1.000 2.000
+ term: NEAR_2 Triangle 1.000 2.000 3.000
+ term: NEAR_3 Triangle 2.000 3.000 4.000
+ term: NEAR_4 Triangle 3.000 4.000 5.000
+ term: NEAR_5 Triangle 4.000 5.000 6.000
+ term: NEAR_6 Triangle 5.000 6.000 7.000
+ term: NEAR_7 Triangle 6.000 7.000 8.000
+ term: NEAR_8 Triangle 7.000 8.000 9.000
+ term: NEAR_9 Triangle 8.000 9.000 10.000
+OutputVariable: outputFx
+ enabled: true
+ range: -1.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: true
+ lock-range: false
+ term: f1 Constant 0.840
+ term: f2 Constant 0.450
+ term: f3 Constant 0.040
+ term: f4 Constant -0.180
+ term: f5 Constant -0.190
+ term: f6 Constant -0.040
+ term: f7 Constant 0.090
+ term: f8 Constant 0.120
+ term: f9 Constant 0.040
+OutputVariable: trueFx
+ enabled: true
+ range: -1.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage
+ default: nan
+ lock-previous: true
+ lock-range: false
+ term: fx Function sin(inputX)/inputX
+OutputVariable: diffFx
+ enabled: true
+ range: -1.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: diff Function fabs(outputFx-trueFx)
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: none
+ rule: if inputX is NEAR_1 then outputFx is f1
+ rule: if inputX is NEAR_2 then outputFx is f2
+ rule: if inputX is NEAR_3 then outputFx is f3
+ rule: if inputX is NEAR_4 then outputFx is f4
+ rule: if inputX is NEAR_5 then outputFx is f5
+ rule: if inputX is NEAR_6 then outputFx is f6
+ rule: if inputX is NEAR_7 then outputFx is f7
+ rule: if inputX is NEAR_8 then outputFx is f8
+ rule: if inputX is NEAR_9 then outputFx is f9
+ rule: if inputX is any then trueFx is fx and diffFx is diff
diff --git a/examples/original/takagi-sugeno/octave/COPYING b/examples/original/takagi-sugeno/octave/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/examples/original/takagi-sugeno/octave/DESCRIPTION b/examples/original/takagi-sugeno/octave/DESCRIPTION
new file mode 100644
index 0000000..35df57d
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/DESCRIPTION
@@ -0,0 +1,12 @@
+Name: fuzzy-logic-toolkit
+Version: 0.4.2
+Date: 2012-10-02
+Author: L. Markowsky <lmarkov@users.sourceforge.net>
+Maintainer: L. Markowsky <lmarkov@users.sourceforge.net>
+Title: Octave Fuzzy Logic Toolkit
+Description: A mostly MATLAB-compatible fuzzy logic toolkit for Octave.
+Depends: octave (>= 3.2.4)
+Autoload: no
+License: GPLv3+
+Url: http://octave.sf.net
+ http://sf.net/projects/octave-fuzzy
diff --git a/examples/original/takagi-sugeno/octave/cubic_approximator.fis b/examples/original/takagi-sugeno/octave/cubic_approximator.fis
new file mode 100644
index 0000000..49bf5b1
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/cubic_approximator.fis
@@ -0,0 +1,81 @@
+## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
+##
+## This file is part of the fuzzy-logic-toolkit.
+##
+## The fuzzy-logic-toolkit is free software; you can redistribute it
+## and/or modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 3 of
+## the License, or (at your option) any later version.
+##
+## The fuzzy-logic-toolkit is distributed in the hope that it will be
+## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with the fuzzy-logic-toolkit; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+## Author: L. Markowsky
+## Keywords: fuzzy-logic-toolkit fis
+## Directory: fuzzy-logic-toolkit/inst/
+## Filename: cubic_approximator.fis
+## Last-Modified: 28 Aug 2012
+
+[System]
+Name='Cubic-Approximator'
+Type='sugeno'
+Version=2.0
+NumInputs=1
+NumOutputs=1
+NumRules=11
+AndMethod='min'
+OrMethod='max'
+ImpMethod='prod'
+AggMethod='sum'
+DefuzzMethod='wtaver'
+
+[Input1]
+Name='X'
+Range=[-5 5]
+NumMFs=11
+MF1 = 'About-Neg-Five':'trimf', [-6 -5 -4]
+MF2 = 'About-Neg-Four':'trimf', [-5 -4 -3]
+MF3 = 'About-Neg-Three':'trimf', [-4 -3 -2]
+MF4 = 'About-Neg-Two':'trimf', [-3 -2 -1]
+MF5 = 'About-Neg-One':'trimf', [-2 -1 0]
+MF6 = 'About-Zero':'trimf', [-1 0 1]
+MF7 = 'About-One':'trimf', [0 1 2]
+MF8 = 'About-Two':'trimf', [1 2 3]
+MF9 = 'About-Three':'trimf', [2 3 4]
+MF10 = 'About-Four':'trimf', [3 4 5]
+MF11 = 'About-Five':'trimf', [4 5 6]
+
+[Output1]
+Name='Approx-X-Cubed'
+Range=[-5 5]
+NumMFs=11
+MF1 = 'Tangent-at-Neg-Five':'linear', [75 250]
+MF2 = 'Tangent-at-Neg-Four':'linear', [48 128]
+MF3 = 'Tangent-at-Neg-Three':'linear', [27 54]
+MF4 = 'Tangent-at-Neg-Two':'linear', [12 16]
+MF5 = 'Tangent-at-Neg-One':'linear', [3 2]
+MF6 = 'Tangent-at-Zero':'linear', [0 0]
+MF7 = 'Tangent-at-One':'linear', [3 -2]
+MF8 = 'Tangent-at-Two':'linear', [12 -16]
+MF9 = 'Tangent-at-Three':'linear', [27 -54]
+MF10 = 'Tangent-at-Four':'linear', [48 -128]
+MF11 = 'Tangent-at-Five':'linear', [75 -250]
+
+[Rules]
+1, 1 (1) : 1
+2, 2 (1) : 1
+3, 3 (1) : 1
+4, 4 (1) : 1
+5, 5 (1) : 1
+6, 6 (1) : 1
+7, 7 (1) : 1
+8, 8 (1) : 1
+9, 9 (1) : 1
+10, 10 (1) : 1
+11, 11 (1) : 1
diff --git a/examples/original/takagi-sugeno/octave/cubic_approximator.fll b/examples/original/takagi-sugeno/octave/cubic_approximator.fll
new file mode 100644
index 0000000..28ba40a
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/cubic_approximator.fll
@@ -0,0 +1,50 @@
+Engine: Cubic-Approximator
+InputVariable: X
+ enabled: true
+ range: -5.000 5.000
+ term: AboutNegFive Triangle -6.000 -5.000 -4.000
+ term: AboutNegFour Triangle -5.000 -4.000 -3.000
+ term: AboutNegThree Triangle -4.000 -3.000 -2.000
+ term: AboutNegTwo Triangle -3.000 -2.000 -1.000
+ term: AboutNegOne Triangle -2.000 -1.000 0.000
+ term: AboutZero Triangle -1.000 0.000 1.000
+ term: AboutOne Triangle 0.000 1.000 2.000
+ term: AboutTwo Triangle 1.000 2.000 3.000
+ term: AboutThree Triangle 2.000 3.000 4.000
+ term: AboutFour Triangle 3.000 4.000 5.000
+ term: AboutFive Triangle 4.000 5.000 6.000
+OutputVariable: ApproxXCubed
+ enabled: true
+ range: -5.000 5.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: TangentatNegFive Linear 75.000 250.000
+ term: TangentatNegFour Linear 48.000 128.000
+ term: TangentatNegThree Linear 27.000 54.000
+ term: TangentatNegTwo Linear 12.000 16.000
+ term: TangentatNegOne Linear 3.000 2.000
+ term: TangentatZero Linear 0.000 0.000
+ term: TangentatOne Linear 3.000 -2.000
+ term: TangentatTwo Linear 12.000 -16.000
+ term: TangentatThree Linear 27.000 -54.000
+ term: TangentatFour Linear 48.000 -128.000
+ term: TangentatFive Linear 75.000 -250.000
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: none
+ rule: if X is AboutNegFive then ApproxXCubed is TangentatNegFive
+ rule: if X is AboutNegFour then ApproxXCubed is TangentatNegFour
+ rule: if X is AboutNegThree then ApproxXCubed is TangentatNegThree
+ rule: if X is AboutNegTwo then ApproxXCubed is TangentatNegTwo
+ rule: if X is AboutNegOne then ApproxXCubed is TangentatNegOne
+ rule: if X is AboutZero then ApproxXCubed is TangentatZero
+ rule: if X is AboutOne then ApproxXCubed is TangentatOne
+ rule: if X is AboutTwo then ApproxXCubed is TangentatTwo
+ rule: if X is AboutThree then ApproxXCubed is TangentatThree
+ rule: if X is AboutFour then ApproxXCubed is TangentatFour
+ rule: if X is AboutFive then ApproxXCubed is TangentatFive
diff --git a/examples/original/takagi-sugeno/octave/heart_disease_risk.fis b/examples/original/takagi-sugeno/octave/heart_disease_risk.fis
new file mode 100644
index 0000000..e0e18e0
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/heart_disease_risk.fis
@@ -0,0 +1,90 @@
+## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
+##
+## This file is part of the fuzzy-logic-toolkit.
+##
+## The fuzzy-logic-toolkit is free software; you can redistribute it
+## and/or modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 3 of
+## the License, or (at your option) any later version.
+##
+## The fuzzy-logic-toolkit is distributed in the hope that it will be
+## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with the fuzzy-logic-toolkit; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+## Author: L. Markowsky
+## Keywords: fuzzy-logic-toolkit fis
+## Directory: fuzzy-logic-toolkit/inst/
+## Filename: heart_disease_risk.fis
+## Last-Modified: 28 Aug 2012
+
+## Heart Disease Risk FIS
+
+[System]
+
+ Name = 'Heart-Disease-Risk'
+ Type = 'sugeno'
+ Version = 2.0
+ NumInputs = 2
+ NumOutputs = 1
+ NumRules = 15
+ AndMethod = 'min'
+ OrMethod = 'max'
+ ImpMethod = 'prod'
+ AggMethod = 'sum'
+ DefuzzMethod = 'wtaver'
+
+[Input1]
+
+ Name = 'LDL-Level'
+ Range = [0 300]
+ NumMFs = 5
+ MF1 = 'Low' : 'trapmf', [-1 0 90 110]
+ MF2 = 'Low-Borderline' : 'trapmf', [90 110 120 140]
+ MF3 = 'Borderline' : 'trapmf', [120 140 150 170]
+ MF4 = 'High-Borderline' : 'trapmf', [150 170 180 200]
+ MF5 = 'High' : 'trapmf', [180 200 300 301]
+
+[Input2]
+
+ Name = 'HDL-Level'
+ Range = [0 100]
+ NumMFs = 3
+
+ MF1 = 'Low-HDL' : 'trapmf', [-1 0 35 45]
+ MF2 = 'Moderate-HDL' : 'trapmf', [35 45 55 65]
+ MF3 = 'High-HDL' : 'trapmf', [55 65 100 101]
+
+[Output1]
+
+ Name = 'Heart-Disease-Risk'
+ Range = [0 10]
+ NumMFs = 5
+
+ MF1 = 'No-Risk' : 'constant', [0]
+ MF2 = 'Low-Risk' : 'constant', [2.5]
+ MF3 = 'Medium-Risk' : 'constant', [5]
+ MF4 = 'High-Risk' : 'constant', [7.5]
+ MF5 = 'Extreme-Risk' : 'constant', [10]
+
+[Rules]
+
+ 1 1, 3 (1) : 1
+ 1 2, 2 (1) : 1
+ 1 3, 1 (1) : 1
+ 2 1, 3 (1) : 1
+ 2 2, 2 (1) : 1
+ 2 3, 2 (1) : 1
+ 3 1, 4 (1) : 1
+ 3 2, 3 (1) : 1
+ 3 3, 2 (1) : 1
+ 4 1, 4 (1) : 1
+ 4 2, 4 (1) : 1
+ 4 3, 3 (1) : 1
+ 5 1, 5 (1) : 1
+ 5 2, 4 (1) : 1
+ 5 3, 3 (1) : 1
diff --git a/examples/original/takagi-sugeno/octave/heart_disease_risk.fll b/examples/original/takagi-sugeno/octave/heart_disease_risk.fll
new file mode 100644
index 0000000..c401dd4
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/heart_disease_risk.fll
@@ -0,0 +1,48 @@
+Engine: Heart-Disease-Risk
+InputVariable: LDLLevel
+ enabled: true
+ range: 0.000 300.000
+ term: Low Trapezoid -1.000 0.000 90.000 110.000
+ term: LowBorderline Trapezoid 90.000 110.000 120.000 140.000
+ term: Borderline Trapezoid 120.000 140.000 150.000 170.000
+ term: HighBorderline Trapezoid 150.000 170.000 180.000 200.000
+ term: High Trapezoid 180.000 200.000 300.000 301.000
+InputVariable: HDLLevel
+ enabled: true
+ range: 0.000 100.000
+ term: LowHDL Trapezoid -1.000 0.000 35.000 45.000
+ term: ModerateHDL Trapezoid 35.000 45.000 55.000 65.000
+ term: HighHDL Trapezoid 55.000 65.000 100.000 101.000
+OutputVariable: HeartDiseaseRisk
+ enabled: true
+ range: 0.000 10.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: NoRisk Constant 0.000
+ term: LowRisk Constant 2.500
+ term: MediumRisk Constant 5.000
+ term: HighRisk Constant 7.500
+ term: ExtremeRisk Constant 10.000
+RuleBlock:
+ enabled: true
+ conjunction: Minimum
+ disjunction: none
+ activation: none
+ rule: if LDLLevel is Low and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk
+ rule: if LDLLevel is Low and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk
+ rule: if LDLLevel is Low and HDLLevel is HighHDL then HeartDiseaseRisk is NoRisk
+ rule: if LDLLevel is LowBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk
+ rule: if LDLLevel is LowBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk
+ rule: if LDLLevel is LowBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk
+ rule: if LDLLevel is Borderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk
+ rule: if LDLLevel is Borderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is MediumRisk
+ rule: if LDLLevel is Borderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk
+ rule: if LDLLevel is HighBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk
+ rule: if LDLLevel is HighBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk
+ rule: if LDLLevel is HighBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk
+ rule: if LDLLevel is High and HDLLevel is LowHDL then HeartDiseaseRisk is ExtremeRisk
+ rule: if LDLLevel is High and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk
+ rule: if LDLLevel is High and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk
diff --git a/examples/original/takagi-sugeno/octave/linear_tip_calculator.fis b/examples/original/takagi-sugeno/octave/linear_tip_calculator.fis
new file mode 100644
index 0000000..f387ce1
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/linear_tip_calculator.fis
@@ -0,0 +1,64 @@
+## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
+##
+## This file is part of the fuzzy-logic-toolkit.
+##
+## The fuzzy-logic-toolkit is free software; you can redistribute it
+## and/or modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 3 of
+## the License, or (at your option) any later version.
+##
+## The fuzzy-logic-toolkit is distributed in the hope that it will be
+## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with the fuzzy-logic-toolkit; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+## Author: L. Markowsky
+## Keywords: fuzzy-logic-toolkit fis
+## Directory: fuzzy-logic-toolkit/inst/
+## Filename: linear_tip_calculator.fis
+## Last-Modified: 28 Aug 2012
+
+[System]
+Name='Linear-Tip-Calculator'
+Type='sugeno'
+Version=2.0
+NumInputs=2
+NumOutputs=1
+NumRules=4
+AndMethod='min'
+OrMethod='max'
+ImpMethod='prod'
+AggMethod='sum'
+DefuzzMethod='wtaver'
+
+[Input1]
+Name='Food-Quality'
+Range=[1 10]
+NumMFs=2
+MF1='Bad':'trapmf',[0 1 3 7]
+MF2='Good':'trapmf',[3 7 10 11]
+
+[Input2]
+Name='Service'
+Range=[1 10]
+NumMFs=2
+MF1='Bad':'trapmf',[0 1 3 7]
+MF2='Good':'trapmf',[3 7 10 11]
+
+[Output1]
+Name='Tip'
+Range=[10 20]
+NumMFs=3
+MF1='Ten-Percent':'linear',[0 0 10]
+MF2='Fifteen-Percent':'linear',[0 0 15]
+MF3='Twenty-Percent':'linear',[0 0 20]
+
+[Rules]
+1 1, 1 (1) : 1
+1 2, 2 (1) : 1
+2 1, 2 (1) : 1
+2 2, 3 (1) : 1
diff --git a/examples/original/takagi-sugeno/octave/linear_tip_calculator.fll b/examples/original/takagi-sugeno/octave/linear_tip_calculator.fll
new file mode 100644
index 0000000..34b0334
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/linear_tip_calculator.fll
@@ -0,0 +1,31 @@
+Engine: Linear-Tip-Calculator
+InputVariable: FoodQuality
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+InputVariable: Service
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+OutputVariable: Tip
+ enabled: true
+ range: 10.000 20.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: TenPercent Linear 0.000 0.000 10.000
+ term: FifteenPercent Linear 0.000 0.000 15.000
+ term: TwentyPercent Linear 0.000 0.000 20.000
+RuleBlock:
+ enabled: true
+ conjunction: Minimum
+ disjunction: none
+ activation: none
+ rule: if FoodQuality is Bad and Service is Bad then Tip is TenPercent
+ rule: if FoodQuality is Bad and Service is Good then Tip is FifteenPercent
+ rule: if FoodQuality is Good and Service is Bad then Tip is FifteenPercent
+ rule: if FoodQuality is Good and Service is Good then Tip is TwentyPercent
diff --git a/examples/original/takagi-sugeno/octave/sugeno_tip_calculator.fis b/examples/original/takagi-sugeno/octave/sugeno_tip_calculator.fis
new file mode 100644
index 0000000..78786df
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/sugeno_tip_calculator.fis
@@ -0,0 +1,98 @@
+## Copyright (C) 2011-2012 L. Markowsky <lmarkov@users.sourceforge.net>
+##
+## This file is part of the fuzzy-logic-toolkit.
+##
+## The fuzzy-logic-toolkit is free software; you can redistribute it
+## and/or modify it under the terms of the GNU General Public License
+## as published by the Free Software Foundation; either version 3 of
+## the License, or (at your option) any later version.
+##
+## The fuzzy-logic-toolkit is distributed in the hope that it will be
+## useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with the fuzzy-logic-toolkit; see the file COPYING. If not,
+## see <http://www.gnu.org/licenses/>.
+
+## Author: L. Markowsky
+## Keywords: fuzzy-logic-toolkit fis
+## Directory: fuzzy-logic-toolkit/inst/
+## Filename: sugeno_tip_calculator.fis
+## Last-Modified: 28 Aug 2012
+
+% Sugeno Tip Calculator
+
+% Computes cheap, average, and generous tips
+% given food quality and service ratings.
+
+[System]
+
+Name = 'Sugeno-Tip-Calculator'
+Type = 'sugeno'
+Version = 1.0
+NumInputs = 2
+NumOutputs = 3
+NumRules = 10
+AndMethod = 'einstein_product'
+OrMethod = 'einstein_sum'
+ImpMethod = 'prod'
+AggMethod = 'sum'
+DefuzzMethod = 'wtaver'
+
+[Input1]
+
+Name = 'Food-Quality'
+Range = [1 10]
+NumMFs = 2
+MF1 = 'Bad' : 'trapmf', [0 1 3 7]
+MF2 = 'Good' : 'trapmf', [3 7 10 11]
+
+[Input2]
+
+Name = 'Service'
+Range = [1 10]
+NumMFs = 2
+MF1 = 'Bad' : 'trapmf', [0 1 3 7]
+MF2 = 'Good' : 'trapmf', [3 7 10 11]
+
+[Output1]
+
+Name = 'Cheap-Tip'
+Range = [5 25]
+NumMFs = 3
+MF1 = 'Low' : 'constant', [10]
+MF2 = 'Medium' : 'constant', [15]
+MF3 = 'High' : 'constant', [20]
+
+[Output2]
+
+Name = 'Average-Tip'
+Range = [5 25]
+NumMFs = 3
+MF1 = 'Low' : 'constant', [10]
+MF2 = 'Medium' : 'constant', [15]
+MF3 = 'High' : 'constant', [20]
+
+[Output3]
+
+Name = 'Generous-Tip'
+Range = [5 25]
+NumMFs = 3
+MF1 = 'Low' : 'constant', [10]
+MF2 = 'Medium' : 'constant', [15]
+MF3 = 'High' : 'constant', [20]
+
+[Rules]
+
+ 1.30 1.30, 1.30 1.20 1.00 (1) : 1
+ 2.00 1.30, 1.00 1.00 2.00 (1) : 1
+ 2.20 1.20, 1.00 2.00 3.00 (1) : 1
+ 1.00 1.00, 1.00 1.00 2.00 (1) : 1
+ 2.00 1.00, 1.00 2.00 3.00 (1) : 1
+ 2.30 1.00, 1.00 2.00 3.20 (1) : 1
+ 1.00 2.00, 1.00 2.00 3.00 (1) : 1
+ 2.00 2.00, 2.00 2.00 3.20 (1) : 1
+ 1.20 2.20, 1.00 2.00 3.00 (1) : 1
+ 2.40 2.40, 3.00 3.20 3.30 (1) : 1
diff --git a/examples/original/takagi-sugeno/octave/sugeno_tip_calculator.fll b/examples/original/takagi-sugeno/octave/sugeno_tip_calculator.fll
new file mode 100644
index 0000000..2006e71
--- /dev/null
+++ b/examples/original/takagi-sugeno/octave/sugeno_tip_calculator.fll
@@ -0,0 +1,59 @@
+Engine: Sugeno-Tip-Calculator
+InputVariable: FoodQuality
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+InputVariable: Service
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+OutputVariable: CheapTip
+ enabled: true
+ range: 5.000 25.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: Low Constant 10.000
+ term: Medium Constant 15.000
+ term: High Constant 20.000
+OutputVariable: AverageTip
+ enabled: true
+ range: 5.000 25.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: Low Constant 10.000
+ term: Medium Constant 15.000
+ term: High Constant 20.000
+OutputVariable: GenerousTip
+ enabled: true
+ range: 5.000 25.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: Low Constant 10.000
+ term: Medium Constant 15.000
+ term: High Constant 20.000
+RuleBlock:
+ enabled: true
+ conjunction: EinsteinProduct
+ disjunction: none
+ activation: none
+ rule: if FoodQuality is extremely Bad and Service is extremely Bad then CheapTip is extremely Low and AverageTip is very Low and GenerousTip is Low
+ rule: if FoodQuality is Good and Service is extremely Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium
+ rule: if FoodQuality is very Good and Service is very Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ rule: if FoodQuality is Bad and Service is Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium
+ rule: if FoodQuality is Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ rule: if FoodQuality is extremely Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is very High
+ rule: if FoodQuality is Bad and Service is Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ rule: if FoodQuality is Good and Service is Good then CheapTip is Medium and AverageTip is Medium and GenerousTip is very High
+ rule: if FoodQuality is very Bad and Service is very Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ rule: if FoodQuality is very very Good and Service is very very Good then CheapTip is High and AverageTip is very High and GenerousTip is extremely High
diff --git a/examples/original/tsukamoto/tsukamoto.fis b/examples/original/tsukamoto/tsukamoto.fis
new file mode 100644
index 0000000..711e427
--- /dev/null
+++ b/examples/original/tsukamoto/tsukamoto.fis
@@ -0,0 +1,65 @@
+[System]
+Name=''
+Type='sugeno'
+Version=4.0
+NumInputs=1
+NumOutputs=3
+NumRules=3
+AndMethod=''
+OrMethod=''
+ImpMethod='prod'
+AggMethod='sum'
+DefuzzMethod='wtaver'
+
+[Input1]
+Enabled=1
+Name='X'
+Range=[-10.000 10.000]
+NumMFs=3
+MF1='small':'gbellmf',[5.000 3.000 -10.000]
+MF2='medium':'gbellmf',[5.000 3.000 0.000]
+MF3='large':'gbellmf',[5.000 3.000 10.000]
+
+
+[Output1]
+Enabled=1
+Name='A'
+Range=[0.000 1.000]
+Default=nan
+LockPrevious=0
+LockRange=0
+NumMFs=3
+MF1='a1':'rampmf',[0.000 0.250]
+MF2='a2':'rampmf',[0.600 0.400]
+MF3='a3':'rampmf',[0.700 1.000]
+
+[Output2]
+Enabled=1
+Name='B'
+Range=[0.000 1.000]
+Default=nan
+LockPrevious=0
+LockRange=0
+NumMFs=3
+MF1='b1':'sigmf',[30.000 0.130]
+MF2='b2':'sigmf',[-30.000 0.500]
+MF3='b3':'sigmf',[30.000 0.830]
+
+[Output3]
+Enabled=1
+Name='C'
+Range=[0.000 1.000]
+Default=nan
+LockPrevious=0
+LockRange=0
+NumMFs=3
+MF1='c1':'smf',[0.000 0.250]
+MF2='c2':'zmf',[0.300 0.600]
+MF3='c3':'smf',[0.700 1.000]
+
+
+[Rules]
+1.0 , 1.0 1.0 1.0 (1) : 1
+2.0 , 2.0 2.0 2.0 (1) : 1
+3.0 , 3.0 3.0 3.0 (1) : 1
+
diff --git a/examples/original/tsukamoto/tsukamoto.fll b/examples/original/tsukamoto/tsukamoto.fll
new file mode 100644
index 0000000..1811b81
--- /dev/null
+++ b/examples/original/tsukamoto/tsukamoto.fll
@@ -0,0 +1,59 @@
+Engine:
+InputVariable: X
+ enabled: true
+ range: -10.000 10.000
+ term: small Bell -10.000 5.000 3.000
+ term: medium Bell 0.000 5.000 3.000
+ term: large Bell 10.000 5.000 3.000
+OutputVariable: Ramps
+ enabled: true
+ range: 0.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: b Ramp 0.600 0.400
+ term: a Ramp 0.000 0.250
+ term: c Ramp 0.700 1.000
+OutputVariable: Sigmoids
+ enabled: true
+ range: 0.020 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: b Sigmoid 0.500 -30.000
+ term: a Sigmoid 0.130 30.000
+ term: c Sigmoid 0.830 30.000
+OutputVariable: ZSShapes
+ enabled: true
+ range: 0.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: b ZShape 0.300 0.600
+ term: a SShape 0.000 0.250
+ term: c SShape 0.700 1.000
+OutputVariable: Concaves
+ enabled: true
+ range: 0.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: b Concave 0.500 0.400
+ term: a Concave 0.240 0.250
+ term: c Concave 0.900 1.000
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: none
+ rule: if X is small then Ramps is a and Sigmoids is a and ZSShapes is a and Concaves is a
+ rule: if X is medium then Ramps is b and Sigmoids is b and ZSShapes is b and Concaves is b
+ rule: if X is large then Ramps is c and Sigmoids is c and ZSShapes is c and Concaves is c \ No newline at end of file
diff --git a/examples/takagi-sugeno/SimpleDimmer.cpp b/examples/takagi-sugeno/SimpleDimmer.cpp
new file mode 100644
index 0000000..bd7e6ee
--- /dev/null
+++ b/examples/takagi-sugeno/SimpleDimmer.cpp
@@ -0,0 +1,44 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("simple-dimmer");
+
+InputVariable* inputVariable = new InputVariable;
+inputVariable->setEnabled(true);
+inputVariable->setName("Ambient");
+inputVariable->setRange(0.000, 1.000);
+inputVariable->addTerm(new Triangle("DARK", 0.000, 0.250, 0.500));
+inputVariable->addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+inputVariable->addTerm(new Triangle("BRIGHT", 0.500, 0.750, 1.000));
+engine->addInputVariable(inputVariable);
+
+OutputVariable* outputVariable = new OutputVariable;
+outputVariable->setEnabled(true);
+outputVariable->setName("Power");
+outputVariable->setRange(0.000, 1.000);
+outputVariable->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable->setDefaultValue(fl::nan);
+outputVariable->setLockPreviousOutputValue(false);
+outputVariable->setLockOutputValueInRange(false);
+outputVariable->addTerm(new Constant("LOW", 0.250));
+outputVariable->addTerm(new Constant("MEDIUM", 0.500));
+outputVariable->addTerm(new Constant("HIGH", 0.750));
+engine->addOutputVariable(outputVariable);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(fl::null);
+ruleBlock->setDisjunction(fl::null);
+ruleBlock->setActivation(fl::null);
+ruleBlock->addRule(fl::Rule::parse("if Ambient is DARK then Power is HIGH", engine));
+ruleBlock->addRule(fl::Rule::parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
+ruleBlock->addRule(fl::Rule::parse("if Ambient is BRIGHT then Power is LOW", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/takagi-sugeno/SimpleDimmer.fcl b/examples/takagi-sugeno/SimpleDimmer.fcl
new file mode 100644
index 0000000..65ccd94
--- /dev/null
+++ b/examples/takagi-sugeno/SimpleDimmer.fcl
@@ -0,0 +1,33 @@
+FUNCTION_BLOCK simple-dimmer
+
+VAR_INPUT
+ Ambient: REAL;
+END_VAR
+
+VAR_OUTPUT
+ Power: REAL;
+END_VAR
+
+FUZZIFY Ambient
+ RANGE := (0.000 .. 1.000);
+ TERM DARK := Triangle 0.000 0.250 0.500;
+ TERM MEDIUM := Triangle 0.250 0.500 0.750;
+ TERM BRIGHT := Triangle 0.500 0.750 1.000;
+END_FUZZIFY
+
+DEFUZZIFY Power
+ RANGE := (0.000 .. 1.000);
+ TERM LOW := 0.250;
+ TERM MEDIUM := 0.500;
+ TERM HIGH := 0.750;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ RULE 1 : if Ambient is DARK then Power is HIGH
+ RULE 2 : if Ambient is MEDIUM then Power is MEDIUM
+ RULE 3 : if Ambient is BRIGHT then Power is LOW
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/takagi-sugeno/SimpleDimmer.fis b/examples/takagi-sugeno/SimpleDimmer.fis
new file mode 100644
index 0000000..9557f61
--- /dev/null
+++ b/examples/takagi-sugeno/SimpleDimmer.fis
@@ -0,0 +1,32 @@
+[System]
+Name='simple-dimmer'
+Type='sugeno'
+NumInputs=1
+NumOutputs=1
+NumRules=3
+AndMethod=''
+OrMethod=''
+ImpMethod=''
+AggMethod=''
+DefuzzMethod='wtaver'
+
+[Input1]
+Name='Ambient'
+Range=[0.000 1.000]
+NumMFs=3
+MF1='DARK':'trimf',[0.000 0.250 0.500]
+MF2='MEDIUM':'trimf',[0.250 0.500 0.750]
+MF3='BRIGHT':'trimf',[0.500 0.750 1.000]
+
+[Output1]
+Name='Power'
+Range=[0.000 1.000]
+NumMFs=3
+MF1='LOW':'constant',[0.250]
+MF2='MEDIUM':'constant',[0.500]
+MF3='HIGH':'constant',[0.750]
+
+[Rules]
+1.000 , 3.000 (1.000) : 1
+2.000 , 2.000 (1.000) : 1
+3.000 , 1.000 (1.000) : 1
diff --git a/examples/takagi-sugeno/SimpleDimmer.fld b/examples/takagi-sugeno/SimpleDimmer.fld
new file mode 100644
index 0000000..6efef0a
--- /dev/null
+++ b/examples/takagi-sugeno/SimpleDimmer.fld
@@ -0,0 +1,1026 @@
+#@Engine: simple-dimmer;
+#@InputVariable: Ambient; @OutputVariable: Power;
+0.00000000 nan
+0.00097752 0.75000000
+0.00195503 0.75000000
+0.00293255 0.75000000
+0.00391007 0.75000000
+0.00488759 0.75000000
+0.00586510 0.75000000
+0.00684262 0.75000000
+0.00782014 0.75000000
+0.00879765 0.75000000
+0.00977517 0.75000000
+0.01075269 0.75000000
+0.01173021 0.75000000
+0.01270772 0.75000000
+0.01368524 0.75000000
+0.01466276 0.75000000
+0.01564027 0.75000000
+0.01661779 0.75000000
+0.01759531 0.75000000
+0.01857283 0.75000000
+0.01955034 0.75000000
+0.02052786 0.75000000
+0.02150538 0.75000000
+0.02248289 0.75000000
+0.02346041 0.75000000
+0.02443793 0.75000000
+0.02541544 0.75000000
+0.02639296 0.75000000
+0.02737048 0.75000000
+0.02834800 0.75000000
+0.02932551 0.75000000
+0.03030303 0.75000000
+0.03128055 0.75000000
+0.03225806 0.75000000
+0.03323558 0.75000000
+0.03421310 0.75000000
+0.03519062 0.75000000
+0.03616813 0.75000000
+0.03714565 0.75000000
+0.03812317 0.75000000
+0.03910068 0.75000000
+0.04007820 0.75000000
+0.04105572 0.75000000
+0.04203324 0.75000000
+0.04301075 0.75000000
+0.04398827 0.75000000
+0.04496579 0.75000000
+0.04594330 0.75000000
+0.04692082 0.75000000
+0.04789834 0.75000000
+0.04887586 0.75000000
+0.04985337 0.75000000
+0.05083089 0.75000000
+0.05180841 0.75000000
+0.05278592 0.75000000
+0.05376344 0.75000000
+0.05474096 0.75000000
+0.05571848 0.75000000
+0.05669599 0.75000000
+0.05767351 0.75000000
+0.05865103 0.75000000
+0.05962854 0.75000000
+0.06060606 0.75000000
+0.06158358 0.75000000
+0.06256109 0.75000000
+0.06353861 0.75000000
+0.06451613 0.75000000
+0.06549365 0.75000000
+0.06647116 0.75000000
+0.06744868 0.75000000
+0.06842620 0.75000000
+0.06940371 0.75000000
+0.07038123 0.75000000
+0.07135875 0.75000000
+0.07233627 0.75000000
+0.07331378 0.75000000
+0.07429130 0.75000000
+0.07526882 0.75000000
+0.07624633 0.75000000
+0.07722385 0.75000000
+0.07820137 0.75000000
+0.07917889 0.75000000
+0.08015640 0.75000000
+0.08113392 0.75000000
+0.08211144 0.75000000
+0.08308895 0.75000000
+0.08406647 0.75000000
+0.08504399 0.75000000
+0.08602151 0.75000000
+0.08699902 0.75000000
+0.08797654 0.75000000
+0.08895406 0.75000000
+0.08993157 0.75000000
+0.09090909 0.75000000
+0.09188661 0.75000000
+0.09286413 0.75000000
+0.09384164 0.75000000
+0.09481916 0.75000000
+0.09579668 0.75000000
+0.09677419 0.75000000
+0.09775171 0.75000000
+0.09872923 0.75000000
+0.09970674 0.75000000
+0.10068426 0.75000000
+0.10166178 0.75000000
+0.10263930 0.75000000
+0.10361681 0.75000000
+0.10459433 0.75000000
+0.10557185 0.75000000
+0.10654936 0.75000000
+0.10752688 0.75000000
+0.10850440 0.75000000
+0.10948192 0.75000000
+0.11045943 0.75000000
+0.11143695 0.75000000
+0.11241447 0.75000000
+0.11339198 0.75000000
+0.11436950 0.75000000
+0.11534702 0.75000000
+0.11632454 0.75000000
+0.11730205 0.75000000
+0.11827957 0.75000000
+0.11925709 0.75000000
+0.12023460 0.75000000
+0.12121212 0.75000000
+0.12218964 0.75000000
+0.12316716 0.75000000
+0.12414467 0.75000000
+0.12512219 0.75000000
+0.12609971 0.75000000
+0.12707722 0.75000000
+0.12805474 0.75000000
+0.12903226 0.75000000
+0.13000978 0.75000000
+0.13098729 0.75000000
+0.13196481 0.75000000
+0.13294233 0.75000000
+0.13391984 0.75000000
+0.13489736 0.75000000
+0.13587488 0.75000000
+0.13685239 0.75000000
+0.13782991 0.75000000
+0.13880743 0.75000000
+0.13978495 0.75000000
+0.14076246 0.75000000
+0.14173998 0.75000000
+0.14271750 0.75000000
+0.14369501 0.75000000
+0.14467253 0.75000000
+0.14565005 0.75000000
+0.14662757 0.75000000
+0.14760508 0.75000000
+0.14858260 0.75000000
+0.14956012 0.75000000
+0.15053763 0.75000000
+0.15151515 0.75000000
+0.15249267 0.75000000
+0.15347019 0.75000000
+0.15444770 0.75000000
+0.15542522 0.75000000
+0.15640274 0.75000000
+0.15738025 0.75000000
+0.15835777 0.75000000
+0.15933529 0.75000000
+0.16031281 0.75000000
+0.16129032 0.75000000
+0.16226784 0.75000000
+0.16324536 0.75000000
+0.16422287 0.75000000
+0.16520039 0.75000000
+0.16617791 0.75000000
+0.16715543 0.75000000
+0.16813294 0.75000000
+0.16911046 0.75000000
+0.17008798 0.75000000
+0.17106549 0.75000000
+0.17204301 0.75000000
+0.17302053 0.75000000
+0.17399804 0.75000000
+0.17497556 0.75000000
+0.17595308 0.75000000
+0.17693060 0.75000000
+0.17790811 0.75000000
+0.17888563 0.75000000
+0.17986315 0.75000000
+0.18084066 0.75000000
+0.18181818 0.75000000
+0.18279570 0.75000000
+0.18377322 0.75000000
+0.18475073 0.75000000
+0.18572825 0.75000000
+0.18670577 0.75000000
+0.18768328 0.75000000
+0.18866080 0.75000000
+0.18963832 0.75000000
+0.19061584 0.75000000
+0.19159335 0.75000000
+0.19257087 0.75000000
+0.19354839 0.75000000
+0.19452590 0.75000000
+0.19550342 0.75000000
+0.19648094 0.75000000
+0.19745846 0.75000000
+0.19843597 0.75000000
+0.19941349 0.75000000
+0.20039101 0.75000000
+0.20136852 0.75000000
+0.20234604 0.75000000
+0.20332356 0.75000000
+0.20430108 0.75000000
+0.20527859 0.75000000
+0.20625611 0.75000000
+0.20723363 0.75000000
+0.20821114 0.75000000
+0.20918866 0.75000000
+0.21016618 0.75000000
+0.21114370 0.75000000
+0.21212121 0.75000000
+0.21309873 0.75000000
+0.21407625 0.75000000
+0.21505376 0.75000000
+0.21603128 0.75000000
+0.21700880 0.75000000
+0.21798631 0.75000000
+0.21896383 0.75000000
+0.21994135 0.75000000
+0.22091887 0.75000000
+0.22189638 0.75000000
+0.22287390 0.75000000
+0.22385142 0.75000000
+0.22482893 0.75000000
+0.22580645 0.75000000
+0.22678397 0.75000000
+0.22776149 0.75000000
+0.22873900 0.75000000
+0.22971652 0.75000000
+0.23069404 0.75000000
+0.23167155 0.75000000
+0.23264907 0.75000000
+0.23362659 0.75000000
+0.23460411 0.75000000
+0.23558162 0.75000000
+0.23655914 0.75000000
+0.23753666 0.75000000
+0.23851417 0.75000000
+0.23949169 0.75000000
+0.24046921 0.75000000
+0.24144673 0.75000000
+0.24242424 0.75000000
+0.24340176 0.75000000
+0.24437928 0.75000000
+0.24535679 0.75000000
+0.24633431 0.75000000
+0.24731183 0.75000000
+0.24828935 0.75000000
+0.24926686 0.75000000
+0.25024438 0.74975562
+0.25122190 0.74877810
+0.25219941 0.74780059
+0.25317693 0.74682307
+0.25415445 0.74584555
+0.25513196 0.74486804
+0.25610948 0.74389052
+0.25708700 0.74291300
+0.25806452 0.74193548
+0.25904203 0.74095797
+0.26001955 0.73998045
+0.26099707 0.73900293
+0.26197458 0.73802542
+0.26295210 0.73704790
+0.26392962 0.73607038
+0.26490714 0.73509286
+0.26588465 0.73411535
+0.26686217 0.73313783
+0.26783969 0.73216031
+0.26881720 0.73118280
+0.26979472 0.73020528
+0.27077224 0.72922776
+0.27174976 0.72825024
+0.27272727 0.72727273
+0.27370479 0.72629521
+0.27468231 0.72531769
+0.27565982 0.72434018
+0.27663734 0.72336266
+0.27761486 0.72238514
+0.27859238 0.72140762
+0.27956989 0.72043011
+0.28054741 0.71945259
+0.28152493 0.71847507
+0.28250244 0.71749756
+0.28347996 0.71652004
+0.28445748 0.71554252
+0.28543500 0.71456500
+0.28641251 0.71358749
+0.28739003 0.71260997
+0.28836755 0.71163245
+0.28934506 0.71065494
+0.29032258 0.70967742
+0.29130010 0.70869990
+0.29227761 0.70772239
+0.29325513 0.70674487
+0.29423265 0.70576735
+0.29521017 0.70478983
+0.29618768 0.70381232
+0.29716520 0.70283480
+0.29814272 0.70185728
+0.29912023 0.70087977
+0.30009775 0.69990225
+0.30107527 0.69892473
+0.30205279 0.69794721
+0.30303030 0.69696970
+0.30400782 0.69599218
+0.30498534 0.69501466
+0.30596285 0.69403715
+0.30694037 0.69305963
+0.30791789 0.69208211
+0.30889541 0.69110459
+0.30987292 0.69012708
+0.31085044 0.68914956
+0.31182796 0.68817204
+0.31280547 0.68719453
+0.31378299 0.68621701
+0.31476051 0.68523949
+0.31573803 0.68426197
+0.31671554 0.68328446
+0.31769306 0.68230694
+0.31867058 0.68132942
+0.31964809 0.68035191
+0.32062561 0.67937439
+0.32160313 0.67839687
+0.32258065 0.67741935
+0.32355816 0.67644184
+0.32453568 0.67546432
+0.32551320 0.67448680
+0.32649071 0.67350929
+0.32746823 0.67253177
+0.32844575 0.67155425
+0.32942326 0.67057674
+0.33040078 0.66959922
+0.33137830 0.66862170
+0.33235582 0.66764418
+0.33333333 0.66666667
+0.33431085 0.66568915
+0.33528837 0.66471163
+0.33626588 0.66373412
+0.33724340 0.66275660
+0.33822092 0.66177908
+0.33919844 0.66080156
+0.34017595 0.65982405
+0.34115347 0.65884653
+0.34213099 0.65786901
+0.34310850 0.65689150
+0.34408602 0.65591398
+0.34506354 0.65493646
+0.34604106 0.65395894
+0.34701857 0.65298143
+0.34799609 0.65200391
+0.34897361 0.65102639
+0.34995112 0.65004888
+0.35092864 0.64907136
+0.35190616 0.64809384
+0.35288368 0.64711632
+0.35386119 0.64613881
+0.35483871 0.64516129
+0.35581623 0.64418377
+0.35679374 0.64320626
+0.35777126 0.64222874
+0.35874878 0.64125122
+0.35972630 0.64027370
+0.36070381 0.63929619
+0.36168133 0.63831867
+0.36265885 0.63734115
+0.36363636 0.63636364
+0.36461388 0.63538612
+0.36559140 0.63440860
+0.36656891 0.63343109
+0.36754643 0.63245357
+0.36852395 0.63147605
+0.36950147 0.63049853
+0.37047898 0.62952102
+0.37145650 0.62854350
+0.37243402 0.62756598
+0.37341153 0.62658847
+0.37438905 0.62561095
+0.37536657 0.62463343
+0.37634409 0.62365591
+0.37732160 0.62267840
+0.37829912 0.62170088
+0.37927664 0.62072336
+0.38025415 0.61974585
+0.38123167 0.61876833
+0.38220919 0.61779081
+0.38318671 0.61681329
+0.38416422 0.61583578
+0.38514174 0.61485826
+0.38611926 0.61388074
+0.38709677 0.61290323
+0.38807429 0.61192571
+0.38905181 0.61094819
+0.39002933 0.60997067
+0.39100684 0.60899316
+0.39198436 0.60801564
+0.39296188 0.60703812
+0.39393939 0.60606061
+0.39491691 0.60508309
+0.39589443 0.60410557
+0.39687195 0.60312805
+0.39784946 0.60215054
+0.39882698 0.60117302
+0.39980450 0.60019550
+0.40078201 0.59921799
+0.40175953 0.59824047
+0.40273705 0.59726295
+0.40371457 0.59628543
+0.40469208 0.59530792
+0.40566960 0.59433040
+0.40664712 0.59335288
+0.40762463 0.59237537
+0.40860215 0.59139785
+0.40957967 0.59042033
+0.41055718 0.58944282
+0.41153470 0.58846530
+0.41251222 0.58748778
+0.41348974 0.58651026
+0.41446725 0.58553275
+0.41544477 0.58455523
+0.41642229 0.58357771
+0.41739980 0.58260020
+0.41837732 0.58162268
+0.41935484 0.58064516
+0.42033236 0.57966764
+0.42130987 0.57869013
+0.42228739 0.57771261
+0.42326491 0.57673509
+0.42424242 0.57575758
+0.42521994 0.57478006
+0.42619746 0.57380254
+0.42717498 0.57282502
+0.42815249 0.57184751
+0.42913001 0.57086999
+0.43010753 0.56989247
+0.43108504 0.56891496
+0.43206256 0.56793744
+0.43304008 0.56695992
+0.43401760 0.56598240
+0.43499511 0.56500489
+0.43597263 0.56402737
+0.43695015 0.56304985
+0.43792766 0.56207234
+0.43890518 0.56109482
+0.43988270 0.56011730
+0.44086022 0.55913978
+0.44183773 0.55816227
+0.44281525 0.55718475
+0.44379277 0.55620723
+0.44477028 0.55522972
+0.44574780 0.55425220
+0.44672532 0.55327468
+0.44770283 0.55229717
+0.44868035 0.55131965
+0.44965787 0.55034213
+0.45063539 0.54936461
+0.45161290 0.54838710
+0.45259042 0.54740958
+0.45356794 0.54643206
+0.45454545 0.54545455
+0.45552297 0.54447703
+0.45650049 0.54349951
+0.45747801 0.54252199
+0.45845552 0.54154448
+0.45943304 0.54056696
+0.46041056 0.53958944
+0.46138807 0.53861193
+0.46236559 0.53763441
+0.46334311 0.53665689
+0.46432063 0.53567937
+0.46529814 0.53470186
+0.46627566 0.53372434
+0.46725318 0.53274682
+0.46823069 0.53176931
+0.46920821 0.53079179
+0.47018573 0.52981427
+0.47116325 0.52883675
+0.47214076 0.52785924
+0.47311828 0.52688172
+0.47409580 0.52590420
+0.47507331 0.52492669
+0.47605083 0.52394917
+0.47702835 0.52297165
+0.47800587 0.52199413
+0.47898338 0.52101662
+0.47996090 0.52003910
+0.48093842 0.51906158
+0.48191593 0.51808407
+0.48289345 0.51710655
+0.48387097 0.51612903
+0.48484848 0.51515152
+0.48582600 0.51417400
+0.48680352 0.51319648
+0.48778104 0.51221896
+0.48875855 0.51124145
+0.48973607 0.51026393
+0.49071359 0.50928641
+0.49169110 0.50830890
+0.49266862 0.50733138
+0.49364614 0.50635386
+0.49462366 0.50537634
+0.49560117 0.50439883
+0.49657869 0.50342131
+0.49755621 0.50244379
+0.49853372 0.50146628
+0.49951124 0.50048876
+0.50048876 0.49951124
+0.50146628 0.49853372
+0.50244379 0.49755621
+0.50342131 0.49657869
+0.50439883 0.49560117
+0.50537634 0.49462366
+0.50635386 0.49364614
+0.50733138 0.49266862
+0.50830890 0.49169110
+0.50928641 0.49071359
+0.51026393 0.48973607
+0.51124145 0.48875855
+0.51221896 0.48778104
+0.51319648 0.48680352
+0.51417400 0.48582600
+0.51515152 0.48484848
+0.51612903 0.48387097
+0.51710655 0.48289345
+0.51808407 0.48191593
+0.51906158 0.48093842
+0.52003910 0.47996090
+0.52101662 0.47898338
+0.52199413 0.47800587
+0.52297165 0.47702835
+0.52394917 0.47605083
+0.52492669 0.47507331
+0.52590420 0.47409580
+0.52688172 0.47311828
+0.52785924 0.47214076
+0.52883675 0.47116325
+0.52981427 0.47018573
+0.53079179 0.46920821
+0.53176931 0.46823069
+0.53274682 0.46725318
+0.53372434 0.46627566
+0.53470186 0.46529814
+0.53567937 0.46432063
+0.53665689 0.46334311
+0.53763441 0.46236559
+0.53861193 0.46138807
+0.53958944 0.46041056
+0.54056696 0.45943304
+0.54154448 0.45845552
+0.54252199 0.45747801
+0.54349951 0.45650049
+0.54447703 0.45552297
+0.54545455 0.45454545
+0.54643206 0.45356794
+0.54740958 0.45259042
+0.54838710 0.45161290
+0.54936461 0.45063539
+0.55034213 0.44965787
+0.55131965 0.44868035
+0.55229717 0.44770283
+0.55327468 0.44672532
+0.55425220 0.44574780
+0.55522972 0.44477028
+0.55620723 0.44379277
+0.55718475 0.44281525
+0.55816227 0.44183773
+0.55913978 0.44086022
+0.56011730 0.43988270
+0.56109482 0.43890518
+0.56207234 0.43792766
+0.56304985 0.43695015
+0.56402737 0.43597263
+0.56500489 0.43499511
+0.56598240 0.43401760
+0.56695992 0.43304008
+0.56793744 0.43206256
+0.56891496 0.43108504
+0.56989247 0.43010753
+0.57086999 0.42913001
+0.57184751 0.42815249
+0.57282502 0.42717498
+0.57380254 0.42619746
+0.57478006 0.42521994
+0.57575758 0.42424242
+0.57673509 0.42326491
+0.57771261 0.42228739
+0.57869013 0.42130987
+0.57966764 0.42033236
+0.58064516 0.41935484
+0.58162268 0.41837732
+0.58260020 0.41739980
+0.58357771 0.41642229
+0.58455523 0.41544477
+0.58553275 0.41446725
+0.58651026 0.41348974
+0.58748778 0.41251222
+0.58846530 0.41153470
+0.58944282 0.41055718
+0.59042033 0.40957967
+0.59139785 0.40860215
+0.59237537 0.40762463
+0.59335288 0.40664712
+0.59433040 0.40566960
+0.59530792 0.40469208
+0.59628543 0.40371457
+0.59726295 0.40273705
+0.59824047 0.40175953
+0.59921799 0.40078201
+0.60019550 0.39980450
+0.60117302 0.39882698
+0.60215054 0.39784946
+0.60312805 0.39687195
+0.60410557 0.39589443
+0.60508309 0.39491691
+0.60606061 0.39393939
+0.60703812 0.39296188
+0.60801564 0.39198436
+0.60899316 0.39100684
+0.60997067 0.39002933
+0.61094819 0.38905181
+0.61192571 0.38807429
+0.61290323 0.38709677
+0.61388074 0.38611926
+0.61485826 0.38514174
+0.61583578 0.38416422
+0.61681329 0.38318671
+0.61779081 0.38220919
+0.61876833 0.38123167
+0.61974585 0.38025415
+0.62072336 0.37927664
+0.62170088 0.37829912
+0.62267840 0.37732160
+0.62365591 0.37634409
+0.62463343 0.37536657
+0.62561095 0.37438905
+0.62658847 0.37341153
+0.62756598 0.37243402
+0.62854350 0.37145650
+0.62952102 0.37047898
+0.63049853 0.36950147
+0.63147605 0.36852395
+0.63245357 0.36754643
+0.63343109 0.36656891
+0.63440860 0.36559140
+0.63538612 0.36461388
+0.63636364 0.36363636
+0.63734115 0.36265885
+0.63831867 0.36168133
+0.63929619 0.36070381
+0.64027370 0.35972630
+0.64125122 0.35874878
+0.64222874 0.35777126
+0.64320626 0.35679374
+0.64418377 0.35581623
+0.64516129 0.35483871
+0.64613881 0.35386119
+0.64711632 0.35288368
+0.64809384 0.35190616
+0.64907136 0.35092864
+0.65004888 0.34995112
+0.65102639 0.34897361
+0.65200391 0.34799609
+0.65298143 0.34701857
+0.65395894 0.34604106
+0.65493646 0.34506354
+0.65591398 0.34408602
+0.65689150 0.34310850
+0.65786901 0.34213099
+0.65884653 0.34115347
+0.65982405 0.34017595
+0.66080156 0.33919844
+0.66177908 0.33822092
+0.66275660 0.33724340
+0.66373412 0.33626588
+0.66471163 0.33528837
+0.66568915 0.33431085
+0.66666667 0.33333333
+0.66764418 0.33235582
+0.66862170 0.33137830
+0.66959922 0.33040078
+0.67057674 0.32942326
+0.67155425 0.32844575
+0.67253177 0.32746823
+0.67350929 0.32649071
+0.67448680 0.32551320
+0.67546432 0.32453568
+0.67644184 0.32355816
+0.67741935 0.32258065
+0.67839687 0.32160313
+0.67937439 0.32062561
+0.68035191 0.31964809
+0.68132942 0.31867058
+0.68230694 0.31769306
+0.68328446 0.31671554
+0.68426197 0.31573803
+0.68523949 0.31476051
+0.68621701 0.31378299
+0.68719453 0.31280547
+0.68817204 0.31182796
+0.68914956 0.31085044
+0.69012708 0.30987292
+0.69110459 0.30889541
+0.69208211 0.30791789
+0.69305963 0.30694037
+0.69403715 0.30596285
+0.69501466 0.30498534
+0.69599218 0.30400782
+0.69696970 0.30303030
+0.69794721 0.30205279
+0.69892473 0.30107527
+0.69990225 0.30009775
+0.70087977 0.29912023
+0.70185728 0.29814272
+0.70283480 0.29716520
+0.70381232 0.29618768
+0.70478983 0.29521017
+0.70576735 0.29423265
+0.70674487 0.29325513
+0.70772239 0.29227761
+0.70869990 0.29130010
+0.70967742 0.29032258
+0.71065494 0.28934506
+0.71163245 0.28836755
+0.71260997 0.28739003
+0.71358749 0.28641251
+0.71456500 0.28543500
+0.71554252 0.28445748
+0.71652004 0.28347996
+0.71749756 0.28250244
+0.71847507 0.28152493
+0.71945259 0.28054741
+0.72043011 0.27956989
+0.72140762 0.27859238
+0.72238514 0.27761486
+0.72336266 0.27663734
+0.72434018 0.27565982
+0.72531769 0.27468231
+0.72629521 0.27370479
+0.72727273 0.27272727
+0.72825024 0.27174976
+0.72922776 0.27077224
+0.73020528 0.26979472
+0.73118280 0.26881720
+0.73216031 0.26783969
+0.73313783 0.26686217
+0.73411535 0.26588465
+0.73509286 0.26490714
+0.73607038 0.26392962
+0.73704790 0.26295210
+0.73802542 0.26197458
+0.73900293 0.26099707
+0.73998045 0.26001955
+0.74095797 0.25904203
+0.74193548 0.25806452
+0.74291300 0.25708700
+0.74389052 0.25610948
+0.74486804 0.25513196
+0.74584555 0.25415445
+0.74682307 0.25317693
+0.74780059 0.25219941
+0.74877810 0.25122190
+0.74975562 0.25024438
+0.75073314 0.25000000
+0.75171065 0.25000000
+0.75268817 0.25000000
+0.75366569 0.25000000
+0.75464321 0.25000000
+0.75562072 0.25000000
+0.75659824 0.25000000
+0.75757576 0.25000000
+0.75855327 0.25000000
+0.75953079 0.25000000
+0.76050831 0.25000000
+0.76148583 0.25000000
+0.76246334 0.25000000
+0.76344086 0.25000000
+0.76441838 0.25000000
+0.76539589 0.25000000
+0.76637341 0.25000000
+0.76735093 0.25000000
+0.76832845 0.25000000
+0.76930596 0.25000000
+0.77028348 0.25000000
+0.77126100 0.25000000
+0.77223851 0.25000000
+0.77321603 0.25000000
+0.77419355 0.25000000
+0.77517107 0.25000000
+0.77614858 0.25000000
+0.77712610 0.25000000
+0.77810362 0.25000000
+0.77908113 0.25000000
+0.78005865 0.25000000
+0.78103617 0.25000000
+0.78201369 0.25000000
+0.78299120 0.25000000
+0.78396872 0.25000000
+0.78494624 0.25000000
+0.78592375 0.25000000
+0.78690127 0.25000000
+0.78787879 0.25000000
+0.78885630 0.25000000
+0.78983382 0.25000000
+0.79081134 0.25000000
+0.79178886 0.25000000
+0.79276637 0.25000000
+0.79374389 0.25000000
+0.79472141 0.25000000
+0.79569892 0.25000000
+0.79667644 0.25000000
+0.79765396 0.25000000
+0.79863148 0.25000000
+0.79960899 0.25000000
+0.80058651 0.25000000
+0.80156403 0.25000000
+0.80254154 0.25000000
+0.80351906 0.25000000
+0.80449658 0.25000000
+0.80547410 0.25000000
+0.80645161 0.25000000
+0.80742913 0.25000000
+0.80840665 0.25000000
+0.80938416 0.25000000
+0.81036168 0.25000000
+0.81133920 0.25000000
+0.81231672 0.25000000
+0.81329423 0.25000000
+0.81427175 0.25000000
+0.81524927 0.25000000
+0.81622678 0.25000000
+0.81720430 0.25000000
+0.81818182 0.25000000
+0.81915934 0.25000000
+0.82013685 0.25000000
+0.82111437 0.25000000
+0.82209189 0.25000000
+0.82306940 0.25000000
+0.82404692 0.25000000
+0.82502444 0.25000000
+0.82600196 0.25000000
+0.82697947 0.25000000
+0.82795699 0.25000000
+0.82893451 0.25000000
+0.82991202 0.25000000
+0.83088954 0.25000000
+0.83186706 0.25000000
+0.83284457 0.25000000
+0.83382209 0.25000000
+0.83479961 0.25000000
+0.83577713 0.25000000
+0.83675464 0.25000000
+0.83773216 0.25000000
+0.83870968 0.25000000
+0.83968719 0.25000000
+0.84066471 0.25000000
+0.84164223 0.25000000
+0.84261975 0.25000000
+0.84359726 0.25000000
+0.84457478 0.25000000
+0.84555230 0.25000000
+0.84652981 0.25000000
+0.84750733 0.25000000
+0.84848485 0.25000000
+0.84946237 0.25000000
+0.85043988 0.25000000
+0.85141740 0.25000000
+0.85239492 0.25000000
+0.85337243 0.25000000
+0.85434995 0.25000000
+0.85532747 0.25000000
+0.85630499 0.25000000
+0.85728250 0.25000000
+0.85826002 0.25000000
+0.85923754 0.25000000
+0.86021505 0.25000000
+0.86119257 0.25000000
+0.86217009 0.25000000
+0.86314761 0.25000000
+0.86412512 0.25000000
+0.86510264 0.25000000
+0.86608016 0.25000000
+0.86705767 0.25000000
+0.86803519 0.25000000
+0.86901271 0.25000000
+0.86999022 0.25000000
+0.87096774 0.25000000
+0.87194526 0.25000000
+0.87292278 0.25000000
+0.87390029 0.25000000
+0.87487781 0.25000000
+0.87585533 0.25000000
+0.87683284 0.25000000
+0.87781036 0.25000000
+0.87878788 0.25000000
+0.87976540 0.25000000
+0.88074291 0.25000000
+0.88172043 0.25000000
+0.88269795 0.25000000
+0.88367546 0.25000000
+0.88465298 0.25000000
+0.88563050 0.25000000
+0.88660802 0.25000000
+0.88758553 0.25000000
+0.88856305 0.25000000
+0.88954057 0.25000000
+0.89051808 0.25000000
+0.89149560 0.25000000
+0.89247312 0.25000000
+0.89345064 0.25000000
+0.89442815 0.25000000
+0.89540567 0.25000000
+0.89638319 0.25000000
+0.89736070 0.25000000
+0.89833822 0.25000000
+0.89931574 0.25000000
+0.90029326 0.25000000
+0.90127077 0.25000000
+0.90224829 0.25000000
+0.90322581 0.25000000
+0.90420332 0.25000000
+0.90518084 0.25000000
+0.90615836 0.25000000
+0.90713587 0.25000000
+0.90811339 0.25000000
+0.90909091 0.25000000
+0.91006843 0.25000000
+0.91104594 0.25000000
+0.91202346 0.25000000
+0.91300098 0.25000000
+0.91397849 0.25000000
+0.91495601 0.25000000
+0.91593353 0.25000000
+0.91691105 0.25000000
+0.91788856 0.25000000
+0.91886608 0.25000000
+0.91984360 0.25000000
+0.92082111 0.25000000
+0.92179863 0.25000000
+0.92277615 0.25000000
+0.92375367 0.25000000
+0.92473118 0.25000000
+0.92570870 0.25000000
+0.92668622 0.25000000
+0.92766373 0.25000000
+0.92864125 0.25000000
+0.92961877 0.25000000
+0.93059629 0.25000000
+0.93157380 0.25000000
+0.93255132 0.25000000
+0.93352884 0.25000000
+0.93450635 0.25000000
+0.93548387 0.25000000
+0.93646139 0.25000000
+0.93743891 0.25000000
+0.93841642 0.25000000
+0.93939394 0.25000000
+0.94037146 0.25000000
+0.94134897 0.25000000
+0.94232649 0.25000000
+0.94330401 0.25000000
+0.94428152 0.25000000
+0.94525904 0.25000000
+0.94623656 0.25000000
+0.94721408 0.25000000
+0.94819159 0.25000000
+0.94916911 0.25000000
+0.95014663 0.25000000
+0.95112414 0.25000000
+0.95210166 0.25000000
+0.95307918 0.25000000
+0.95405670 0.25000000
+0.95503421 0.25000000
+0.95601173 0.25000000
+0.95698925 0.25000000
+0.95796676 0.25000000
+0.95894428 0.25000000
+0.95992180 0.25000000
+0.96089932 0.25000000
+0.96187683 0.25000000
+0.96285435 0.25000000
+0.96383187 0.25000000
+0.96480938 0.25000000
+0.96578690 0.25000000
+0.96676442 0.25000000
+0.96774194 0.25000000
+0.96871945 0.25000000
+0.96969697 0.25000000
+0.97067449 0.25000000
+0.97165200 0.25000000
+0.97262952 0.25000000
+0.97360704 0.25000000
+0.97458456 0.25000000
+0.97556207 0.25000000
+0.97653959 0.25000000
+0.97751711 0.25000000
+0.97849462 0.25000000
+0.97947214 0.25000000
+0.98044966 0.25000000
+0.98142717 0.25000000
+0.98240469 0.25000000
+0.98338221 0.25000000
+0.98435973 0.25000000
+0.98533724 0.25000000
+0.98631476 0.25000000
+0.98729228 0.25000000
+0.98826979 0.25000000
+0.98924731 0.25000000
+0.99022483 0.25000000
+0.99120235 0.25000000
+0.99217986 0.25000000
+0.99315738 0.25000000
+0.99413490 0.25000000
+0.99511241 0.25000000
+0.99608993 0.25000000
+0.99706745 0.25000000
+0.99804497 0.25000000
+0.99902248 0.25000000
+1.00000000 nan
diff --git a/examples/takagi-sugeno/SimpleDimmer.fll b/examples/takagi-sugeno/SimpleDimmer.fll
new file mode 100644
index 0000000..038c785
--- /dev/null
+++ b/examples/takagi-sugeno/SimpleDimmer.fll
@@ -0,0 +1,26 @@
+Engine: simple-dimmer
+InputVariable: Ambient
+ enabled: true
+ range: 0.000 1.000
+ term: DARK Triangle 0.000 0.250 0.500
+ term: MEDIUM Triangle 0.250 0.500 0.750
+ term: BRIGHT Triangle 0.500 0.750 1.000
+OutputVariable: Power
+ enabled: true
+ range: 0.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: LOW Constant 0.250
+ term: MEDIUM Constant 0.500
+ term: HIGH Constant 0.750
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: none
+ rule: if Ambient is DARK then Power is HIGH
+ rule: if Ambient is MEDIUM then Power is MEDIUM
+ rule: if Ambient is BRIGHT then Power is LOW \ No newline at end of file
diff --git a/examples/takagi-sugeno/SimpleDimmer.java b/examples/takagi-sugeno/SimpleDimmer.java
new file mode 100644
index 0000000..6d60f0e
--- /dev/null
+++ b/examples/takagi-sugeno/SimpleDimmer.java
@@ -0,0 +1,54 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class SimpleDimmer{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("simple-dimmer");
+
+InputVariable inputVariable = new InputVariable();
+inputVariable.setEnabled(true);
+inputVariable.setName("Ambient");
+inputVariable.setRange(0.000, 1.000);
+inputVariable.addTerm(new Triangle("DARK", 0.000, 0.250, 0.500));
+inputVariable.addTerm(new Triangle("MEDIUM", 0.250, 0.500, 0.750));
+inputVariable.addTerm(new Triangle("BRIGHT", 0.500, 0.750, 1.000));
+engine.addInputVariable(inputVariable);
+
+OutputVariable outputVariable = new OutputVariable();
+outputVariable.setEnabled(true);
+outputVariable.setName("Power");
+outputVariable.setRange(0.000, 1.000);
+outputVariable.fuzzyOutput().setAccumulation(null);
+outputVariable.setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable.setDefaultValue(Double.NaN);
+outputVariable.setLockPreviousOutputValue(false);
+outputVariable.setLockOutputValueInRange(false);
+outputVariable.addTerm(new Constant("LOW", 0.250));
+outputVariable.addTerm(new Constant("MEDIUM", 0.500));
+outputVariable.addTerm(new Constant("HIGH", 0.750));
+engine.addOutputVariable(outputVariable);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(null);
+ruleBlock.setDisjunction(null);
+ruleBlock.setActivation(null);
+ruleBlock.addRule(Rule.parse("if Ambient is DARK then Power is HIGH", engine));
+ruleBlock.addRule(Rule.parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
+ruleBlock.addRule(Rule.parse("if Ambient is BRIGHT then Power is LOW", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/takagi-sugeno/approximation.cpp b/examples/takagi-sugeno/approximation.cpp
new file mode 100644
index 0000000..178f162
--- /dev/null
+++ b/examples/takagi-sugeno/approximation.cpp
@@ -0,0 +1,87 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("approximation of sin(x)/x");
+
+InputVariable* inputVariable = new InputVariable;
+inputVariable->setEnabled(true);
+inputVariable->setName("inputX");
+inputVariable->setRange(0.000, 10.000);
+inputVariable->addTerm(new Triangle("NEAR_1", 0.000, 1.000, 2.000));
+inputVariable->addTerm(new Triangle("NEAR_2", 1.000, 2.000, 3.000));
+inputVariable->addTerm(new Triangle("NEAR_3", 2.000, 3.000, 4.000));
+inputVariable->addTerm(new Triangle("NEAR_4", 3.000, 4.000, 5.000));
+inputVariable->addTerm(new Triangle("NEAR_5", 4.000, 5.000, 6.000));
+inputVariable->addTerm(new Triangle("NEAR_6", 5.000, 6.000, 7.000));
+inputVariable->addTerm(new Triangle("NEAR_7", 6.000, 7.000, 8.000));
+inputVariable->addTerm(new Triangle("NEAR_8", 7.000, 8.000, 9.000));
+inputVariable->addTerm(new Triangle("NEAR_9", 8.000, 9.000, 10.000));
+engine->addInputVariable(inputVariable);
+
+OutputVariable* outputVariable1 = new OutputVariable;
+outputVariable1->setEnabled(true);
+outputVariable1->setName("outputFx");
+outputVariable1->setRange(-1.000, 1.000);
+outputVariable1->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable1->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable1->setDefaultValue(fl::nan);
+outputVariable1->setLockPreviousOutputValue(true);
+outputVariable1->setLockOutputValueInRange(false);
+outputVariable1->addTerm(new Constant("f1", 0.840));
+outputVariable1->addTerm(new Constant("f2", 0.450));
+outputVariable1->addTerm(new Constant("f3", 0.040));
+outputVariable1->addTerm(new Constant("f4", -0.180));
+outputVariable1->addTerm(new Constant("f5", -0.190));
+outputVariable1->addTerm(new Constant("f6", -0.040));
+outputVariable1->addTerm(new Constant("f7", 0.090));
+outputVariable1->addTerm(new Constant("f8", 0.120));
+outputVariable1->addTerm(new Constant("f9", 0.040));
+engine->addOutputVariable(outputVariable1);
+
+OutputVariable* outputVariable2 = new OutputVariable;
+outputVariable2->setEnabled(true);
+outputVariable2->setName("trueFx");
+outputVariable2->setRange(-1.000, 1.000);
+outputVariable2->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable2->setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable2->setDefaultValue(fl::nan);
+outputVariable2->setLockPreviousOutputValue(true);
+outputVariable2->setLockOutputValueInRange(false);
+outputVariable2->addTerm(Function::create("fx", "sin(inputX)/inputX", engine));
+engine->addOutputVariable(outputVariable2);
+
+OutputVariable* outputVariable3 = new OutputVariable;
+outputVariable3->setEnabled(true);
+outputVariable3->setName("diffFx");
+outputVariable3->setRange(-1.000, 1.000);
+outputVariable3->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable3->setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable3->setDefaultValue(fl::nan);
+outputVariable3->setLockPreviousOutputValue(false);
+outputVariable3->setLockOutputValueInRange(false);
+outputVariable3->addTerm(Function::create("diff", "fabs(outputFx-trueFx)", engine));
+engine->addOutputVariable(outputVariable3);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(fl::null);
+ruleBlock->setDisjunction(fl::null);
+ruleBlock->setActivation(fl::null);
+ruleBlock->addRule(fl::Rule::parse("if inputX is NEAR_1 then outputFx is f1", engine));
+ruleBlock->addRule(fl::Rule::parse("if inputX is NEAR_2 then outputFx is f2", engine));
+ruleBlock->addRule(fl::Rule::parse("if inputX is NEAR_3 then outputFx is f3", engine));
+ruleBlock->addRule(fl::Rule::parse("if inputX is NEAR_4 then outputFx is f4", engine));
+ruleBlock->addRule(fl::Rule::parse("if inputX is NEAR_5 then outputFx is f5", engine));
+ruleBlock->addRule(fl::Rule::parse("if inputX is NEAR_6 then outputFx is f6", engine));
+ruleBlock->addRule(fl::Rule::parse("if inputX is NEAR_7 then outputFx is f7", engine));
+ruleBlock->addRule(fl::Rule::parse("if inputX is NEAR_8 then outputFx is f8", engine));
+ruleBlock->addRule(fl::Rule::parse("if inputX is NEAR_9 then outputFx is f9", engine));
+ruleBlock->addRule(fl::Rule::parse("if inputX is any then trueFx is fx and diffFx is diff", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/takagi-sugeno/approximation.fcl b/examples/takagi-sugeno/approximation.fcl
new file mode 100644
index 0000000..8b5f121
--- /dev/null
+++ b/examples/takagi-sugeno/approximation.fcl
@@ -0,0 +1,68 @@
+FUNCTION_BLOCK approximation of sin(x)/x
+
+VAR_INPUT
+ inputX: REAL;
+END_VAR
+
+VAR_OUTPUT
+ outputFx: REAL;
+ trueFx: REAL;
+ diffFx: REAL;
+END_VAR
+
+FUZZIFY inputX
+ RANGE := (0.000 .. 10.000);
+ TERM NEAR_1 := Triangle 0.000 1.000 2.000;
+ TERM NEAR_2 := Triangle 1.000 2.000 3.000;
+ TERM NEAR_3 := Triangle 2.000 3.000 4.000;
+ TERM NEAR_4 := Triangle 3.000 4.000 5.000;
+ TERM NEAR_5 := Triangle 4.000 5.000 6.000;
+ TERM NEAR_6 := Triangle 5.000 6.000 7.000;
+ TERM NEAR_7 := Triangle 6.000 7.000 8.000;
+ TERM NEAR_8 := Triangle 7.000 8.000 9.000;
+ TERM NEAR_9 := Triangle 8.000 9.000 10.000;
+END_FUZZIFY
+
+DEFUZZIFY outputFx
+ RANGE := (-1.000 .. 1.000);
+ TERM f1 := 0.840;
+ TERM f2 := 0.450;
+ TERM f3 := 0.040;
+ TERM f4 := -0.180;
+ TERM f5 := -0.190;
+ TERM f6 := -0.040;
+ TERM f7 := 0.090;
+ TERM f8 := 0.120;
+ TERM f9 := 0.040;
+ METHOD : COGS;
+ DEFAULT := nan | NC;
+END_DEFUZZIFY
+
+DEFUZZIFY trueFx
+ RANGE := (-1.000 .. 1.000);
+ TERM fx := Function sin(inputX)/inputX;
+ METHOD : COGS;
+ DEFAULT := nan | NC;
+END_DEFUZZIFY
+
+DEFUZZIFY diffFx
+ RANGE := (-1.000 .. 1.000);
+ TERM diff := Function fabs(outputFx-trueFx);
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ RULE 1 : if inputX is NEAR_1 then outputFx is f1
+ RULE 2 : if inputX is NEAR_2 then outputFx is f2
+ RULE 3 : if inputX is NEAR_3 then outputFx is f3
+ RULE 4 : if inputX is NEAR_4 then outputFx is f4
+ RULE 5 : if inputX is NEAR_5 then outputFx is f5
+ RULE 6 : if inputX is NEAR_6 then outputFx is f6
+ RULE 7 : if inputX is NEAR_7 then outputFx is f7
+ RULE 8 : if inputX is NEAR_8 then outputFx is f8
+ RULE 9 : if inputX is NEAR_9 then outputFx is f9
+ RULE 10 : if inputX is any then trueFx is fx and diffFx is diff
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/takagi-sugeno/approximation.fis b/examples/takagi-sugeno/approximation.fis
new file mode 100644
index 0000000..73075bc
--- /dev/null
+++ b/examples/takagi-sugeno/approximation.fis
@@ -0,0 +1,65 @@
+[System]
+Name='approximation of sin(x)/x'
+Type='sugeno'
+NumInputs=1
+NumOutputs=3
+NumRules=10
+AndMethod=''
+OrMethod=''
+ImpMethod=''
+AggMethod=''
+DefuzzMethod='wtaver'
+
+[Input1]
+Name='inputX'
+Range=[0.000 10.000]
+NumMFs=9
+MF1='NEAR_1':'trimf',[0.000 1.000 2.000]
+MF2='NEAR_2':'trimf',[1.000 2.000 3.000]
+MF3='NEAR_3':'trimf',[2.000 3.000 4.000]
+MF4='NEAR_4':'trimf',[3.000 4.000 5.000]
+MF5='NEAR_5':'trimf',[4.000 5.000 6.000]
+MF6='NEAR_6':'trimf',[5.000 6.000 7.000]
+MF7='NEAR_7':'trimf',[6.000 7.000 8.000]
+MF8='NEAR_8':'trimf',[7.000 8.000 9.000]
+MF9='NEAR_9':'trimf',[8.000 9.000 10.000]
+
+[Output1]
+Name='outputFx'
+Range=[-1.000 1.000]
+LockPrevious=1
+NumMFs=9
+MF1='f1':'constant',[0.840]
+MF2='f2':'constant',[0.450]
+MF3='f3':'constant',[0.040]
+MF4='f4':'constant',[-0.180]
+MF5='f5':'constant',[-0.190]
+MF6='f6':'constant',[-0.040]
+MF7='f7':'constant',[0.090]
+MF8='f8':'constant',[0.120]
+MF9='f9':'constant',[0.040]
+
+[Output2]
+Name='trueFx'
+Range=[-1.000 1.000]
+LockPrevious=1
+NumMFs=1
+MF1='fx':'function',[sin(inputX)/inputX]
+
+[Output3]
+Name='diffFx'
+Range=[-1.000 1.000]
+NumMFs=1
+MF1='diff':'function',[fabs(outputFx-trueFx)]
+
+[Rules]
+1.000 , 1.000 0.000 0.000 (1.000) : 1
+2.000 , 2.000 0.000 0.000 (1.000) : 1
+3.000 , 3.000 0.000 0.000 (1.000) : 1
+4.000 , 4.000 0.000 0.000 (1.000) : 1
+5.000 , 5.000 0.000 0.000 (1.000) : 1
+6.000 , 6.000 0.000 0.000 (1.000) : 1
+7.000 , 7.000 0.000 0.000 (1.000) : 1
+8.000 , 8.000 0.000 0.000 (1.000) : 1
+9.000 , 9.000 0.000 0.000 (1.000) : 1
+0.990 , 0.000 1.000 1.000 (1.000) : 1
diff --git a/examples/takagi-sugeno/approximation.fld b/examples/takagi-sugeno/approximation.fld
new file mode 100644
index 0000000..36bdbd8
--- /dev/null
+++ b/examples/takagi-sugeno/approximation.fld
@@ -0,0 +1,1026 @@
+#@Engine: approximation of sin(x)/x;
+#@InputVariable: inputX; @OutputVariable: outputFx; @OutputVariable: trueFx; @OutputVariable: diffFx;
+0.00000000 nan nan nan
+0.00977517 0.84000000 0.99998407 0.15998407
+0.01955034 0.84000000 0.99993630 0.15993630
+0.02932551 0.84000000 0.99985668 0.15985668
+0.03910068 0.84000000 0.99974521 0.15974521
+0.04887586 0.84000000 0.99960191 0.15960191
+0.05865103 0.84000000 0.99942677 0.15942677
+0.06842620 0.84000000 0.99921983 0.15921983
+0.07820137 0.84000000 0.99898107 0.15898107
+0.08797654 0.84000000 0.99871052 0.15871052
+0.09775171 0.84000000 0.99840819 0.15840819
+0.10752688 0.84000000 0.99807411 0.15807411
+0.11730205 0.84000000 0.99770828 0.15770828
+0.12707722 0.84000000 0.99731074 0.15731074
+0.13685239 0.84000000 0.99688149 0.15688149
+0.14662757 0.84000000 0.99642058 0.15642058
+0.15640274 0.84000000 0.99592801 0.15592801
+0.16617791 0.84000000 0.99540383 0.15540383
+0.17595308 0.84000000 0.99484807 0.15484807
+0.18572825 0.84000000 0.99426074 0.15426074
+0.19550342 0.84000000 0.99364190 0.15364190
+0.20527859 0.84000000 0.99299157 0.15299157
+0.21505376 0.84000000 0.99230978 0.15230978
+0.22482893 0.84000000 0.99159659 0.15159659
+0.23460411 0.84000000 0.99085203 0.15085203
+0.24437928 0.84000000 0.99007614 0.15007614
+0.25415445 0.84000000 0.98926897 0.14926897
+0.26392962 0.84000000 0.98843056 0.14843056
+0.27370479 0.84000000 0.98756097 0.14756097
+0.28347996 0.84000000 0.98666023 0.14666023
+0.29325513 0.84000000 0.98572841 0.14572841
+0.30303030 0.84000000 0.98476555 0.14476555
+0.31280547 0.84000000 0.98377172 0.14377172
+0.32258065 0.84000000 0.98274697 0.14274697
+0.33235582 0.84000000 0.98169135 0.14169135
+0.34213099 0.84000000 0.98060493 0.14060493
+0.35190616 0.84000000 0.97948777 0.13948777
+0.36168133 0.84000000 0.97833993 0.13833993
+0.37145650 0.84000000 0.97716148 0.13716148
+0.38123167 0.84000000 0.97595249 0.13595249
+0.39100684 0.84000000 0.97471302 0.13471302
+0.40078201 0.84000000 0.97344315 0.13344315
+0.41055718 0.84000000 0.97214295 0.13214295
+0.42033236 0.84000000 0.97081249 0.13081249
+0.43010753 0.84000000 0.96945185 0.12945185
+0.43988270 0.84000000 0.96806111 0.12806111
+0.44965787 0.84000000 0.96664035 0.12664035
+0.45943304 0.84000000 0.96518964 0.12518964
+0.46920821 0.84000000 0.96370907 0.12370907
+0.47898338 0.84000000 0.96219873 0.12219873
+0.48875855 0.84000000 0.96065870 0.12065870
+0.49853372 0.84000000 0.95908907 0.11908907
+0.50830890 0.84000000 0.95748993 0.11748993
+0.51808407 0.84000000 0.95586137 0.11586137
+0.52785924 0.84000000 0.95420348 0.11420348
+0.53763441 0.84000000 0.95251635 0.11251635
+0.54740958 0.84000000 0.95080010 0.11080010
+0.55718475 0.84000000 0.94905480 0.10905480
+0.56695992 0.84000000 0.94728056 0.10728056
+0.57673509 0.84000000 0.94547749 0.10547749
+0.58651026 0.84000000 0.94364568 0.10364568
+0.59628543 0.84000000 0.94178524 0.10178524
+0.60606061 0.84000000 0.93989628 0.09989628
+0.61583578 0.84000000 0.93797889 0.09797889
+0.62561095 0.84000000 0.93603320 0.09603320
+0.63538612 0.84000000 0.93405932 0.09405932
+0.64516129 0.84000000 0.93205734 0.09205734
+0.65493646 0.84000000 0.93002740 0.09002740
+0.66471163 0.84000000 0.92796960 0.08796960
+0.67448680 0.84000000 0.92588406 0.08588406
+0.68426197 0.84000000 0.92377090 0.08377090
+0.69403715 0.84000000 0.92163024 0.08163024
+0.70381232 0.84000000 0.91946220 0.07946220
+0.71358749 0.84000000 0.91726690 0.07726690
+0.72336266 0.84000000 0.91504448 0.07504448
+0.73313783 0.84000000 0.91279505 0.07279505
+0.74291300 0.84000000 0.91051874 0.07051874
+0.75268817 0.84000000 0.90821568 0.06821568
+0.76246334 0.84000000 0.90588601 0.06588601
+0.77223851 0.84000000 0.90352985 0.06352985
+0.78201369 0.84000000 0.90114734 0.06114734
+0.79178886 0.84000000 0.89873861 0.05873861
+0.80156403 0.84000000 0.89630380 0.05630380
+0.81133920 0.84000000 0.89384305 0.05384305
+0.82111437 0.84000000 0.89135649 0.05135649
+0.83088954 0.84000000 0.88884427 0.04884427
+0.84066471 0.84000000 0.88630653 0.04630653
+0.85043988 0.84000000 0.88374342 0.04374342
+0.86021505 0.84000000 0.88115507 0.04115507
+0.86999022 0.84000000 0.87854163 0.03854163
+0.87976540 0.84000000 0.87590326 0.03590326
+0.88954057 0.84000000 0.87324010 0.03324010
+0.89931574 0.84000000 0.87055230 0.03055230
+0.90909091 0.84000000 0.86784001 0.02784001
+0.91886608 0.84000000 0.86510339 0.02510339
+0.92864125 0.84000000 0.86234258 0.02234258
+0.93841642 0.84000000 0.85955775 0.01955775
+0.94819159 0.84000000 0.85674906 0.01674906
+0.95796676 0.84000000 0.85391665 0.01391665
+0.96774194 0.84000000 0.85106070 0.01106070
+0.97751711 0.84000000 0.84818136 0.00818136
+0.98729228 0.84000000 0.84527878 0.00527878
+0.99706745 0.84000000 0.84235315 0.00235315
+1.00684262 0.83733138 0.83940461 0.00207323
+1.01661779 0.83351906 0.83643334 0.00291428
+1.02639296 0.82970674 0.83343951 0.00373276
+1.03616813 0.82589443 0.83042327 0.00452884
+1.04594330 0.82208211 0.82738481 0.00530270
+1.05571848 0.81826979 0.82432428 0.00605449
+1.06549365 0.81445748 0.82124187 0.00678439
+1.07526882 0.81064516 0.81813774 0.00749258
+1.08504399 0.80683284 0.81501207 0.00817923
+1.09481916 0.80302053 0.81186504 0.00884451
+1.10459433 0.79920821 0.80869682 0.00948860
+1.11436950 0.79539589 0.80550758 0.01011168
+1.12414467 0.79158358 0.80229751 0.01071393
+1.13391984 0.78777126 0.79906678 0.01129552
+1.14369501 0.78395894 0.79581558 0.01185663
+1.15347019 0.78014663 0.79254408 0.01239745
+1.16324536 0.77633431 0.78925248 0.01291816
+1.17302053 0.77252199 0.78594094 0.01341895
+1.18279570 0.76870968 0.78260967 0.01389999
+1.19257087 0.76489736 0.77925884 0.01436147
+1.20234604 0.76108504 0.77588863 0.01480359
+1.21212121 0.75727273 0.77249925 0.01522652
+1.22189638 0.75346041 0.76909087 0.01563046
+1.23167155 0.74964809 0.76566369 0.01601559
+1.24144673 0.74583578 0.76221789 0.01638211
+1.25122190 0.74202346 0.75875367 0.01673021
+1.26099707 0.73821114 0.75527122 0.01706007
+1.27077224 0.73439883 0.75177073 0.01737190
+1.28054741 0.73058651 0.74825240 0.01766589
+1.29032258 0.72677419 0.74471642 0.01794222
+1.30009775 0.72296188 0.74116298 0.01820111
+1.30987292 0.71914956 0.73759230 0.01844274
+1.31964809 0.71533724 0.73400455 0.01866731
+1.32942326 0.71152493 0.73039994 0.01887502
+1.33919844 0.70771261 0.72677868 0.01906607
+1.34897361 0.70390029 0.72314095 0.01924066
+1.35874878 0.70008798 0.71948696 0.01939899
+1.36852395 0.69627566 0.71581692 0.01954126
+1.37829912 0.69246334 0.71213102 0.01966767
+1.38807429 0.68865103 0.70842946 0.01977844
+1.39784946 0.68483871 0.70471246 0.01987375
+1.40762463 0.68102639 0.70098021 0.01995382
+1.41739980 0.67721408 0.69723292 0.02001884
+1.42717498 0.67340176 0.69347080 0.02006904
+1.43695015 0.66958944 0.68969405 0.02010461
+1.44672532 0.66577713 0.68590288 0.02012575
+1.45650049 0.66196481 0.68209750 0.02013269
+1.46627566 0.65815249 0.67827811 0.02012562
+1.47605083 0.65434018 0.67444493 0.02010476
+1.48582600 0.65052786 0.67059817 0.02007031
+1.49560117 0.64671554 0.66673803 0.02002249
+1.50537634 0.64290323 0.66286472 0.01996150
+1.51515152 0.63909091 0.65897847 0.01988756
+1.52492669 0.63527859 0.65507947 0.01980088
+1.53470186 0.63146628 0.65116795 0.01970168
+1.54447703 0.62765396 0.64724411 0.01959016
+1.55425220 0.62384164 0.64330818 0.01946653
+1.56402737 0.62002933 0.63936035 0.01933103
+1.57380254 0.61621701 0.63540086 0.01918385
+1.58357771 0.61240469 0.63142990 0.01902521
+1.59335288 0.60859238 0.62744771 0.01885533
+1.60312805 0.60478006 0.62345448 0.01867443
+1.61290323 0.60096774 0.61945045 0.01848271
+1.62267840 0.59715543 0.61543583 0.01828041
+1.63245357 0.59334311 0.61141083 0.01806772
+1.64222874 0.58953079 0.60737568 0.01784488
+1.65200391 0.58571848 0.60333058 0.01761210
+1.66177908 0.58190616 0.59927576 0.01736960
+1.67155425 0.57809384 0.59521144 0.01711760
+1.68132942 0.57428152 0.59113783 0.01685631
+1.69110459 0.57046921 0.58705516 0.01658596
+1.70087977 0.56665689 0.58296365 0.01630676
+1.71065494 0.56284457 0.57886351 0.01601893
+1.72043011 0.55903226 0.57475496 0.01572270
+1.73020528 0.55521994 0.57063823 0.01541829
+1.73998045 0.55140762 0.56651353 0.01510591
+1.74975562 0.54759531 0.56238109 0.01478578
+1.75953079 0.54378299 0.55824113 0.01445814
+1.76930596 0.53997067 0.55409386 0.01412319
+1.77908113 0.53615836 0.54993952 0.01378116
+1.78885630 0.53234604 0.54577832 0.01343228
+1.79863148 0.52853372 0.54161048 0.01307675
+1.80840665 0.52472141 0.53743622 0.01271481
+1.81818182 0.52090909 0.53325577 0.01234668
+1.82795699 0.51709677 0.52906935 0.01197258
+1.83773216 0.51328446 0.52487718 0.01159273
+1.84750733 0.50947214 0.52067949 0.01120735
+1.85728250 0.50565982 0.51647649 0.01081666
+1.86705767 0.50184751 0.51226841 0.01042090
+1.87683284 0.49803519 0.50805546 0.01002027
+1.88660802 0.49422287 0.50383788 0.00961501
+1.89638319 0.49041056 0.49961589 0.00920533
+1.90615836 0.48659824 0.49538970 0.00879146
+1.91593353 0.48278592 0.49115955 0.00837362
+1.92570870 0.47897361 0.48692564 0.00795203
+1.93548387 0.47516129 0.48268821 0.00752692
+1.94525904 0.47134897 0.47844748 0.00709850
+1.95503421 0.46753666 0.47420366 0.00666700
+1.96480938 0.46372434 0.46995699 0.00623265
+1.97458456 0.45991202 0.46570768 0.00579565
+1.98435973 0.45609971 0.46145595 0.00535624
+1.99413490 0.45228739 0.45720203 0.00491464
+2.00391007 0.44839687 0.45294613 0.00454926
+2.01368524 0.44438905 0.44868849 0.00429944
+2.02346041 0.44038123 0.44442931 0.00404808
+2.03323558 0.43637341 0.44016883 0.00379542
+2.04301075 0.43236559 0.43590726 0.00354167
+2.05278592 0.42835777 0.43164482 0.00328705
+2.06256109 0.42434995 0.42738174 0.00303178
+2.07233627 0.42034213 0.42311822 0.00277609
+2.08211144 0.41633431 0.41885450 0.00252019
+2.09188661 0.41232649 0.41459079 0.00226430
+2.10166178 0.40831867 0.41032731 0.00200864
+2.11143695 0.40431085 0.40606429 0.00175344
+2.12121212 0.40030303 0.40180193 0.00149890
+2.13098729 0.39629521 0.39754045 0.00124524
+2.14076246 0.39228739 0.39328009 0.00099270
+2.15053763 0.38827957 0.38902104 0.00074147
+2.16031281 0.38427175 0.38476354 0.00049179
+2.17008798 0.38026393 0.38050779 0.00024386
+2.17986315 0.37625611 0.37625401 0.00000210
+2.18963832 0.37224829 0.37200242 0.00024587
+2.19941349 0.36824047 0.36775324 0.00048723
+2.20918866 0.36423265 0.36350667 0.00072598
+2.21896383 0.36022483 0.35926294 0.00096189
+2.22873900 0.35621701 0.35502225 0.00119476
+2.23851417 0.35220919 0.35078483 0.00142436
+2.24828935 0.34820137 0.34655088 0.00165049
+2.25806452 0.34419355 0.34232062 0.00187293
+2.26783969 0.34018573 0.33809425 0.00209148
+2.27761486 0.33617791 0.33387200 0.00230591
+2.28739003 0.33217009 0.32965407 0.00251602
+2.29716520 0.32816227 0.32544067 0.00272160
+2.30694037 0.32415445 0.32123201 0.00292244
+2.31671554 0.32014663 0.31702830 0.00311833
+2.32649071 0.31613881 0.31282975 0.00330906
+2.33626588 0.31213099 0.30863657 0.00349442
+2.34604106 0.30812317 0.30444897 0.00367420
+2.35581623 0.30411535 0.30026714 0.00384821
+2.36559140 0.30010753 0.29609130 0.00401622
+2.37536657 0.29609971 0.29192166 0.00417805
+2.38514174 0.29209189 0.28775841 0.00433347
+2.39491691 0.28808407 0.28360177 0.00448230
+2.40469208 0.28407625 0.27945193 0.00462432
+2.41446725 0.28006843 0.27530910 0.00475933
+2.42424242 0.27606061 0.27117348 0.00488713
+2.43401760 0.27205279 0.26704526 0.00500752
+2.44379277 0.26804497 0.26292466 0.00512030
+2.45356794 0.26403715 0.25881187 0.00522527
+2.46334311 0.26002933 0.25470709 0.00532224
+2.47311828 0.25602151 0.25061052 0.00541099
+2.48289345 0.25201369 0.24652234 0.00549134
+2.49266862 0.24800587 0.24244277 0.00556309
+2.50244379 0.24399804 0.23837200 0.00562605
+2.51221896 0.23999022 0.23431022 0.00568001
+2.52199413 0.23598240 0.23025762 0.00572479
+2.53176931 0.23197458 0.22621439 0.00576019
+2.54154448 0.22796676 0.22218074 0.00578602
+2.55131965 0.22395894 0.21815685 0.00580210
+2.56109482 0.21995112 0.21414291 0.00580822
+2.57086999 0.21594330 0.21013910 0.00580420
+2.58064516 0.21193548 0.20614563 0.00578985
+2.59042033 0.20792766 0.20216267 0.00576499
+2.60019550 0.20391984 0.19819042 0.00572942
+2.60997067 0.19991202 0.19422905 0.00568297
+2.61974585 0.19590420 0.19027876 0.00562545
+2.62952102 0.19189638 0.18633972 0.00555666
+2.63929619 0.18788856 0.18241212 0.00547644
+2.64907136 0.18388074 0.17849614 0.00538460
+2.65884653 0.17987292 0.17459196 0.00528096
+2.66862170 0.17586510 0.17069976 0.00516534
+2.67839687 0.17185728 0.16681972 0.00503756
+2.68817204 0.16784946 0.16295202 0.00489744
+2.69794721 0.16384164 0.15909683 0.00474481
+2.70772239 0.15983382 0.15525433 0.00457950
+2.71749756 0.15582600 0.15142469 0.00440132
+2.72727273 0.15181818 0.14760808 0.00421010
+2.73704790 0.14781036 0.14380468 0.00400568
+2.74682307 0.14380254 0.14001466 0.00378788
+2.75659824 0.13979472 0.13623819 0.00355653
+2.76637341 0.13578690 0.13247544 0.00331146
+2.77614858 0.13177908 0.12872657 0.00305251
+2.78592375 0.12777126 0.12499175 0.00277951
+2.79569892 0.12376344 0.12127114 0.00249230
+2.80547410 0.11975562 0.11756492 0.00219070
+2.81524927 0.11574780 0.11387324 0.00187456
+2.82502444 0.11173998 0.11019627 0.00154371
+2.83479961 0.10773216 0.10653416 0.00119801
+2.84457478 0.10372434 0.10288707 0.00083727
+2.85434995 0.09971652 0.09925517 0.00046135
+2.86412512 0.09570870 0.09563860 0.00007010
+2.87390029 0.09170088 0.09203753 0.00033665
+2.88367546 0.08769306 0.08845211 0.00075905
+2.89345064 0.08368524 0.08488250 0.00119726
+2.90322581 0.07967742 0.08132883 0.00165141
+2.91300098 0.07566960 0.07779128 0.00212168
+2.92277615 0.07166178 0.07426997 0.00260819
+2.93255132 0.06765396 0.07076507 0.00311111
+2.94232649 0.06364614 0.06727672 0.00363058
+2.95210166 0.05963832 0.06380506 0.00416674
+2.96187683 0.05563050 0.06035024 0.00471974
+2.97165200 0.05162268 0.05691240 0.00528972
+2.98142717 0.04761486 0.05349169 0.00587683
+2.99120235 0.04360704 0.05008823 0.00648120
+3.00097752 0.03978495 0.04670218 0.00691724
+3.01075269 0.03763441 0.04333367 0.00569927
+3.02052786 0.03548387 0.03998284 0.00449897
+3.03030303 0.03333333 0.03664981 0.00331648
+3.04007820 0.03118280 0.03333473 0.00215193
+3.04985337 0.02903226 0.03003772 0.00100547
+3.05962854 0.02688172 0.02675892 0.00012280
+3.06940371 0.02473118 0.02349846 0.00123272
+3.07917889 0.02258065 0.02025646 0.00232419
+3.08895406 0.02043011 0.01703304 0.00339706
+3.09872923 0.01827957 0.01382835 0.00445122
+3.10850440 0.01612903 0.01064249 0.00548655
+3.11827957 0.01397849 0.00747559 0.00650291
+3.12805474 0.01182796 0.00432777 0.00750019
+3.13782991 0.00967742 0.00119915 0.00847827
+3.14760508 0.00752688 -0.00191015 0.00943703
+3.15738025 0.00537634 -0.00500001 0.01037636
+3.16715543 0.00322581 -0.00807033 0.01129614
+3.17693060 0.00107527 -0.01112098 0.01219625
+3.18670577 -0.00107527 -0.01415186 0.01307659
+3.19648094 -0.00322581 -0.01716285 0.01393705
+3.20625611 -0.00537634 -0.02015385 0.01477750
+3.21603128 -0.00752688 -0.02312474 0.01559786
+3.22580645 -0.00967742 -0.02607543 0.01639801
+3.23558162 -0.01182796 -0.02900580 0.01717785
+3.24535679 -0.01397849 -0.03191576 0.01793727
+3.25513196 -0.01612903 -0.03480520 0.01867617
+3.26490714 -0.01827957 -0.03767402 0.01939445
+3.27468231 -0.02043011 -0.04052213 0.02009202
+3.28445748 -0.02258065 -0.04334942 0.02076878
+3.29423265 -0.02473118 -0.04615581 0.02142462
+3.30400782 -0.02688172 -0.04894118 0.02205946
+3.31378299 -0.02903226 -0.05170547 0.02267321
+3.32355816 -0.03118280 -0.05444857 0.02326577
+3.33333333 -0.03333333 -0.05717039 0.02383706
+3.34310850 -0.03548387 -0.05987085 0.02438698
+3.35288368 -0.03763441 -0.06254985 0.02491545
+3.36265885 -0.03978495 -0.06520733 0.02542238
+3.37243402 -0.04193548 -0.06784318 0.02590770
+3.38220919 -0.04408602 -0.07045733 0.02637131
+3.39198436 -0.04623656 -0.07304971 0.02681315
+3.40175953 -0.04838710 -0.07562022 0.02723313
+3.41153470 -0.05053763 -0.07816880 0.02763117
+3.42130987 -0.05268817 -0.08069537 0.02800720
+3.43108504 -0.05483871 -0.08319985 0.02836114
+3.44086022 -0.05698925 -0.08568218 0.02869293
+3.45063539 -0.05913978 -0.08814228 0.02900249
+3.46041056 -0.06129032 -0.09058008 0.02928975
+3.47018573 -0.06344086 -0.09299551 0.02955465
+3.47996090 -0.06559140 -0.09538852 0.02979712
+3.48973607 -0.06774194 -0.09775902 0.03001709
+3.49951124 -0.06989247 -0.10010698 0.03021450
+3.50928641 -0.07204301 -0.10243231 0.03038930
+3.51906158 -0.07419355 -0.10473496 0.03054141
+3.52883675 -0.07634409 -0.10701487 0.03067079
+3.53861193 -0.07849462 -0.10927199 0.03077737
+3.54838710 -0.08064516 -0.11150627 0.03086111
+3.55816227 -0.08279570 -0.11371764 0.03092194
+3.56793744 -0.08494624 -0.11590606 0.03095982
+3.57771261 -0.08709677 -0.11807147 0.03097470
+3.58748778 -0.08924731 -0.12021383 0.03096652
+3.59726295 -0.09139785 -0.12233310 0.03093525
+3.60703812 -0.09354839 -0.12442922 0.03088083
+3.61681329 -0.09569892 -0.12650215 0.03080322
+3.62658847 -0.09784946 -0.12855185 0.03070239
+3.63636364 -0.10000000 -0.13057828 0.03057828
+3.64613881 -0.10215054 -0.13258140 0.03043086
+3.65591398 -0.10430108 -0.13456118 0.03026010
+3.66568915 -0.10645161 -0.13651757 0.03006596
+3.67546432 -0.10860215 -0.13845055 0.02984840
+3.68523949 -0.11075269 -0.14036007 0.02960739
+3.69501466 -0.11290323 -0.14224612 0.02934290
+3.70478983 -0.11505376 -0.14410866 0.02905490
+3.71456500 -0.11720430 -0.14594766 0.02874336
+3.72434018 -0.11935484 -0.14776310 0.02840827
+3.73411535 -0.12150538 -0.14955496 0.02804958
+3.74389052 -0.12365591 -0.15132320 0.02766729
+3.75366569 -0.12580645 -0.15306781 0.02726136
+3.76344086 -0.12795699 -0.15478877 0.02683178
+3.77321603 -0.13010753 -0.15648606 0.02637853
+3.78299120 -0.13225806 -0.15815967 0.02590160
+3.79276637 -0.13440860 -0.15980957 0.02540097
+3.80254154 -0.13655914 -0.16143576 0.02487662
+3.81231672 -0.13870968 -0.16303823 0.02432855
+3.82209189 -0.14086022 -0.16461696 0.02375674
+3.83186706 -0.14301075 -0.16617194 0.02316119
+3.84164223 -0.14516129 -0.16770318 0.02254189
+3.85141740 -0.14731183 -0.16921065 0.02189883
+3.86119257 -0.14946237 -0.17069437 0.02123200
+3.87096774 -0.15161290 -0.17215432 0.02054142
+3.88074291 -0.15376344 -0.17359052 0.01982707
+3.89051808 -0.15591398 -0.17500294 0.01908896
+3.90029326 -0.15806452 -0.17639161 0.01832710
+3.91006843 -0.16021505 -0.17775652 0.01754147
+3.91984360 -0.16236559 -0.17909769 0.01673209
+3.92961877 -0.16451613 -0.18041510 0.01589898
+3.93939394 -0.16666667 -0.18170879 0.01504212
+3.94916911 -0.16881720 -0.18297875 0.01416154
+3.95894428 -0.17096774 -0.18422500 0.01325725
+3.96871945 -0.17311828 -0.18544754 0.01232926
+3.97849462 -0.17526882 -0.18664641 0.01137759
+3.98826979 -0.17741935 -0.18782160 0.01040225
+3.99804497 -0.17956989 -0.18897315 0.00940326
+4.00782014 -0.18007820 -0.19010107 0.01002287
+4.01759531 -0.18017595 -0.19120537 0.01102942
+4.02737048 -0.18027370 -0.19228609 0.01201239
+4.03714565 -0.18037146 -0.19334325 0.01297180
+4.04692082 -0.18046921 -0.19437687 0.01390767
+4.05669599 -0.18056696 -0.19538698 0.01482002
+4.06647116 -0.18066471 -0.19637361 0.01570890
+4.07624633 -0.18076246 -0.19733679 0.01657433
+4.08602151 -0.18086022 -0.19827655 0.01741634
+4.09579668 -0.18095797 -0.19919292 0.01823496
+4.10557185 -0.18105572 -0.20008595 0.01903023
+4.11534702 -0.18115347 -0.20095565 0.01980218
+4.12512219 -0.18125122 -0.20180208 0.02055085
+4.13489736 -0.18134897 -0.20262526 0.02127629
+4.14467253 -0.18144673 -0.20342525 0.02197853
+4.15444770 -0.18154448 -0.20420208 0.02265761
+4.16422287 -0.18164223 -0.20495580 0.02331357
+4.17399804 -0.18173998 -0.20568645 0.02394647
+4.18377322 -0.18183773 -0.20639408 0.02455635
+4.19354839 -0.18193548 -0.20707873 0.02514325
+4.20332356 -0.18203324 -0.20774046 0.02570722
+4.21309873 -0.18213099 -0.20837931 0.02624832
+4.22287390 -0.18222874 -0.20899534 0.02676660
+4.23264907 -0.18232649 -0.20958860 0.02726211
+4.24242424 -0.18242424 -0.21015915 0.02773490
+4.25219941 -0.18252199 -0.21070703 0.02818504
+4.26197458 -0.18261975 -0.21123232 0.02861257
+4.27174976 -0.18271750 -0.21173506 0.02901757
+4.28152493 -0.18281525 -0.21221533 0.02940008
+4.29130010 -0.18291300 -0.21267317 0.02976017
+4.30107527 -0.18301075 -0.21310866 0.03009790
+4.31085044 -0.18310850 -0.21352185 0.03041335
+4.32062561 -0.18320626 -0.21391282 0.03070656
+4.33040078 -0.18330401 -0.21428163 0.03097762
+4.34017595 -0.18340176 -0.21462835 0.03122659
+4.34995112 -0.18349951 -0.21495305 0.03145354
+4.35972630 -0.18359726 -0.21525580 0.03165853
+4.36950147 -0.18369501 -0.21553667 0.03184165
+4.37927664 -0.18379277 -0.21579574 0.03200297
+4.38905181 -0.18389052 -0.21603308 0.03214256
+4.39882698 -0.18398827 -0.21624877 0.03226050
+4.40860215 -0.18408602 -0.21644288 0.03235686
+4.41837732 -0.18418377 -0.21661550 0.03243173
+4.42815249 -0.18428152 -0.21676671 0.03248518
+4.43792766 -0.18437928 -0.21689658 0.03251730
+4.44770283 -0.18447703 -0.21700520 0.03252817
+4.45747801 -0.18457478 -0.21709266 0.03251788
+4.46725318 -0.18467253 -0.21715903 0.03248650
+4.47702835 -0.18477028 -0.21720441 0.03243413
+4.48680352 -0.18486804 -0.21722888 0.03236085
+4.49657869 -0.18496579 -0.21723254 0.03226675
+4.50635386 -0.18506354 -0.21721546 0.03215193
+4.51612903 -0.18516129 -0.21717775 0.03201646
+4.52590420 -0.18525904 -0.21711950 0.03186046
+4.53567937 -0.18535679 -0.21704079 0.03168400
+4.54545455 -0.18545455 -0.21694173 0.03148718
+4.55522972 -0.18555230 -0.21682241 0.03127011
+4.56500489 -0.18565005 -0.21668292 0.03103288
+4.57478006 -0.18574780 -0.21652338 0.03077558
+4.58455523 -0.18584555 -0.21634386 0.03049831
+4.59433040 -0.18594330 -0.21614448 0.03020118
+4.60410557 -0.18604106 -0.21592534 0.02988429
+4.61388074 -0.18613881 -0.21568654 0.02954774
+4.62365591 -0.18623656 -0.21542819 0.02919163
+4.63343109 -0.18633431 -0.21515038 0.02881607
+4.64320626 -0.18643206 -0.21485322 0.02842116
+4.65298143 -0.18652981 -0.21453683 0.02800702
+4.66275660 -0.18662757 -0.21420131 0.02757374
+4.67253177 -0.18672532 -0.21384677 0.02712145
+4.68230694 -0.18682307 -0.21347331 0.02665024
+4.69208211 -0.18692082 -0.21308106 0.02616024
+4.70185728 -0.18701857 -0.21267012 0.02565154
+4.71163245 -0.18711632 -0.21224060 0.02512428
+4.72140762 -0.18721408 -0.21179263 0.02457855
+4.73118280 -0.18731183 -0.21132631 0.02401448
+4.74095797 -0.18740958 -0.21084176 0.02343218
+4.75073314 -0.18750733 -0.21033910 0.02283177
+4.76050831 -0.18760508 -0.20981845 0.02221337
+4.77028348 -0.18770283 -0.20927993 0.02157709
+4.78005865 -0.18780059 -0.20872365 0.02092306
+4.78983382 -0.18789834 -0.20814974 0.02025140
+4.79960899 -0.18799609 -0.20755831 0.01956222
+4.80938416 -0.18809384 -0.20694950 0.01885566
+4.81915934 -0.18819159 -0.20632342 0.01813183
+4.82893451 -0.18828935 -0.20568021 0.01739086
+4.83870968 -0.18838710 -0.20501998 0.01663288
+4.84848485 -0.18848485 -0.20434286 0.01585801
+4.85826002 -0.18858260 -0.20364897 0.01506637
+4.86803519 -0.18868035 -0.20293846 0.01425811
+4.87781036 -0.18877810 -0.20221144 0.01343334
+4.88758553 -0.18887586 -0.20146804 0.01259219
+4.89736070 -0.18897361 -0.20070840 0.01173480
+4.90713587 -0.18907136 -0.19993265 0.01086129
+4.91691105 -0.18916911 -0.19914091 0.00997180
+4.92668622 -0.18926686 -0.19833333 0.00906647
+4.93646139 -0.18936461 -0.19751003 0.00814542
+4.94623656 -0.18946237 -0.19667115 0.00720878
+4.95601173 -0.18956012 -0.19581682 0.00625670
+4.96578690 -0.18965787 -0.19494718 0.00528931
+4.97556207 -0.18975562 -0.19406237 0.00430675
+4.98533724 -0.18985337 -0.19316252 0.00330915
+4.99511241 -0.18995112 -0.19224777 0.00229665
+5.00488759 -0.18926686 -0.19131826 0.00205140
+5.01466276 -0.18780059 -0.19037413 0.00257355
+5.02443793 -0.18633431 -0.18941552 0.00308121
+5.03421310 -0.18486804 -0.18844257 0.00357453
+5.04398827 -0.18340176 -0.18745541 0.00405365
+5.05376344 -0.18193548 -0.18645420 0.00451871
+5.06353861 -0.18046921 -0.18543907 0.00496986
+5.07331378 -0.17900293 -0.18441017 0.00540723
+5.08308895 -0.17753666 -0.18336763 0.00583098
+5.09286413 -0.17607038 -0.18231162 0.00624123
+5.10263930 -0.17460411 -0.18124226 0.00663815
+5.11241447 -0.17313783 -0.18015970 0.00702187
+5.12218964 -0.17167155 -0.17906410 0.00739254
+5.13196481 -0.17020528 -0.17795559 0.00775031
+5.14173998 -0.16873900 -0.17683432 0.00809532
+5.15151515 -0.16727273 -0.17570045 0.00842772
+5.16129032 -0.16580645 -0.17455411 0.00874766
+5.17106549 -0.16434018 -0.17339546 0.00905528
+5.18084066 -0.16287390 -0.17222464 0.00935074
+5.19061584 -0.16140762 -0.17104181 0.00963419
+5.20039101 -0.15994135 -0.16984711 0.00990576
+5.21016618 -0.15847507 -0.16864070 0.01016562
+5.21994135 -0.15700880 -0.16742272 0.01041392
+5.22971652 -0.15554252 -0.16619332 0.01065080
+5.23949169 -0.15407625 -0.16495267 0.01087642
+5.24926686 -0.15260997 -0.16370090 0.01109093
+5.25904203 -0.15114370 -0.16243817 0.01129447
+5.26881720 -0.14967742 -0.16116463 0.01148721
+5.27859238 -0.14821114 -0.15988044 0.01166930
+5.28836755 -0.14674487 -0.15858575 0.01184088
+5.29814272 -0.14527859 -0.15728071 0.01200212
+5.30791789 -0.14381232 -0.15596547 0.01215316
+5.31769306 -0.14234604 -0.15464020 0.01229416
+5.32746823 -0.14087977 -0.15330504 0.01242527
+5.33724340 -0.13941349 -0.15196015 0.01254666
+5.34701857 -0.13794721 -0.15060568 0.01265846
+5.35679374 -0.13648094 -0.14924179 0.01276085
+5.36656891 -0.13501466 -0.14786863 0.01285397
+5.37634409 -0.13354839 -0.14648637 0.01293798
+5.38611926 -0.13208211 -0.14509515 0.01301304
+5.39589443 -0.13061584 -0.14369513 0.01307929
+5.40566960 -0.12914956 -0.14228647 0.01313691
+5.41544477 -0.12768328 -0.14086932 0.01318604
+5.42521994 -0.12621701 -0.13944384 0.01322684
+5.43499511 -0.12475073 -0.13801019 0.01325946
+5.44477028 -0.12328446 -0.13656853 0.01328407
+5.45454545 -0.12181818 -0.13511901 0.01330082
+5.46432063 -0.12035191 -0.13366178 0.01330987
+5.47409580 -0.11888563 -0.13219701 0.01331138
+5.48387097 -0.11741935 -0.13072485 0.01330550
+5.49364614 -0.11595308 -0.12924546 0.01329238
+5.50342131 -0.11448680 -0.12775900 0.01327220
+5.51319648 -0.11302053 -0.12626563 0.01324510
+5.52297165 -0.11155425 -0.12476550 0.01321124
+5.53274682 -0.11008798 -0.12325876 0.01317079
+5.54252199 -0.10862170 -0.12174559 0.01312389
+5.55229717 -0.10715543 -0.12022613 0.01307070
+5.56207234 -0.10568915 -0.11870054 0.01301139
+5.57184751 -0.10422287 -0.11716899 0.01294611
+5.58162268 -0.10275660 -0.11563162 0.01287502
+5.59139785 -0.10129032 -0.11408860 0.01279827
+5.60117302 -0.09982405 -0.11254008 0.01271603
+5.61094819 -0.09835777 -0.11098622 0.01262845
+5.62072336 -0.09689150 -0.10942718 0.01253568
+5.63049853 -0.09542522 -0.10786312 0.01243790
+5.64027370 -0.09395894 -0.10629418 0.01233524
+5.65004888 -0.09249267 -0.10472054 0.01222787
+5.65982405 -0.09102639 -0.10314235 0.01211595
+5.66959922 -0.08956012 -0.10155975 0.01199964
+5.67937439 -0.08809384 -0.09997292 0.01187908
+5.68914956 -0.08662757 -0.09838201 0.01175444
+5.69892473 -0.08516129 -0.09678716 0.01162587
+5.70869990 -0.08369501 -0.09518855 0.01149354
+5.71847507 -0.08222874 -0.09358632 0.01135758
+5.72825024 -0.08076246 -0.09198064 0.01121817
+5.73802542 -0.07929619 -0.09037165 0.01107546
+5.74780059 -0.07782991 -0.08875951 0.01092960
+5.75757576 -0.07636364 -0.08714438 0.01078074
+5.76735093 -0.07489736 -0.08552641 0.01062905
+5.77712610 -0.07343109 -0.08390576 0.01047468
+5.78690127 -0.07196481 -0.08228258 0.01031777
+5.79667644 -0.07049853 -0.08065703 0.01015849
+5.80645161 -0.06903226 -0.07902925 0.00999699
+5.81622678 -0.06756598 -0.07739941 0.00983343
+5.82600196 -0.06609971 -0.07576765 0.00966794
+5.83577713 -0.06463343 -0.07413413 0.00950070
+5.84555230 -0.06316716 -0.07249901 0.00933185
+5.85532747 -0.06170088 -0.07086242 0.00916154
+5.86510264 -0.06023460 -0.06922454 0.00898993
+5.87487781 -0.05876833 -0.06758550 0.00881717
+5.88465298 -0.05730205 -0.06594545 0.00864340
+5.89442815 -0.05583578 -0.06430456 0.00846878
+5.90420332 -0.05436950 -0.06266296 0.00829346
+5.91397849 -0.05290323 -0.06102082 0.00811759
+5.92375367 -0.05143695 -0.05937827 0.00794132
+5.93352884 -0.04997067 -0.05773547 0.00776480
+5.94330401 -0.04850440 -0.05609257 0.00758817
+5.95307918 -0.04703812 -0.05444971 0.00741159
+5.96285435 -0.04557185 -0.05280704 0.00723519
+5.97262952 -0.04410557 -0.05116471 0.00705914
+5.98240469 -0.04263930 -0.04952287 0.00688358
+5.99217986 -0.04117302 -0.04788166 0.00670864
+6.00195503 -0.03974585 -0.04624123 0.00649539
+6.01173021 -0.03847507 -0.04460173 0.00612665
+6.02150538 -0.03720430 -0.04296329 0.00575898
+6.03128055 -0.03593353 -0.04132606 0.00539253
+6.04105572 -0.03466276 -0.03969019 0.00502743
+6.05083089 -0.03339198 -0.03805582 0.00466383
+6.06060606 -0.03212121 -0.03642309 0.00430187
+6.07038123 -0.03085044 -0.03479214 0.00394170
+6.08015640 -0.02957967 -0.03316312 0.00358345
+6.08993157 -0.02830890 -0.03153616 0.00322727
+6.09970674 -0.02703812 -0.02991141 0.00287329
+6.10948192 -0.02576735 -0.02828901 0.00252166
+6.11925709 -0.02449658 -0.02666909 0.00217251
+6.12903226 -0.02322581 -0.02505179 0.00182599
+6.13880743 -0.02195503 -0.02343726 0.00148222
+6.14858260 -0.02068426 -0.02182562 0.00114136
+6.15835777 -0.01941349 -0.02021702 0.00080353
+6.16813294 -0.01814272 -0.01861158 0.00046886
+6.17790811 -0.01687195 -0.01700945 0.00013751
+6.18768328 -0.01560117 -0.01541076 0.00019041
+6.19745846 -0.01433040 -0.01381565 0.00051476
+6.20723363 -0.01305963 -0.01222423 0.00083539
+6.21700880 -0.01178886 -0.01063666 0.00115219
+6.22678397 -0.01051808 -0.00905306 0.00146503
+6.23655914 -0.00924731 -0.00747356 0.00177376
+6.24633431 -0.00797654 -0.00589828 0.00207826
+6.25610948 -0.00670577 -0.00432737 0.00237839
+6.26588465 -0.00543500 -0.00276095 0.00267405
+6.27565982 -0.00416422 -0.00119914 0.00296508
+6.28543500 -0.00289345 0.00035792 0.00325137
+6.29521017 -0.00162268 0.00191011 0.00353279
+6.30498534 -0.00035191 0.00345731 0.00380922
+6.31476051 0.00091887 0.00499939 0.00408052
+6.32453568 0.00218964 0.00653623 0.00434659
+6.33431085 0.00346041 0.00806769 0.00460728
+6.34408602 0.00473118 0.00959367 0.00486249
+6.35386119 0.00600196 0.01111404 0.00511208
+6.36363636 0.00727273 0.01262868 0.00535595
+6.37341153 0.00854350 0.01413746 0.00559396
+6.38318671 0.00981427 0.01564028 0.00582601
+6.39296188 0.01108504 0.01713700 0.00605196
+6.40273705 0.01235582 0.01862753 0.00627171
+6.41251222 0.01362659 0.02011173 0.00648514
+6.42228739 0.01489736 0.02158949 0.00669213
+6.43206256 0.01616813 0.02306071 0.00689257
+6.44183773 0.01743891 0.02452525 0.00708635
+6.45161290 0.01870968 0.02598302 0.00727335
+6.46138807 0.01998045 0.02743390 0.00745345
+6.47116325 0.02125122 0.02887778 0.00762656
+6.48093842 0.02252199 0.03031455 0.00779256
+6.49071359 0.02379277 0.03174410 0.00795133
+6.50048876 0.02506354 0.03316632 0.00810278
+6.51026393 0.02633431 0.03458110 0.00824679
+6.52003910 0.02760508 0.03598835 0.00838326
+6.52981427 0.02887586 0.03738794 0.00851209
+6.53958944 0.03014663 0.03877979 0.00863316
+6.54936461 0.03141740 0.04016378 0.00874638
+6.55913978 0.03268817 0.04153981 0.00885164
+6.56891496 0.03395894 0.04290779 0.00894884
+6.57869013 0.03522972 0.04426760 0.00903788
+6.58846530 0.03650049 0.04561916 0.00911867
+6.59824047 0.03777126 0.04696236 0.00919110
+6.60801564 0.03904203 0.04829710 0.00925507
+6.61779081 0.04031281 0.04962329 0.00931049
+6.62756598 0.04158358 0.05094084 0.00935726
+6.63734115 0.04285435 0.05224965 0.00939530
+6.64711632 0.04412512 0.05354962 0.00942449
+6.65689150 0.04539589 0.05484066 0.00944477
+6.66666667 0.04666667 0.05612268 0.00945602
+6.67644184 0.04793744 0.05739560 0.00945816
+6.68621701 0.04920821 0.05865932 0.00945111
+6.69599218 0.05047898 0.05991375 0.00943477
+6.70576735 0.05174976 0.06115881 0.00940905
+6.71554252 0.05302053 0.06239440 0.00937388
+6.72531769 0.05429130 0.06362046 0.00932916
+6.73509286 0.05556207 0.06483688 0.00927481
+6.74486804 0.05683284 0.06604359 0.00921074
+6.75464321 0.05810362 0.06724050 0.00913689
+6.76441838 0.05937439 0.06842755 0.00905316
+6.77419355 0.06064516 0.06960463 0.00895947
+6.78396872 0.06191593 0.07077169 0.00885575
+6.79374389 0.06318671 0.07192863 0.00874192
+6.80351906 0.06445748 0.07307538 0.00861790
+6.81329423 0.06572825 0.07421187 0.00848362
+6.82306940 0.06699902 0.07533803 0.00833900
+6.83284457 0.06826979 0.07645377 0.00818397
+6.84261975 0.06954057 0.07755903 0.00801846
+6.85239492 0.07081134 0.07865373 0.00784240
+6.86217009 0.07208211 0.07973782 0.00765571
+6.87194526 0.07335288 0.08081121 0.00745832
+6.88172043 0.07462366 0.08187384 0.00725018
+6.89149560 0.07589443 0.08292564 0.00703121
+6.90127077 0.07716520 0.08396655 0.00680135
+6.91104594 0.07843597 0.08499650 0.00656053
+6.92082111 0.07970674 0.08601544 0.00630869
+6.93059629 0.08097752 0.08702329 0.00604577
+6.94037146 0.08224829 0.08802000 0.00577171
+6.95014663 0.08351906 0.08900551 0.00548645
+6.95992180 0.08478983 0.08997976 0.00518992
+6.96969697 0.08606061 0.09094268 0.00488208
+6.97947214 0.08733138 0.09189424 0.00456286
+6.98924731 0.08860215 0.09283436 0.00423221
+6.99902248 0.08987292 0.09376300 0.00389008
+7.00879765 0.09026393 0.09468010 0.00441617
+7.01857283 0.09055718 0.09558561 0.00502843
+7.02834800 0.09085044 0.09647948 0.00562904
+7.03812317 0.09114370 0.09736167 0.00621797
+7.04789834 0.09143695 0.09823211 0.00679516
+7.05767351 0.09173021 0.09909078 0.00736057
+7.06744868 0.09202346 0.09993761 0.00791415
+7.07722385 0.09231672 0.10077256 0.00845585
+7.08699902 0.09260997 0.10159560 0.00898563
+7.09677419 0.09290323 0.10240667 0.00950345
+7.10654936 0.09319648 0.10320574 0.01000926
+7.11632454 0.09348974 0.10399277 0.01050304
+7.12609971 0.09378299 0.10476772 0.01098473
+7.13587488 0.09407625 0.10553054 0.01145430
+7.14565005 0.09436950 0.10628121 0.01191171
+7.15542522 0.09466276 0.10701969 0.01235693
+7.16520039 0.09495601 0.10774594 0.01278992
+7.17497556 0.09524927 0.10845992 0.01321066
+7.18475073 0.09554252 0.10916162 0.01361910
+7.19452590 0.09583578 0.10985099 0.01401522
+7.20430108 0.09612903 0.11052801 0.01439898
+7.21407625 0.09642229 0.11119265 0.01477036
+7.22385142 0.09671554 0.11184488 0.01512934
+7.23362659 0.09700880 0.11248467 0.01547587
+7.24340176 0.09730205 0.11311200 0.01580995
+7.25317693 0.09759531 0.11372685 0.01613154
+7.26295210 0.09788856 0.11432919 0.01644063
+7.27272727 0.09818182 0.11491900 0.01673719
+7.28250244 0.09847507 0.11549627 0.01702119
+7.29227761 0.09876833 0.11606096 0.01729263
+7.30205279 0.09906158 0.11661306 0.01755148
+7.31182796 0.09935484 0.11715257 0.01779773
+7.32160313 0.09964809 0.11767945 0.01803135
+7.33137830 0.09994135 0.11819370 0.01825235
+7.34115347 0.10023460 0.11869529 0.01846069
+7.35092864 0.10052786 0.11918423 0.01865637
+7.36070381 0.10082111 0.11966050 0.01883938
+7.37047898 0.10111437 0.12012408 0.01900971
+7.38025415 0.10140762 0.12057498 0.01916735
+7.39002933 0.10170088 0.12101317 0.01931229
+7.39980450 0.10199413 0.12143866 0.01944452
+7.40957967 0.10228739 0.12185144 0.01956405
+7.41935484 0.10258065 0.12225150 0.01967085
+7.42913001 0.10287390 0.12263884 0.01976494
+7.43890518 0.10316716 0.12301346 0.01984631
+7.44868035 0.10346041 0.12337536 0.01991495
+7.45845552 0.10375367 0.12372454 0.01997088
+7.46823069 0.10404692 0.12406100 0.02001408
+7.47800587 0.10434018 0.12438474 0.02004456
+7.48778104 0.10463343 0.12469576 0.02006233
+7.49755621 0.10492669 0.12499407 0.02006738
+7.50733138 0.10521994 0.12527968 0.02005974
+7.51710655 0.10551320 0.12555259 0.02003939
+7.52688172 0.10580645 0.12581281 0.02000636
+7.53665689 0.10609971 0.12606034 0.01996064
+7.54643206 0.10639296 0.12629521 0.01990225
+7.55620723 0.10668622 0.12651742 0.01983120
+7.56598240 0.10697947 0.12672698 0.01974751
+7.57575758 0.10727273 0.12692390 0.01965117
+7.58553275 0.10756598 0.12710821 0.01954222
+7.59530792 0.10785924 0.12727991 0.01942067
+7.60508309 0.10815249 0.12743902 0.01928653
+7.61485826 0.10844575 0.12758556 0.01913982
+7.62463343 0.10873900 0.12771955 0.01898055
+7.63440860 0.10903226 0.12784101 0.01880876
+7.64418377 0.10932551 0.12794996 0.01862445
+7.65395894 0.10961877 0.12804642 0.01842766
+7.66373412 0.10991202 0.12813042 0.01821839
+7.67350929 0.11020528 0.12820197 0.01799669
+7.68328446 0.11049853 0.12826111 0.01776257
+7.69305963 0.11079179 0.12830785 0.01751607
+7.70283480 0.11108504 0.12834224 0.01725719
+7.71260997 0.11137830 0.12836428 0.01698599
+7.72238514 0.11167155 0.12837403 0.01670247
+7.73216031 0.11196481 0.12837149 0.01640668
+7.74193548 0.11225806 0.12835671 0.01609865
+7.75171065 0.11255132 0.12832972 0.01577840
+7.76148583 0.11284457 0.12829055 0.01544598
+7.77126100 0.11313783 0.12823924 0.01510141
+7.78103617 0.11343109 0.12817582 0.01474473
+7.79081134 0.11372434 0.12810032 0.01437598
+7.80058651 0.11401760 0.12801279 0.01399519
+7.81036168 0.11431085 0.12791326 0.01360241
+7.82013685 0.11460411 0.12780177 0.01319766
+7.82991202 0.11489736 0.12767836 0.01278100
+7.83968719 0.11519062 0.12754308 0.01235246
+7.84946237 0.11548387 0.12739596 0.01191209
+7.85923754 0.11577713 0.12723705 0.01145992
+7.86901271 0.11607038 0.12706639 0.01099601
+7.87878788 0.11636364 0.12688403 0.01052039
+7.88856305 0.11665689 0.12669001 0.01003312
+7.89833822 0.11695015 0.12648438 0.00953423
+7.90811339 0.11724340 0.12626719 0.00902379
+7.91788856 0.11753666 0.12603848 0.00850182
+7.92766373 0.11782991 0.12579831 0.00796840
+7.93743891 0.11812317 0.12554673 0.00742356
+7.94721408 0.11841642 0.12528378 0.00686736
+7.95698925 0.11870968 0.12500952 0.00629984
+7.96676442 0.11900293 0.12472400 0.00572107
+7.97653959 0.11929619 0.12442729 0.00513110
+7.98631476 0.11958944 0.12411942 0.00452998
+7.99608993 0.11988270 0.12380046 0.00391776
+8.00586510 0.11953079 0.12347046 0.00393967
+8.01564027 0.11874878 0.12312949 0.00438071
+8.02541544 0.11796676 0.12277759 0.00481083
+8.03519062 0.11718475 0.12241483 0.00523008
+8.04496579 0.11640274 0.12204128 0.00563854
+8.05474096 0.11562072 0.12165698 0.00603625
+8.06451613 0.11483871 0.12126200 0.00642329
+8.07429130 0.11405670 0.12085641 0.00679971
+8.08406647 0.11327468 0.12044026 0.00716558
+8.09384164 0.11249267 0.12001362 0.00752095
+8.10361681 0.11171065 0.11957656 0.00786590
+8.11339198 0.11092864 0.11912914 0.00820050
+8.12316716 0.11014663 0.11867143 0.00852480
+8.13294233 0.10936461 0.11820349 0.00883887
+8.14271750 0.10858260 0.11772539 0.00914279
+8.15249267 0.10780059 0.11723720 0.00943662
+8.16226784 0.10701857 0.11673900 0.00972043
+8.17204301 0.10623656 0.11623084 0.00999429
+8.18181818 0.10545455 0.11571281 0.01025827
+8.19159335 0.10467253 0.11518497 0.01051244
+8.20136852 0.10389052 0.11464739 0.01075688
+8.21114370 0.10310850 0.11410016 0.01099165
+8.22091887 0.10232649 0.11354333 0.01121684
+8.23069404 0.10154448 0.11297699 0.01143251
+8.24046921 0.10076246 0.11240121 0.01163875
+8.25024438 0.09998045 0.11181607 0.01183562
+8.26001955 0.09919844 0.11122164 0.01202321
+8.26979472 0.09841642 0.11061800 0.01220158
+8.27956989 0.09763441 0.11000523 0.01237083
+8.28934506 0.09685239 0.10938341 0.01253102
+8.29912023 0.09607038 0.10875261 0.01268223
+8.30889541 0.09528837 0.10811292 0.01282455
+8.31867058 0.09450635 0.10746441 0.01295805
+8.32844575 0.09372434 0.10680716 0.01308282
+8.33822092 0.09294233 0.10614127 0.01319894
+8.34799609 0.09216031 0.10546680 0.01330649
+8.35777126 0.09137830 0.10478385 0.01340555
+8.36754643 0.09059629 0.10409249 0.01349620
+8.37732160 0.08981427 0.10339280 0.01357853
+8.38709677 0.08903226 0.10268489 0.01365263
+8.39687195 0.08825024 0.10196882 0.01371857
+8.40664712 0.08746823 0.10124468 0.01377645
+8.41642229 0.08668622 0.10051256 0.01382634
+8.42619746 0.08590420 0.09977255 0.01386834
+8.43597263 0.08512219 0.09902473 0.01390254
+8.44574780 0.08434018 0.09826919 0.01392901
+8.45552297 0.08355816 0.09750601 0.01394785
+8.46529814 0.08277615 0.09673530 0.01395915
+8.47507331 0.08199413 0.09595712 0.01396299
+8.48484848 0.08121212 0.09517159 0.01395947
+8.49462366 0.08043011 0.09437878 0.01394867
+8.50439883 0.07964809 0.09357878 0.01393068
+8.51417400 0.07886608 0.09277169 0.01390561
+8.52394917 0.07808407 0.09195759 0.01387352
+8.53372434 0.07730205 0.09113658 0.01383453
+8.54349951 0.07652004 0.09030876 0.01378872
+8.55327468 0.07573803 0.08947420 0.01373618
+8.56304985 0.07495601 0.08863301 0.01367700
+8.57282502 0.07417400 0.08778528 0.01361129
+8.58260020 0.07339198 0.08693111 0.01353912
+8.59237537 0.07260997 0.08607058 0.01346060
+8.60215054 0.07182796 0.08520379 0.01337583
+8.61192571 0.07104594 0.08433083 0.01328489
+8.62170088 0.07026393 0.08345181 0.01318788
+8.63147605 0.06948192 0.08256681 0.01308489
+8.64125122 0.06869990 0.08167593 0.01297603
+8.65102639 0.06791789 0.08077927 0.01286138
+8.66080156 0.06713587 0.07987693 0.01274105
+8.67057674 0.06635386 0.07896899 0.01261513
+8.68035191 0.06557185 0.07805557 0.01248372
+8.69012708 0.06478983 0.07713675 0.01234691
+8.69990225 0.06400782 0.07621263 0.01220481
+8.70967742 0.06322581 0.07528331 0.01205750
+8.71945259 0.06244379 0.07434889 0.01190509
+8.72922776 0.06166178 0.07340946 0.01174768
+8.73900293 0.06087977 0.07246513 0.01158537
+8.74877810 0.06009775 0.07151600 0.01141825
+8.75855327 0.05931574 0.07056216 0.01124642
+8.76832845 0.05853372 0.06960370 0.01106998
+8.77810362 0.05775171 0.06864074 0.01088903
+8.78787879 0.05696970 0.06767337 0.01070368
+8.79765396 0.05618768 0.06670170 0.01051401
+8.80742913 0.05540567 0.06572581 0.01032014
+8.81720430 0.05462366 0.06474581 0.01012215
+8.82697947 0.05384164 0.06376180 0.00992016
+8.83675464 0.05305963 0.06277389 0.00971426
+8.84652981 0.05227761 0.06178216 0.00950455
+8.85630499 0.05149560 0.06078673 0.00929113
+8.86608016 0.05071359 0.05978769 0.00907410
+8.87585533 0.04993157 0.05878515 0.00885357
+8.88563050 0.04914956 0.05777919 0.00862963
+8.89540567 0.04836755 0.05676994 0.00840239
+8.90518084 0.04758553 0.05575748 0.00817195
+8.91495601 0.04680352 0.05474192 0.00793841
+8.92473118 0.04602151 0.05372336 0.00770186
+8.93450635 0.04523949 0.05270191 0.00746241
+8.94428152 0.04445748 0.05167765 0.00722017
+8.95405670 0.04367546 0.05065070 0.00697523
+8.96383187 0.04289345 0.04962115 0.00672770
+8.97360704 0.04211144 0.04858911 0.00647767
+8.98338221 0.04132942 0.04755468 0.00622526
+8.99315738 0.04054741 0.04651796 0.00597055
+9.00293255 0.04000000 0.04547905 0.00547905
+9.01270772 0.04000000 0.04443805 0.00443805
+9.02248289 0.04000000 0.04339506 0.00339506
+9.03225806 0.04000000 0.04235019 0.00235019
+9.04203324 0.04000000 0.04130354 0.00130354
+9.05180841 0.04000000 0.04025521 0.00025521
+9.06158358 0.04000000 0.03920529 0.00079471
+9.07135875 0.04000000 0.03815390 0.00184610
+9.08113392 0.04000000 0.03710113 0.00289887
+9.09090909 0.04000000 0.03604708 0.00395292
+9.10068426 0.04000000 0.03499185 0.00500815
+9.11045943 0.04000000 0.03393555 0.00606445
+9.12023460 0.04000000 0.03287827 0.00712173
+9.13000978 0.04000000 0.03182012 0.00817988
+9.13978495 0.04000000 0.03076120 0.00923880
+9.14956012 0.04000000 0.02970160 0.01029840
+9.15933529 0.04000000 0.02864143 0.01135857
+9.16911046 0.04000000 0.02758079 0.01241921
+9.17888563 0.04000000 0.02651977 0.01348023
+9.18866080 0.04000000 0.02545848 0.01454152
+9.19843597 0.04000000 0.02439701 0.01560299
+9.20821114 0.04000000 0.02333547 0.01666453
+9.21798631 0.04000000 0.02227395 0.01772605
+9.22776149 0.04000000 0.02121255 0.01878745
+9.23753666 0.04000000 0.02015138 0.01984862
+9.24731183 0.04000000 0.01909053 0.02090947
+9.25708700 0.04000000 0.01803009 0.02196991
+9.26686217 0.04000000 0.01697018 0.02302982
+9.27663734 0.04000000 0.01591087 0.02408913
+9.28641251 0.04000000 0.01485228 0.02514772
+9.29618768 0.04000000 0.01379449 0.02620551
+9.30596285 0.04000000 0.01273761 0.02726239
+9.31573803 0.04000000 0.01168174 0.02831826
+9.32551320 0.04000000 0.01062696 0.02937304
+9.33528837 0.04000000 0.00957337 0.03042663
+9.34506354 0.04000000 0.00852108 0.03147892
+9.35483871 0.04000000 0.00747017 0.03252983
+9.36461388 0.04000000 0.00642074 0.03357926
+9.37438905 0.04000000 0.00537289 0.03462711
+9.38416422 0.04000000 0.00432671 0.03567329
+9.39393939 0.04000000 0.00328229 0.03671771
+9.40371457 0.04000000 0.00223974 0.03776026
+9.41348974 0.04000000 0.00119913 0.03880087
+9.42326491 0.04000000 0.00016057 0.03983943
+9.43304008 0.04000000 -0.00087586 0.04087586
+9.44281525 0.04000000 -0.00191006 0.04191006
+9.45259042 0.04000000 -0.00294193 0.04294193
+9.46236559 0.04000000 -0.00397139 0.04397139
+9.47214076 0.04000000 -0.00499835 0.04499835
+9.48191593 0.04000000 -0.00602272 0.04602272
+9.49169110 0.04000000 -0.00704440 0.04704440
+9.50146628 0.04000000 -0.00806330 0.04806330
+9.51124145 0.04000000 -0.00907934 0.04907934
+9.52101662 0.04000000 -0.01009243 0.05009243
+9.53079179 0.04000000 -0.01110247 0.05110247
+9.54056696 0.04000000 -0.01210939 0.05210939
+9.55034213 0.04000000 -0.01311309 0.05311309
+9.56011730 0.04000000 -0.01411348 0.05411348
+9.56989247 0.04000000 -0.01511049 0.05511049
+9.57966764 0.04000000 -0.01610401 0.05610401
+9.58944282 0.04000000 -0.01709398 0.05709398
+9.59921799 0.04000000 -0.01808029 0.05808029
+9.60899316 0.04000000 -0.01906288 0.05906288
+9.61876833 0.04000000 -0.02004164 0.06004164
+9.62854350 0.04000000 -0.02101651 0.06101651
+9.63831867 0.04000000 -0.02198739 0.06198739
+9.64809384 0.04000000 -0.02295421 0.06295421
+9.65786901 0.04000000 -0.02391688 0.06391688
+9.66764418 0.04000000 -0.02487532 0.06487532
+9.67741935 0.04000000 -0.02582945 0.06582945
+9.68719453 0.04000000 -0.02677918 0.06677918
+9.69696970 0.04000000 -0.02772445 0.06772445
+9.70674487 0.04000000 -0.02866516 0.06866516
+9.71652004 0.04000000 -0.02960125 0.06960125
+9.72629521 0.04000000 -0.03053263 0.07053263
+9.73607038 0.04000000 -0.03145922 0.07145922
+9.74584555 0.04000000 -0.03238095 0.07238095
+9.75562072 0.04000000 -0.03329775 0.07329775
+9.76539589 0.04000000 -0.03420953 0.07420953
+9.77517107 0.04000000 -0.03511622 0.07511622
+9.78494624 0.04000000 -0.03601775 0.07601775
+9.79472141 0.04000000 -0.03691404 0.07691404
+9.80449658 0.04000000 -0.03780502 0.07780502
+9.81427175 0.04000000 -0.03869061 0.07869061
+9.82404692 0.04000000 -0.03957075 0.07957075
+9.83382209 0.04000000 -0.04044536 0.08044536
+9.84359726 0.04000000 -0.04131438 0.08131438
+9.85337243 0.04000000 -0.04217772 0.08217772
+9.86314761 0.04000000 -0.04303533 0.08303533
+9.87292278 0.04000000 -0.04388713 0.08388713
+9.88269795 0.04000000 -0.04473306 0.08473306
+9.89247312 0.04000000 -0.04557305 0.08557305
+9.90224829 0.04000000 -0.04640703 0.08640703
+9.91202346 0.04000000 -0.04723493 0.08723493
+9.92179863 0.04000000 -0.04805669 0.08805669
+9.93157380 0.04000000 -0.04887225 0.08887225
+9.94134897 0.04000000 -0.04968154 0.08968154
+9.95112414 0.04000000 -0.05048449 0.09048449
+9.96089932 0.04000000 -0.05128105 0.09128105
+9.97067449 0.04000000 -0.05207115 0.09207115
+9.98044966 0.04000000 -0.05285474 0.09285474
+9.99022483 0.04000000 -0.05363174 0.09363174
+10.00000000 0.04000000 -0.05440211 0.09440211
diff --git a/examples/takagi-sugeno/approximation.fll b/examples/takagi-sugeno/approximation.fll
new file mode 100644
index 0000000..1d166c9
--- /dev/null
+++ b/examples/takagi-sugeno/approximation.fll
@@ -0,0 +1,63 @@
+Engine: approximation of sin(x)/x
+InputVariable: inputX
+ enabled: true
+ range: 0.000 10.000
+ term: NEAR_1 Triangle 0.000 1.000 2.000
+ term: NEAR_2 Triangle 1.000 2.000 3.000
+ term: NEAR_3 Triangle 2.000 3.000 4.000
+ term: NEAR_4 Triangle 3.000 4.000 5.000
+ term: NEAR_5 Triangle 4.000 5.000 6.000
+ term: NEAR_6 Triangle 5.000 6.000 7.000
+ term: NEAR_7 Triangle 6.000 7.000 8.000
+ term: NEAR_8 Triangle 7.000 8.000 9.000
+ term: NEAR_9 Triangle 8.000 9.000 10.000
+OutputVariable: outputFx
+ enabled: true
+ range: -1.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: true
+ lock-range: false
+ term: f1 Constant 0.840
+ term: f2 Constant 0.450
+ term: f3 Constant 0.040
+ term: f4 Constant -0.180
+ term: f5 Constant -0.190
+ term: f6 Constant -0.040
+ term: f7 Constant 0.090
+ term: f8 Constant 0.120
+ term: f9 Constant 0.040
+OutputVariable: trueFx
+ enabled: true
+ range: -1.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage Automatic
+ default: nan
+ lock-previous: true
+ lock-range: false
+ term: fx Function sin(inputX)/inputX
+OutputVariable: diffFx
+ enabled: true
+ range: -1.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage Automatic
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: diff Function fabs(outputFx-trueFx)
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: none
+ rule: if inputX is NEAR_1 then outputFx is f1
+ rule: if inputX is NEAR_2 then outputFx is f2
+ rule: if inputX is NEAR_3 then outputFx is f3
+ rule: if inputX is NEAR_4 then outputFx is f4
+ rule: if inputX is NEAR_5 then outputFx is f5
+ rule: if inputX is NEAR_6 then outputFx is f6
+ rule: if inputX is NEAR_7 then outputFx is f7
+ rule: if inputX is NEAR_8 then outputFx is f8
+ rule: if inputX is NEAR_9 then outputFx is f9
+ rule: if inputX is any then trueFx is fx and diffFx is diff \ No newline at end of file
diff --git a/examples/takagi-sugeno/approximation.java b/examples/takagi-sugeno/approximation.java
new file mode 100644
index 0000000..c3d98e1
--- /dev/null
+++ b/examples/takagi-sugeno/approximation.java
@@ -0,0 +1,97 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class approximation{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("approximation of sin(x)/x");
+
+InputVariable inputVariable = new InputVariable();
+inputVariable.setEnabled(true);
+inputVariable.setName("inputX");
+inputVariable.setRange(0.000, 10.000);
+inputVariable.addTerm(new Triangle("NEAR_1", 0.000, 1.000, 2.000));
+inputVariable.addTerm(new Triangle("NEAR_2", 1.000, 2.000, 3.000));
+inputVariable.addTerm(new Triangle("NEAR_3", 2.000, 3.000, 4.000));
+inputVariable.addTerm(new Triangle("NEAR_4", 3.000, 4.000, 5.000));
+inputVariable.addTerm(new Triangle("NEAR_5", 4.000, 5.000, 6.000));
+inputVariable.addTerm(new Triangle("NEAR_6", 5.000, 6.000, 7.000));
+inputVariable.addTerm(new Triangle("NEAR_7", 6.000, 7.000, 8.000));
+inputVariable.addTerm(new Triangle("NEAR_8", 7.000, 8.000, 9.000));
+inputVariable.addTerm(new Triangle("NEAR_9", 8.000, 9.000, 10.000));
+engine.addInputVariable(inputVariable);
+
+OutputVariable outputVariable1 = new OutputVariable();
+outputVariable1.setEnabled(true);
+outputVariable1.setName("outputFx");
+outputVariable1.setRange(-1.000, 1.000);
+outputVariable1.fuzzyOutput().setAccumulation(null);
+outputVariable1.setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable1.setDefaultValue(Double.NaN);
+outputVariable1.setLockPreviousOutputValue(true);
+outputVariable1.setLockOutputValueInRange(false);
+outputVariable1.addTerm(new Constant("f1", 0.840));
+outputVariable1.addTerm(new Constant("f2", 0.450));
+outputVariable1.addTerm(new Constant("f3", 0.040));
+outputVariable1.addTerm(new Constant("f4", -0.180));
+outputVariable1.addTerm(new Constant("f5", -0.190));
+outputVariable1.addTerm(new Constant("f6", -0.040));
+outputVariable1.addTerm(new Constant("f7", 0.090));
+outputVariable1.addTerm(new Constant("f8", 0.120));
+outputVariable1.addTerm(new Constant("f9", 0.040));
+engine.addOutputVariable(outputVariable1);
+
+OutputVariable outputVariable2 = new OutputVariable();
+outputVariable2.setEnabled(true);
+outputVariable2.setName("trueFx");
+outputVariable2.setRange(-1.000, 1.000);
+outputVariable2.fuzzyOutput().setAccumulation(null);
+outputVariable2.setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable2.setDefaultValue(Double.NaN);
+outputVariable2.setLockPreviousOutputValue(true);
+outputVariable2.setLockOutputValueInRange(false);
+outputVariable2.addTerm(Function.create("fx", "sin(inputX)/inputX", engine));
+engine.addOutputVariable(outputVariable2);
+
+OutputVariable outputVariable3 = new OutputVariable();
+outputVariable3.setEnabled(true);
+outputVariable3.setName("diffFx");
+outputVariable3.setRange(-1.000, 1.000);
+outputVariable3.fuzzyOutput().setAccumulation(null);
+outputVariable3.setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable3.setDefaultValue(Double.NaN);
+outputVariable3.setLockPreviousOutputValue(false);
+outputVariable3.setLockOutputValueInRange(false);
+outputVariable3.addTerm(Function.create("diff", "fabs(outputFx-trueFx)", engine));
+engine.addOutputVariable(outputVariable3);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(null);
+ruleBlock.setDisjunction(null);
+ruleBlock.setActivation(null);
+ruleBlock.addRule(Rule.parse("if inputX is NEAR_1 then outputFx is f1", engine));
+ruleBlock.addRule(Rule.parse("if inputX is NEAR_2 then outputFx is f2", engine));
+ruleBlock.addRule(Rule.parse("if inputX is NEAR_3 then outputFx is f3", engine));
+ruleBlock.addRule(Rule.parse("if inputX is NEAR_4 then outputFx is f4", engine));
+ruleBlock.addRule(Rule.parse("if inputX is NEAR_5 then outputFx is f5", engine));
+ruleBlock.addRule(Rule.parse("if inputX is NEAR_6 then outputFx is f6", engine));
+ruleBlock.addRule(Rule.parse("if inputX is NEAR_7 then outputFx is f7", engine));
+ruleBlock.addRule(Rule.parse("if inputX is NEAR_8 then outputFx is f8", engine));
+ruleBlock.addRule(Rule.parse("if inputX is NEAR_9 then outputFx is f9", engine));
+ruleBlock.addRule(Rule.parse("if inputX is any then trueFx is fx and diffFx is diff", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/takagi-sugeno/octave/COPYING b/examples/takagi-sugeno/octave/COPYING
new file mode 100644
index 0000000..94a9ed0
--- /dev/null
+++ b/examples/takagi-sugeno/octave/COPYING
@@ -0,0 +1,674 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/examples/takagi-sugeno/octave/DESCRIPTION b/examples/takagi-sugeno/octave/DESCRIPTION
new file mode 100644
index 0000000..35df57d
--- /dev/null
+++ b/examples/takagi-sugeno/octave/DESCRIPTION
@@ -0,0 +1,12 @@
+Name: fuzzy-logic-toolkit
+Version: 0.4.2
+Date: 2012-10-02
+Author: L. Markowsky <lmarkov@users.sourceforge.net>
+Maintainer: L. Markowsky <lmarkov@users.sourceforge.net>
+Title: Octave Fuzzy Logic Toolkit
+Description: A mostly MATLAB-compatible fuzzy logic toolkit for Octave.
+Depends: octave (>= 3.2.4)
+Autoload: no
+License: GPLv3+
+Url: http://octave.sf.net
+ http://sf.net/projects/octave-fuzzy
diff --git a/examples/takagi-sugeno/octave/cubic_approximator.cpp b/examples/takagi-sugeno/octave/cubic_approximator.cpp
new file mode 100644
index 0000000..6941fa5
--- /dev/null
+++ b/examples/takagi-sugeno/octave/cubic_approximator.cpp
@@ -0,0 +1,68 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("Cubic-Approximator");
+
+InputVariable* inputVariable = new InputVariable;
+inputVariable->setEnabled(true);
+inputVariable->setName("X");
+inputVariable->setRange(-5.000, 5.000);
+inputVariable->addTerm(new Triangle("AboutNegFive", -6.000, -5.000, -4.000));
+inputVariable->addTerm(new Triangle("AboutNegFour", -5.000, -4.000, -3.000));
+inputVariable->addTerm(new Triangle("AboutNegThree", -4.000, -3.000, -2.000));
+inputVariable->addTerm(new Triangle("AboutNegTwo", -3.000, -2.000, -1.000));
+inputVariable->addTerm(new Triangle("AboutNegOne", -2.000, -1.000, 0.000));
+inputVariable->addTerm(new Triangle("AboutZero", -1.000, 0.000, 1.000));
+inputVariable->addTerm(new Triangle("AboutOne", 0.000, 1.000, 2.000));
+inputVariable->addTerm(new Triangle("AboutTwo", 1.000, 2.000, 3.000));
+inputVariable->addTerm(new Triangle("AboutThree", 2.000, 3.000, 4.000));
+inputVariable->addTerm(new Triangle("AboutFour", 3.000, 4.000, 5.000));
+inputVariable->addTerm(new Triangle("AboutFive", 4.000, 5.000, 6.000));
+engine->addInputVariable(inputVariable);
+
+OutputVariable* outputVariable = new OutputVariable;
+outputVariable->setEnabled(true);
+outputVariable->setName("ApproxXCubed");
+outputVariable->setRange(-5.000, 5.000);
+outputVariable->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable->setDefaultValue(fl::nan);
+outputVariable->setLockPreviousOutputValue(false);
+outputVariable->setLockOutputValueInRange(false);
+outputVariable->addTerm(Linear::create("TangentatNegFive", engine, 75.000, 250.000));
+outputVariable->addTerm(Linear::create("TangentatNegFour", engine, 48.000, 128.000));
+outputVariable->addTerm(Linear::create("TangentatNegThree", engine, 27.000, 54.000));
+outputVariable->addTerm(Linear::create("TangentatNegTwo", engine, 12.000, 16.000));
+outputVariable->addTerm(Linear::create("TangentatNegOne", engine, 3.000, 2.000));
+outputVariable->addTerm(Linear::create("TangentatZero", engine, 0.000, 0.000));
+outputVariable->addTerm(Linear::create("TangentatOne", engine, 3.000, -2.000));
+outputVariable->addTerm(Linear::create("TangentatTwo", engine, 12.000, -16.000));
+outputVariable->addTerm(Linear::create("TangentatThree", engine, 27.000, -54.000));
+outputVariable->addTerm(Linear::create("TangentatFour", engine, 48.000, -128.000));
+outputVariable->addTerm(Linear::create("TangentatFive", engine, 75.000, -250.000));
+engine->addOutputVariable(outputVariable);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(fl::null);
+ruleBlock->setDisjunction(fl::null);
+ruleBlock->setActivation(fl::null);
+ruleBlock->addRule(fl::Rule::parse("if X is AboutNegFive then ApproxXCubed is TangentatNegFive", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutNegFour then ApproxXCubed is TangentatNegFour", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutNegThree then ApproxXCubed is TangentatNegThree", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutNegTwo then ApproxXCubed is TangentatNegTwo", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutNegOne then ApproxXCubed is TangentatNegOne", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutZero then ApproxXCubed is TangentatZero", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutOne then ApproxXCubed is TangentatOne", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutTwo then ApproxXCubed is TangentatTwo", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutThree then ApproxXCubed is TangentatThree", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutFour then ApproxXCubed is TangentatFour", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is AboutFive then ApproxXCubed is TangentatFive", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/takagi-sugeno/octave/cubic_approximator.fcl b/examples/takagi-sugeno/octave/cubic_approximator.fcl
new file mode 100644
index 0000000..db88e44
--- /dev/null
+++ b/examples/takagi-sugeno/octave/cubic_approximator.fcl
@@ -0,0 +1,57 @@
+FUNCTION_BLOCK Cubic-Approximator
+
+VAR_INPUT
+ X: REAL;
+END_VAR
+
+VAR_OUTPUT
+ ApproxXCubed: REAL;
+END_VAR
+
+FUZZIFY X
+ RANGE := (-5.000 .. 5.000);
+ TERM AboutNegFive := Triangle -6.000 -5.000 -4.000;
+ TERM AboutNegFour := Triangle -5.000 -4.000 -3.000;
+ TERM AboutNegThree := Triangle -4.000 -3.000 -2.000;
+ TERM AboutNegTwo := Triangle -3.000 -2.000 -1.000;
+ TERM AboutNegOne := Triangle -2.000 -1.000 0.000;
+ TERM AboutZero := Triangle -1.000 0.000 1.000;
+ TERM AboutOne := Triangle 0.000 1.000 2.000;
+ TERM AboutTwo := Triangle 1.000 2.000 3.000;
+ TERM AboutThree := Triangle 2.000 3.000 4.000;
+ TERM AboutFour := Triangle 3.000 4.000 5.000;
+ TERM AboutFive := Triangle 4.000 5.000 6.000;
+END_FUZZIFY
+
+DEFUZZIFY ApproxXCubed
+ RANGE := (-5.000 .. 5.000);
+ TERM TangentatNegFive := Linear 75.000 250.000;
+ TERM TangentatNegFour := Linear 48.000 128.000;
+ TERM TangentatNegThree := Linear 27.000 54.000;
+ TERM TangentatNegTwo := Linear 12.000 16.000;
+ TERM TangentatNegOne := Linear 3.000 2.000;
+ TERM TangentatZero := Linear 0.000 0.000;
+ TERM TangentatOne := Linear 3.000 -2.000;
+ TERM TangentatTwo := Linear 12.000 -16.000;
+ TERM TangentatThree := Linear 27.000 -54.000;
+ TERM TangentatFour := Linear 48.000 -128.000;
+ TERM TangentatFive := Linear 75.000 -250.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ RULE 1 : if X is AboutNegFive then ApproxXCubed is TangentatNegFive
+ RULE 2 : if X is AboutNegFour then ApproxXCubed is TangentatNegFour
+ RULE 3 : if X is AboutNegThree then ApproxXCubed is TangentatNegThree
+ RULE 4 : if X is AboutNegTwo then ApproxXCubed is TangentatNegTwo
+ RULE 5 : if X is AboutNegOne then ApproxXCubed is TangentatNegOne
+ RULE 6 : if X is AboutZero then ApproxXCubed is TangentatZero
+ RULE 7 : if X is AboutOne then ApproxXCubed is TangentatOne
+ RULE 8 : if X is AboutTwo then ApproxXCubed is TangentatTwo
+ RULE 9 : if X is AboutThree then ApproxXCubed is TangentatThree
+ RULE 10 : if X is AboutFour then ApproxXCubed is TangentatFour
+ RULE 11 : if X is AboutFive then ApproxXCubed is TangentatFive
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/takagi-sugeno/octave/cubic_approximator.fis b/examples/takagi-sugeno/octave/cubic_approximator.fis
new file mode 100644
index 0000000..b69675b
--- /dev/null
+++ b/examples/takagi-sugeno/octave/cubic_approximator.fis
@@ -0,0 +1,56 @@
+[System]
+Name='Cubic-Approximator'
+Type='sugeno'
+NumInputs=1
+NumOutputs=1
+NumRules=11
+AndMethod=''
+OrMethod=''
+ImpMethod=''
+AggMethod=''
+DefuzzMethod='wtaver'
+
+[Input1]
+Name='X'
+Range=[-5.000 5.000]
+NumMFs=11
+MF1='AboutNegFive':'trimf',[-6.000 -5.000 -4.000]
+MF2='AboutNegFour':'trimf',[-5.000 -4.000 -3.000]
+MF3='AboutNegThree':'trimf',[-4.000 -3.000 -2.000]
+MF4='AboutNegTwo':'trimf',[-3.000 -2.000 -1.000]
+MF5='AboutNegOne':'trimf',[-2.000 -1.000 0.000]
+MF6='AboutZero':'trimf',[-1.000 0.000 1.000]
+MF7='AboutOne':'trimf',[0.000 1.000 2.000]
+MF8='AboutTwo':'trimf',[1.000 2.000 3.000]
+MF9='AboutThree':'trimf',[2.000 3.000 4.000]
+MF10='AboutFour':'trimf',[3.000 4.000 5.000]
+MF11='AboutFive':'trimf',[4.000 5.000 6.000]
+
+[Output1]
+Name='ApproxXCubed'
+Range=[-5.000 5.000]
+NumMFs=11
+MF1='TangentatNegFive':'linear',[75.000 250.000]
+MF2='TangentatNegFour':'linear',[48.000 128.000]
+MF3='TangentatNegThree':'linear',[27.000 54.000]
+MF4='TangentatNegTwo':'linear',[12.000 16.000]
+MF5='TangentatNegOne':'linear',[3.000 2.000]
+MF6='TangentatZero':'linear',[0.000 0.000]
+MF7='TangentatOne':'linear',[3.000 -2.000]
+MF8='TangentatTwo':'linear',[12.000 -16.000]
+MF9='TangentatThree':'linear',[27.000 -54.000]
+MF10='TangentatFour':'linear',[48.000 -128.000]
+MF11='TangentatFive':'linear',[75.000 -250.000]
+
+[Rules]
+1.000 , 1.000 (1.000) : 1
+2.000 , 2.000 (1.000) : 1
+3.000 , 3.000 (1.000) : 1
+4.000 , 4.000 (1.000) : 1
+5.000 , 5.000 (1.000) : 1
+6.000 , 6.000 (1.000) : 1
+7.000 , 7.000 (1.000) : 1
+8.000 , 8.000 (1.000) : 1
+9.000 , 9.000 (1.000) : 1
+10.000 , 10.000 (1.000) : 1
+11.000 , 11.000 (1.000) : 1
diff --git a/examples/takagi-sugeno/octave/cubic_approximator.fld b/examples/takagi-sugeno/octave/cubic_approximator.fld
new file mode 100644
index 0000000..e13c169
--- /dev/null
+++ b/examples/takagi-sugeno/octave/cubic_approximator.fld
@@ -0,0 +1,1026 @@
+#@Engine: Cubic-Approximator;
+#@InputVariable: X; @OutputVariable: ApproxXCubed;
+-5.00000000 -125.00000000
+-4.99022483 -124.14236490
+-4.98044966 -123.28988972
+-4.97067449 -122.44257445
+-4.96089932 -121.60041910
+-4.95112414 -120.76342366
+-4.94134897 -119.93158814
+-4.93157380 -119.10491253
+-4.92179863 -118.28339683
+-4.91202346 -117.46704105
+-4.90224829 -116.65584518
+-4.89247312 -115.84980923
+-4.88269795 -115.04893319
+-4.87292278 -114.25321706
+-4.86314761 -113.46266085
+-4.85337243 -112.67726456
+-4.84359726 -111.89702818
+-4.83382209 -111.12195171
+-4.82404692 -110.35203516
+-4.81427175 -109.58727852
+-4.80449658 -108.82768179
+-4.79472141 -108.07324498
+-4.78494624 -107.32396809
+-4.77517107 -106.57985111
+-4.76539589 -105.84089404
+-4.75562072 -105.10709689
+-4.74584555 -104.37845965
+-4.73607038 -103.65498233
+-4.72629521 -102.93666492
+-4.71652004 -102.22350742
+-4.70674487 -101.51550984
+-4.69696970 -100.81267218
+-4.68719453 -100.11499442
+-4.67741935 -99.42247659
+-4.66764418 -98.73511866
+-4.65786901 -98.05292065
+-4.64809384 -97.37588256
+-4.63831867 -96.70400438
+-4.62854350 -96.03728611
+-4.61876833 -95.37572776
+-4.60899316 -94.71932933
+-4.59921799 -94.06809080
+-4.58944282 -93.42201219
+-4.57966764 -92.78109350
+-4.56989247 -92.14533472
+-4.56011730 -91.51473586
+-4.55034213 -90.88929690
+-4.54056696 -90.26901787
+-4.53079179 -89.65389875
+-4.52101662 -89.04393954
+-4.51124145 -88.43914024
+-4.50146628 -87.83950086
+-4.49169110 -87.24502140
+-4.48191593 -86.65570185
+-4.47214076 -86.07154221
+-4.46236559 -85.49254249
+-4.45259042 -84.91870268
+-4.44281525 -84.35002279
+-4.43304008 -83.78650281
+-4.42326491 -83.22814275
+-4.41348974 -82.67494260
+-4.40371457 -82.12690236
+-4.39393939 -81.58402204
+-4.38416422 -81.04630163
+-4.37438905 -80.51374114
+-4.36461388 -79.98634056
+-4.35483871 -79.46409990
+-4.34506354 -78.94701915
+-4.33528837 -78.43509831
+-4.32551320 -77.92833739
+-4.31573803 -77.42673638
+-4.30596285 -76.93029529
+-4.29618768 -76.43901411
+-4.28641251 -75.95289285
+-4.27663734 -75.47193150
+-4.26686217 -74.99613006
+-4.25708700 -74.52548854
+-4.24731183 -74.06000694
+-4.23753666 -73.59968525
+-4.22776149 -73.14452347
+-4.21798631 -72.69452160
+-4.20821114 -72.24967966
+-4.19843597 -71.80999762
+-4.18866080 -71.37547550
+-4.17888563 -70.94611329
+-4.16911046 -70.52191100
+-4.15933529 -70.10286863
+-4.14956012 -69.68898616
+-4.13978495 -69.28026361
+-4.13000978 -68.87670098
+-4.12023460 -68.47829826
+-4.11045943 -68.08505545
+-4.10068426 -67.69697256
+-4.09090909 -67.31404959
+-4.08113392 -66.93628652
+-4.07135875 -66.56368338
+-4.06158358 -66.19624014
+-4.05180841 -65.83395682
+-4.04203324 -65.47683342
+-4.03225806 -65.12486993
+-4.02248289 -64.77806635
+-4.01270772 -64.43642269
+-4.00293255 -64.09993894
+-3.99315738 -63.60411131
+-3.98338221 -63.04196730
+-3.97360704 -62.48383657
+-3.96383187 -61.92971910
+-3.95405670 -61.37961490
+-3.94428152 -60.83352396
+-3.93450635 -60.29144630
+-3.92473118 -59.75338189
+-3.91495601 -59.21933076
+-3.90518084 -58.68929289
+-3.89540567 -58.16326829
+-3.88563050 -57.64125696
+-3.87585533 -57.12325889
+-3.86608016 -56.60927409
+-3.85630499 -56.09930255
+-3.84652981 -55.59334428
+-3.83675464 -55.09139928
+-3.82697947 -54.59346755
+-3.81720430 -54.09954908
+-3.80742913 -53.60964388
+-3.79765396 -53.12375195
+-3.78787879 -52.64187328
+-3.77810362 -52.16400788
+-3.76832845 -51.69015574
+-3.75855327 -51.22031688
+-3.74877810 -50.75449128
+-3.73900293 -50.29267894
+-3.72922776 -49.83487987
+-3.71945259 -49.38109407
+-3.70967742 -48.93132154
+-3.69990225 -48.48556227
+-3.69012708 -48.04381627
+-3.68035191 -47.60608354
+-3.67057674 -47.17236407
+-3.66080156 -46.74265787
+-3.65102639 -46.31696494
+-3.64125122 -45.89528527
+-3.63147605 -45.47761887
+-3.62170088 -45.06396574
+-3.61192571 -44.65432587
+-3.60215054 -44.24869927
+-3.59237537 -43.84708594
+-3.58260020 -43.44948587
+-3.57282502 -43.05589907
+-3.56304985 -42.66632554
+-3.55327468 -42.28076527
+-3.54349951 -41.89921827
+-3.53372434 -41.52168454
+-3.52394917 -41.14816407
+-3.51417400 -40.77865687
+-3.50439883 -40.41316294
+-3.49462366 -40.05168228
+-3.48484848 -39.69421488
+-3.47507331 -39.34076074
+-3.46529814 -38.99131988
+-3.45552297 -38.64589228
+-3.44574780 -38.30447795
+-3.43597263 -37.96707688
+-3.42619746 -37.63368908
+-3.41642229 -37.30431455
+-3.40664712 -36.97895328
+-3.39687195 -36.65760528
+-3.38709677 -36.34027055
+-3.37732160 -36.02694909
+-3.36754643 -35.71764089
+-3.35777126 -35.41234596
+-3.34799609 -35.11106429
+-3.33822092 -34.81379589
+-3.32844575 -34.52054076
+-3.31867058 -34.23129889
+-3.30889541 -33.94607030
+-3.29912023 -33.66485496
+-3.28934506 -33.38765290
+-3.27956989 -33.11446410
+-3.26979472 -32.84528857
+-3.26001955 -32.58012630
+-3.25024438 -32.31897730
+-3.24046921 -32.06184157
+-3.23069404 -31.80871911
+-3.22091887 -31.55960991
+-3.21114370 -31.31451398
+-3.20136852 -31.07343131
+-3.19159335 -30.83636192
+-3.18181818 -30.60330579
+-3.17204301 -30.37426292
+-3.16226784 -30.14923332
+-3.15249267 -29.92821699
+-3.14271750 -29.71121393
+-3.13294233 -29.49822413
+-3.12316716 -29.28924760
+-3.11339198 -29.08428433
+-3.10361681 -28.88333434
+-3.09384164 -28.68639761
+-3.08406647 -28.49347414
+-3.07429130 -28.30456394
+-3.06451613 -28.11966701
+-3.05474096 -27.93878335
+-3.04496579 -27.76191295
+-3.03519062 -27.58905582
+-3.02541544 -27.42021196
+-3.01564027 -27.25538136
+-3.00586510 -27.09456403
+-2.99608993 -26.86728700
+-2.98631476 -26.53751114
+-2.97653959 -26.21060190
+-2.96676442 -25.88655928
+-2.95698925 -25.56538328
+-2.94721408 -25.24707390
+-2.93743891 -24.93163113
+-2.92766373 -24.61905499
+-2.91788856 -24.30934546
+-2.90811339 -24.00250256
+-2.89833822 -23.69852627
+-2.88856305 -23.39741660
+-2.87878788 -23.09917355
+-2.86901271 -22.80379712
+-2.85923754 -22.51128731
+-2.84946237 -22.22164412
+-2.83968719 -21.93486755
+-2.82991202 -21.65095759
+-2.82013685 -21.36991426
+-2.81036168 -21.09173754
+-2.80058651 -20.81642745
+-2.79081134 -20.54398397
+-2.78103617 -20.27440711
+-2.77126100 -20.00769687
+-2.76148583 -19.74385325
+-2.75171065 -19.48287625
+-2.74193548 -19.22476587
+-2.73216031 -18.96952211
+-2.72238514 -18.71714496
+-2.71260997 -18.46763444
+-2.70283480 -18.22099053
+-2.69305963 -17.97721324
+-2.68328446 -17.73630258
+-2.67350929 -17.49825853
+-2.66373412 -17.26308110
+-2.65395894 -17.03077029
+-2.64418377 -16.80132610
+-2.63440860 -16.57474853
+-2.62463343 -16.35103757
+-2.61485826 -16.13019324
+-2.60508309 -15.91221552
+-2.59530792 -15.69710443
+-2.58553275 -15.48485995
+-2.57575758 -15.27548209
+-2.56598240 -15.06897086
+-2.55620723 -14.86532624
+-2.54643206 -14.66454824
+-2.53665689 -14.46663685
+-2.52688172 -14.27159209
+-2.51710655 -14.07941395
+-2.50733138 -13.89010242
+-2.49755621 -13.70365752
+-2.48778104 -13.52007923
+-2.47800587 -13.33936757
+-2.46823069 -13.16152252
+-2.45845552 -12.98654409
+-2.44868035 -12.81443228
+-2.43890518 -12.64518709
+-2.42913001 -12.47880852
+-2.41935484 -12.31529657
+-2.40957967 -12.15465123
+-2.39980450 -11.99687252
+-2.39002933 -11.84196042
+-2.38025415 -11.68991495
+-2.37047898 -11.54073609
+-2.36070381 -11.39442385
+-2.35092864 -11.25097823
+-2.34115347 -11.11039923
+-2.33137830 -10.97268685
+-2.32160313 -10.83784109
+-2.31182796 -10.70586195
+-2.30205279 -10.57674943
+-2.29227761 -10.45050352
+-2.28250244 -10.32712424
+-2.27272727 -10.20661157
+-2.26295210 -10.08896552
+-2.25317693 -9.97418610
+-2.24340176 -9.86227329
+-2.23362659 -9.75322710
+-2.22385142 -9.64704753
+-2.21407625 -9.54373457
+-2.20430108 -9.44328824
+-2.19452590 -9.34570853
+-2.18475073 -9.25099543
+-2.17497556 -9.15914896
+-2.16520039 -9.07016910
+-2.15542522 -8.98405586
+-2.14565005 -8.90080925
+-2.13587488 -8.82042925
+-2.12609971 -8.74291587
+-2.11632454 -8.66826911
+-2.10654936 -8.59648896
+-2.09677419 -8.52757544
+-2.08699902 -8.46152854
+-2.07722385 -8.39834825
+-2.06744868 -8.33803459
+-2.05767351 -8.28058754
+-2.04789834 -8.22600711
+-2.03812317 -8.17429331
+-2.02834800 -8.12544612
+-2.01857283 -8.07946555
+-2.00879765 -8.03635160
+-1.99902248 -7.98436833
+-1.98924731 -7.82899757
+-1.97947214 -7.67534679
+-1.96969697 -7.52341598
+-1.95992180 -7.37320514
+-1.95014663 -7.22471427
+-1.94037146 -7.07794337
+-1.93059629 -6.93289245
+-1.92082111 -6.78956149
+-1.91104594 -6.64795051
+-1.90127077 -6.50805950
+-1.89149560 -6.36988846
+-1.88172043 -6.23343739
+-1.87194526 -6.09870629
+-1.86217009 -5.96569517
+-1.85239492 -5.83440402
+-1.84261975 -5.70483283
+-1.83284457 -5.57698162
+-1.82306940 -5.45085038
+-1.81329423 -5.32643911
+-1.80351906 -5.20374782
+-1.79374389 -5.08277649
+-1.78396872 -4.96352514
+-1.77419355 -4.84599376
+-1.76441838 -4.73018235
+-1.75464321 -4.61609091
+-1.74486804 -4.50371944
+-1.73509286 -4.39306794
+-1.72531769 -4.28413642
+-1.71554252 -4.17692486
+-1.70576735 -4.07143328
+-1.69599218 -3.96766167
+-1.68621701 -3.86561003
+-1.67644184 -3.76527836
+-1.66666667 -3.66666667
+-1.65689150 -3.56977494
+-1.64711632 -3.47460319
+-1.63734115 -3.38115141
+-1.62756598 -3.28941960
+-1.61779081 -3.19940776
+-1.60801564 -3.11111589
+-1.59824047 -3.02454399
+-1.58846530 -2.93969207
+-1.57869013 -2.85656011
+-1.56891496 -2.77514813
+-1.55913978 -2.69545612
+-1.54936461 -2.61748408
+-1.53958944 -2.54123202
+-1.52981427 -2.46669992
+-1.52003910 -2.39388779
+-1.51026393 -2.32279564
+-1.50048876 -2.25342346
+-1.49071359 -2.18577125
+-1.48093842 -2.11983901
+-1.47116325 -2.05562674
+-1.46138807 -1.99313445
+-1.45161290 -1.93236212
+-1.44183773 -1.87330977
+-1.43206256 -1.81597739
+-1.42228739 -1.76036498
+-1.41251222 -1.70647254
+-1.40273705 -1.65430007
+-1.39296188 -1.60384758
+-1.38318671 -1.55511505
+-1.37341153 -1.50810250
+-1.36363636 -1.46280992
+-1.35386119 -1.41923731
+-1.34408602 -1.37738467
+-1.33431085 -1.33725200
+-1.32453568 -1.29883931
+-1.31476051 -1.26214658
+-1.30498534 -1.22717383
+-1.29521017 -1.19392105
+-1.28543500 -1.16238824
+-1.27565982 -1.13257540
+-1.26588465 -1.10448253
+-1.25610948 -1.07810964
+-1.24633431 -1.05345671
+-1.23655914 -1.03052376
+-1.22678397 -1.00931078
+-1.21700880 -0.98981777
+-1.20723363 -0.97204473
+-1.19745846 -0.95599166
+-1.18768328 -0.94165857
+-1.17790811 -0.92904544
+-1.16813294 -0.91815229
+-1.15835777 -0.90897911
+-1.14858260 -0.90152590
+-1.13880743 -0.89579266
+-1.12903226 -0.89177940
+-1.11925709 -0.88948610
+-1.10948192 -0.88891278
+-1.09970674 -0.89005943
+-1.08993157 -0.89292604
+-1.08015640 -0.89751263
+-1.07038123 -0.90381920
+-1.06060606 -0.91184573
+-1.05083089 -0.92159223
+-1.04105572 -0.93305871
+-1.03128055 -0.94624516
+-1.02150538 -0.96115158
+-1.01173021 -0.97777797
+-1.00195503 -0.99612433
+-0.99217986 -0.96890292
+-0.98240469 -0.93054755
+-0.97262952 -0.89276551
+-0.96285435 -0.85555680
+-0.95307918 -0.81892141
+-0.94330401 -0.78285934
+-0.93352884 -0.74737059
+-0.92375367 -0.71245517
+-0.91397849 -0.67811308
+-0.90420332 -0.64434430
+-0.89442815 -0.61114885
+-0.88465298 -0.57852673
+-0.87487781 -0.54647793
+-0.86510264 -0.51500245
+-0.85532747 -0.48410030
+-0.84555230 -0.45377147
+-0.83577713 -0.42401596
+-0.82600196 -0.39483378
+-0.81622678 -0.36622492
+-0.80645161 -0.33818939
+-0.79667644 -0.31072718
+-0.78690127 -0.28383829
+-0.77712610 -0.25752273
+-0.76735093 -0.23178049
+-0.75757576 -0.20661157
+-0.74780059 -0.18201598
+-0.73802542 -0.15799371
+-0.72825024 -0.13454477
+-0.71847507 -0.11166915
+-0.70869990 -0.08936685
+-0.69892473 -0.06763788
+-0.68914956 -0.04648223
+-0.67937439 -0.02589990
+-0.66959922 -0.00589090
+-0.65982405 0.01354478
+-0.65004888 0.03240713
+-0.64027370 0.05069616
+-0.63049853 0.06841186
+-0.62072336 0.08555425
+-0.61094819 0.10212330
+-0.60117302 0.11811904
+-0.59139785 0.13354145
+-0.58162268 0.14839054
+-0.57184751 0.16266630
+-0.56207234 0.17636874
+-0.55229717 0.18949785
+-0.54252199 0.20205365
+-0.53274682 0.21403611
+-0.52297165 0.22544526
+-0.51319648 0.23628108
+-0.50342131 0.24654357
+-0.49364614 0.25623275
+-0.48387097 0.26534860
+-0.47409580 0.27389112
+-0.46432063 0.28186032
+-0.45454545 0.28925620
+-0.44477028 0.29607875
+-0.43499511 0.30232798
+-0.42521994 0.30800389
+-0.41544477 0.31310647
+-0.40566960 0.31763573
+-0.39589443 0.32159166
+-0.38611926 0.32497427
+-0.37634409 0.32778356
+-0.36656891 0.33001952
+-0.35679374 0.33168216
+-0.34701857 0.33277148
+-0.33724340 0.33328747
+-0.32746823 0.33323014
+-0.31769306 0.33259948
+-0.30791789 0.33139550
+-0.29814272 0.32961820
+-0.28836755 0.32726757
+-0.27859238 0.32434362
+-0.26881720 0.32084634
+-0.25904203 0.31677574
+-0.24926686 0.31213182
+-0.23949169 0.30691457
+-0.22971652 0.30112400
+-0.21994135 0.29476011
+-0.21016618 0.28782289
+-0.20039101 0.28031235
+-0.19061584 0.27222848
+-0.18084066 0.26357129
+-0.17106549 0.25434078
+-0.16129032 0.24453694
+-0.15151515 0.23415978
+-0.14173998 0.22320929
+-0.13196481 0.21168549
+-0.12218964 0.19958835
+-0.11241447 0.18691790
+-0.10263930 0.17367412
+-0.09286413 0.15985701
+-0.08308895 0.14546659
+-0.07331378 0.13050283
+-0.06353861 0.11496576
+-0.05376344 0.09885536
+-0.04398827 0.08217164
+-0.03421310 0.06491459
+-0.02443793 0.04708422
+-0.01466276 0.02868052
+-0.00488759 0.00970351
+0.00488759 -0.00970351
+0.01466276 -0.02868052
+0.02443793 -0.04708422
+0.03421310 -0.06491459
+0.04398827 -0.08217164
+0.05376344 -0.09885536
+0.06353861 -0.11496576
+0.07331378 -0.13050283
+0.08308895 -0.14546659
+0.09286413 -0.15985701
+0.10263930 -0.17367412
+0.11241447 -0.18691790
+0.12218964 -0.19958835
+0.13196481 -0.21168549
+0.14173998 -0.22320929
+0.15151515 -0.23415978
+0.16129032 -0.24453694
+0.17106549 -0.25434078
+0.18084066 -0.26357129
+0.19061584 -0.27222848
+0.20039101 -0.28031235
+0.21016618 -0.28782289
+0.21994135 -0.29476011
+0.22971652 -0.30112400
+0.23949169 -0.30691457
+0.24926686 -0.31213182
+0.25904203 -0.31677574
+0.26881720 -0.32084634
+0.27859238 -0.32434362
+0.28836755 -0.32726757
+0.29814272 -0.32961820
+0.30791789 -0.33139550
+0.31769306 -0.33259948
+0.32746823 -0.33323014
+0.33724340 -0.33328747
+0.34701857 -0.33277148
+0.35679374 -0.33168216
+0.36656891 -0.33001952
+0.37634409 -0.32778356
+0.38611926 -0.32497427
+0.39589443 -0.32159166
+0.40566960 -0.31763573
+0.41544477 -0.31310647
+0.42521994 -0.30800389
+0.43499511 -0.30232798
+0.44477028 -0.29607875
+0.45454545 -0.28925620
+0.46432063 -0.28186032
+0.47409580 -0.27389112
+0.48387097 -0.26534860
+0.49364614 -0.25623275
+0.50342131 -0.24654357
+0.51319648 -0.23628108
+0.52297165 -0.22544526
+0.53274682 -0.21403611
+0.54252199 -0.20205365
+0.55229717 -0.18949785
+0.56207234 -0.17636874
+0.57184751 -0.16266630
+0.58162268 -0.14839054
+0.59139785 -0.13354145
+0.60117302 -0.11811904
+0.61094819 -0.10212330
+0.62072336 -0.08555425
+0.63049853 -0.06841186
+0.64027370 -0.05069616
+0.65004888 -0.03240713
+0.65982405 -0.01354478
+0.66959922 0.00589090
+0.67937439 0.02589990
+0.68914956 0.04648223
+0.69892473 0.06763788
+0.70869990 0.08936685
+0.71847507 0.11166915
+0.72825024 0.13454477
+0.73802542 0.15799371
+0.74780059 0.18201598
+0.75757576 0.20661157
+0.76735093 0.23178049
+0.77712610 0.25752273
+0.78690127 0.28383829
+0.79667644 0.31072718
+0.80645161 0.33818939
+0.81622678 0.36622492
+0.82600196 0.39483378
+0.83577713 0.42401596
+0.84555230 0.45377147
+0.85532747 0.48410030
+0.86510264 0.51500245
+0.87487781 0.54647793
+0.88465298 0.57852673
+0.89442815 0.61114885
+0.90420332 0.64434430
+0.91397849 0.67811308
+0.92375367 0.71245517
+0.93352884 0.74737059
+0.94330401 0.78285934
+0.95307918 0.81892141
+0.96285435 0.85555680
+0.97262952 0.89276551
+0.98240469 0.93054755
+0.99217986 0.96890292
+1.00195503 0.99612433
+1.01173021 0.97777797
+1.02150538 0.96115158
+1.03128055 0.94624516
+1.04105572 0.93305871
+1.05083089 0.92159223
+1.06060606 0.91184573
+1.07038123 0.90381920
+1.08015640 0.89751263
+1.08993157 0.89292604
+1.09970674 0.89005943
+1.10948192 0.88891278
+1.11925709 0.88948610
+1.12903226 0.89177940
+1.13880743 0.89579266
+1.14858260 0.90152590
+1.15835777 0.90897911
+1.16813294 0.91815229
+1.17790811 0.92904544
+1.18768328 0.94165857
+1.19745846 0.95599166
+1.20723363 0.97204473
+1.21700880 0.98981777
+1.22678397 1.00931078
+1.23655914 1.03052376
+1.24633431 1.05345671
+1.25610948 1.07810964
+1.26588465 1.10448253
+1.27565982 1.13257540
+1.28543500 1.16238824
+1.29521017 1.19392105
+1.30498534 1.22717383
+1.31476051 1.26214658
+1.32453568 1.29883931
+1.33431085 1.33725200
+1.34408602 1.37738467
+1.35386119 1.41923731
+1.36363636 1.46280992
+1.37341153 1.50810250
+1.38318671 1.55511505
+1.39296188 1.60384758
+1.40273705 1.65430007
+1.41251222 1.70647254
+1.42228739 1.76036498
+1.43206256 1.81597739
+1.44183773 1.87330977
+1.45161290 1.93236212
+1.46138807 1.99313445
+1.47116325 2.05562674
+1.48093842 2.11983901
+1.49071359 2.18577125
+1.50048876 2.25342346
+1.51026393 2.32279564
+1.52003910 2.39388779
+1.52981427 2.46669992
+1.53958944 2.54123202
+1.54936461 2.61748408
+1.55913978 2.69545612
+1.56891496 2.77514813
+1.57869013 2.85656011
+1.58846530 2.93969207
+1.59824047 3.02454399
+1.60801564 3.11111589
+1.61779081 3.19940776
+1.62756598 3.28941960
+1.63734115 3.38115141
+1.64711632 3.47460319
+1.65689150 3.56977494
+1.66666667 3.66666667
+1.67644184 3.76527836
+1.68621701 3.86561003
+1.69599218 3.96766167
+1.70576735 4.07143328
+1.71554252 4.17692486
+1.72531769 4.28413642
+1.73509286 4.39306794
+1.74486804 4.50371944
+1.75464321 4.61609091
+1.76441838 4.73018235
+1.77419355 4.84599376
+1.78396872 4.96352514
+1.79374389 5.08277649
+1.80351906 5.20374782
+1.81329423 5.32643911
+1.82306940 5.45085038
+1.83284457 5.57698162
+1.84261975 5.70483283
+1.85239492 5.83440402
+1.86217009 5.96569517
+1.87194526 6.09870629
+1.88172043 6.23343739
+1.89149560 6.36988846
+1.90127077 6.50805950
+1.91104594 6.64795051
+1.92082111 6.78956149
+1.93059629 6.93289245
+1.94037146 7.07794337
+1.95014663 7.22471427
+1.95992180 7.37320514
+1.96969697 7.52341598
+1.97947214 7.67534679
+1.98924731 7.82899757
+1.99902248 7.98436833
+2.00879765 8.03635160
+2.01857283 8.07946555
+2.02834800 8.12544612
+2.03812317 8.17429331
+2.04789834 8.22600711
+2.05767351 8.28058754
+2.06744868 8.33803459
+2.07722385 8.39834825
+2.08699902 8.46152854
+2.09677419 8.52757544
+2.10654936 8.59648896
+2.11632454 8.66826911
+2.12609971 8.74291587
+2.13587488 8.82042925
+2.14565005 8.90080925
+2.15542522 8.98405586
+2.16520039 9.07016910
+2.17497556 9.15914896
+2.18475073 9.25099543
+2.19452590 9.34570853
+2.20430108 9.44328824
+2.21407625 9.54373457
+2.22385142 9.64704753
+2.23362659 9.75322710
+2.24340176 9.86227329
+2.25317693 9.97418610
+2.26295210 10.08896552
+2.27272727 10.20661157
+2.28250244 10.32712424
+2.29227761 10.45050352
+2.30205279 10.57674943
+2.31182796 10.70586195
+2.32160313 10.83784109
+2.33137830 10.97268685
+2.34115347 11.11039923
+2.35092864 11.25097823
+2.36070381 11.39442385
+2.37047898 11.54073609
+2.38025415 11.68991495
+2.39002933 11.84196042
+2.39980450 11.99687252
+2.40957967 12.15465123
+2.41935484 12.31529657
+2.42913001 12.47880852
+2.43890518 12.64518709
+2.44868035 12.81443228
+2.45845552 12.98654409
+2.46823069 13.16152252
+2.47800587 13.33936757
+2.48778104 13.52007923
+2.49755621 13.70365752
+2.50733138 13.89010242
+2.51710655 14.07941395
+2.52688172 14.27159209
+2.53665689 14.46663685
+2.54643206 14.66454824
+2.55620723 14.86532624
+2.56598240 15.06897086
+2.57575758 15.27548209
+2.58553275 15.48485995
+2.59530792 15.69710443
+2.60508309 15.91221552
+2.61485826 16.13019324
+2.62463343 16.35103757
+2.63440860 16.57474853
+2.64418377 16.80132610
+2.65395894 17.03077029
+2.66373412 17.26308110
+2.67350929 17.49825853
+2.68328446 17.73630258
+2.69305963 17.97721324
+2.70283480 18.22099053
+2.71260997 18.46763444
+2.72238514 18.71714496
+2.73216031 18.96952211
+2.74193548 19.22476587
+2.75171065 19.48287625
+2.76148583 19.74385325
+2.77126100 20.00769687
+2.78103617 20.27440711
+2.79081134 20.54398397
+2.80058651 20.81642745
+2.81036168 21.09173754
+2.82013685 21.36991426
+2.82991202 21.65095759
+2.83968719 21.93486755
+2.84946237 22.22164412
+2.85923754 22.51128731
+2.86901271 22.80379712
+2.87878788 23.09917355
+2.88856305 23.39741660
+2.89833822 23.69852627
+2.90811339 24.00250256
+2.91788856 24.30934546
+2.92766373 24.61905499
+2.93743891 24.93163113
+2.94721408 25.24707390
+2.95698925 25.56538328
+2.96676442 25.88655928
+2.97653959 26.21060190
+2.98631476 26.53751114
+2.99608993 26.86728700
+3.00586510 27.09456403
+3.01564027 27.25538136
+3.02541544 27.42021196
+3.03519062 27.58905582
+3.04496579 27.76191295
+3.05474096 27.93878335
+3.06451613 28.11966701
+3.07429130 28.30456394
+3.08406647 28.49347414
+3.09384164 28.68639761
+3.10361681 28.88333434
+3.11339198 29.08428433
+3.12316716 29.28924760
+3.13294233 29.49822413
+3.14271750 29.71121393
+3.15249267 29.92821699
+3.16226784 30.14923332
+3.17204301 30.37426292
+3.18181818 30.60330579
+3.19159335 30.83636192
+3.20136852 31.07343131
+3.21114370 31.31451398
+3.22091887 31.55960991
+3.23069404 31.80871911
+3.24046921 32.06184157
+3.25024438 32.31897730
+3.26001955 32.58012630
+3.26979472 32.84528857
+3.27956989 33.11446410
+3.28934506 33.38765290
+3.29912023 33.66485496
+3.30889541 33.94607030
+3.31867058 34.23129889
+3.32844575 34.52054076
+3.33822092 34.81379589
+3.34799609 35.11106429
+3.35777126 35.41234596
+3.36754643 35.71764089
+3.37732160 36.02694909
+3.38709677 36.34027055
+3.39687195 36.65760528
+3.40664712 36.97895328
+3.41642229 37.30431455
+3.42619746 37.63368908
+3.43597263 37.96707688
+3.44574780 38.30447795
+3.45552297 38.64589228
+3.46529814 38.99131988
+3.47507331 39.34076074
+3.48484848 39.69421488
+3.49462366 40.05168228
+3.50439883 40.41316294
+3.51417400 40.77865687
+3.52394917 41.14816407
+3.53372434 41.52168454
+3.54349951 41.89921827
+3.55327468 42.28076527
+3.56304985 42.66632554
+3.57282502 43.05589907
+3.58260020 43.44948587
+3.59237537 43.84708594
+3.60215054 44.24869927
+3.61192571 44.65432587
+3.62170088 45.06396574
+3.63147605 45.47761887
+3.64125122 45.89528527
+3.65102639 46.31696494
+3.66080156 46.74265787
+3.67057674 47.17236407
+3.68035191 47.60608354
+3.69012708 48.04381627
+3.69990225 48.48556227
+3.70967742 48.93132154
+3.71945259 49.38109407
+3.72922776 49.83487987
+3.73900293 50.29267894
+3.74877810 50.75449128
+3.75855327 51.22031688
+3.76832845 51.69015574
+3.77810362 52.16400788
+3.78787879 52.64187328
+3.79765396 53.12375195
+3.80742913 53.60964388
+3.81720430 54.09954908
+3.82697947 54.59346755
+3.83675464 55.09139928
+3.84652981 55.59334428
+3.85630499 56.09930255
+3.86608016 56.60927409
+3.87585533 57.12325889
+3.88563050 57.64125696
+3.89540567 58.16326829
+3.90518084 58.68929289
+3.91495601 59.21933076
+3.92473118 59.75338189
+3.93450635 60.29144630
+3.94428152 60.83352396
+3.95405670 61.37961490
+3.96383187 61.92971910
+3.97360704 62.48383657
+3.98338221 63.04196730
+3.99315738 63.60411131
+4.00293255 64.09993894
+4.01270772 64.43642269
+4.02248289 64.77806635
+4.03225806 65.12486993
+4.04203324 65.47683342
+4.05180841 65.83395682
+4.06158358 66.19624014
+4.07135875 66.56368338
+4.08113392 66.93628652
+4.09090909 67.31404959
+4.10068426 67.69697256
+4.11045943 68.08505545
+4.12023460 68.47829826
+4.13000978 68.87670098
+4.13978495 69.28026361
+4.14956012 69.68898616
+4.15933529 70.10286863
+4.16911046 70.52191100
+4.17888563 70.94611329
+4.18866080 71.37547550
+4.19843597 71.80999762
+4.20821114 72.24967966
+4.21798631 72.69452160
+4.22776149 73.14452347
+4.23753666 73.59968525
+4.24731183 74.06000694
+4.25708700 74.52548854
+4.26686217 74.99613006
+4.27663734 75.47193150
+4.28641251 75.95289285
+4.29618768 76.43901411
+4.30596285 76.93029529
+4.31573803 77.42673638
+4.32551320 77.92833739
+4.33528837 78.43509831
+4.34506354 78.94701915
+4.35483871 79.46409990
+4.36461388 79.98634056
+4.37438905 80.51374114
+4.38416422 81.04630163
+4.39393939 81.58402204
+4.40371457 82.12690236
+4.41348974 82.67494260
+4.42326491 83.22814275
+4.43304008 83.78650281
+4.44281525 84.35002279
+4.45259042 84.91870268
+4.46236559 85.49254249
+4.47214076 86.07154221
+4.48191593 86.65570185
+4.49169110 87.24502140
+4.50146628 87.83950086
+4.51124145 88.43914024
+4.52101662 89.04393954
+4.53079179 89.65389875
+4.54056696 90.26901787
+4.55034213 90.88929690
+4.56011730 91.51473586
+4.56989247 92.14533472
+4.57966764 92.78109350
+4.58944282 93.42201219
+4.59921799 94.06809080
+4.60899316 94.71932933
+4.61876833 95.37572776
+4.62854350 96.03728611
+4.63831867 96.70400438
+4.64809384 97.37588256
+4.65786901 98.05292065
+4.66764418 98.73511866
+4.67741935 99.42247659
+4.68719453 100.11499442
+4.69696970 100.81267218
+4.70674487 101.51550984
+4.71652004 102.22350742
+4.72629521 102.93666492
+4.73607038 103.65498233
+4.74584555 104.37845965
+4.75562072 105.10709689
+4.76539589 105.84089404
+4.77517107 106.57985111
+4.78494624 107.32396809
+4.79472141 108.07324498
+4.80449658 108.82768179
+4.81427175 109.58727852
+4.82404692 110.35203516
+4.83382209 111.12195171
+4.84359726 111.89702818
+4.85337243 112.67726456
+4.86314761 113.46266085
+4.87292278 114.25321706
+4.88269795 115.04893319
+4.89247312 115.84980923
+4.90224829 116.65584518
+4.91202346 117.46704105
+4.92179863 118.28339683
+4.93157380 119.10491253
+4.94134897 119.93158814
+4.95112414 120.76342366
+4.96089932 121.60041910
+4.97067449 122.44257445
+4.98044966 123.28988972
+4.99022483 124.14236490
+5.00000000 125.00000000
diff --git a/examples/takagi-sugeno/octave/cubic_approximator.fll b/examples/takagi-sugeno/octave/cubic_approximator.fll
new file mode 100644
index 0000000..073e70e
--- /dev/null
+++ b/examples/takagi-sugeno/octave/cubic_approximator.fll
@@ -0,0 +1,50 @@
+Engine: Cubic-Approximator
+InputVariable: X
+ enabled: true
+ range: -5.000 5.000
+ term: AboutNegFive Triangle -6.000 -5.000 -4.000
+ term: AboutNegFour Triangle -5.000 -4.000 -3.000
+ term: AboutNegThree Triangle -4.000 -3.000 -2.000
+ term: AboutNegTwo Triangle -3.000 -2.000 -1.000
+ term: AboutNegOne Triangle -2.000 -1.000 0.000
+ term: AboutZero Triangle -1.000 0.000 1.000
+ term: AboutOne Triangle 0.000 1.000 2.000
+ term: AboutTwo Triangle 1.000 2.000 3.000
+ term: AboutThree Triangle 2.000 3.000 4.000
+ term: AboutFour Triangle 3.000 4.000 5.000
+ term: AboutFive Triangle 4.000 5.000 6.000
+OutputVariable: ApproxXCubed
+ enabled: true
+ range: -5.000 5.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: TangentatNegFive Linear 75.000 250.000
+ term: TangentatNegFour Linear 48.000 128.000
+ term: TangentatNegThree Linear 27.000 54.000
+ term: TangentatNegTwo Linear 12.000 16.000
+ term: TangentatNegOne Linear 3.000 2.000
+ term: TangentatZero Linear 0.000 0.000
+ term: TangentatOne Linear 3.000 -2.000
+ term: TangentatTwo Linear 12.000 -16.000
+ term: TangentatThree Linear 27.000 -54.000
+ term: TangentatFour Linear 48.000 -128.000
+ term: TangentatFive Linear 75.000 -250.000
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: none
+ rule: if X is AboutNegFive then ApproxXCubed is TangentatNegFive
+ rule: if X is AboutNegFour then ApproxXCubed is TangentatNegFour
+ rule: if X is AboutNegThree then ApproxXCubed is TangentatNegThree
+ rule: if X is AboutNegTwo then ApproxXCubed is TangentatNegTwo
+ rule: if X is AboutNegOne then ApproxXCubed is TangentatNegOne
+ rule: if X is AboutZero then ApproxXCubed is TangentatZero
+ rule: if X is AboutOne then ApproxXCubed is TangentatOne
+ rule: if X is AboutTwo then ApproxXCubed is TangentatTwo
+ rule: if X is AboutThree then ApproxXCubed is TangentatThree
+ rule: if X is AboutFour then ApproxXCubed is TangentatFour
+ rule: if X is AboutFive then ApproxXCubed is TangentatFive \ No newline at end of file
diff --git a/examples/takagi-sugeno/octave/cubic_approximator.java b/examples/takagi-sugeno/octave/cubic_approximator.java
new file mode 100644
index 0000000..1955a24
--- /dev/null
+++ b/examples/takagi-sugeno/octave/cubic_approximator.java
@@ -0,0 +1,78 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class cubic_approximator{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("Cubic-Approximator");
+
+InputVariable inputVariable = new InputVariable();
+inputVariable.setEnabled(true);
+inputVariable.setName("X");
+inputVariable.setRange(-5.000, 5.000);
+inputVariable.addTerm(new Triangle("AboutNegFive", -6.000, -5.000, -4.000));
+inputVariable.addTerm(new Triangle("AboutNegFour", -5.000, -4.000, -3.000));
+inputVariable.addTerm(new Triangle("AboutNegThree", -4.000, -3.000, -2.000));
+inputVariable.addTerm(new Triangle("AboutNegTwo", -3.000, -2.000, -1.000));
+inputVariable.addTerm(new Triangle("AboutNegOne", -2.000, -1.000, 0.000));
+inputVariable.addTerm(new Triangle("AboutZero", -1.000, 0.000, 1.000));
+inputVariable.addTerm(new Triangle("AboutOne", 0.000, 1.000, 2.000));
+inputVariable.addTerm(new Triangle("AboutTwo", 1.000, 2.000, 3.000));
+inputVariable.addTerm(new Triangle("AboutThree", 2.000, 3.000, 4.000));
+inputVariable.addTerm(new Triangle("AboutFour", 3.000, 4.000, 5.000));
+inputVariable.addTerm(new Triangle("AboutFive", 4.000, 5.000, 6.000));
+engine.addInputVariable(inputVariable);
+
+OutputVariable outputVariable = new OutputVariable();
+outputVariable.setEnabled(true);
+outputVariable.setName("ApproxXCubed");
+outputVariable.setRange(-5.000, 5.000);
+outputVariable.fuzzyOutput().setAccumulation(null);
+outputVariable.setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable.setDefaultValue(Double.NaN);
+outputVariable.setLockPreviousOutputValue(false);
+outputVariable.setLockOutputValueInRange(false);
+outputVariable.addTerm(Linear.create("TangentatNegFive", engine, 75.000, 250.000));
+outputVariable.addTerm(Linear.create("TangentatNegFour", engine, 48.000, 128.000));
+outputVariable.addTerm(Linear.create("TangentatNegThree", engine, 27.000, 54.000));
+outputVariable.addTerm(Linear.create("TangentatNegTwo", engine, 12.000, 16.000));
+outputVariable.addTerm(Linear.create("TangentatNegOne", engine, 3.000, 2.000));
+outputVariable.addTerm(Linear.create("TangentatZero", engine, 0.000, 0.000));
+outputVariable.addTerm(Linear.create("TangentatOne", engine, 3.000, -2.000));
+outputVariable.addTerm(Linear.create("TangentatTwo", engine, 12.000, -16.000));
+outputVariable.addTerm(Linear.create("TangentatThree", engine, 27.000, -54.000));
+outputVariable.addTerm(Linear.create("TangentatFour", engine, 48.000, -128.000));
+outputVariable.addTerm(Linear.create("TangentatFive", engine, 75.000, -250.000));
+engine.addOutputVariable(outputVariable);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(null);
+ruleBlock.setDisjunction(null);
+ruleBlock.setActivation(null);
+ruleBlock.addRule(Rule.parse("if X is AboutNegFive then ApproxXCubed is TangentatNegFive", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutNegFour then ApproxXCubed is TangentatNegFour", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutNegThree then ApproxXCubed is TangentatNegThree", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutNegTwo then ApproxXCubed is TangentatNegTwo", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutNegOne then ApproxXCubed is TangentatNegOne", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutZero then ApproxXCubed is TangentatZero", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutOne then ApproxXCubed is TangentatOne", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutTwo then ApproxXCubed is TangentatTwo", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutThree then ApproxXCubed is TangentatThree", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutFour then ApproxXCubed is TangentatFour", engine));
+ruleBlock.addRule(Rule.parse("if X is AboutFive then ApproxXCubed is TangentatFive", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/takagi-sugeno/octave/heart_disease_risk.cpp b/examples/takagi-sugeno/octave/heart_disease_risk.cpp
new file mode 100644
index 0000000..397b303
--- /dev/null
+++ b/examples/takagi-sugeno/octave/heart_disease_risk.cpp
@@ -0,0 +1,69 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("Heart-Disease-Risk");
+
+InputVariable* inputVariable1 = new InputVariable;
+inputVariable1->setEnabled(true);
+inputVariable1->setName("LDLLevel");
+inputVariable1->setRange(0.000, 300.000);
+inputVariable1->addTerm(new Trapezoid("Low", -1.000, 0.000, 90.000, 110.000));
+inputVariable1->addTerm(new Trapezoid("LowBorderline", 90.000, 110.000, 120.000, 140.000));
+inputVariable1->addTerm(new Trapezoid("Borderline", 120.000, 140.000, 150.000, 170.000));
+inputVariable1->addTerm(new Trapezoid("HighBorderline", 150.000, 170.000, 180.000, 200.000));
+inputVariable1->addTerm(new Trapezoid("High", 180.000, 200.000, 300.000, 301.000));
+engine->addInputVariable(inputVariable1);
+
+InputVariable* inputVariable2 = new InputVariable;
+inputVariable2->setEnabled(true);
+inputVariable2->setName("HDLLevel");
+inputVariable2->setRange(0.000, 100.000);
+inputVariable2->addTerm(new Trapezoid("LowHDL", -1.000, 0.000, 35.000, 45.000));
+inputVariable2->addTerm(new Trapezoid("ModerateHDL", 35.000, 45.000, 55.000, 65.000));
+inputVariable2->addTerm(new Trapezoid("HighHDL", 55.000, 65.000, 100.000, 101.000));
+engine->addInputVariable(inputVariable2);
+
+OutputVariable* outputVariable = new OutputVariable;
+outputVariable->setEnabled(true);
+outputVariable->setName("HeartDiseaseRisk");
+outputVariable->setRange(0.000, 10.000);
+outputVariable->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable->setDefaultValue(fl::nan);
+outputVariable->setLockPreviousOutputValue(false);
+outputVariable->setLockOutputValueInRange(false);
+outputVariable->addTerm(new Constant("NoRisk", 0.000));
+outputVariable->addTerm(new Constant("LowRisk", 2.500));
+outputVariable->addTerm(new Constant("MediumRisk", 5.000));
+outputVariable->addTerm(new Constant("HighRisk", 7.500));
+outputVariable->addTerm(new Constant("ExtremeRisk", 10.000));
+engine->addOutputVariable(outputVariable);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(new Minimum);
+ruleBlock->setDisjunction(fl::null);
+ruleBlock->setActivation(fl::null);
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is Low and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is Low and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is Low and HDLLevel is HighHDL then HeartDiseaseRisk is NoRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is LowBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is LowBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is LowBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is Borderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is Borderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is MediumRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is Borderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is HighBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is HighBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is HighBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is High and HDLLevel is LowHDL then HeartDiseaseRisk is ExtremeRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is High and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk", engine));
+ruleBlock->addRule(fl::Rule::parse("if LDLLevel is High and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/takagi-sugeno/octave/heart_disease_risk.fcl b/examples/takagi-sugeno/octave/heart_disease_risk.fcl
new file mode 100644
index 0000000..9629a47
--- /dev/null
+++ b/examples/takagi-sugeno/octave/heart_disease_risk.fcl
@@ -0,0 +1,58 @@
+FUNCTION_BLOCK Heart-Disease-Risk
+
+VAR_INPUT
+ LDLLevel: REAL;
+ HDLLevel: REAL;
+END_VAR
+
+VAR_OUTPUT
+ HeartDiseaseRisk: REAL;
+END_VAR
+
+FUZZIFY LDLLevel
+ RANGE := (0.000 .. 300.000);
+ TERM Low := Trapezoid -1.000 0.000 90.000 110.000;
+ TERM LowBorderline := Trapezoid 90.000 110.000 120.000 140.000;
+ TERM Borderline := Trapezoid 120.000 140.000 150.000 170.000;
+ TERM HighBorderline := Trapezoid 150.000 170.000 180.000 200.000;
+ TERM High := Trapezoid 180.000 200.000 300.000 301.000;
+END_FUZZIFY
+
+FUZZIFY HDLLevel
+ RANGE := (0.000 .. 100.000);
+ TERM LowHDL := Trapezoid -1.000 0.000 35.000 45.000;
+ TERM ModerateHDL := Trapezoid 35.000 45.000 55.000 65.000;
+ TERM HighHDL := Trapezoid 55.000 65.000 100.000 101.000;
+END_FUZZIFY
+
+DEFUZZIFY HeartDiseaseRisk
+ RANGE := (0.000 .. 10.000);
+ TERM NoRisk := 0.000;
+ TERM LowRisk := 2.500;
+ TERM MediumRisk := 5.000;
+ TERM HighRisk := 7.500;
+ TERM ExtremeRisk := 10.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ AND : MIN;
+ RULE 1 : if LDLLevel is Low and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk
+ RULE 2 : if LDLLevel is Low and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk
+ RULE 3 : if LDLLevel is Low and HDLLevel is HighHDL then HeartDiseaseRisk is NoRisk
+ RULE 4 : if LDLLevel is LowBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk
+ RULE 5 : if LDLLevel is LowBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk
+ RULE 6 : if LDLLevel is LowBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk
+ RULE 7 : if LDLLevel is Borderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk
+ RULE 8 : if LDLLevel is Borderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is MediumRisk
+ RULE 9 : if LDLLevel is Borderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk
+ RULE 10 : if LDLLevel is HighBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk
+ RULE 11 : if LDLLevel is HighBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk
+ RULE 12 : if LDLLevel is HighBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk
+ RULE 13 : if LDLLevel is High and HDLLevel is LowHDL then HeartDiseaseRisk is ExtremeRisk
+ RULE 14 : if LDLLevel is High and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk
+ RULE 15 : if LDLLevel is High and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/takagi-sugeno/octave/heart_disease_risk.fis b/examples/takagi-sugeno/octave/heart_disease_risk.fis
new file mode 100644
index 0000000..11686f1
--- /dev/null
+++ b/examples/takagi-sugeno/octave/heart_disease_risk.fis
@@ -0,0 +1,56 @@
+[System]
+Name='Heart-Disease-Risk'
+Type='sugeno'
+NumInputs=2
+NumOutputs=1
+NumRules=15
+AndMethod='min'
+OrMethod=''
+ImpMethod=''
+AggMethod=''
+DefuzzMethod='wtaver'
+
+[Input1]
+Name='LDLLevel'
+Range=[0.000 300.000]
+NumMFs=5
+MF1='Low':'trapmf',[-1.000 0.000 90.000 110.000]
+MF2='LowBorderline':'trapmf',[90.000 110.000 120.000 140.000]
+MF3='Borderline':'trapmf',[120.000 140.000 150.000 170.000]
+MF4='HighBorderline':'trapmf',[150.000 170.000 180.000 200.000]
+MF5='High':'trapmf',[180.000 200.000 300.000 301.000]
+
+[Input2]
+Name='HDLLevel'
+Range=[0.000 100.000]
+NumMFs=3
+MF1='LowHDL':'trapmf',[-1.000 0.000 35.000 45.000]
+MF2='ModerateHDL':'trapmf',[35.000 45.000 55.000 65.000]
+MF3='HighHDL':'trapmf',[55.000 65.000 100.000 101.000]
+
+[Output1]
+Name='HeartDiseaseRisk'
+Range=[0.000 10.000]
+NumMFs=5
+MF1='NoRisk':'constant',[0.000]
+MF2='LowRisk':'constant',[2.500]
+MF3='MediumRisk':'constant',[5.000]
+MF4='HighRisk':'constant',[7.500]
+MF5='ExtremeRisk':'constant',[10.000]
+
+[Rules]
+1.000 1.000 , 3.000 (1.000) : 1
+1.000 2.000 , 2.000 (1.000) : 1
+1.000 3.000 , 1.000 (1.000) : 1
+2.000 1.000 , 3.000 (1.000) : 1
+2.000 2.000 , 2.000 (1.000) : 1
+2.000 3.000 , 2.000 (1.000) : 1
+3.000 1.000 , 4.000 (1.000) : 1
+3.000 2.000 , 3.000 (1.000) : 1
+3.000 3.000 , 2.000 (1.000) : 1
+4.000 1.000 , 4.000 (1.000) : 1
+4.000 2.000 , 4.000 (1.000) : 1
+4.000 3.000 , 3.000 (1.000) : 1
+5.000 1.000 , 5.000 (1.000) : 1
+5.000 2.000 , 4.000 (1.000) : 1
+5.000 3.000 , 3.000 (1.000) : 1
diff --git a/examples/takagi-sugeno/octave/heart_disease_risk.fld b/examples/takagi-sugeno/octave/heart_disease_risk.fld
new file mode 100644
index 0000000..afc1fe0
--- /dev/null
+++ b/examples/takagi-sugeno/octave/heart_disease_risk.fld
@@ -0,0 +1,1026 @@
+#@Engine: Heart-Disease-Risk;
+#@InputVariable: LDLLevel; @InputVariable: HDLLevel; @OutputVariable: HeartDiseaseRisk;
+0.00000000 0.00000000 5.00000000
+0.00000000 3.22580645 5.00000000
+0.00000000 6.45161290 5.00000000
+0.00000000 9.67741935 5.00000000
+0.00000000 12.90322581 5.00000000
+0.00000000 16.12903226 5.00000000
+0.00000000 19.35483871 5.00000000
+0.00000000 22.58064516 5.00000000
+0.00000000 25.80645161 5.00000000
+0.00000000 29.03225806 5.00000000
+0.00000000 32.25806452 5.00000000
+0.00000000 35.48387097 4.87903226
+0.00000000 38.70967742 4.07258065
+0.00000000 41.93548387 3.26612903
+0.00000000 45.16129032 2.50000000
+0.00000000 48.38709677 2.50000000
+0.00000000 51.61290323 2.50000000
+0.00000000 54.83870968 2.50000000
+0.00000000 58.06451613 1.73387097
+0.00000000 61.29032258 0.92741935
+0.00000000 64.51612903 0.12096774
+0.00000000 67.74193548 0.00000000
+0.00000000 70.96774194 0.00000000
+0.00000000 74.19354839 0.00000000
+0.00000000 77.41935484 0.00000000
+0.00000000 80.64516129 0.00000000
+0.00000000 83.87096774 0.00000000
+0.00000000 87.09677419 0.00000000
+0.00000000 90.32258065 0.00000000
+0.00000000 93.54838710 0.00000000
+0.00000000 96.77419355 0.00000000
+0.00000000 100.00000000 0.00000000
+9.67741935 0.00000000 5.00000000
+9.67741935 3.22580645 5.00000000
+9.67741935 6.45161290 5.00000000
+9.67741935 9.67741935 5.00000000
+9.67741935 12.90322581 5.00000000
+9.67741935 16.12903226 5.00000000
+9.67741935 19.35483871 5.00000000
+9.67741935 22.58064516 5.00000000
+9.67741935 25.80645161 5.00000000
+9.67741935 29.03225806 5.00000000
+9.67741935 32.25806452 5.00000000
+9.67741935 35.48387097 4.87903226
+9.67741935 38.70967742 4.07258065
+9.67741935 41.93548387 3.26612903
+9.67741935 45.16129032 2.50000000
+9.67741935 48.38709677 2.50000000
+9.67741935 51.61290323 2.50000000
+9.67741935 54.83870968 2.50000000
+9.67741935 58.06451613 1.73387097
+9.67741935 61.29032258 0.92741935
+9.67741935 64.51612903 0.12096774
+9.67741935 67.74193548 0.00000000
+9.67741935 70.96774194 0.00000000
+9.67741935 74.19354839 0.00000000
+9.67741935 77.41935484 0.00000000
+9.67741935 80.64516129 0.00000000
+9.67741935 83.87096774 0.00000000
+9.67741935 87.09677419 0.00000000
+9.67741935 90.32258065 0.00000000
+9.67741935 93.54838710 0.00000000
+9.67741935 96.77419355 0.00000000
+9.67741935 100.00000000 0.00000000
+19.35483871 0.00000000 5.00000000
+19.35483871 3.22580645 5.00000000
+19.35483871 6.45161290 5.00000000
+19.35483871 9.67741935 5.00000000
+19.35483871 12.90322581 5.00000000
+19.35483871 16.12903226 5.00000000
+19.35483871 19.35483871 5.00000000
+19.35483871 22.58064516 5.00000000
+19.35483871 25.80645161 5.00000000
+19.35483871 29.03225806 5.00000000
+19.35483871 32.25806452 5.00000000
+19.35483871 35.48387097 4.87903226
+19.35483871 38.70967742 4.07258065
+19.35483871 41.93548387 3.26612903
+19.35483871 45.16129032 2.50000000
+19.35483871 48.38709677 2.50000000
+19.35483871 51.61290323 2.50000000
+19.35483871 54.83870968 2.50000000
+19.35483871 58.06451613 1.73387097
+19.35483871 61.29032258 0.92741935
+19.35483871 64.51612903 0.12096774
+19.35483871 67.74193548 0.00000000
+19.35483871 70.96774194 0.00000000
+19.35483871 74.19354839 0.00000000
+19.35483871 77.41935484 0.00000000
+19.35483871 80.64516129 0.00000000
+19.35483871 83.87096774 0.00000000
+19.35483871 87.09677419 0.00000000
+19.35483871 90.32258065 0.00000000
+19.35483871 93.54838710 0.00000000
+19.35483871 96.77419355 0.00000000
+19.35483871 100.00000000 0.00000000
+29.03225806 0.00000000 5.00000000
+29.03225806 3.22580645 5.00000000
+29.03225806 6.45161290 5.00000000
+29.03225806 9.67741935 5.00000000
+29.03225806 12.90322581 5.00000000
+29.03225806 16.12903226 5.00000000
+29.03225806 19.35483871 5.00000000
+29.03225806 22.58064516 5.00000000
+29.03225806 25.80645161 5.00000000
+29.03225806 29.03225806 5.00000000
+29.03225806 32.25806452 5.00000000
+29.03225806 35.48387097 4.87903226
+29.03225806 38.70967742 4.07258065
+29.03225806 41.93548387 3.26612903
+29.03225806 45.16129032 2.50000000
+29.03225806 48.38709677 2.50000000
+29.03225806 51.61290323 2.50000000
+29.03225806 54.83870968 2.50000000
+29.03225806 58.06451613 1.73387097
+29.03225806 61.29032258 0.92741935
+29.03225806 64.51612903 0.12096774
+29.03225806 67.74193548 0.00000000
+29.03225806 70.96774194 0.00000000
+29.03225806 74.19354839 0.00000000
+29.03225806 77.41935484 0.00000000
+29.03225806 80.64516129 0.00000000
+29.03225806 83.87096774 0.00000000
+29.03225806 87.09677419 0.00000000
+29.03225806 90.32258065 0.00000000
+29.03225806 93.54838710 0.00000000
+29.03225806 96.77419355 0.00000000
+29.03225806 100.00000000 0.00000000
+38.70967742 0.00000000 5.00000000
+38.70967742 3.22580645 5.00000000
+38.70967742 6.45161290 5.00000000
+38.70967742 9.67741935 5.00000000
+38.70967742 12.90322581 5.00000000
+38.70967742 16.12903226 5.00000000
+38.70967742 19.35483871 5.00000000
+38.70967742 22.58064516 5.00000000
+38.70967742 25.80645161 5.00000000
+38.70967742 29.03225806 5.00000000
+38.70967742 32.25806452 5.00000000
+38.70967742 35.48387097 4.87903226
+38.70967742 38.70967742 4.07258065
+38.70967742 41.93548387 3.26612903
+38.70967742 45.16129032 2.50000000
+38.70967742 48.38709677 2.50000000
+38.70967742 51.61290323 2.50000000
+38.70967742 54.83870968 2.50000000
+38.70967742 58.06451613 1.73387097
+38.70967742 61.29032258 0.92741935
+38.70967742 64.51612903 0.12096774
+38.70967742 67.74193548 0.00000000
+38.70967742 70.96774194 0.00000000
+38.70967742 74.19354839 0.00000000
+38.70967742 77.41935484 0.00000000
+38.70967742 80.64516129 0.00000000
+38.70967742 83.87096774 0.00000000
+38.70967742 87.09677419 0.00000000
+38.70967742 90.32258065 0.00000000
+38.70967742 93.54838710 0.00000000
+38.70967742 96.77419355 0.00000000
+38.70967742 100.00000000 0.00000000
+48.38709677 0.00000000 5.00000000
+48.38709677 3.22580645 5.00000000
+48.38709677 6.45161290 5.00000000
+48.38709677 9.67741935 5.00000000
+48.38709677 12.90322581 5.00000000
+48.38709677 16.12903226 5.00000000
+48.38709677 19.35483871 5.00000000
+48.38709677 22.58064516 5.00000000
+48.38709677 25.80645161 5.00000000
+48.38709677 29.03225806 5.00000000
+48.38709677 32.25806452 5.00000000
+48.38709677 35.48387097 4.87903226
+48.38709677 38.70967742 4.07258065
+48.38709677 41.93548387 3.26612903
+48.38709677 45.16129032 2.50000000
+48.38709677 48.38709677 2.50000000
+48.38709677 51.61290323 2.50000000
+48.38709677 54.83870968 2.50000000
+48.38709677 58.06451613 1.73387097
+48.38709677 61.29032258 0.92741935
+48.38709677 64.51612903 0.12096774
+48.38709677 67.74193548 0.00000000
+48.38709677 70.96774194 0.00000000
+48.38709677 74.19354839 0.00000000
+48.38709677 77.41935484 0.00000000
+48.38709677 80.64516129 0.00000000
+48.38709677 83.87096774 0.00000000
+48.38709677 87.09677419 0.00000000
+48.38709677 90.32258065 0.00000000
+48.38709677 93.54838710 0.00000000
+48.38709677 96.77419355 0.00000000
+48.38709677 100.00000000 0.00000000
+58.06451613 0.00000000 5.00000000
+58.06451613 3.22580645 5.00000000
+58.06451613 6.45161290 5.00000000
+58.06451613 9.67741935 5.00000000
+58.06451613 12.90322581 5.00000000
+58.06451613 16.12903226 5.00000000
+58.06451613 19.35483871 5.00000000
+58.06451613 22.58064516 5.00000000
+58.06451613 25.80645161 5.00000000
+58.06451613 29.03225806 5.00000000
+58.06451613 32.25806452 5.00000000
+58.06451613 35.48387097 4.87903226
+58.06451613 38.70967742 4.07258065
+58.06451613 41.93548387 3.26612903
+58.06451613 45.16129032 2.50000000
+58.06451613 48.38709677 2.50000000
+58.06451613 51.61290323 2.50000000
+58.06451613 54.83870968 2.50000000
+58.06451613 58.06451613 1.73387097
+58.06451613 61.29032258 0.92741935
+58.06451613 64.51612903 0.12096774
+58.06451613 67.74193548 0.00000000
+58.06451613 70.96774194 0.00000000
+58.06451613 74.19354839 0.00000000
+58.06451613 77.41935484 0.00000000
+58.06451613 80.64516129 0.00000000
+58.06451613 83.87096774 0.00000000
+58.06451613 87.09677419 0.00000000
+58.06451613 90.32258065 0.00000000
+58.06451613 93.54838710 0.00000000
+58.06451613 96.77419355 0.00000000
+58.06451613 100.00000000 0.00000000
+67.74193548 0.00000000 5.00000000
+67.74193548 3.22580645 5.00000000
+67.74193548 6.45161290 5.00000000
+67.74193548 9.67741935 5.00000000
+67.74193548 12.90322581 5.00000000
+67.74193548 16.12903226 5.00000000
+67.74193548 19.35483871 5.00000000
+67.74193548 22.58064516 5.00000000
+67.74193548 25.80645161 5.00000000
+67.74193548 29.03225806 5.00000000
+67.74193548 32.25806452 5.00000000
+67.74193548 35.48387097 4.87903226
+67.74193548 38.70967742 4.07258065
+67.74193548 41.93548387 3.26612903
+67.74193548 45.16129032 2.50000000
+67.74193548 48.38709677 2.50000000
+67.74193548 51.61290323 2.50000000
+67.74193548 54.83870968 2.50000000
+67.74193548 58.06451613 1.73387097
+67.74193548 61.29032258 0.92741935
+67.74193548 64.51612903 0.12096774
+67.74193548 67.74193548 0.00000000
+67.74193548 70.96774194 0.00000000
+67.74193548 74.19354839 0.00000000
+67.74193548 77.41935484 0.00000000
+67.74193548 80.64516129 0.00000000
+67.74193548 83.87096774 0.00000000
+67.74193548 87.09677419 0.00000000
+67.74193548 90.32258065 0.00000000
+67.74193548 93.54838710 0.00000000
+67.74193548 96.77419355 0.00000000
+67.74193548 100.00000000 0.00000000
+77.41935484 0.00000000 5.00000000
+77.41935484 3.22580645 5.00000000
+77.41935484 6.45161290 5.00000000
+77.41935484 9.67741935 5.00000000
+77.41935484 12.90322581 5.00000000
+77.41935484 16.12903226 5.00000000
+77.41935484 19.35483871 5.00000000
+77.41935484 22.58064516 5.00000000
+77.41935484 25.80645161 5.00000000
+77.41935484 29.03225806 5.00000000
+77.41935484 32.25806452 5.00000000
+77.41935484 35.48387097 4.87903226
+77.41935484 38.70967742 4.07258065
+77.41935484 41.93548387 3.26612903
+77.41935484 45.16129032 2.50000000
+77.41935484 48.38709677 2.50000000
+77.41935484 51.61290323 2.50000000
+77.41935484 54.83870968 2.50000000
+77.41935484 58.06451613 1.73387097
+77.41935484 61.29032258 0.92741935
+77.41935484 64.51612903 0.12096774
+77.41935484 67.74193548 0.00000000
+77.41935484 70.96774194 0.00000000
+77.41935484 74.19354839 0.00000000
+77.41935484 77.41935484 0.00000000
+77.41935484 80.64516129 0.00000000
+77.41935484 83.87096774 0.00000000
+77.41935484 87.09677419 0.00000000
+77.41935484 90.32258065 0.00000000
+77.41935484 93.54838710 0.00000000
+77.41935484 96.77419355 0.00000000
+77.41935484 100.00000000 0.00000000
+87.09677419 0.00000000 5.00000000
+87.09677419 3.22580645 5.00000000
+87.09677419 6.45161290 5.00000000
+87.09677419 9.67741935 5.00000000
+87.09677419 12.90322581 5.00000000
+87.09677419 16.12903226 5.00000000
+87.09677419 19.35483871 5.00000000
+87.09677419 22.58064516 5.00000000
+87.09677419 25.80645161 5.00000000
+87.09677419 29.03225806 5.00000000
+87.09677419 32.25806452 5.00000000
+87.09677419 35.48387097 4.87903226
+87.09677419 38.70967742 4.07258065
+87.09677419 41.93548387 3.26612903
+87.09677419 45.16129032 2.50000000
+87.09677419 48.38709677 2.50000000
+87.09677419 51.61290323 2.50000000
+87.09677419 54.83870968 2.50000000
+87.09677419 58.06451613 1.73387097
+87.09677419 61.29032258 0.92741935
+87.09677419 64.51612903 0.12096774
+87.09677419 67.74193548 0.00000000
+87.09677419 70.96774194 0.00000000
+87.09677419 74.19354839 0.00000000
+87.09677419 77.41935484 0.00000000
+87.09677419 80.64516129 0.00000000
+87.09677419 83.87096774 0.00000000
+87.09677419 87.09677419 0.00000000
+87.09677419 90.32258065 0.00000000
+87.09677419 93.54838710 0.00000000
+87.09677419 96.77419355 0.00000000
+87.09677419 100.00000000 0.00000000
+96.77419355 0.00000000 5.00000000
+96.77419355 3.22580645 5.00000000
+96.77419355 6.45161290 5.00000000
+96.77419355 9.67741935 5.00000000
+96.77419355 12.90322581 5.00000000
+96.77419355 16.12903226 5.00000000
+96.77419355 19.35483871 5.00000000
+96.77419355 22.58064516 5.00000000
+96.77419355 25.80645161 5.00000000
+96.77419355 29.03225806 5.00000000
+96.77419355 32.25806452 5.00000000
+96.77419355 35.48387097 4.77941176
+96.77419355 38.70967742 3.94230769
+96.77419355 41.93548387 3.45000000
+96.77419355 45.16129032 2.50000000
+96.77419355 48.38709677 2.50000000
+96.77419355 51.61290323 2.50000000
+96.77419355 54.83870968 2.50000000
+96.77419355 58.06451613 2.02500000
+96.77419355 61.29032258 1.56250000
+96.77419355 64.51612903 0.99264706
+96.77419355 67.74193548 0.84677419
+96.77419355 70.96774194 0.84677419
+96.77419355 74.19354839 0.84677419
+96.77419355 77.41935484 0.84677419
+96.77419355 80.64516129 0.84677419
+96.77419355 83.87096774 0.84677419
+96.77419355 87.09677419 0.84677419
+96.77419355 90.32258065 0.84677419
+96.77419355 93.54838710 0.84677419
+96.77419355 96.77419355 0.84677419
+96.77419355 100.00000000 0.84677419
+106.45161290 0.00000000 5.00000000
+106.45161290 3.22580645 5.00000000
+106.45161290 6.45161290 5.00000000
+106.45161290 9.67741935 5.00000000
+106.45161290 12.90322581 5.00000000
+106.45161290 16.12903226 5.00000000
+106.45161290 19.35483871 5.00000000
+106.45161290 22.58064516 5.00000000
+106.45161290 25.80645161 5.00000000
+106.45161290 29.03225806 5.00000000
+106.45161290 32.25806452 5.00000000
+106.45161290 35.48387097 4.77941176
+106.45161290 38.70967742 3.98809524
+106.45161290 41.93548387 3.39285714
+106.45161290 45.16129032 2.50000000
+106.45161290 48.38709677 2.50000000
+106.45161290 51.61290323 2.50000000
+106.45161290 54.83870968 2.50000000
+106.45161290 58.06451613 2.17261905
+106.45161290 61.29032258 2.17261905
+106.45161290 64.51612903 2.09558824
+106.45161290 67.74193548 2.05645161
+106.45161290 70.96774194 2.05645161
+106.45161290 74.19354839 2.05645161
+106.45161290 77.41935484 2.05645161
+106.45161290 80.64516129 2.05645161
+106.45161290 83.87096774 2.05645161
+106.45161290 87.09677419 2.05645161
+106.45161290 90.32258065 2.05645161
+106.45161290 93.54838710 2.05645161
+106.45161290 96.77419355 2.05645161
+106.45161290 100.00000000 2.05645161
+116.12903226 0.00000000 5.00000000
+116.12903226 3.22580645 5.00000000
+116.12903226 6.45161290 5.00000000
+116.12903226 9.67741935 5.00000000
+116.12903226 12.90322581 5.00000000
+116.12903226 16.12903226 5.00000000
+116.12903226 19.35483871 5.00000000
+116.12903226 22.58064516 5.00000000
+116.12903226 25.80645161 5.00000000
+116.12903226 29.03225806 5.00000000
+116.12903226 32.25806452 5.00000000
+116.12903226 35.48387097 4.87903226
+116.12903226 38.70967742 4.07258065
+116.12903226 41.93548387 3.26612903
+116.12903226 45.16129032 2.50000000
+116.12903226 48.38709677 2.50000000
+116.12903226 51.61290323 2.50000000
+116.12903226 54.83870968 2.50000000
+116.12903226 58.06451613 2.50000000
+116.12903226 61.29032258 2.50000000
+116.12903226 64.51612903 2.50000000
+116.12903226 67.74193548 2.50000000
+116.12903226 70.96774194 2.50000000
+116.12903226 74.19354839 2.50000000
+116.12903226 77.41935484 2.50000000
+116.12903226 80.64516129 2.50000000
+116.12903226 83.87096774 2.50000000
+116.12903226 87.09677419 2.50000000
+116.12903226 90.32258065 2.50000000
+116.12903226 93.54838710 2.50000000
+116.12903226 96.77419355 2.50000000
+116.12903226 100.00000000 2.50000000
+125.80645161 0.00000000 5.72580645
+125.80645161 3.22580645 5.72580645
+125.80645161 6.45161290 5.72580645
+125.80645161 9.67741935 5.72580645
+125.80645161 12.90322581 5.72580645
+125.80645161 16.12903226 5.72580645
+125.80645161 19.35483871 5.72580645
+125.80645161 22.58064516 5.72580645
+125.80645161 25.80645161 5.72580645
+125.80645161 29.03225806 5.72580645
+125.80645161 32.25806452 5.72580645
+125.80645161 35.48387097 5.55147059
+125.80645161 38.70967742 4.87244898
+125.80645161 41.93548387 4.36224490
+125.80645161 45.16129032 3.22580645
+125.80645161 48.38709677 3.22580645
+125.80645161 51.61290323 3.22580645
+125.80645161 54.83870968 3.22580645
+125.80645161 58.06451613 2.95918367
+125.80645161 61.29032258 2.95918367
+125.80645161 64.51612903 2.61029412
+125.80645161 67.74193548 2.50000000
+125.80645161 70.96774194 2.50000000
+125.80645161 74.19354839 2.50000000
+125.80645161 77.41935484 2.50000000
+125.80645161 80.64516129 2.50000000
+125.80645161 83.87096774 2.50000000
+125.80645161 87.09677419 2.50000000
+125.80645161 90.32258065 2.50000000
+125.80645161 93.54838710 2.50000000
+125.80645161 96.77419355 2.50000000
+125.80645161 100.00000000 2.50000000
+135.48387097 0.00000000 6.93548387
+135.48387097 3.22580645 6.93548387
+135.48387097 6.45161290 6.93548387
+135.48387097 9.67741935 6.93548387
+135.48387097 12.90322581 6.93548387
+135.48387097 16.12903226 6.93548387
+135.48387097 19.35483871 6.93548387
+135.48387097 22.58064516 6.93548387
+135.48387097 25.80645161 6.93548387
+135.48387097 29.03225806 6.93548387
+135.48387097 32.25806452 6.93548387
+135.48387097 35.48387097 6.65441176
+135.48387097 38.70967742 5.69444444
+135.48387097 41.93548387 5.13888889
+135.48387097 45.16129032 4.43548387
+135.48387097 48.38709677 4.43548387
+135.48387097 51.61290323 4.43548387
+135.48387097 54.83870968 4.43548387
+135.48387097 58.06451613 3.69444444
+135.48387097 61.29032258 3.13888889
+135.48387097 64.51612903 2.61029412
+135.48387097 67.74193548 2.50000000
+135.48387097 70.96774194 2.50000000
+135.48387097 74.19354839 2.50000000
+135.48387097 77.41935484 2.50000000
+135.48387097 80.64516129 2.50000000
+135.48387097 83.87096774 2.50000000
+135.48387097 87.09677419 2.50000000
+135.48387097 90.32258065 2.50000000
+135.48387097 93.54838710 2.50000000
+135.48387097 96.77419355 2.50000000
+135.48387097 100.00000000 2.50000000
+145.16129032 0.00000000 7.50000000
+145.16129032 3.22580645 7.50000000
+145.16129032 6.45161290 7.50000000
+145.16129032 9.67741935 7.50000000
+145.16129032 12.90322581 7.50000000
+145.16129032 16.12903226 7.50000000
+145.16129032 19.35483871 7.50000000
+145.16129032 22.58064516 7.50000000
+145.16129032 25.80645161 7.50000000
+145.16129032 29.03225806 7.50000000
+145.16129032 32.25806452 7.50000000
+145.16129032 35.48387097 7.37903226
+145.16129032 38.70967742 6.57258065
+145.16129032 41.93548387 5.76612903
+145.16129032 45.16129032 5.00000000
+145.16129032 48.38709677 5.00000000
+145.16129032 51.61290323 5.00000000
+145.16129032 54.83870968 5.00000000
+145.16129032 58.06451613 4.23387097
+145.16129032 61.29032258 3.42741935
+145.16129032 64.51612903 2.62096774
+145.16129032 67.74193548 2.50000000
+145.16129032 70.96774194 2.50000000
+145.16129032 74.19354839 2.50000000
+145.16129032 77.41935484 2.50000000
+145.16129032 80.64516129 2.50000000
+145.16129032 83.87096774 2.50000000
+145.16129032 87.09677419 2.50000000
+145.16129032 90.32258065 2.50000000
+145.16129032 93.54838710 2.50000000
+145.16129032 96.77419355 2.50000000
+145.16129032 100.00000000 2.50000000
+154.83870968 0.00000000 7.50000000
+154.83870968 3.22580645 7.50000000
+154.83870968 6.45161290 7.50000000
+154.83870968 9.67741935 7.50000000
+154.83870968 12.90322581 7.50000000
+154.83870968 16.12903226 7.50000000
+154.83870968 19.35483871 7.50000000
+154.83870968 22.58064516 7.50000000
+154.83870968 25.80645161 7.50000000
+154.83870968 29.03225806 7.50000000
+154.83870968 32.25806452 7.50000000
+154.83870968 35.48387097 7.38970588
+154.83870968 38.70967742 6.87500000
+154.83870968 41.93548387 6.33152174
+154.83870968 45.16129032 5.60483871
+154.83870968 48.38709677 5.60483871
+154.83870968 51.61290323 5.60483871
+154.83870968 54.83870968 5.60483871
+154.83870968 58.06451613 4.89130435
+154.83870968 61.29032258 4.34782609
+154.83870968 64.51612903 3.38235294
+154.83870968 67.74193548 3.10483871
+154.83870968 70.96774194 3.10483871
+154.83870968 74.19354839 3.10483871
+154.83870968 77.41935484 3.10483871
+154.83870968 80.64516129 3.10483871
+154.83870968 83.87096774 3.10483871
+154.83870968 87.09677419 3.10483871
+154.83870968 90.32258065 3.10483871
+154.83870968 93.54838710 3.10483871
+154.83870968 96.77419355 3.10483871
+154.83870968 100.00000000 3.10483871
+164.51612903 0.00000000 7.50000000
+164.51612903 3.22580645 7.50000000
+164.51612903 6.45161290 7.50000000
+164.51612903 9.67741935 7.50000000
+164.51612903 12.90322581 7.50000000
+164.51612903 16.12903226 7.50000000
+164.51612903 19.35483871 7.50000000
+164.51612903 22.58064516 7.50000000
+164.51612903 25.80645161 7.50000000
+164.51612903 29.03225806 7.50000000
+164.51612903 32.25806452 7.50000000
+164.51612903 35.48387097 7.38970588
+164.51612903 38.70967742 7.05729167
+164.51612903 41.93548387 7.05729167
+164.51612903 45.16129032 6.81451613
+164.51612903 48.38709677 6.81451613
+164.51612903 51.61290323 6.81451613
+164.51612903 54.83870968 6.81451613
+164.51612903 58.06451613 5.67708333
+164.51612903 61.29032258 5.15625000
+164.51612903 64.51612903 4.48529412
+164.51612903 67.74193548 4.31451613
+164.51612903 70.96774194 4.31451613
+164.51612903 74.19354839 4.31451613
+164.51612903 77.41935484 4.31451613
+164.51612903 80.64516129 4.31451613
+164.51612903 83.87096774 4.31451613
+164.51612903 87.09677419 4.31451613
+164.51612903 90.32258065 4.31451613
+164.51612903 93.54838710 4.31451613
+164.51612903 96.77419355 4.31451613
+164.51612903 100.00000000 4.31451613
+174.19354839 0.00000000 7.50000000
+174.19354839 3.22580645 7.50000000
+174.19354839 6.45161290 7.50000000
+174.19354839 9.67741935 7.50000000
+174.19354839 12.90322581 7.50000000
+174.19354839 16.12903226 7.50000000
+174.19354839 19.35483871 7.50000000
+174.19354839 22.58064516 7.50000000
+174.19354839 25.80645161 7.50000000
+174.19354839 29.03225806 7.50000000
+174.19354839 32.25806452 7.50000000
+174.19354839 35.48387097 7.50000000
+174.19354839 38.70967742 7.50000000
+174.19354839 41.93548387 7.50000000
+174.19354839 45.16129032 7.50000000
+174.19354839 48.38709677 7.50000000
+174.19354839 51.61290323 7.50000000
+174.19354839 54.83870968 7.50000000
+174.19354839 58.06451613 6.73387097
+174.19354839 61.29032258 5.92741935
+174.19354839 64.51612903 5.12096774
+174.19354839 67.74193548 5.00000000
+174.19354839 70.96774194 5.00000000
+174.19354839 74.19354839 5.00000000
+174.19354839 77.41935484 5.00000000
+174.19354839 80.64516129 5.00000000
+174.19354839 83.87096774 5.00000000
+174.19354839 87.09677419 5.00000000
+174.19354839 90.32258065 5.00000000
+174.19354839 93.54838710 5.00000000
+174.19354839 96.77419355 5.00000000
+174.19354839 100.00000000 5.00000000
+183.87096774 0.00000000 7.98387097
+183.87096774 3.22580645 7.98387097
+183.87096774 6.45161290 7.98387097
+183.87096774 9.67741935 7.98387097
+183.87096774 12.90322581 7.98387097
+183.87096774 16.12903226 7.98387097
+183.87096774 19.35483871 7.98387097
+183.87096774 22.58064516 7.98387097
+183.87096774 25.80645161 7.98387097
+183.87096774 29.03225806 7.98387097
+183.87096774 32.25806452 7.98387097
+183.87096774 35.48387097 7.94117647
+183.87096774 38.70967742 7.84883721
+183.87096774 41.93548387 7.84883721
+183.87096774 45.16129032 7.50000000
+183.87096774 48.38709677 7.50000000
+183.87096774 51.61290323 7.50000000
+183.87096774 54.83870968 7.50000000
+183.87096774 58.06451613 6.59883721
+183.87096774 61.29032258 6.01744186
+183.87096774 64.51612903 5.22058824
+183.87096774 67.74193548 5.00000000
+183.87096774 70.96774194 5.00000000
+183.87096774 74.19354839 5.00000000
+183.87096774 77.41935484 5.00000000
+183.87096774 80.64516129 5.00000000
+183.87096774 83.87096774 5.00000000
+183.87096774 87.09677419 5.00000000
+183.87096774 90.32258065 5.00000000
+183.87096774 93.54838710 5.00000000
+183.87096774 96.77419355 5.00000000
+183.87096774 100.00000000 5.00000000
+193.54838710 0.00000000 9.19354839
+193.54838710 3.22580645 9.19354839
+193.54838710 6.45161290 9.19354839
+193.54838710 9.67741935 9.19354839
+193.54838710 12.90322581 9.19354839
+193.54838710 16.12903226 9.19354839
+193.54838710 19.35483871 9.19354839
+193.54838710 22.58064516 9.19354839
+193.54838710 25.80645161 9.19354839
+193.54838710 29.03225806 9.19354839
+193.54838710 32.25806452 9.19354839
+193.54838710 35.48387097 9.04411765
+193.54838710 38.70967742 8.45588235
+193.54838710 41.93548387 7.97500000
+193.54838710 45.16129032 7.50000000
+193.54838710 48.38709677 7.50000000
+193.54838710 51.61290323 7.50000000
+193.54838710 54.83870968 7.50000000
+193.54838710 58.06451613 6.55000000
+193.54838710 61.29032258 6.05392157
+193.54838710 64.51612903 5.22058824
+193.54838710 67.74193548 5.00000000
+193.54838710 70.96774194 5.00000000
+193.54838710 74.19354839 5.00000000
+193.54838710 77.41935484 5.00000000
+193.54838710 80.64516129 5.00000000
+193.54838710 83.87096774 5.00000000
+193.54838710 87.09677419 5.00000000
+193.54838710 90.32258065 5.00000000
+193.54838710 93.54838710 5.00000000
+193.54838710 96.77419355 5.00000000
+193.54838710 100.00000000 5.00000000
+203.22580645 0.00000000 10.00000000
+203.22580645 3.22580645 10.00000000
+203.22580645 6.45161290 10.00000000
+203.22580645 9.67741935 10.00000000
+203.22580645 12.90322581 10.00000000
+203.22580645 16.12903226 10.00000000
+203.22580645 19.35483871 10.00000000
+203.22580645 22.58064516 10.00000000
+203.22580645 25.80645161 10.00000000
+203.22580645 29.03225806 10.00000000
+203.22580645 32.25806452 10.00000000
+203.22580645 35.48387097 9.87903226
+203.22580645 38.70967742 9.07258065
+203.22580645 41.93548387 8.26612903
+203.22580645 45.16129032 7.50000000
+203.22580645 48.38709677 7.50000000
+203.22580645 51.61290323 7.50000000
+203.22580645 54.83870968 7.50000000
+203.22580645 58.06451613 6.73387097
+203.22580645 61.29032258 5.92741935
+203.22580645 64.51612903 5.12096774
+203.22580645 67.74193548 5.00000000
+203.22580645 70.96774194 5.00000000
+203.22580645 74.19354839 5.00000000
+203.22580645 77.41935484 5.00000000
+203.22580645 80.64516129 5.00000000
+203.22580645 83.87096774 5.00000000
+203.22580645 87.09677419 5.00000000
+203.22580645 90.32258065 5.00000000
+203.22580645 93.54838710 5.00000000
+203.22580645 96.77419355 5.00000000
+203.22580645 100.00000000 5.00000000
+212.90322581 0.00000000 10.00000000
+212.90322581 3.22580645 10.00000000
+212.90322581 6.45161290 10.00000000
+212.90322581 9.67741935 10.00000000
+212.90322581 12.90322581 10.00000000
+212.90322581 16.12903226 10.00000000
+212.90322581 19.35483871 10.00000000
+212.90322581 22.58064516 10.00000000
+212.90322581 25.80645161 10.00000000
+212.90322581 29.03225806 10.00000000
+212.90322581 32.25806452 10.00000000
+212.90322581 35.48387097 9.87903226
+212.90322581 38.70967742 9.07258065
+212.90322581 41.93548387 8.26612903
+212.90322581 45.16129032 7.50000000
+212.90322581 48.38709677 7.50000000
+212.90322581 51.61290323 7.50000000
+212.90322581 54.83870968 7.50000000
+212.90322581 58.06451613 6.73387097
+212.90322581 61.29032258 5.92741935
+212.90322581 64.51612903 5.12096774
+212.90322581 67.74193548 5.00000000
+212.90322581 70.96774194 5.00000000
+212.90322581 74.19354839 5.00000000
+212.90322581 77.41935484 5.00000000
+212.90322581 80.64516129 5.00000000
+212.90322581 83.87096774 5.00000000
+212.90322581 87.09677419 5.00000000
+212.90322581 90.32258065 5.00000000
+212.90322581 93.54838710 5.00000000
+212.90322581 96.77419355 5.00000000
+212.90322581 100.00000000 5.00000000
+222.58064516 0.00000000 10.00000000
+222.58064516 3.22580645 10.00000000
+222.58064516 6.45161290 10.00000000
+222.58064516 9.67741935 10.00000000
+222.58064516 12.90322581 10.00000000
+222.58064516 16.12903226 10.00000000
+222.58064516 19.35483871 10.00000000
+222.58064516 22.58064516 10.00000000
+222.58064516 25.80645161 10.00000000
+222.58064516 29.03225806 10.00000000
+222.58064516 32.25806452 10.00000000
+222.58064516 35.48387097 9.87903226
+222.58064516 38.70967742 9.07258065
+222.58064516 41.93548387 8.26612903
+222.58064516 45.16129032 7.50000000
+222.58064516 48.38709677 7.50000000
+222.58064516 51.61290323 7.50000000
+222.58064516 54.83870968 7.50000000
+222.58064516 58.06451613 6.73387097
+222.58064516 61.29032258 5.92741935
+222.58064516 64.51612903 5.12096774
+222.58064516 67.74193548 5.00000000
+222.58064516 70.96774194 5.00000000
+222.58064516 74.19354839 5.00000000
+222.58064516 77.41935484 5.00000000
+222.58064516 80.64516129 5.00000000
+222.58064516 83.87096774 5.00000000
+222.58064516 87.09677419 5.00000000
+222.58064516 90.32258065 5.00000000
+222.58064516 93.54838710 5.00000000
+222.58064516 96.77419355 5.00000000
+222.58064516 100.00000000 5.00000000
+232.25806452 0.00000000 10.00000000
+232.25806452 3.22580645 10.00000000
+232.25806452 6.45161290 10.00000000
+232.25806452 9.67741935 10.00000000
+232.25806452 12.90322581 10.00000000
+232.25806452 16.12903226 10.00000000
+232.25806452 19.35483871 10.00000000
+232.25806452 22.58064516 10.00000000
+232.25806452 25.80645161 10.00000000
+232.25806452 29.03225806 10.00000000
+232.25806452 32.25806452 10.00000000
+232.25806452 35.48387097 9.87903226
+232.25806452 38.70967742 9.07258065
+232.25806452 41.93548387 8.26612903
+232.25806452 45.16129032 7.50000000
+232.25806452 48.38709677 7.50000000
+232.25806452 51.61290323 7.50000000
+232.25806452 54.83870968 7.50000000
+232.25806452 58.06451613 6.73387097
+232.25806452 61.29032258 5.92741935
+232.25806452 64.51612903 5.12096774
+232.25806452 67.74193548 5.00000000
+232.25806452 70.96774194 5.00000000
+232.25806452 74.19354839 5.00000000
+232.25806452 77.41935484 5.00000000
+232.25806452 80.64516129 5.00000000
+232.25806452 83.87096774 5.00000000
+232.25806452 87.09677419 5.00000000
+232.25806452 90.32258065 5.00000000
+232.25806452 93.54838710 5.00000000
+232.25806452 96.77419355 5.00000000
+232.25806452 100.00000000 5.00000000
+241.93548387 0.00000000 10.00000000
+241.93548387 3.22580645 10.00000000
+241.93548387 6.45161290 10.00000000
+241.93548387 9.67741935 10.00000000
+241.93548387 12.90322581 10.00000000
+241.93548387 16.12903226 10.00000000
+241.93548387 19.35483871 10.00000000
+241.93548387 22.58064516 10.00000000
+241.93548387 25.80645161 10.00000000
+241.93548387 29.03225806 10.00000000
+241.93548387 32.25806452 10.00000000
+241.93548387 35.48387097 9.87903226
+241.93548387 38.70967742 9.07258065
+241.93548387 41.93548387 8.26612903
+241.93548387 45.16129032 7.50000000
+241.93548387 48.38709677 7.50000000
+241.93548387 51.61290323 7.50000000
+241.93548387 54.83870968 7.50000000
+241.93548387 58.06451613 6.73387097
+241.93548387 61.29032258 5.92741935
+241.93548387 64.51612903 5.12096774
+241.93548387 67.74193548 5.00000000
+241.93548387 70.96774194 5.00000000
+241.93548387 74.19354839 5.00000000
+241.93548387 77.41935484 5.00000000
+241.93548387 80.64516129 5.00000000
+241.93548387 83.87096774 5.00000000
+241.93548387 87.09677419 5.00000000
+241.93548387 90.32258065 5.00000000
+241.93548387 93.54838710 5.00000000
+241.93548387 96.77419355 5.00000000
+241.93548387 100.00000000 5.00000000
+251.61290323 0.00000000 10.00000000
+251.61290323 3.22580645 10.00000000
+251.61290323 6.45161290 10.00000000
+251.61290323 9.67741935 10.00000000
+251.61290323 12.90322581 10.00000000
+251.61290323 16.12903226 10.00000000
+251.61290323 19.35483871 10.00000000
+251.61290323 22.58064516 10.00000000
+251.61290323 25.80645161 10.00000000
+251.61290323 29.03225806 10.00000000
+251.61290323 32.25806452 10.00000000
+251.61290323 35.48387097 9.87903226
+251.61290323 38.70967742 9.07258065
+251.61290323 41.93548387 8.26612903
+251.61290323 45.16129032 7.50000000
+251.61290323 48.38709677 7.50000000
+251.61290323 51.61290323 7.50000000
+251.61290323 54.83870968 7.50000000
+251.61290323 58.06451613 6.73387097
+251.61290323 61.29032258 5.92741935
+251.61290323 64.51612903 5.12096774
+251.61290323 67.74193548 5.00000000
+251.61290323 70.96774194 5.00000000
+251.61290323 74.19354839 5.00000000
+251.61290323 77.41935484 5.00000000
+251.61290323 80.64516129 5.00000000
+251.61290323 83.87096774 5.00000000
+251.61290323 87.09677419 5.00000000
+251.61290323 90.32258065 5.00000000
+251.61290323 93.54838710 5.00000000
+251.61290323 96.77419355 5.00000000
+251.61290323 100.00000000 5.00000000
+261.29032258 0.00000000 10.00000000
+261.29032258 3.22580645 10.00000000
+261.29032258 6.45161290 10.00000000
+261.29032258 9.67741935 10.00000000
+261.29032258 12.90322581 10.00000000
+261.29032258 16.12903226 10.00000000
+261.29032258 19.35483871 10.00000000
+261.29032258 22.58064516 10.00000000
+261.29032258 25.80645161 10.00000000
+261.29032258 29.03225806 10.00000000
+261.29032258 32.25806452 10.00000000
+261.29032258 35.48387097 9.87903226
+261.29032258 38.70967742 9.07258065
+261.29032258 41.93548387 8.26612903
+261.29032258 45.16129032 7.50000000
+261.29032258 48.38709677 7.50000000
+261.29032258 51.61290323 7.50000000
+261.29032258 54.83870968 7.50000000
+261.29032258 58.06451613 6.73387097
+261.29032258 61.29032258 5.92741935
+261.29032258 64.51612903 5.12096774
+261.29032258 67.74193548 5.00000000
+261.29032258 70.96774194 5.00000000
+261.29032258 74.19354839 5.00000000
+261.29032258 77.41935484 5.00000000
+261.29032258 80.64516129 5.00000000
+261.29032258 83.87096774 5.00000000
+261.29032258 87.09677419 5.00000000
+261.29032258 90.32258065 5.00000000
+261.29032258 93.54838710 5.00000000
+261.29032258 96.77419355 5.00000000
+261.29032258 100.00000000 5.00000000
+270.96774194 0.00000000 10.00000000
+270.96774194 3.22580645 10.00000000
+270.96774194 6.45161290 10.00000000
+270.96774194 9.67741935 10.00000000
+270.96774194 12.90322581 10.00000000
+270.96774194 16.12903226 10.00000000
+270.96774194 19.35483871 10.00000000
+270.96774194 22.58064516 10.00000000
+270.96774194 25.80645161 10.00000000
+270.96774194 29.03225806 10.00000000
+270.96774194 32.25806452 10.00000000
+270.96774194 35.48387097 9.87903226
+270.96774194 38.70967742 9.07258065
+270.96774194 41.93548387 8.26612903
+270.96774194 45.16129032 7.50000000
+270.96774194 48.38709677 7.50000000
+270.96774194 51.61290323 7.50000000
+270.96774194 54.83870968 7.50000000
+270.96774194 58.06451613 6.73387097
+270.96774194 61.29032258 5.92741935
+270.96774194 64.51612903 5.12096774
+270.96774194 67.74193548 5.00000000
+270.96774194 70.96774194 5.00000000
+270.96774194 74.19354839 5.00000000
+270.96774194 77.41935484 5.00000000
+270.96774194 80.64516129 5.00000000
+270.96774194 83.87096774 5.00000000
+270.96774194 87.09677419 5.00000000
+270.96774194 90.32258065 5.00000000
+270.96774194 93.54838710 5.00000000
+270.96774194 96.77419355 5.00000000
+270.96774194 100.00000000 5.00000000
+280.64516129 0.00000000 10.00000000
+280.64516129 3.22580645 10.00000000
+280.64516129 6.45161290 10.00000000
+280.64516129 9.67741935 10.00000000
+280.64516129 12.90322581 10.00000000
+280.64516129 16.12903226 10.00000000
+280.64516129 19.35483871 10.00000000
+280.64516129 22.58064516 10.00000000
+280.64516129 25.80645161 10.00000000
+280.64516129 29.03225806 10.00000000
+280.64516129 32.25806452 10.00000000
+280.64516129 35.48387097 9.87903226
+280.64516129 38.70967742 9.07258065
+280.64516129 41.93548387 8.26612903
+280.64516129 45.16129032 7.50000000
+280.64516129 48.38709677 7.50000000
+280.64516129 51.61290323 7.50000000
+280.64516129 54.83870968 7.50000000
+280.64516129 58.06451613 6.73387097
+280.64516129 61.29032258 5.92741935
+280.64516129 64.51612903 5.12096774
+280.64516129 67.74193548 5.00000000
+280.64516129 70.96774194 5.00000000
+280.64516129 74.19354839 5.00000000
+280.64516129 77.41935484 5.00000000
+280.64516129 80.64516129 5.00000000
+280.64516129 83.87096774 5.00000000
+280.64516129 87.09677419 5.00000000
+280.64516129 90.32258065 5.00000000
+280.64516129 93.54838710 5.00000000
+280.64516129 96.77419355 5.00000000
+280.64516129 100.00000000 5.00000000
+290.32258065 0.00000000 10.00000000
+290.32258065 3.22580645 10.00000000
+290.32258065 6.45161290 10.00000000
+290.32258065 9.67741935 10.00000000
+290.32258065 12.90322581 10.00000000
+290.32258065 16.12903226 10.00000000
+290.32258065 19.35483871 10.00000000
+290.32258065 22.58064516 10.00000000
+290.32258065 25.80645161 10.00000000
+290.32258065 29.03225806 10.00000000
+290.32258065 32.25806452 10.00000000
+290.32258065 35.48387097 9.87903226
+290.32258065 38.70967742 9.07258065
+290.32258065 41.93548387 8.26612903
+290.32258065 45.16129032 7.50000000
+290.32258065 48.38709677 7.50000000
+290.32258065 51.61290323 7.50000000
+290.32258065 54.83870968 7.50000000
+290.32258065 58.06451613 6.73387097
+290.32258065 61.29032258 5.92741935
+290.32258065 64.51612903 5.12096774
+290.32258065 67.74193548 5.00000000
+290.32258065 70.96774194 5.00000000
+290.32258065 74.19354839 5.00000000
+290.32258065 77.41935484 5.00000000
+290.32258065 80.64516129 5.00000000
+290.32258065 83.87096774 5.00000000
+290.32258065 87.09677419 5.00000000
+290.32258065 90.32258065 5.00000000
+290.32258065 93.54838710 5.00000000
+290.32258065 96.77419355 5.00000000
+290.32258065 100.00000000 5.00000000
+300.00000000 0.00000000 10.00000000
+300.00000000 3.22580645 10.00000000
+300.00000000 6.45161290 10.00000000
+300.00000000 9.67741935 10.00000000
+300.00000000 12.90322581 10.00000000
+300.00000000 16.12903226 10.00000000
+300.00000000 19.35483871 10.00000000
+300.00000000 22.58064516 10.00000000
+300.00000000 25.80645161 10.00000000
+300.00000000 29.03225806 10.00000000
+300.00000000 32.25806452 10.00000000
+300.00000000 35.48387097 9.87903226
+300.00000000 38.70967742 9.07258065
+300.00000000 41.93548387 8.26612903
+300.00000000 45.16129032 7.50000000
+300.00000000 48.38709677 7.50000000
+300.00000000 51.61290323 7.50000000
+300.00000000 54.83870968 7.50000000
+300.00000000 58.06451613 6.73387097
+300.00000000 61.29032258 5.92741935
+300.00000000 64.51612903 5.12096774
+300.00000000 67.74193548 5.00000000
+300.00000000 70.96774194 5.00000000
+300.00000000 74.19354839 5.00000000
+300.00000000 77.41935484 5.00000000
+300.00000000 80.64516129 5.00000000
+300.00000000 83.87096774 5.00000000
+300.00000000 87.09677419 5.00000000
+300.00000000 90.32258065 5.00000000
+300.00000000 93.54838710 5.00000000
+300.00000000 96.77419355 5.00000000
+300.00000000 100.00000000 5.00000000
diff --git a/examples/takagi-sugeno/octave/heart_disease_risk.fll b/examples/takagi-sugeno/octave/heart_disease_risk.fll
new file mode 100644
index 0000000..5bc3207
--- /dev/null
+++ b/examples/takagi-sugeno/octave/heart_disease_risk.fll
@@ -0,0 +1,48 @@
+Engine: Heart-Disease-Risk
+InputVariable: LDLLevel
+ enabled: true
+ range: 0.000 300.000
+ term: Low Trapezoid -1.000 0.000 90.000 110.000
+ term: LowBorderline Trapezoid 90.000 110.000 120.000 140.000
+ term: Borderline Trapezoid 120.000 140.000 150.000 170.000
+ term: HighBorderline Trapezoid 150.000 170.000 180.000 200.000
+ term: High Trapezoid 180.000 200.000 300.000 301.000
+InputVariable: HDLLevel
+ enabled: true
+ range: 0.000 100.000
+ term: LowHDL Trapezoid -1.000 0.000 35.000 45.000
+ term: ModerateHDL Trapezoid 35.000 45.000 55.000 65.000
+ term: HighHDL Trapezoid 55.000 65.000 100.000 101.000
+OutputVariable: HeartDiseaseRisk
+ enabled: true
+ range: 0.000 10.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: NoRisk Constant 0.000
+ term: LowRisk Constant 2.500
+ term: MediumRisk Constant 5.000
+ term: HighRisk Constant 7.500
+ term: ExtremeRisk Constant 10.000
+RuleBlock:
+ enabled: true
+ conjunction: Minimum
+ disjunction: none
+ activation: none
+ rule: if LDLLevel is Low and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk
+ rule: if LDLLevel is Low and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk
+ rule: if LDLLevel is Low and HDLLevel is HighHDL then HeartDiseaseRisk is NoRisk
+ rule: if LDLLevel is LowBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk
+ rule: if LDLLevel is LowBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk
+ rule: if LDLLevel is LowBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk
+ rule: if LDLLevel is Borderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk
+ rule: if LDLLevel is Borderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is MediumRisk
+ rule: if LDLLevel is Borderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk
+ rule: if LDLLevel is HighBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk
+ rule: if LDLLevel is HighBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk
+ rule: if LDLLevel is HighBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk
+ rule: if LDLLevel is High and HDLLevel is LowHDL then HeartDiseaseRisk is ExtremeRisk
+ rule: if LDLLevel is High and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk
+ rule: if LDLLevel is High and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk \ No newline at end of file
diff --git a/examples/takagi-sugeno/octave/heart_disease_risk.java b/examples/takagi-sugeno/octave/heart_disease_risk.java
new file mode 100644
index 0000000..fcd67c9
--- /dev/null
+++ b/examples/takagi-sugeno/octave/heart_disease_risk.java
@@ -0,0 +1,79 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class heart_disease_risk{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("Heart-Disease-Risk");
+
+InputVariable inputVariable1 = new InputVariable();
+inputVariable1.setEnabled(true);
+inputVariable1.setName("LDLLevel");
+inputVariable1.setRange(0.000, 300.000);
+inputVariable1.addTerm(new Trapezoid("Low", -1.000, 0.000, 90.000, 110.000));
+inputVariable1.addTerm(new Trapezoid("LowBorderline", 90.000, 110.000, 120.000, 140.000));
+inputVariable1.addTerm(new Trapezoid("Borderline", 120.000, 140.000, 150.000, 170.000));
+inputVariable1.addTerm(new Trapezoid("HighBorderline", 150.000, 170.000, 180.000, 200.000));
+inputVariable1.addTerm(new Trapezoid("High", 180.000, 200.000, 300.000, 301.000));
+engine.addInputVariable(inputVariable1);
+
+InputVariable inputVariable2 = new InputVariable();
+inputVariable2.setEnabled(true);
+inputVariable2.setName("HDLLevel");
+inputVariable2.setRange(0.000, 100.000);
+inputVariable2.addTerm(new Trapezoid("LowHDL", -1.000, 0.000, 35.000, 45.000));
+inputVariable2.addTerm(new Trapezoid("ModerateHDL", 35.000, 45.000, 55.000, 65.000));
+inputVariable2.addTerm(new Trapezoid("HighHDL", 55.000, 65.000, 100.000, 101.000));
+engine.addInputVariable(inputVariable2);
+
+OutputVariable outputVariable = new OutputVariable();
+outputVariable.setEnabled(true);
+outputVariable.setName("HeartDiseaseRisk");
+outputVariable.setRange(0.000, 10.000);
+outputVariable.fuzzyOutput().setAccumulation(null);
+outputVariable.setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable.setDefaultValue(Double.NaN);
+outputVariable.setLockPreviousOutputValue(false);
+outputVariable.setLockOutputValueInRange(false);
+outputVariable.addTerm(new Constant("NoRisk", 0.000));
+outputVariable.addTerm(new Constant("LowRisk", 2.500));
+outputVariable.addTerm(new Constant("MediumRisk", 5.000));
+outputVariable.addTerm(new Constant("HighRisk", 7.500));
+outputVariable.addTerm(new Constant("ExtremeRisk", 10.000));
+engine.addOutputVariable(outputVariable);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(new Minimum());
+ruleBlock.setDisjunction(null);
+ruleBlock.setActivation(null);
+ruleBlock.addRule(Rule.parse("if LDLLevel is Low and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is Low and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is Low and HDLLevel is HighHDL then HeartDiseaseRisk is NoRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is LowBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is MediumRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is LowBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is LowRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is LowBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is Borderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is Borderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is MediumRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is Borderline and HDLLevel is HighHDL then HeartDiseaseRisk is LowRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is HighBorderline and HDLLevel is LowHDL then HeartDiseaseRisk is HighRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is HighBorderline and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is HighBorderline and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is High and HDLLevel is LowHDL then HeartDiseaseRisk is ExtremeRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is High and HDLLevel is ModerateHDL then HeartDiseaseRisk is HighRisk", engine));
+ruleBlock.addRule(Rule.parse("if LDLLevel is High and HDLLevel is HighHDL then HeartDiseaseRisk is MediumRisk", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/takagi-sugeno/octave/linear_tip_calculator.cpp b/examples/takagi-sugeno/octave/linear_tip_calculator.cpp
new file mode 100644
index 0000000..6982766
--- /dev/null
+++ b/examples/takagi-sugeno/octave/linear_tip_calculator.cpp
@@ -0,0 +1,52 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("Linear-Tip-Calculator");
+
+InputVariable* inputVariable1 = new InputVariable;
+inputVariable1->setEnabled(true);
+inputVariable1->setName("FoodQuality");
+inputVariable1->setRange(1.000, 10.000);
+inputVariable1->addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable1->addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine->addInputVariable(inputVariable1);
+
+InputVariable* inputVariable2 = new InputVariable;
+inputVariable2->setEnabled(true);
+inputVariable2->setName("Service");
+inputVariable2->setRange(1.000, 10.000);
+inputVariable2->addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable2->addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine->addInputVariable(inputVariable2);
+
+OutputVariable* outputVariable = new OutputVariable;
+outputVariable->setEnabled(true);
+outputVariable->setName("Tip");
+outputVariable->setRange(10.000, 20.000);
+outputVariable->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable->setDefaultValue(fl::nan);
+outputVariable->setLockPreviousOutputValue(false);
+outputVariable->setLockOutputValueInRange(false);
+outputVariable->addTerm(Linear::create("TenPercent", engine, 0.000, 0.000, 10.000));
+outputVariable->addTerm(Linear::create("FifteenPercent", engine, 0.000, 0.000, 15.000));
+outputVariable->addTerm(Linear::create("TwentyPercent", engine, 0.000, 0.000, 20.000));
+engine->addOutputVariable(outputVariable);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(new Minimum);
+ruleBlock->setDisjunction(fl::null);
+ruleBlock->setActivation(fl::null);
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Bad and Service is Bad then Tip is TenPercent", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Bad and Service is Good then Tip is FifteenPercent", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Good and Service is Bad then Tip is FifteenPercent", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Good and Service is Good then Tip is TwentyPercent", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/takagi-sugeno/octave/linear_tip_calculator.fcl b/examples/takagi-sugeno/octave/linear_tip_calculator.fcl
new file mode 100644
index 0000000..d326b2e
--- /dev/null
+++ b/examples/takagi-sugeno/octave/linear_tip_calculator.fcl
@@ -0,0 +1,41 @@
+FUNCTION_BLOCK Linear-Tip-Calculator
+
+VAR_INPUT
+ FoodQuality: REAL;
+ Service: REAL;
+END_VAR
+
+VAR_OUTPUT
+ Tip: REAL;
+END_VAR
+
+FUZZIFY FoodQuality
+ RANGE := (1.000 .. 10.000);
+ TERM Bad := Trapezoid 0.000 1.000 3.000 7.000;
+ TERM Good := Trapezoid 3.000 7.000 10.000 11.000;
+END_FUZZIFY
+
+FUZZIFY Service
+ RANGE := (1.000 .. 10.000);
+ TERM Bad := Trapezoid 0.000 1.000 3.000 7.000;
+ TERM Good := Trapezoid 3.000 7.000 10.000 11.000;
+END_FUZZIFY
+
+DEFUZZIFY Tip
+ RANGE := (10.000 .. 20.000);
+ TERM TenPercent := Linear 0.000 0.000 10.000;
+ TERM FifteenPercent := Linear 0.000 0.000 15.000;
+ TERM TwentyPercent := Linear 0.000 0.000 20.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ AND : MIN;
+ RULE 1 : if FoodQuality is Bad and Service is Bad then Tip is TenPercent
+ RULE 2 : if FoodQuality is Bad and Service is Good then Tip is FifteenPercent
+ RULE 3 : if FoodQuality is Good and Service is Bad then Tip is FifteenPercent
+ RULE 4 : if FoodQuality is Good and Service is Good then Tip is TwentyPercent
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/takagi-sugeno/octave/linear_tip_calculator.fis b/examples/takagi-sugeno/octave/linear_tip_calculator.fis
new file mode 100644
index 0000000..8df5a02
--- /dev/null
+++ b/examples/takagi-sugeno/octave/linear_tip_calculator.fis
@@ -0,0 +1,39 @@
+[System]
+Name='Linear-Tip-Calculator'
+Type='sugeno'
+NumInputs=2
+NumOutputs=1
+NumRules=4
+AndMethod='min'
+OrMethod=''
+ImpMethod=''
+AggMethod=''
+DefuzzMethod='wtaver'
+
+[Input1]
+Name='FoodQuality'
+Range=[1.000 10.000]
+NumMFs=2
+MF1='Bad':'trapmf',[0.000 1.000 3.000 7.000]
+MF2='Good':'trapmf',[3.000 7.000 10.000 11.000]
+
+[Input2]
+Name='Service'
+Range=[1.000 10.000]
+NumMFs=2
+MF1='Bad':'trapmf',[0.000 1.000 3.000 7.000]
+MF2='Good':'trapmf',[3.000 7.000 10.000 11.000]
+
+[Output1]
+Name='Tip'
+Range=[10.000 20.000]
+NumMFs=3
+MF1='TenPercent':'linear',[0.000 0.000 10.000]
+MF2='FifteenPercent':'linear',[0.000 0.000 15.000]
+MF3='TwentyPercent':'linear',[0.000 0.000 20.000]
+
+[Rules]
+1.000 1.000 , 1.000 (1.000) : 1
+1.000 2.000 , 2.000 (1.000) : 1
+2.000 1.000 , 2.000 (1.000) : 1
+2.000 2.000 , 3.000 (1.000) : 1
diff --git a/examples/takagi-sugeno/octave/linear_tip_calculator.fld b/examples/takagi-sugeno/octave/linear_tip_calculator.fld
new file mode 100644
index 0000000..27f51b4
--- /dev/null
+++ b/examples/takagi-sugeno/octave/linear_tip_calculator.fld
@@ -0,0 +1,1026 @@
+#@Engine: Linear-Tip-Calculator;
+#@InputVariable: FoodQuality; @InputVariable: Service; @OutputVariable: Tip;
+1.00000000 1.00000000 10.00000000
+1.00000000 1.29032258 10.00000000
+1.00000000 1.58064516 10.00000000
+1.00000000 1.87096774 10.00000000
+1.00000000 2.16129032 10.00000000
+1.00000000 2.45161290 10.00000000
+1.00000000 2.74193548 10.00000000
+1.00000000 3.03225806 10.04032258
+1.00000000 3.32258065 10.40322581
+1.00000000 3.61290323 10.76612903
+1.00000000 3.90322581 11.12903226
+1.00000000 4.19354839 11.49193548
+1.00000000 4.48387097 11.85483871
+1.00000000 4.77419355 12.21774194
+1.00000000 5.06451613 12.58064516
+1.00000000 5.35483871 12.94354839
+1.00000000 5.64516129 13.30645161
+1.00000000 5.93548387 13.66935484
+1.00000000 6.22580645 14.03225806
+1.00000000 6.51612903 14.39516129
+1.00000000 6.80645161 14.75806452
+1.00000000 7.09677419 15.00000000
+1.00000000 7.38709677 15.00000000
+1.00000000 7.67741935 15.00000000
+1.00000000 7.96774194 15.00000000
+1.00000000 8.25806452 15.00000000
+1.00000000 8.54838710 15.00000000
+1.00000000 8.83870968 15.00000000
+1.00000000 9.12903226 15.00000000
+1.00000000 9.41935484 15.00000000
+1.00000000 9.70967742 15.00000000
+1.00000000 10.00000000 15.00000000
+1.29032258 1.00000000 10.00000000
+1.29032258 1.29032258 10.00000000
+1.29032258 1.58064516 10.00000000
+1.29032258 1.87096774 10.00000000
+1.29032258 2.16129032 10.00000000
+1.29032258 2.45161290 10.00000000
+1.29032258 2.74193548 10.00000000
+1.29032258 3.03225806 10.04032258
+1.29032258 3.32258065 10.40322581
+1.29032258 3.61290323 10.76612903
+1.29032258 3.90322581 11.12903226
+1.29032258 4.19354839 11.49193548
+1.29032258 4.48387097 11.85483871
+1.29032258 4.77419355 12.21774194
+1.29032258 5.06451613 12.58064516
+1.29032258 5.35483871 12.94354839
+1.29032258 5.64516129 13.30645161
+1.29032258 5.93548387 13.66935484
+1.29032258 6.22580645 14.03225806
+1.29032258 6.51612903 14.39516129
+1.29032258 6.80645161 14.75806452
+1.29032258 7.09677419 15.00000000
+1.29032258 7.38709677 15.00000000
+1.29032258 7.67741935 15.00000000
+1.29032258 7.96774194 15.00000000
+1.29032258 8.25806452 15.00000000
+1.29032258 8.54838710 15.00000000
+1.29032258 8.83870968 15.00000000
+1.29032258 9.12903226 15.00000000
+1.29032258 9.41935484 15.00000000
+1.29032258 9.70967742 15.00000000
+1.29032258 10.00000000 15.00000000
+1.58064516 1.00000000 10.00000000
+1.58064516 1.29032258 10.00000000
+1.58064516 1.58064516 10.00000000
+1.58064516 1.87096774 10.00000000
+1.58064516 2.16129032 10.00000000
+1.58064516 2.45161290 10.00000000
+1.58064516 2.74193548 10.00000000
+1.58064516 3.03225806 10.04032258
+1.58064516 3.32258065 10.40322581
+1.58064516 3.61290323 10.76612903
+1.58064516 3.90322581 11.12903226
+1.58064516 4.19354839 11.49193548
+1.58064516 4.48387097 11.85483871
+1.58064516 4.77419355 12.21774194
+1.58064516 5.06451613 12.58064516
+1.58064516 5.35483871 12.94354839
+1.58064516 5.64516129 13.30645161
+1.58064516 5.93548387 13.66935484
+1.58064516 6.22580645 14.03225806
+1.58064516 6.51612903 14.39516129
+1.58064516 6.80645161 14.75806452
+1.58064516 7.09677419 15.00000000
+1.58064516 7.38709677 15.00000000
+1.58064516 7.67741935 15.00000000
+1.58064516 7.96774194 15.00000000
+1.58064516 8.25806452 15.00000000
+1.58064516 8.54838710 15.00000000
+1.58064516 8.83870968 15.00000000
+1.58064516 9.12903226 15.00000000
+1.58064516 9.41935484 15.00000000
+1.58064516 9.70967742 15.00000000
+1.58064516 10.00000000 15.00000000
+1.87096774 1.00000000 10.00000000
+1.87096774 1.29032258 10.00000000
+1.87096774 1.58064516 10.00000000
+1.87096774 1.87096774 10.00000000
+1.87096774 2.16129032 10.00000000
+1.87096774 2.45161290 10.00000000
+1.87096774 2.74193548 10.00000000
+1.87096774 3.03225806 10.04032258
+1.87096774 3.32258065 10.40322581
+1.87096774 3.61290323 10.76612903
+1.87096774 3.90322581 11.12903226
+1.87096774 4.19354839 11.49193548
+1.87096774 4.48387097 11.85483871
+1.87096774 4.77419355 12.21774194
+1.87096774 5.06451613 12.58064516
+1.87096774 5.35483871 12.94354839
+1.87096774 5.64516129 13.30645161
+1.87096774 5.93548387 13.66935484
+1.87096774 6.22580645 14.03225806
+1.87096774 6.51612903 14.39516129
+1.87096774 6.80645161 14.75806452
+1.87096774 7.09677419 15.00000000
+1.87096774 7.38709677 15.00000000
+1.87096774 7.67741935 15.00000000
+1.87096774 7.96774194 15.00000000
+1.87096774 8.25806452 15.00000000
+1.87096774 8.54838710 15.00000000
+1.87096774 8.83870968 15.00000000
+1.87096774 9.12903226 15.00000000
+1.87096774 9.41935484 15.00000000
+1.87096774 9.70967742 15.00000000
+1.87096774 10.00000000 15.00000000
+2.16129032 1.00000000 10.00000000
+2.16129032 1.29032258 10.00000000
+2.16129032 1.58064516 10.00000000
+2.16129032 1.87096774 10.00000000
+2.16129032 2.16129032 10.00000000
+2.16129032 2.45161290 10.00000000
+2.16129032 2.74193548 10.00000000
+2.16129032 3.03225806 10.04032258
+2.16129032 3.32258065 10.40322581
+2.16129032 3.61290323 10.76612903
+2.16129032 3.90322581 11.12903226
+2.16129032 4.19354839 11.49193548
+2.16129032 4.48387097 11.85483871
+2.16129032 4.77419355 12.21774194
+2.16129032 5.06451613 12.58064516
+2.16129032 5.35483871 12.94354839
+2.16129032 5.64516129 13.30645161
+2.16129032 5.93548387 13.66935484
+2.16129032 6.22580645 14.03225806
+2.16129032 6.51612903 14.39516129
+2.16129032 6.80645161 14.75806452
+2.16129032 7.09677419 15.00000000
+2.16129032 7.38709677 15.00000000
+2.16129032 7.67741935 15.00000000
+2.16129032 7.96774194 15.00000000
+2.16129032 8.25806452 15.00000000
+2.16129032 8.54838710 15.00000000
+2.16129032 8.83870968 15.00000000
+2.16129032 9.12903226 15.00000000
+2.16129032 9.41935484 15.00000000
+2.16129032 9.70967742 15.00000000
+2.16129032 10.00000000 15.00000000
+2.45161290 1.00000000 10.00000000
+2.45161290 1.29032258 10.00000000
+2.45161290 1.58064516 10.00000000
+2.45161290 1.87096774 10.00000000
+2.45161290 2.16129032 10.00000000
+2.45161290 2.45161290 10.00000000
+2.45161290 2.74193548 10.00000000
+2.45161290 3.03225806 10.04032258
+2.45161290 3.32258065 10.40322581
+2.45161290 3.61290323 10.76612903
+2.45161290 3.90322581 11.12903226
+2.45161290 4.19354839 11.49193548
+2.45161290 4.48387097 11.85483871
+2.45161290 4.77419355 12.21774194
+2.45161290 5.06451613 12.58064516
+2.45161290 5.35483871 12.94354839
+2.45161290 5.64516129 13.30645161
+2.45161290 5.93548387 13.66935484
+2.45161290 6.22580645 14.03225806
+2.45161290 6.51612903 14.39516129
+2.45161290 6.80645161 14.75806452
+2.45161290 7.09677419 15.00000000
+2.45161290 7.38709677 15.00000000
+2.45161290 7.67741935 15.00000000
+2.45161290 7.96774194 15.00000000
+2.45161290 8.25806452 15.00000000
+2.45161290 8.54838710 15.00000000
+2.45161290 8.83870968 15.00000000
+2.45161290 9.12903226 15.00000000
+2.45161290 9.41935484 15.00000000
+2.45161290 9.70967742 15.00000000
+2.45161290 10.00000000 15.00000000
+2.74193548 1.00000000 10.00000000
+2.74193548 1.29032258 10.00000000
+2.74193548 1.58064516 10.00000000
+2.74193548 1.87096774 10.00000000
+2.74193548 2.16129032 10.00000000
+2.74193548 2.45161290 10.00000000
+2.74193548 2.74193548 10.00000000
+2.74193548 3.03225806 10.04032258
+2.74193548 3.32258065 10.40322581
+2.74193548 3.61290323 10.76612903
+2.74193548 3.90322581 11.12903226
+2.74193548 4.19354839 11.49193548
+2.74193548 4.48387097 11.85483871
+2.74193548 4.77419355 12.21774194
+2.74193548 5.06451613 12.58064516
+2.74193548 5.35483871 12.94354839
+2.74193548 5.64516129 13.30645161
+2.74193548 5.93548387 13.66935484
+2.74193548 6.22580645 14.03225806
+2.74193548 6.51612903 14.39516129
+2.74193548 6.80645161 14.75806452
+2.74193548 7.09677419 15.00000000
+2.74193548 7.38709677 15.00000000
+2.74193548 7.67741935 15.00000000
+2.74193548 7.96774194 15.00000000
+2.74193548 8.25806452 15.00000000
+2.74193548 8.54838710 15.00000000
+2.74193548 8.83870968 15.00000000
+2.74193548 9.12903226 15.00000000
+2.74193548 9.41935484 15.00000000
+2.74193548 9.70967742 15.00000000
+2.74193548 10.00000000 15.00000000
+3.03225806 1.00000000 10.04032258
+3.03225806 1.29032258 10.04032258
+3.03225806 1.58064516 10.04032258
+3.03225806 1.87096774 10.04032258
+3.03225806 2.16129032 10.04032258
+3.03225806 2.45161290 10.04032258
+3.03225806 2.74193548 10.04032258
+3.03225806 3.03225806 10.15873016
+3.03225806 3.32258065 10.51587302
+3.03225806 3.61290323 10.87301587
+3.03225806 3.90322581 11.23015873
+3.03225806 4.19354839 11.58730159
+3.03225806 4.48387097 11.94444444
+3.03225806 4.77419355 12.30158730
+3.03225806 5.06451613 12.65873016
+3.03225806 5.35483871 13.01587302
+3.03225806 5.64516129 13.37301587
+3.03225806 5.93548387 13.73015873
+3.03225806 6.22580645 14.08730159
+3.03225806 6.51612903 14.44444444
+3.03225806 6.80645161 14.80158730
+3.03225806 7.09677419 15.04032258
+3.03225806 7.38709677 15.04032258
+3.03225806 7.67741935 15.04032258
+3.03225806 7.96774194 15.04032258
+3.03225806 8.25806452 15.04032258
+3.03225806 8.54838710 15.04032258
+3.03225806 8.83870968 15.04032258
+3.03225806 9.12903226 15.04032258
+3.03225806 9.41935484 15.04032258
+3.03225806 9.70967742 15.04032258
+3.03225806 10.00000000 15.04032258
+3.32258065 1.00000000 10.40322581
+3.32258065 1.29032258 10.40322581
+3.32258065 1.58064516 10.40322581
+3.32258065 1.87096774 10.40322581
+3.32258065 2.16129032 10.40322581
+3.32258065 2.45161290 10.40322581
+3.32258065 2.74193548 10.40322581
+3.32258065 3.03225806 10.51587302
+3.32258065 3.32258065 11.38888889
+3.32258065 3.61290323 11.70138889
+3.32258065 3.90322581 12.01388889
+3.32258065 4.19354839 12.32638889
+3.32258065 4.48387097 12.63888889
+3.32258065 4.77419355 12.95138889
+3.32258065 5.06451613 13.26388889
+3.32258065 5.35483871 13.57638889
+3.32258065 5.64516129 13.88888889
+3.32258065 5.93548387 14.20138889
+3.32258065 6.22580645 14.51388889
+3.32258065 6.51612903 14.82638889
+3.32258065 6.80645161 15.14705882
+3.32258065 7.09677419 15.40322581
+3.32258065 7.38709677 15.40322581
+3.32258065 7.67741935 15.40322581
+3.32258065 7.96774194 15.40322581
+3.32258065 8.25806452 15.40322581
+3.32258065 8.54838710 15.40322581
+3.32258065 8.83870968 15.40322581
+3.32258065 9.12903226 15.40322581
+3.32258065 9.41935484 15.40322581
+3.32258065 9.70967742 15.40322581
+3.32258065 10.00000000 15.40322581
+3.61290323 1.00000000 10.76612903
+3.61290323 1.29032258 10.76612903
+3.61290323 1.58064516 10.76612903
+3.61290323 1.87096774 10.76612903
+3.61290323 2.16129032 10.76612903
+3.61290323 2.45161290 10.76612903
+3.61290323 2.74193548 10.76612903
+3.61290323 3.03225806 10.87301587
+3.61290323 3.32258065 11.70138889
+3.61290323 3.61290323 12.34567901
+3.61290323 3.90322581 12.62345679
+3.61290323 4.19354839 12.90123457
+3.61290323 4.48387097 13.17901235
+3.61290323 4.77419355 13.45679012
+3.61290323 5.06451613 13.73456790
+3.61290323 5.35483871 14.01234568
+3.61290323 5.64516129 14.29012346
+3.61290323 5.93548387 14.56790123
+3.61290323 6.22580645 14.84567901
+3.61290323 6.51612903 15.12987013
+3.61290323 6.80645161 15.47794118
+3.61290323 7.09677419 15.76612903
+3.61290323 7.38709677 15.76612903
+3.61290323 7.67741935 15.76612903
+3.61290323 7.96774194 15.76612903
+3.61290323 8.25806452 15.76612903
+3.61290323 8.54838710 15.76612903
+3.61290323 8.83870968 15.76612903
+3.61290323 9.12903226 15.76612903
+3.61290323 9.41935484 15.76612903
+3.61290323 9.70967742 15.76612903
+3.61290323 10.00000000 15.76612903
+3.90322581 1.00000000 11.12903226
+3.90322581 1.29032258 11.12903226
+3.90322581 1.58064516 11.12903226
+3.90322581 1.87096774 11.12903226
+3.90322581 2.16129032 11.12903226
+3.90322581 2.45161290 11.12903226
+3.90322581 2.74193548 11.12903226
+3.90322581 3.03225806 11.23015873
+3.90322581 3.32258065 12.01388889
+3.90322581 3.61290323 12.62345679
+3.90322581 3.90322581 13.11111111
+3.90322581 4.19354839 13.36111111
+3.90322581 4.48387097 13.61111111
+3.90322581 4.77419355 13.86111111
+3.90322581 5.06451613 14.11111111
+3.90322581 5.35483871 14.36111111
+3.90322581 5.64516129 14.61111111
+3.90322581 5.93548387 14.86111111
+3.90322581 6.22580645 15.11627907
+3.90322581 6.51612903 15.42207792
+3.90322581 6.80645161 15.80882353
+3.90322581 7.09677419 16.12903226
+3.90322581 7.38709677 16.12903226
+3.90322581 7.67741935 16.12903226
+3.90322581 7.96774194 16.12903226
+3.90322581 8.25806452 16.12903226
+3.90322581 8.54838710 16.12903226
+3.90322581 8.83870968 16.12903226
+3.90322581 9.12903226 16.12903226
+3.90322581 9.41935484 16.12903226
+3.90322581 9.70967742 16.12903226
+3.90322581 10.00000000 16.12903226
+4.19354839 1.00000000 11.49193548
+4.19354839 1.29032258 11.49193548
+4.19354839 1.58064516 11.49193548
+4.19354839 1.87096774 11.49193548
+4.19354839 2.16129032 11.49193548
+4.19354839 2.45161290 11.49193548
+4.19354839 2.74193548 11.49193548
+4.19354839 3.03225806 11.58730159
+4.19354839 3.32258065 12.32638889
+4.19354839 3.61290323 12.90123457
+4.19354839 3.90322581 13.36111111
+4.19354839 4.19354839 13.73737374
+4.19354839 4.48387097 13.96464646
+4.19354839 4.77419355 14.19191919
+4.19354839 5.06451613 14.41919192
+4.19354839 5.35483871 14.64646465
+4.19354839 5.64516129 14.87373737
+4.19354839 5.93548387 15.10526316
+4.19354839 6.22580645 15.37790698
+4.19354839 6.51612903 15.71428571
+4.19354839 6.80645161 16.13970588
+4.19354839 7.09677419 16.49193548
+4.19354839 7.38709677 16.49193548
+4.19354839 7.67741935 16.49193548
+4.19354839 7.96774194 16.49193548
+4.19354839 8.25806452 16.49193548
+4.19354839 8.54838710 16.49193548
+4.19354839 8.83870968 16.49193548
+4.19354839 9.12903226 16.49193548
+4.19354839 9.41935484 16.49193548
+4.19354839 9.70967742 16.49193548
+4.19354839 10.00000000 16.49193548
+4.48387097 1.00000000 11.85483871
+4.48387097 1.29032258 11.85483871
+4.48387097 1.58064516 11.85483871
+4.48387097 1.87096774 11.85483871
+4.48387097 2.16129032 11.85483871
+4.48387097 2.45161290 11.85483871
+4.48387097 2.74193548 11.85483871
+4.48387097 3.03225806 11.94444444
+4.48387097 3.32258065 12.63888889
+4.48387097 3.61290323 13.17901235
+4.48387097 3.90322581 13.61111111
+4.48387097 4.19354839 13.96464646
+4.48387097 4.48387097 14.25925926
+4.48387097 4.77419355 14.46759259
+4.48387097 5.06451613 14.67592593
+4.48387097 5.35483871 14.88425926
+4.48387097 5.64516129 15.09615385
+4.48387097 5.93548387 15.34210526
+4.48387097 6.22580645 15.63953488
+4.48387097 6.51612903 16.00649351
+4.48387097 6.80645161 16.47058824
+4.48387097 7.09677419 16.85483871
+4.48387097 7.38709677 16.85483871
+4.48387097 7.67741935 16.85483871
+4.48387097 7.96774194 16.85483871
+4.48387097 8.25806452 16.85483871
+4.48387097 8.54838710 16.85483871
+4.48387097 8.83870968 16.85483871
+4.48387097 9.12903226 16.85483871
+4.48387097 9.41935484 16.85483871
+4.48387097 9.70967742 16.85483871
+4.48387097 10.00000000 16.85483871
+4.77419355 1.00000000 12.21774194
+4.77419355 1.29032258 12.21774194
+4.77419355 1.58064516 12.21774194
+4.77419355 1.87096774 12.21774194
+4.77419355 2.16129032 12.21774194
+4.77419355 2.45161290 12.21774194
+4.77419355 2.74193548 12.21774194
+4.77419355 3.03225806 12.30158730
+4.77419355 3.32258065 12.95138889
+4.77419355 3.61290323 13.45679012
+4.77419355 3.90322581 13.86111111
+4.77419355 4.19354839 14.19191919
+4.77419355 4.48387097 14.46759259
+4.77419355 4.77419355 14.70085470
+4.77419355 5.06451613 14.89316239
+4.77419355 5.35483871 15.08849558
+4.77419355 5.64516129 15.31250000
+4.77419355 5.93548387 15.57894737
+4.77419355 6.22580645 15.90116279
+4.77419355 6.51612903 16.29870130
+4.77419355 6.80645161 16.80147059
+4.77419355 7.09677419 17.21774194
+4.77419355 7.38709677 17.21774194
+4.77419355 7.67741935 17.21774194
+4.77419355 7.96774194 17.21774194
+4.77419355 8.25806452 17.21774194
+4.77419355 8.54838710 17.21774194
+4.77419355 8.83870968 17.21774194
+4.77419355 9.12903226 17.21774194
+4.77419355 9.41935484 17.21774194
+4.77419355 9.70967742 17.21774194
+4.77419355 10.00000000 17.21774194
+5.06451613 1.00000000 12.58064516
+5.06451613 1.29032258 12.58064516
+5.06451613 1.58064516 12.58064516
+5.06451613 1.87096774 12.58064516
+5.06451613 2.16129032 12.58064516
+5.06451613 2.45161290 12.58064516
+5.06451613 2.74193548 12.58064516
+5.06451613 3.03225806 12.65873016
+5.06451613 3.32258065 13.26388889
+5.06451613 3.61290323 13.73456790
+5.06451613 3.90322581 14.11111111
+5.06451613 4.19354839 14.41919192
+5.06451613 4.48387097 14.67592593
+5.06451613 4.77419355 14.89316239
+5.06451613 5.06451613 15.08196721
+5.06451613 5.35483871 15.28761062
+5.06451613 5.64516129 15.52884615
+5.06451613 5.93548387 15.81578947
+5.06451613 6.22580645 16.16279070
+5.06451613 6.51612903 16.59090909
+5.06451613 6.80645161 17.13235294
+5.06451613 7.09677419 17.58064516
+5.06451613 7.38709677 17.58064516
+5.06451613 7.67741935 17.58064516
+5.06451613 7.96774194 17.58064516
+5.06451613 8.25806452 17.58064516
+5.06451613 8.54838710 17.58064516
+5.06451613 8.83870968 17.58064516
+5.06451613 9.12903226 17.58064516
+5.06451613 9.41935484 17.58064516
+5.06451613 9.70967742 17.58064516
+5.06451613 10.00000000 17.58064516
+5.35483871 1.00000000 12.94354839
+5.35483871 1.29032258 12.94354839
+5.35483871 1.58064516 12.94354839
+5.35483871 1.87096774 12.94354839
+5.35483871 2.16129032 12.94354839
+5.35483871 2.45161290 12.94354839
+5.35483871 2.74193548 12.94354839
+5.35483871 3.03225806 13.01587302
+5.35483871 3.32258065 13.57638889
+5.35483871 3.61290323 14.01234568
+5.35483871 3.90322581 14.36111111
+5.35483871 4.19354839 14.64646465
+5.35483871 4.48387097 14.88425926
+5.35483871 4.77419355 15.08849558
+5.35483871 5.06451613 15.28761062
+5.35483871 5.35483871 15.48672566
+5.35483871 5.64516129 15.74519231
+5.35483871 5.93548387 16.05263158
+5.35483871 6.22580645 16.42441860
+5.35483871 6.51612903 16.88311688
+5.35483871 6.80645161 17.46323529
+5.35483871 7.09677419 17.94354839
+5.35483871 7.38709677 17.94354839
+5.35483871 7.67741935 17.94354839
+5.35483871 7.96774194 17.94354839
+5.35483871 8.25806452 17.94354839
+5.35483871 8.54838710 17.94354839
+5.35483871 8.83870968 17.94354839
+5.35483871 9.12903226 17.94354839
+5.35483871 9.41935484 17.94354839
+5.35483871 9.70967742 17.94354839
+5.35483871 10.00000000 17.94354839
+5.64516129 1.00000000 13.30645161
+5.64516129 1.29032258 13.30645161
+5.64516129 1.58064516 13.30645161
+5.64516129 1.87096774 13.30645161
+5.64516129 2.16129032 13.30645161
+5.64516129 2.45161290 13.30645161
+5.64516129 2.74193548 13.30645161
+5.64516129 3.03225806 13.37301587
+5.64516129 3.32258065 13.88888889
+5.64516129 3.61290323 14.29012346
+5.64516129 3.90322581 14.61111111
+5.64516129 4.19354839 14.87373737
+5.64516129 4.48387097 15.09615385
+5.64516129 4.77419355 15.31250000
+5.64516129 5.06451613 15.52884615
+5.64516129 5.35483871 15.74519231
+5.64516129 5.64516129 15.96153846
+5.64516129 5.93548387 16.28947368
+5.64516129 6.22580645 16.68604651
+5.64516129 6.51612903 17.17532468
+5.64516129 6.80645161 17.79411765
+5.64516129 7.09677419 18.30645161
+5.64516129 7.38709677 18.30645161
+5.64516129 7.67741935 18.30645161
+5.64516129 7.96774194 18.30645161
+5.64516129 8.25806452 18.30645161
+5.64516129 8.54838710 18.30645161
+5.64516129 8.83870968 18.30645161
+5.64516129 9.12903226 18.30645161
+5.64516129 9.41935484 18.30645161
+5.64516129 9.70967742 18.30645161
+5.64516129 10.00000000 18.30645161
+5.93548387 1.00000000 13.66935484
+5.93548387 1.29032258 13.66935484
+5.93548387 1.58064516 13.66935484
+5.93548387 1.87096774 13.66935484
+5.93548387 2.16129032 13.66935484
+5.93548387 2.45161290 13.66935484
+5.93548387 2.74193548 13.66935484
+5.93548387 3.03225806 13.73015873
+5.93548387 3.32258065 14.20138889
+5.93548387 3.61290323 14.56790123
+5.93548387 3.90322581 14.86111111
+5.93548387 4.19354839 15.10526316
+5.93548387 4.48387097 15.34210526
+5.93548387 4.77419355 15.57894737
+5.93548387 5.06451613 15.81578947
+5.93548387 5.35483871 16.05263158
+5.93548387 5.64516129 16.28947368
+5.93548387 5.93548387 16.52631579
+5.93548387 6.22580645 16.94767442
+5.93548387 6.51612903 17.46753247
+5.93548387 6.80645161 18.12500000
+5.93548387 7.09677419 18.66935484
+5.93548387 7.38709677 18.66935484
+5.93548387 7.67741935 18.66935484
+5.93548387 7.96774194 18.66935484
+5.93548387 8.25806452 18.66935484
+5.93548387 8.54838710 18.66935484
+5.93548387 8.83870968 18.66935484
+5.93548387 9.12903226 18.66935484
+5.93548387 9.41935484 18.66935484
+5.93548387 9.70967742 18.66935484
+5.93548387 10.00000000 18.66935484
+6.22580645 1.00000000 14.03225806
+6.22580645 1.29032258 14.03225806
+6.22580645 1.58064516 14.03225806
+6.22580645 1.87096774 14.03225806
+6.22580645 2.16129032 14.03225806
+6.22580645 2.45161290 14.03225806
+6.22580645 2.74193548 14.03225806
+6.22580645 3.03225806 14.08730159
+6.22580645 3.32258065 14.51388889
+6.22580645 3.61290323 14.84567901
+6.22580645 3.90322581 15.11627907
+6.22580645 4.19354839 15.37790698
+6.22580645 4.48387097 15.63953488
+6.22580645 4.77419355 15.90116279
+6.22580645 5.06451613 16.16279070
+6.22580645 5.35483871 16.42441860
+6.22580645 5.64516129 16.68604651
+6.22580645 5.93548387 16.94767442
+6.22580645 6.22580645 17.20930233
+6.22580645 6.51612903 17.75974026
+6.22580645 6.80645161 18.45588235
+6.22580645 7.09677419 19.03225806
+6.22580645 7.38709677 19.03225806
+6.22580645 7.67741935 19.03225806
+6.22580645 7.96774194 19.03225806
+6.22580645 8.25806452 19.03225806
+6.22580645 8.54838710 19.03225806
+6.22580645 8.83870968 19.03225806
+6.22580645 9.12903226 19.03225806
+6.22580645 9.41935484 19.03225806
+6.22580645 9.70967742 19.03225806
+6.22580645 10.00000000 19.03225806
+6.51612903 1.00000000 14.39516129
+6.51612903 1.29032258 14.39516129
+6.51612903 1.58064516 14.39516129
+6.51612903 1.87096774 14.39516129
+6.51612903 2.16129032 14.39516129
+6.51612903 2.45161290 14.39516129
+6.51612903 2.74193548 14.39516129
+6.51612903 3.03225806 14.44444444
+6.51612903 3.32258065 14.82638889
+6.51612903 3.61290323 15.12987013
+6.51612903 3.90322581 15.42207792
+6.51612903 4.19354839 15.71428571
+6.51612903 4.48387097 16.00649351
+6.51612903 4.77419355 16.29870130
+6.51612903 5.06451613 16.59090909
+6.51612903 5.35483871 16.88311688
+6.51612903 5.64516129 17.17532468
+6.51612903 5.93548387 17.46753247
+6.51612903 6.22580645 17.75974026
+6.51612903 6.51612903 18.05194805
+6.51612903 6.80645161 18.78676471
+6.51612903 7.09677419 19.39516129
+6.51612903 7.38709677 19.39516129
+6.51612903 7.67741935 19.39516129
+6.51612903 7.96774194 19.39516129
+6.51612903 8.25806452 19.39516129
+6.51612903 8.54838710 19.39516129
+6.51612903 8.83870968 19.39516129
+6.51612903 9.12903226 19.39516129
+6.51612903 9.41935484 19.39516129
+6.51612903 9.70967742 19.39516129
+6.51612903 10.00000000 19.39516129
+6.80645161 1.00000000 14.75806452
+6.80645161 1.29032258 14.75806452
+6.80645161 1.58064516 14.75806452
+6.80645161 1.87096774 14.75806452
+6.80645161 2.16129032 14.75806452
+6.80645161 2.45161290 14.75806452
+6.80645161 2.74193548 14.75806452
+6.80645161 3.03225806 14.80158730
+6.80645161 3.32258065 15.14705882
+6.80645161 3.61290323 15.47794118
+6.80645161 3.90322581 15.80882353
+6.80645161 4.19354839 16.13970588
+6.80645161 4.48387097 16.47058824
+6.80645161 4.77419355 16.80147059
+6.80645161 5.06451613 17.13235294
+6.80645161 5.35483871 17.46323529
+6.80645161 5.64516129 17.79411765
+6.80645161 5.93548387 18.12500000
+6.80645161 6.22580645 18.45588235
+6.80645161 6.51612903 18.78676471
+6.80645161 6.80645161 19.11764706
+6.80645161 7.09677419 19.75806452
+6.80645161 7.38709677 19.75806452
+6.80645161 7.67741935 19.75806452
+6.80645161 7.96774194 19.75806452
+6.80645161 8.25806452 19.75806452
+6.80645161 8.54838710 19.75806452
+6.80645161 8.83870968 19.75806452
+6.80645161 9.12903226 19.75806452
+6.80645161 9.41935484 19.75806452
+6.80645161 9.70967742 19.75806452
+6.80645161 10.00000000 19.75806452
+7.09677419 1.00000000 15.00000000
+7.09677419 1.29032258 15.00000000
+7.09677419 1.58064516 15.00000000
+7.09677419 1.87096774 15.00000000
+7.09677419 2.16129032 15.00000000
+7.09677419 2.45161290 15.00000000
+7.09677419 2.74193548 15.00000000
+7.09677419 3.03225806 15.04032258
+7.09677419 3.32258065 15.40322581
+7.09677419 3.61290323 15.76612903
+7.09677419 3.90322581 16.12903226
+7.09677419 4.19354839 16.49193548
+7.09677419 4.48387097 16.85483871
+7.09677419 4.77419355 17.21774194
+7.09677419 5.06451613 17.58064516
+7.09677419 5.35483871 17.94354839
+7.09677419 5.64516129 18.30645161
+7.09677419 5.93548387 18.66935484
+7.09677419 6.22580645 19.03225806
+7.09677419 6.51612903 19.39516129
+7.09677419 6.80645161 19.75806452
+7.09677419 7.09677419 20.00000000
+7.09677419 7.38709677 20.00000000
+7.09677419 7.67741935 20.00000000
+7.09677419 7.96774194 20.00000000
+7.09677419 8.25806452 20.00000000
+7.09677419 8.54838710 20.00000000
+7.09677419 8.83870968 20.00000000
+7.09677419 9.12903226 20.00000000
+7.09677419 9.41935484 20.00000000
+7.09677419 9.70967742 20.00000000
+7.09677419 10.00000000 20.00000000
+7.38709677 1.00000000 15.00000000
+7.38709677 1.29032258 15.00000000
+7.38709677 1.58064516 15.00000000
+7.38709677 1.87096774 15.00000000
+7.38709677 2.16129032 15.00000000
+7.38709677 2.45161290 15.00000000
+7.38709677 2.74193548 15.00000000
+7.38709677 3.03225806 15.04032258
+7.38709677 3.32258065 15.40322581
+7.38709677 3.61290323 15.76612903
+7.38709677 3.90322581 16.12903226
+7.38709677 4.19354839 16.49193548
+7.38709677 4.48387097 16.85483871
+7.38709677 4.77419355 17.21774194
+7.38709677 5.06451613 17.58064516
+7.38709677 5.35483871 17.94354839
+7.38709677 5.64516129 18.30645161
+7.38709677 5.93548387 18.66935484
+7.38709677 6.22580645 19.03225806
+7.38709677 6.51612903 19.39516129
+7.38709677 6.80645161 19.75806452
+7.38709677 7.09677419 20.00000000
+7.38709677 7.38709677 20.00000000
+7.38709677 7.67741935 20.00000000
+7.38709677 7.96774194 20.00000000
+7.38709677 8.25806452 20.00000000
+7.38709677 8.54838710 20.00000000
+7.38709677 8.83870968 20.00000000
+7.38709677 9.12903226 20.00000000
+7.38709677 9.41935484 20.00000000
+7.38709677 9.70967742 20.00000000
+7.38709677 10.00000000 20.00000000
+7.67741935 1.00000000 15.00000000
+7.67741935 1.29032258 15.00000000
+7.67741935 1.58064516 15.00000000
+7.67741935 1.87096774 15.00000000
+7.67741935 2.16129032 15.00000000
+7.67741935 2.45161290 15.00000000
+7.67741935 2.74193548 15.00000000
+7.67741935 3.03225806 15.04032258
+7.67741935 3.32258065 15.40322581
+7.67741935 3.61290323 15.76612903
+7.67741935 3.90322581 16.12903226
+7.67741935 4.19354839 16.49193548
+7.67741935 4.48387097 16.85483871
+7.67741935 4.77419355 17.21774194
+7.67741935 5.06451613 17.58064516
+7.67741935 5.35483871 17.94354839
+7.67741935 5.64516129 18.30645161
+7.67741935 5.93548387 18.66935484
+7.67741935 6.22580645 19.03225806
+7.67741935 6.51612903 19.39516129
+7.67741935 6.80645161 19.75806452
+7.67741935 7.09677419 20.00000000
+7.67741935 7.38709677 20.00000000
+7.67741935 7.67741935 20.00000000
+7.67741935 7.96774194 20.00000000
+7.67741935 8.25806452 20.00000000
+7.67741935 8.54838710 20.00000000
+7.67741935 8.83870968 20.00000000
+7.67741935 9.12903226 20.00000000
+7.67741935 9.41935484 20.00000000
+7.67741935 9.70967742 20.00000000
+7.67741935 10.00000000 20.00000000
+7.96774194 1.00000000 15.00000000
+7.96774194 1.29032258 15.00000000
+7.96774194 1.58064516 15.00000000
+7.96774194 1.87096774 15.00000000
+7.96774194 2.16129032 15.00000000
+7.96774194 2.45161290 15.00000000
+7.96774194 2.74193548 15.00000000
+7.96774194 3.03225806 15.04032258
+7.96774194 3.32258065 15.40322581
+7.96774194 3.61290323 15.76612903
+7.96774194 3.90322581 16.12903226
+7.96774194 4.19354839 16.49193548
+7.96774194 4.48387097 16.85483871
+7.96774194 4.77419355 17.21774194
+7.96774194 5.06451613 17.58064516
+7.96774194 5.35483871 17.94354839
+7.96774194 5.64516129 18.30645161
+7.96774194 5.93548387 18.66935484
+7.96774194 6.22580645 19.03225806
+7.96774194 6.51612903 19.39516129
+7.96774194 6.80645161 19.75806452
+7.96774194 7.09677419 20.00000000
+7.96774194 7.38709677 20.00000000
+7.96774194 7.67741935 20.00000000
+7.96774194 7.96774194 20.00000000
+7.96774194 8.25806452 20.00000000
+7.96774194 8.54838710 20.00000000
+7.96774194 8.83870968 20.00000000
+7.96774194 9.12903226 20.00000000
+7.96774194 9.41935484 20.00000000
+7.96774194 9.70967742 20.00000000
+7.96774194 10.00000000 20.00000000
+8.25806452 1.00000000 15.00000000
+8.25806452 1.29032258 15.00000000
+8.25806452 1.58064516 15.00000000
+8.25806452 1.87096774 15.00000000
+8.25806452 2.16129032 15.00000000
+8.25806452 2.45161290 15.00000000
+8.25806452 2.74193548 15.00000000
+8.25806452 3.03225806 15.04032258
+8.25806452 3.32258065 15.40322581
+8.25806452 3.61290323 15.76612903
+8.25806452 3.90322581 16.12903226
+8.25806452 4.19354839 16.49193548
+8.25806452 4.48387097 16.85483871
+8.25806452 4.77419355 17.21774194
+8.25806452 5.06451613 17.58064516
+8.25806452 5.35483871 17.94354839
+8.25806452 5.64516129 18.30645161
+8.25806452 5.93548387 18.66935484
+8.25806452 6.22580645 19.03225806
+8.25806452 6.51612903 19.39516129
+8.25806452 6.80645161 19.75806452
+8.25806452 7.09677419 20.00000000
+8.25806452 7.38709677 20.00000000
+8.25806452 7.67741935 20.00000000
+8.25806452 7.96774194 20.00000000
+8.25806452 8.25806452 20.00000000
+8.25806452 8.54838710 20.00000000
+8.25806452 8.83870968 20.00000000
+8.25806452 9.12903226 20.00000000
+8.25806452 9.41935484 20.00000000
+8.25806452 9.70967742 20.00000000
+8.25806452 10.00000000 20.00000000
+8.54838710 1.00000000 15.00000000
+8.54838710 1.29032258 15.00000000
+8.54838710 1.58064516 15.00000000
+8.54838710 1.87096774 15.00000000
+8.54838710 2.16129032 15.00000000
+8.54838710 2.45161290 15.00000000
+8.54838710 2.74193548 15.00000000
+8.54838710 3.03225806 15.04032258
+8.54838710 3.32258065 15.40322581
+8.54838710 3.61290323 15.76612903
+8.54838710 3.90322581 16.12903226
+8.54838710 4.19354839 16.49193548
+8.54838710 4.48387097 16.85483871
+8.54838710 4.77419355 17.21774194
+8.54838710 5.06451613 17.58064516
+8.54838710 5.35483871 17.94354839
+8.54838710 5.64516129 18.30645161
+8.54838710 5.93548387 18.66935484
+8.54838710 6.22580645 19.03225806
+8.54838710 6.51612903 19.39516129
+8.54838710 6.80645161 19.75806452
+8.54838710 7.09677419 20.00000000
+8.54838710 7.38709677 20.00000000
+8.54838710 7.67741935 20.00000000
+8.54838710 7.96774194 20.00000000
+8.54838710 8.25806452 20.00000000
+8.54838710 8.54838710 20.00000000
+8.54838710 8.83870968 20.00000000
+8.54838710 9.12903226 20.00000000
+8.54838710 9.41935484 20.00000000
+8.54838710 9.70967742 20.00000000
+8.54838710 10.00000000 20.00000000
+8.83870968 1.00000000 15.00000000
+8.83870968 1.29032258 15.00000000
+8.83870968 1.58064516 15.00000000
+8.83870968 1.87096774 15.00000000
+8.83870968 2.16129032 15.00000000
+8.83870968 2.45161290 15.00000000
+8.83870968 2.74193548 15.00000000
+8.83870968 3.03225806 15.04032258
+8.83870968 3.32258065 15.40322581
+8.83870968 3.61290323 15.76612903
+8.83870968 3.90322581 16.12903226
+8.83870968 4.19354839 16.49193548
+8.83870968 4.48387097 16.85483871
+8.83870968 4.77419355 17.21774194
+8.83870968 5.06451613 17.58064516
+8.83870968 5.35483871 17.94354839
+8.83870968 5.64516129 18.30645161
+8.83870968 5.93548387 18.66935484
+8.83870968 6.22580645 19.03225806
+8.83870968 6.51612903 19.39516129
+8.83870968 6.80645161 19.75806452
+8.83870968 7.09677419 20.00000000
+8.83870968 7.38709677 20.00000000
+8.83870968 7.67741935 20.00000000
+8.83870968 7.96774194 20.00000000
+8.83870968 8.25806452 20.00000000
+8.83870968 8.54838710 20.00000000
+8.83870968 8.83870968 20.00000000
+8.83870968 9.12903226 20.00000000
+8.83870968 9.41935484 20.00000000
+8.83870968 9.70967742 20.00000000
+8.83870968 10.00000000 20.00000000
+9.12903226 1.00000000 15.00000000
+9.12903226 1.29032258 15.00000000
+9.12903226 1.58064516 15.00000000
+9.12903226 1.87096774 15.00000000
+9.12903226 2.16129032 15.00000000
+9.12903226 2.45161290 15.00000000
+9.12903226 2.74193548 15.00000000
+9.12903226 3.03225806 15.04032258
+9.12903226 3.32258065 15.40322581
+9.12903226 3.61290323 15.76612903
+9.12903226 3.90322581 16.12903226
+9.12903226 4.19354839 16.49193548
+9.12903226 4.48387097 16.85483871
+9.12903226 4.77419355 17.21774194
+9.12903226 5.06451613 17.58064516
+9.12903226 5.35483871 17.94354839
+9.12903226 5.64516129 18.30645161
+9.12903226 5.93548387 18.66935484
+9.12903226 6.22580645 19.03225806
+9.12903226 6.51612903 19.39516129
+9.12903226 6.80645161 19.75806452
+9.12903226 7.09677419 20.00000000
+9.12903226 7.38709677 20.00000000
+9.12903226 7.67741935 20.00000000
+9.12903226 7.96774194 20.00000000
+9.12903226 8.25806452 20.00000000
+9.12903226 8.54838710 20.00000000
+9.12903226 8.83870968 20.00000000
+9.12903226 9.12903226 20.00000000
+9.12903226 9.41935484 20.00000000
+9.12903226 9.70967742 20.00000000
+9.12903226 10.00000000 20.00000000
+9.41935484 1.00000000 15.00000000
+9.41935484 1.29032258 15.00000000
+9.41935484 1.58064516 15.00000000
+9.41935484 1.87096774 15.00000000
+9.41935484 2.16129032 15.00000000
+9.41935484 2.45161290 15.00000000
+9.41935484 2.74193548 15.00000000
+9.41935484 3.03225806 15.04032258
+9.41935484 3.32258065 15.40322581
+9.41935484 3.61290323 15.76612903
+9.41935484 3.90322581 16.12903226
+9.41935484 4.19354839 16.49193548
+9.41935484 4.48387097 16.85483871
+9.41935484 4.77419355 17.21774194
+9.41935484 5.06451613 17.58064516
+9.41935484 5.35483871 17.94354839
+9.41935484 5.64516129 18.30645161
+9.41935484 5.93548387 18.66935484
+9.41935484 6.22580645 19.03225806
+9.41935484 6.51612903 19.39516129
+9.41935484 6.80645161 19.75806452
+9.41935484 7.09677419 20.00000000
+9.41935484 7.38709677 20.00000000
+9.41935484 7.67741935 20.00000000
+9.41935484 7.96774194 20.00000000
+9.41935484 8.25806452 20.00000000
+9.41935484 8.54838710 20.00000000
+9.41935484 8.83870968 20.00000000
+9.41935484 9.12903226 20.00000000
+9.41935484 9.41935484 20.00000000
+9.41935484 9.70967742 20.00000000
+9.41935484 10.00000000 20.00000000
+9.70967742 1.00000000 15.00000000
+9.70967742 1.29032258 15.00000000
+9.70967742 1.58064516 15.00000000
+9.70967742 1.87096774 15.00000000
+9.70967742 2.16129032 15.00000000
+9.70967742 2.45161290 15.00000000
+9.70967742 2.74193548 15.00000000
+9.70967742 3.03225806 15.04032258
+9.70967742 3.32258065 15.40322581
+9.70967742 3.61290323 15.76612903
+9.70967742 3.90322581 16.12903226
+9.70967742 4.19354839 16.49193548
+9.70967742 4.48387097 16.85483871
+9.70967742 4.77419355 17.21774194
+9.70967742 5.06451613 17.58064516
+9.70967742 5.35483871 17.94354839
+9.70967742 5.64516129 18.30645161
+9.70967742 5.93548387 18.66935484
+9.70967742 6.22580645 19.03225806
+9.70967742 6.51612903 19.39516129
+9.70967742 6.80645161 19.75806452
+9.70967742 7.09677419 20.00000000
+9.70967742 7.38709677 20.00000000
+9.70967742 7.67741935 20.00000000
+9.70967742 7.96774194 20.00000000
+9.70967742 8.25806452 20.00000000
+9.70967742 8.54838710 20.00000000
+9.70967742 8.83870968 20.00000000
+9.70967742 9.12903226 20.00000000
+9.70967742 9.41935484 20.00000000
+9.70967742 9.70967742 20.00000000
+9.70967742 10.00000000 20.00000000
+10.00000000 1.00000000 15.00000000
+10.00000000 1.29032258 15.00000000
+10.00000000 1.58064516 15.00000000
+10.00000000 1.87096774 15.00000000
+10.00000000 2.16129032 15.00000000
+10.00000000 2.45161290 15.00000000
+10.00000000 2.74193548 15.00000000
+10.00000000 3.03225806 15.04032258
+10.00000000 3.32258065 15.40322581
+10.00000000 3.61290323 15.76612903
+10.00000000 3.90322581 16.12903226
+10.00000000 4.19354839 16.49193548
+10.00000000 4.48387097 16.85483871
+10.00000000 4.77419355 17.21774194
+10.00000000 5.06451613 17.58064516
+10.00000000 5.35483871 17.94354839
+10.00000000 5.64516129 18.30645161
+10.00000000 5.93548387 18.66935484
+10.00000000 6.22580645 19.03225806
+10.00000000 6.51612903 19.39516129
+10.00000000 6.80645161 19.75806452
+10.00000000 7.09677419 20.00000000
+10.00000000 7.38709677 20.00000000
+10.00000000 7.67741935 20.00000000
+10.00000000 7.96774194 20.00000000
+10.00000000 8.25806452 20.00000000
+10.00000000 8.54838710 20.00000000
+10.00000000 8.83870968 20.00000000
+10.00000000 9.12903226 20.00000000
+10.00000000 9.41935484 20.00000000
+10.00000000 9.70967742 20.00000000
+10.00000000 10.00000000 20.00000000
diff --git a/examples/takagi-sugeno/octave/linear_tip_calculator.fll b/examples/takagi-sugeno/octave/linear_tip_calculator.fll
new file mode 100644
index 0000000..8c1f597
--- /dev/null
+++ b/examples/takagi-sugeno/octave/linear_tip_calculator.fll
@@ -0,0 +1,31 @@
+Engine: Linear-Tip-Calculator
+InputVariable: FoodQuality
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+InputVariable: Service
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+OutputVariable: Tip
+ enabled: true
+ range: 10.000 20.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: TenPercent Linear 0.000 0.000 10.000
+ term: FifteenPercent Linear 0.000 0.000 15.000
+ term: TwentyPercent Linear 0.000 0.000 20.000
+RuleBlock:
+ enabled: true
+ conjunction: Minimum
+ disjunction: none
+ activation: none
+ rule: if FoodQuality is Bad and Service is Bad then Tip is TenPercent
+ rule: if FoodQuality is Bad and Service is Good then Tip is FifteenPercent
+ rule: if FoodQuality is Good and Service is Bad then Tip is FifteenPercent
+ rule: if FoodQuality is Good and Service is Good then Tip is TwentyPercent \ No newline at end of file
diff --git a/examples/takagi-sugeno/octave/linear_tip_calculator.java b/examples/takagi-sugeno/octave/linear_tip_calculator.java
new file mode 100644
index 0000000..0600638
--- /dev/null
+++ b/examples/takagi-sugeno/octave/linear_tip_calculator.java
@@ -0,0 +1,62 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class linear_tip_calculator{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("Linear-Tip-Calculator");
+
+InputVariable inputVariable1 = new InputVariable();
+inputVariable1.setEnabled(true);
+inputVariable1.setName("FoodQuality");
+inputVariable1.setRange(1.000, 10.000);
+inputVariable1.addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable1.addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine.addInputVariable(inputVariable1);
+
+InputVariable inputVariable2 = new InputVariable();
+inputVariable2.setEnabled(true);
+inputVariable2.setName("Service");
+inputVariable2.setRange(1.000, 10.000);
+inputVariable2.addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable2.addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine.addInputVariable(inputVariable2);
+
+OutputVariable outputVariable = new OutputVariable();
+outputVariable.setEnabled(true);
+outputVariable.setName("Tip");
+outputVariable.setRange(10.000, 20.000);
+outputVariable.fuzzyOutput().setAccumulation(null);
+outputVariable.setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable.setDefaultValue(Double.NaN);
+outputVariable.setLockPreviousOutputValue(false);
+outputVariable.setLockOutputValueInRange(false);
+outputVariable.addTerm(Linear.create("TenPercent", engine, 0.000, 0.000, 10.000));
+outputVariable.addTerm(Linear.create("FifteenPercent", engine, 0.000, 0.000, 15.000));
+outputVariable.addTerm(Linear.create("TwentyPercent", engine, 0.000, 0.000, 20.000));
+engine.addOutputVariable(outputVariable);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(new Minimum());
+ruleBlock.setDisjunction(null);
+ruleBlock.setActivation(null);
+ruleBlock.addRule(Rule.parse("if FoodQuality is Bad and Service is Bad then Tip is TenPercent", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Bad and Service is Good then Tip is FifteenPercent", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Good and Service is Bad then Tip is FifteenPercent", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Good and Service is Good then Tip is TwentyPercent", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/takagi-sugeno/octave/sugeno_tip_calculator.cpp b/examples/takagi-sugeno/octave/sugeno_tip_calculator.cpp
new file mode 100644
index 0000000..d92de0a
--- /dev/null
+++ b/examples/takagi-sugeno/octave/sugeno_tip_calculator.cpp
@@ -0,0 +1,86 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("Sugeno-Tip-Calculator");
+
+InputVariable* inputVariable1 = new InputVariable;
+inputVariable1->setEnabled(true);
+inputVariable1->setName("FoodQuality");
+inputVariable1->setRange(1.000, 10.000);
+inputVariable1->addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable1->addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine->addInputVariable(inputVariable1);
+
+InputVariable* inputVariable2 = new InputVariable;
+inputVariable2->setEnabled(true);
+inputVariable2->setName("Service");
+inputVariable2->setRange(1.000, 10.000);
+inputVariable2->addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable2->addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine->addInputVariable(inputVariable2);
+
+OutputVariable* outputVariable1 = new OutputVariable;
+outputVariable1->setEnabled(true);
+outputVariable1->setName("CheapTip");
+outputVariable1->setRange(5.000, 25.000);
+outputVariable1->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable1->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable1->setDefaultValue(fl::nan);
+outputVariable1->setLockPreviousOutputValue(false);
+outputVariable1->setLockOutputValueInRange(false);
+outputVariable1->addTerm(new Constant("Low", 10.000));
+outputVariable1->addTerm(new Constant("Medium", 15.000));
+outputVariable1->addTerm(new Constant("High", 20.000));
+engine->addOutputVariable(outputVariable1);
+
+OutputVariable* outputVariable2 = new OutputVariable;
+outputVariable2->setEnabled(true);
+outputVariable2->setName("AverageTip");
+outputVariable2->setRange(5.000, 25.000);
+outputVariable2->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable2->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable2->setDefaultValue(fl::nan);
+outputVariable2->setLockPreviousOutputValue(false);
+outputVariable2->setLockOutputValueInRange(false);
+outputVariable2->addTerm(new Constant("Low", 10.000));
+outputVariable2->addTerm(new Constant("Medium", 15.000));
+outputVariable2->addTerm(new Constant("High", 20.000));
+engine->addOutputVariable(outputVariable2);
+
+OutputVariable* outputVariable3 = new OutputVariable;
+outputVariable3->setEnabled(true);
+outputVariable3->setName("GenerousTip");
+outputVariable3->setRange(5.000, 25.000);
+outputVariable3->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable3->setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable3->setDefaultValue(fl::nan);
+outputVariable3->setLockPreviousOutputValue(false);
+outputVariable3->setLockOutputValueInRange(false);
+outputVariable3->addTerm(new Constant("Low", 10.000));
+outputVariable3->addTerm(new Constant("Medium", 15.000));
+outputVariable3->addTerm(new Constant("High", 20.000));
+engine->addOutputVariable(outputVariable3);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(new EinsteinProduct);
+ruleBlock->setDisjunction(fl::null);
+ruleBlock->setActivation(fl::null);
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is extremely Bad and Service is extremely Bad then CheapTip is extremely Low and AverageTip is very Low and GenerousTip is Low", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Good and Service is extremely Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is very Good and Service is very Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Bad and Service is Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is extremely Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is very High", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Bad and Service is Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is Good and Service is Good then CheapTip is Medium and AverageTip is Medium and GenerousTip is very High", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is very Bad and Service is very Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High", engine));
+ruleBlock->addRule(fl::Rule::parse("if FoodQuality is very very Good and Service is very very Good then CheapTip is High and AverageTip is very High and GenerousTip is extremely High", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/takagi-sugeno/octave/sugeno_tip_calculator.fcl b/examples/takagi-sugeno/octave/sugeno_tip_calculator.fcl
new file mode 100644
index 0000000..ad98f68
--- /dev/null
+++ b/examples/takagi-sugeno/octave/sugeno_tip_calculator.fcl
@@ -0,0 +1,67 @@
+FUNCTION_BLOCK Sugeno-Tip-Calculator
+
+VAR_INPUT
+ FoodQuality: REAL;
+ Service: REAL;
+END_VAR
+
+VAR_OUTPUT
+ CheapTip: REAL;
+ AverageTip: REAL;
+ GenerousTip: REAL;
+END_VAR
+
+FUZZIFY FoodQuality
+ RANGE := (1.000 .. 10.000);
+ TERM Bad := Trapezoid 0.000 1.000 3.000 7.000;
+ TERM Good := Trapezoid 3.000 7.000 10.000 11.000;
+END_FUZZIFY
+
+FUZZIFY Service
+ RANGE := (1.000 .. 10.000);
+ TERM Bad := Trapezoid 0.000 1.000 3.000 7.000;
+ TERM Good := Trapezoid 3.000 7.000 10.000 11.000;
+END_FUZZIFY
+
+DEFUZZIFY CheapTip
+ RANGE := (5.000 .. 25.000);
+ TERM Low := 10.000;
+ TERM Medium := 15.000;
+ TERM High := 20.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY AverageTip
+ RANGE := (5.000 .. 25.000);
+ TERM Low := 10.000;
+ TERM Medium := 15.000;
+ TERM High := 20.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY GenerousTip
+ RANGE := (5.000 .. 25.000);
+ TERM Low := 10.000;
+ TERM Medium := 15.000;
+ TERM High := 20.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ AND : EPROD;
+ RULE 1 : if FoodQuality is extremely Bad and Service is extremely Bad then CheapTip is extremely Low and AverageTip is very Low and GenerousTip is Low
+ RULE 2 : if FoodQuality is Good and Service is extremely Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium
+ RULE 3 : if FoodQuality is very Good and Service is very Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ RULE 4 : if FoodQuality is Bad and Service is Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium
+ RULE 5 : if FoodQuality is Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ RULE 6 : if FoodQuality is extremely Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is very High
+ RULE 7 : if FoodQuality is Bad and Service is Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ RULE 8 : if FoodQuality is Good and Service is Good then CheapTip is Medium and AverageTip is Medium and GenerousTip is very High
+ RULE 9 : if FoodQuality is very Bad and Service is very Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ RULE 10 : if FoodQuality is very very Good and Service is very very Good then CheapTip is High and AverageTip is very High and GenerousTip is extremely High
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/takagi-sugeno/octave/sugeno_tip_calculator.fis b/examples/takagi-sugeno/octave/sugeno_tip_calculator.fis
new file mode 100644
index 0000000..4349913
--- /dev/null
+++ b/examples/takagi-sugeno/octave/sugeno_tip_calculator.fis
@@ -0,0 +1,61 @@
+[System]
+Name='Sugeno-Tip-Calculator'
+Type='sugeno'
+NumInputs=2
+NumOutputs=3
+NumRules=10
+AndMethod='einstein_product'
+OrMethod=''
+ImpMethod=''
+AggMethod=''
+DefuzzMethod='wtaver'
+
+[Input1]
+Name='FoodQuality'
+Range=[1.000 10.000]
+NumMFs=2
+MF1='Bad':'trapmf',[0.000 1.000 3.000 7.000]
+MF2='Good':'trapmf',[3.000 7.000 10.000 11.000]
+
+[Input2]
+Name='Service'
+Range=[1.000 10.000]
+NumMFs=2
+MF1='Bad':'trapmf',[0.000 1.000 3.000 7.000]
+MF2='Good':'trapmf',[3.000 7.000 10.000 11.000]
+
+[Output1]
+Name='CheapTip'
+Range=[5.000 25.000]
+NumMFs=3
+MF1='Low':'constant',[10.000]
+MF2='Medium':'constant',[15.000]
+MF3='High':'constant',[20.000]
+
+[Output2]
+Name='AverageTip'
+Range=[5.000 25.000]
+NumMFs=3
+MF1='Low':'constant',[10.000]
+MF2='Medium':'constant',[15.000]
+MF3='High':'constant',[20.000]
+
+[Output3]
+Name='GenerousTip'
+Range=[5.000 25.000]
+NumMFs=3
+MF1='Low':'constant',[10.000]
+MF2='Medium':'constant',[15.000]
+MF3='High':'constant',[20.000]
+
+[Rules]
+1.300 1.300 , 1.300 1.200 1.000 (1.000) : 1
+2.000 1.300 , 1.000 1.000 2.000 (1.000) : 1
+2.200 1.200 , 1.000 2.000 3.000 (1.000) : 1
+1.000 1.000 , 1.000 1.000 2.000 (1.000) : 1
+2.000 1.000 , 1.000 2.000 3.000 (1.000) : 1
+2.300 1.000 , 1.000 2.000 3.200 (1.000) : 1
+1.000 2.000 , 1.000 2.000 3.000 (1.000) : 1
+2.000 2.000 , 2.000 2.000 3.200 (1.000) : 1
+1.200 2.200 , 1.000 2.000 3.000 (1.000) : 1
+2.400 2.400 , 3.000 3.200 3.300 (1.000) : 1
diff --git a/examples/takagi-sugeno/octave/sugeno_tip_calculator.fld b/examples/takagi-sugeno/octave/sugeno_tip_calculator.fld
new file mode 100644
index 0000000..6816af5
--- /dev/null
+++ b/examples/takagi-sugeno/octave/sugeno_tip_calculator.fld
@@ -0,0 +1,1026 @@
+#@Engine: Sugeno-Tip-Calculator;
+#@InputVariable: FoodQuality; @InputVariable: Service; @OutputVariable: CheapTip; @OutputVariable: AverageTip; @OutputVariable: GenerousTip;
+1.00000000 1.00000000 10.00000000 10.00000000 12.50000000
+1.00000000 1.29032258 10.00000000 10.00000000 12.50000000
+1.00000000 1.58064516 10.00000000 10.00000000 12.50000000
+1.00000000 1.87096774 10.00000000 10.00000000 12.50000000
+1.00000000 2.16129032 10.00000000 10.00000000 12.50000000
+1.00000000 2.45161290 10.00000000 10.00000000 12.50000000
+1.00000000 2.74193548 10.00000000 10.00000000 12.50000000
+1.00000000 3.03225806 10.00000000 10.02032322 12.52040460
+1.00000000 3.32258065 10.00000000 10.21723908 12.72618837
+1.00000000 3.61290323 10.00000000 10.43854143 12.97859532
+1.00000000 3.90322581 10.00000000 10.68860515 13.30323372
+1.00000000 4.19354839 10.00000000 10.98519415 13.75455390
+1.00000000 4.48387097 10.00000000 11.36896201 14.43109544
+1.00000000 4.77419355 10.00000000 11.91319586 15.48909397
+1.00000000 5.06451613 10.00000000 12.68223479 17.02303230
+1.00000000 5.35483871 10.00000000 13.34274407 18.15544945
+1.00000000 5.64516129 10.00000000 13.79246624 18.75419392
+1.00000000 5.93548387 10.00000000 14.13081618 19.12558840
+1.00000000 6.22580645 10.00000000 14.41328213 19.41290031
+1.00000000 6.51612903 10.00000000 14.65879553 19.65878725
+1.00000000 6.80645161 10.00000000 14.87303754 19.87303753
+1.00000000 7.09677419 10.00000000 15.00000000 20.00000000
+1.00000000 7.38709677 10.00000000 15.00000000 20.00000000
+1.00000000 7.67741935 10.00000000 15.00000000 20.00000000
+1.00000000 7.96774194 10.00000000 15.00000000 20.00000000
+1.00000000 8.25806452 10.00000000 15.00000000 20.00000000
+1.00000000 8.54838710 10.00000000 15.00000000 20.00000000
+1.00000000 8.83870968 10.00000000 15.00000000 20.00000000
+1.00000000 9.12903226 10.00000000 15.00000000 20.00000000
+1.00000000 9.41935484 10.00000000 15.00000000 20.00000000
+1.00000000 9.70967742 10.00000000 15.00000000 20.00000000
+1.00000000 10.00000000 10.00000000 15.00000000 20.00000000
+1.29032258 1.00000000 10.00000000 10.00000000 12.50000000
+1.29032258 1.29032258 10.00000000 10.00000000 12.50000000
+1.29032258 1.58064516 10.00000000 10.00000000 12.50000000
+1.29032258 1.87096774 10.00000000 10.00000000 12.50000000
+1.29032258 2.16129032 10.00000000 10.00000000 12.50000000
+1.29032258 2.45161290 10.00000000 10.00000000 12.50000000
+1.29032258 2.74193548 10.00000000 10.00000000 12.50000000
+1.29032258 3.03225806 10.00000000 10.02032322 12.52040460
+1.29032258 3.32258065 10.00000000 10.21723908 12.72618837
+1.29032258 3.61290323 10.00000000 10.43854143 12.97859532
+1.29032258 3.90322581 10.00000000 10.68860515 13.30323372
+1.29032258 4.19354839 10.00000000 10.98519415 13.75455390
+1.29032258 4.48387097 10.00000000 11.36896201 14.43109544
+1.29032258 4.77419355 10.00000000 11.91319586 15.48909397
+1.29032258 5.06451613 10.00000000 12.68223479 17.02303230
+1.29032258 5.35483871 10.00000000 13.34274407 18.15544945
+1.29032258 5.64516129 10.00000000 13.79246624 18.75419392
+1.29032258 5.93548387 10.00000000 14.13081618 19.12558840
+1.29032258 6.22580645 10.00000000 14.41328213 19.41290031
+1.29032258 6.51612903 10.00000000 14.65879553 19.65878725
+1.29032258 6.80645161 10.00000000 14.87303754 19.87303753
+1.29032258 7.09677419 10.00000000 15.00000000 20.00000000
+1.29032258 7.38709677 10.00000000 15.00000000 20.00000000
+1.29032258 7.67741935 10.00000000 15.00000000 20.00000000
+1.29032258 7.96774194 10.00000000 15.00000000 20.00000000
+1.29032258 8.25806452 10.00000000 15.00000000 20.00000000
+1.29032258 8.54838710 10.00000000 15.00000000 20.00000000
+1.29032258 8.83870968 10.00000000 15.00000000 20.00000000
+1.29032258 9.12903226 10.00000000 15.00000000 20.00000000
+1.29032258 9.41935484 10.00000000 15.00000000 20.00000000
+1.29032258 9.70967742 10.00000000 15.00000000 20.00000000
+1.29032258 10.00000000 10.00000000 15.00000000 20.00000000
+1.58064516 1.00000000 10.00000000 10.00000000 12.50000000
+1.58064516 1.29032258 10.00000000 10.00000000 12.50000000
+1.58064516 1.58064516 10.00000000 10.00000000 12.50000000
+1.58064516 1.87096774 10.00000000 10.00000000 12.50000000
+1.58064516 2.16129032 10.00000000 10.00000000 12.50000000
+1.58064516 2.45161290 10.00000000 10.00000000 12.50000000
+1.58064516 2.74193548 10.00000000 10.00000000 12.50000000
+1.58064516 3.03225806 10.00000000 10.02032322 12.52040460
+1.58064516 3.32258065 10.00000000 10.21723908 12.72618837
+1.58064516 3.61290323 10.00000000 10.43854143 12.97859532
+1.58064516 3.90322581 10.00000000 10.68860515 13.30323372
+1.58064516 4.19354839 10.00000000 10.98519415 13.75455390
+1.58064516 4.48387097 10.00000000 11.36896201 14.43109544
+1.58064516 4.77419355 10.00000000 11.91319586 15.48909397
+1.58064516 5.06451613 10.00000000 12.68223479 17.02303230
+1.58064516 5.35483871 10.00000000 13.34274407 18.15544945
+1.58064516 5.64516129 10.00000000 13.79246624 18.75419392
+1.58064516 5.93548387 10.00000000 14.13081618 19.12558840
+1.58064516 6.22580645 10.00000000 14.41328213 19.41290031
+1.58064516 6.51612903 10.00000000 14.65879553 19.65878725
+1.58064516 6.80645161 10.00000000 14.87303754 19.87303753
+1.58064516 7.09677419 10.00000000 15.00000000 20.00000000
+1.58064516 7.38709677 10.00000000 15.00000000 20.00000000
+1.58064516 7.67741935 10.00000000 15.00000000 20.00000000
+1.58064516 7.96774194 10.00000000 15.00000000 20.00000000
+1.58064516 8.25806452 10.00000000 15.00000000 20.00000000
+1.58064516 8.54838710 10.00000000 15.00000000 20.00000000
+1.58064516 8.83870968 10.00000000 15.00000000 20.00000000
+1.58064516 9.12903226 10.00000000 15.00000000 20.00000000
+1.58064516 9.41935484 10.00000000 15.00000000 20.00000000
+1.58064516 9.70967742 10.00000000 15.00000000 20.00000000
+1.58064516 10.00000000 10.00000000 15.00000000 20.00000000
+1.87096774 1.00000000 10.00000000 10.00000000 12.50000000
+1.87096774 1.29032258 10.00000000 10.00000000 12.50000000
+1.87096774 1.58064516 10.00000000 10.00000000 12.50000000
+1.87096774 1.87096774 10.00000000 10.00000000 12.50000000
+1.87096774 2.16129032 10.00000000 10.00000000 12.50000000
+1.87096774 2.45161290 10.00000000 10.00000000 12.50000000
+1.87096774 2.74193548 10.00000000 10.00000000 12.50000000
+1.87096774 3.03225806 10.00000000 10.02032322 12.52040460
+1.87096774 3.32258065 10.00000000 10.21723908 12.72618837
+1.87096774 3.61290323 10.00000000 10.43854143 12.97859532
+1.87096774 3.90322581 10.00000000 10.68860515 13.30323372
+1.87096774 4.19354839 10.00000000 10.98519415 13.75455390
+1.87096774 4.48387097 10.00000000 11.36896201 14.43109544
+1.87096774 4.77419355 10.00000000 11.91319586 15.48909397
+1.87096774 5.06451613 10.00000000 12.68223479 17.02303230
+1.87096774 5.35483871 10.00000000 13.34274407 18.15544945
+1.87096774 5.64516129 10.00000000 13.79246624 18.75419392
+1.87096774 5.93548387 10.00000000 14.13081618 19.12558840
+1.87096774 6.22580645 10.00000000 14.41328213 19.41290031
+1.87096774 6.51612903 10.00000000 14.65879553 19.65878725
+1.87096774 6.80645161 10.00000000 14.87303754 19.87303753
+1.87096774 7.09677419 10.00000000 15.00000000 20.00000000
+1.87096774 7.38709677 10.00000000 15.00000000 20.00000000
+1.87096774 7.67741935 10.00000000 15.00000000 20.00000000
+1.87096774 7.96774194 10.00000000 15.00000000 20.00000000
+1.87096774 8.25806452 10.00000000 15.00000000 20.00000000
+1.87096774 8.54838710 10.00000000 15.00000000 20.00000000
+1.87096774 8.83870968 10.00000000 15.00000000 20.00000000
+1.87096774 9.12903226 10.00000000 15.00000000 20.00000000
+1.87096774 9.41935484 10.00000000 15.00000000 20.00000000
+1.87096774 9.70967742 10.00000000 15.00000000 20.00000000
+1.87096774 10.00000000 10.00000000 15.00000000 20.00000000
+2.16129032 1.00000000 10.00000000 10.00000000 12.50000000
+2.16129032 1.29032258 10.00000000 10.00000000 12.50000000
+2.16129032 1.58064516 10.00000000 10.00000000 12.50000000
+2.16129032 1.87096774 10.00000000 10.00000000 12.50000000
+2.16129032 2.16129032 10.00000000 10.00000000 12.50000000
+2.16129032 2.45161290 10.00000000 10.00000000 12.50000000
+2.16129032 2.74193548 10.00000000 10.00000000 12.50000000
+2.16129032 3.03225806 10.00000000 10.02032322 12.52040460
+2.16129032 3.32258065 10.00000000 10.21723908 12.72618837
+2.16129032 3.61290323 10.00000000 10.43854143 12.97859532
+2.16129032 3.90322581 10.00000000 10.68860515 13.30323372
+2.16129032 4.19354839 10.00000000 10.98519415 13.75455390
+2.16129032 4.48387097 10.00000000 11.36896201 14.43109544
+2.16129032 4.77419355 10.00000000 11.91319586 15.48909397
+2.16129032 5.06451613 10.00000000 12.68223479 17.02303230
+2.16129032 5.35483871 10.00000000 13.34274407 18.15544945
+2.16129032 5.64516129 10.00000000 13.79246624 18.75419392
+2.16129032 5.93548387 10.00000000 14.13081618 19.12558840
+2.16129032 6.22580645 10.00000000 14.41328213 19.41290031
+2.16129032 6.51612903 10.00000000 14.65879553 19.65878725
+2.16129032 6.80645161 10.00000000 14.87303754 19.87303753
+2.16129032 7.09677419 10.00000000 15.00000000 20.00000000
+2.16129032 7.38709677 10.00000000 15.00000000 20.00000000
+2.16129032 7.67741935 10.00000000 15.00000000 20.00000000
+2.16129032 7.96774194 10.00000000 15.00000000 20.00000000
+2.16129032 8.25806452 10.00000000 15.00000000 20.00000000
+2.16129032 8.54838710 10.00000000 15.00000000 20.00000000
+2.16129032 8.83870968 10.00000000 15.00000000 20.00000000
+2.16129032 9.12903226 10.00000000 15.00000000 20.00000000
+2.16129032 9.41935484 10.00000000 15.00000000 20.00000000
+2.16129032 9.70967742 10.00000000 15.00000000 20.00000000
+2.16129032 10.00000000 10.00000000 15.00000000 20.00000000
+2.45161290 1.00000000 10.00000000 10.00000000 12.50000000
+2.45161290 1.29032258 10.00000000 10.00000000 12.50000000
+2.45161290 1.58064516 10.00000000 10.00000000 12.50000000
+2.45161290 1.87096774 10.00000000 10.00000000 12.50000000
+2.45161290 2.16129032 10.00000000 10.00000000 12.50000000
+2.45161290 2.45161290 10.00000000 10.00000000 12.50000000
+2.45161290 2.74193548 10.00000000 10.00000000 12.50000000
+2.45161290 3.03225806 10.00000000 10.02032322 12.52040460
+2.45161290 3.32258065 10.00000000 10.21723908 12.72618837
+2.45161290 3.61290323 10.00000000 10.43854143 12.97859532
+2.45161290 3.90322581 10.00000000 10.68860515 13.30323372
+2.45161290 4.19354839 10.00000000 10.98519415 13.75455390
+2.45161290 4.48387097 10.00000000 11.36896201 14.43109544
+2.45161290 4.77419355 10.00000000 11.91319586 15.48909397
+2.45161290 5.06451613 10.00000000 12.68223479 17.02303230
+2.45161290 5.35483871 10.00000000 13.34274407 18.15544945
+2.45161290 5.64516129 10.00000000 13.79246624 18.75419392
+2.45161290 5.93548387 10.00000000 14.13081618 19.12558840
+2.45161290 6.22580645 10.00000000 14.41328213 19.41290031
+2.45161290 6.51612903 10.00000000 14.65879553 19.65878725
+2.45161290 6.80645161 10.00000000 14.87303754 19.87303753
+2.45161290 7.09677419 10.00000000 15.00000000 20.00000000
+2.45161290 7.38709677 10.00000000 15.00000000 20.00000000
+2.45161290 7.67741935 10.00000000 15.00000000 20.00000000
+2.45161290 7.96774194 10.00000000 15.00000000 20.00000000
+2.45161290 8.25806452 10.00000000 15.00000000 20.00000000
+2.45161290 8.54838710 10.00000000 15.00000000 20.00000000
+2.45161290 8.83870968 10.00000000 15.00000000 20.00000000
+2.45161290 9.12903226 10.00000000 15.00000000 20.00000000
+2.45161290 9.41935484 10.00000000 15.00000000 20.00000000
+2.45161290 9.70967742 10.00000000 15.00000000 20.00000000
+2.45161290 10.00000000 10.00000000 15.00000000 20.00000000
+2.74193548 1.00000000 10.00000000 10.00000000 12.50000000
+2.74193548 1.29032258 10.00000000 10.00000000 12.50000000
+2.74193548 1.58064516 10.00000000 10.00000000 12.50000000
+2.74193548 1.87096774 10.00000000 10.00000000 12.50000000
+2.74193548 2.16129032 10.00000000 10.00000000 12.50000000
+2.74193548 2.45161290 10.00000000 10.00000000 12.50000000
+2.74193548 2.74193548 10.00000000 10.00000000 12.50000000
+2.74193548 3.03225806 10.00000000 10.02032322 12.52040460
+2.74193548 3.32258065 10.00000000 10.21723908 12.72618837
+2.74193548 3.61290323 10.00000000 10.43854143 12.97859532
+2.74193548 3.90322581 10.00000000 10.68860515 13.30323372
+2.74193548 4.19354839 10.00000000 10.98519415 13.75455390
+2.74193548 4.48387097 10.00000000 11.36896201 14.43109544
+2.74193548 4.77419355 10.00000000 11.91319586 15.48909397
+2.74193548 5.06451613 10.00000000 12.68223479 17.02303230
+2.74193548 5.35483871 10.00000000 13.34274407 18.15544945
+2.74193548 5.64516129 10.00000000 13.79246624 18.75419392
+2.74193548 5.93548387 10.00000000 14.13081618 19.12558840
+2.74193548 6.22580645 10.00000000 14.41328213 19.41290031
+2.74193548 6.51612903 10.00000000 14.65879553 19.65878725
+2.74193548 6.80645161 10.00000000 14.87303754 19.87303753
+2.74193548 7.09677419 10.00000000 15.00000000 20.00000000
+2.74193548 7.38709677 10.00000000 15.00000000 20.00000000
+2.74193548 7.67741935 10.00000000 15.00000000 20.00000000
+2.74193548 7.96774194 10.00000000 15.00000000 20.00000000
+2.74193548 8.25806452 10.00000000 15.00000000 20.00000000
+2.74193548 8.54838710 10.00000000 15.00000000 20.00000000
+2.74193548 8.83870968 10.00000000 15.00000000 20.00000000
+2.74193548 9.12903226 10.00000000 15.00000000 20.00000000
+2.74193548 9.41935484 10.00000000 15.00000000 20.00000000
+2.74193548 9.70967742 10.00000000 15.00000000 20.00000000
+2.74193548 10.00000000 10.00000000 15.00000000 20.00000000
+3.03225806 1.00000000 10.00000000 10.02056414 12.53036255
+3.03225806 1.29032258 10.00000000 10.02056414 12.53036255
+3.03225806 1.58064516 10.00000000 10.02056414 12.53036255
+3.03225806 1.87096774 10.00000000 10.02056414 12.53036255
+3.03225806 2.16129032 10.00000000 10.02056414 12.53036255
+3.03225806 2.45161290 10.00000000 10.02056414 12.53036255
+3.03225806 2.74193548 10.00000000 10.02056414 12.53036255
+3.03225806 3.03225806 10.00008162 10.04023401 12.54971361
+3.03225806 3.32258065 10.00084536 10.23133043 12.74581753
+3.03225806 3.61290323 10.00166050 10.44709908 12.98846248
+3.03225806 3.90322581 10.00253632 10.69213103 13.30366093
+3.03225806 4.19354839 10.00350696 10.98431132 13.74623534
+3.03225806 4.48387097 10.00465122 11.36442108 14.41531219
+3.03225806 4.77419355 10.00613539 11.90630175 15.46893972
+3.03225806 5.06451613 10.00830466 12.67597755 17.00612582
+3.03225806 5.35483871 10.01079710 13.33923254 18.14567412
+3.03225806 5.64516129 10.01307288 13.79127531 18.74912170
+3.03225806 5.93548387 10.01499275 14.13114438 19.12316822
+3.03225806 6.22580645 10.01659745 14.41445725 19.41211259
+3.03225806 6.51612903 10.01801781 14.66014744 19.65891493
+3.03225806 6.80645161 10.01938833 14.87383528 19.87334753
+3.03225806 7.09677419 10.02032454 15.00000000 20.00000000
+3.03225806 7.38709677 10.02032454 15.00000000 20.00000000
+3.03225806 7.67741935 10.02032454 15.00000000 20.00000000
+3.03225806 7.96774194 10.02032454 15.00000000 20.00000000
+3.03225806 8.25806452 10.02032454 15.00000000 20.00000000
+3.03225806 8.54838710 10.02032454 15.00000000 20.00000000
+3.03225806 8.83870968 10.02032454 15.00000000 20.00000000
+3.03225806 9.12903226 10.02032454 15.00000000 20.00000000
+3.03225806 9.41935484 10.02032454 15.00000000 20.00000000
+3.03225806 9.70967742 10.02032454 15.00000000 20.00000000
+3.03225806 10.00000000 10.02032454 15.00000000 20.00000000
+3.32258065 1.00000000 10.00000000 10.23852600 12.81465712
+3.32258065 1.29032258 10.00000000 10.23852600 12.81465712
+3.32258065 1.58064516 10.00000000 10.23852600 12.81465712
+3.32258065 1.87096774 10.00000000 10.23852600 12.81465712
+3.32258065 2.16129032 10.00000000 10.23852600 12.81465712
+3.32258065 2.45161290 10.00000000 10.23852600 12.81465712
+3.32258065 2.74193548 10.00000000 10.23852600 12.81465712
+3.32258065 3.03225806 10.00081091 10.25216001 12.82509445
+3.32258065 3.32258065 10.00847573 10.39024810 12.94131554
+3.32258065 3.61290323 10.01682656 10.55678831 13.10652832
+3.32258065 3.90322581 10.02600789 10.75843537 13.34992628
+3.32258065 4.19354839 10.03642525 11.01464869 13.72980008
+3.32258065 4.48387097 10.04898564 11.36779630 14.35055538
+3.32258065 4.77419355 10.06563624 11.89543354 15.38280506
+3.32258065 5.06451613 10.09043159 12.66530578 16.93433074
+3.32258065 5.35483871 10.11905829 13.33050784 18.08725853
+3.32258065 5.64516129 10.14531886 13.79087513 18.71123750
+3.32258065 5.93548387 10.16705394 14.13888710 19.10302935
+3.32258065 6.22580645 10.18433380 14.42710664 19.40531141
+3.32258065 6.51612903 10.19847233 14.67287318 19.66004764
+3.32258065 6.80645161 10.21090121 14.88093570 19.87607311
+3.32258065 7.09677419 10.21874952 15.00000000 20.00000000
+3.32258065 7.38709677 10.21874952 15.00000000 20.00000000
+3.32258065 7.67741935 10.21874952 15.00000000 20.00000000
+3.32258065 7.96774194 10.21874952 15.00000000 20.00000000
+3.32258065 8.25806452 10.21874952 15.00000000 20.00000000
+3.32258065 8.54838710 10.21874952 15.00000000 20.00000000
+3.32258065 8.83870968 10.21874952 15.00000000 20.00000000
+3.32258065 9.12903226 10.21874952 15.00000000 20.00000000
+3.32258065 9.41935484 10.21874952 15.00000000 20.00000000
+3.32258065 9.70967742 10.21874952 15.00000000 20.00000000
+3.32258065 10.00000000 10.21874952 15.00000000 20.00000000
+3.61290323 1.00000000 10.00000000 10.50490830 13.12845546
+3.61290323 1.29032258 10.00000000 10.50490830 13.12845546
+3.61290323 1.58064516 10.00000000 10.50490830 13.12845546
+3.61290323 1.87096774 10.00000000 10.50490830 13.12845546
+3.61290323 2.16129032 10.00000000 10.50490830 13.12845546
+3.61290323 2.45161290 10.00000000 10.50490830 13.12845546
+3.61290323 2.74193548 10.00000000 10.50490830 13.12845546
+3.61290323 3.03225806 10.00151654 10.51262673 13.13088541
+3.61290323 3.32258065 10.01600168 10.59992682 13.17930400
+3.61290323 3.61290323 10.03212956 10.72120213 13.28528620
+3.61290323 3.90322581 10.05031902 10.88533698 13.48054126
+3.61290323 4.19354839 10.07154360 11.11425892 13.82721937
+3.61290323 4.48387097 10.09785029 11.45287584 14.43542451
+3.61290323 4.77419355 10.13366827 11.98002190 15.48143735
+3.61290323 5.06451613 10.18719850 12.73374607 17.00406518
+3.61290323 5.35483871 10.24796420 13.36174755 18.08140820
+3.61290323 5.64516129 10.30403654 13.80875389 18.68736063
+3.61290323 5.93548387 10.35025162 14.15521373 19.08606379
+3.61290323 6.22580645 10.38608863 14.44355382 19.39936608
+3.61290323 6.51612903 10.41383257 14.68673503 19.66149620
+3.61290323 6.80645161 10.43623515 14.88800549 19.87887528
+3.61290323 7.09677419 10.44926133 15.00000088 20.00000000
+3.61290323 7.38709677 10.44926133 15.00000088 20.00000000
+3.61290323 7.67741935 10.44926133 15.00000088 20.00000000
+3.61290323 7.96774194 10.44926133 15.00000088 20.00000000
+3.61290323 8.25806452 10.44926133 15.00000088 20.00000000
+3.61290323 8.54838710 10.44926133 15.00000088 20.00000000
+3.61290323 8.83870968 10.44926133 15.00000088 20.00000000
+3.61290323 9.12903226 10.44926133 15.00000088 20.00000000
+3.61290323 9.41935484 10.44926133 15.00000088 20.00000000
+3.61290323 9.70967742 10.44926133 15.00000088 20.00000000
+3.61290323 10.00000000 10.44926133 15.00000088 20.00000000
+3.90322581 1.00000000 10.00000000 10.81017051 13.50482619
+3.90322581 1.29032258 10.00000000 10.81017051 13.50482619
+3.90322581 1.58064516 10.00000000 10.81017051 13.50482619
+3.90322581 1.87096774 10.00000000 10.81017051 13.50482619
+3.90322581 2.16129032 10.00000000 10.81017051 13.50482619
+3.90322581 2.45161290 10.00000000 10.81017051 13.50482619
+3.90322581 2.74193548 10.00000000 10.81017051 13.50482619
+3.90322581 3.03225806 10.00219148 10.81256800 13.49994499
+3.90322581 3.32258065 10.02334161 10.85552124 13.49103677
+3.90322581 3.61290323 10.04741939 10.93971057 13.55528460
+3.90322581 3.90322581 10.07534164 11.07630295 13.72649949
+3.90322581 4.19354839 10.10893601 11.29025424 14.07090979
+3.90322581 4.48387097 10.15193928 11.62903831 14.70330070
+3.90322581 4.77419355 10.21233649 12.16677306 15.79128080
+3.90322581 5.06451613 10.30009318 12.86586763 17.18478750
+3.90322581 5.35483871 10.39754980 13.42561609 18.11553344
+3.90322581 5.64516129 10.48826068 13.84290562 18.67501261
+3.90322581 5.93548387 10.56389908 14.17975972 19.07251531
+3.90322581 6.22580645 10.62276486 14.46381877 19.39494339
+3.90322581 6.51612903 10.66748610 14.70188269 19.66385099
+3.90322581 6.80645161 10.70191101 14.89518965 19.88205071
+3.90322581 7.09677419 10.72100391 15.00002113 20.00000000
+3.90322581 7.38709677 10.72100391 15.00002113 20.00000000
+3.90322581 7.67741935 10.72100391 15.00002113 20.00000000
+3.90322581 7.96774194 10.72100391 15.00002113 20.00000000
+3.90322581 8.25806452 10.72100391 15.00002113 20.00000000
+3.90322581 8.54838710 10.72100391 15.00002113 20.00000000
+3.90322581 8.83870968 10.72100391 15.00002113 20.00000000
+3.90322581 9.12903226 10.72100391 15.00002113 20.00000000
+3.90322581 9.41935484 10.72100391 15.00002113 20.00000000
+3.90322581 9.70967742 10.72100391 15.00002113 20.00000000
+3.90322581 10.00000000 10.72100391 15.00002113 20.00000000
+4.19354839 1.00000000 10.00000000 11.15752390 14.00262973
+4.19354839 1.29032258 10.00000000 11.15752390 14.00262973
+4.19354839 1.58064516 10.00000000 11.15752390 14.00262973
+4.19354839 1.87096774 10.00000000 11.15752390 14.00262973
+4.19354839 2.16129032 10.00000000 11.15752390 14.00262973
+4.19354839 2.45161290 10.00000000 11.15752390 14.00262973
+4.19354839 2.74193548 10.00000000 11.15752390 14.00262973
+4.19354839 3.03225806 10.00284797 11.15550089 13.99105017
+4.19354839 3.32258065 10.03061130 11.16343190 13.93454481
+4.19354839 3.61290323 10.06293737 11.22200777 13.97446418
+4.19354839 3.90322581 10.10150367 11.34453978 14.14653042
+4.19354839 4.19354839 10.14947661 11.55849242 14.51982064
+4.19354839 4.48387097 10.21306769 11.91049442 15.20610247
+4.19354839 4.77419355 10.30455207 12.44702544 16.30551023
+4.19354839 5.06451613 10.42825336 13.03462310 17.41989968
+4.19354839 5.35483871 10.56483051 13.51054329 18.16893632
+4.19354839 5.64516129 10.69399611 13.89010562 18.67059669
+4.19354839 5.93548387 10.80488969 14.21182688 19.06294905
+4.19354839 6.22580645 10.89398583 14.48780444 19.39301254
+4.19354839 6.51612903 10.96315550 14.71842615 19.66783672
+4.19354839 6.80645161 11.01688740 14.90267275 19.88592684
+4.19354839 7.09677419 11.04734052 15.00021055 20.00000000
+4.19354839 7.38709677 11.04734052 15.00021055 20.00000000
+4.19354839 7.67741935 11.04734052 15.00021055 20.00000000
+4.19354839 7.96774194 11.04734052 15.00021055 20.00000000
+4.19354839 8.25806452 11.04734052 15.00021055 20.00000000
+4.19354839 8.54838710 11.04734052 15.00021055 20.00000000
+4.19354839 8.83870968 11.04734052 15.00021055 20.00000000
+4.19354839 9.12903226 11.04734052 15.00021055 20.00000000
+4.19354839 9.41935484 11.04734052 15.00021055 20.00000000
+4.19354839 9.70967742 11.04734052 15.00021055 20.00000000
+4.19354839 10.00000000 11.04734052 15.00021055 20.00000000
+4.48387097 1.00000000 10.00000000 11.56528482 14.70576330
+4.48387097 1.29032258 10.00000000 11.56528482 14.70576330
+4.48387097 1.58064516 10.00000000 11.56528482 14.70576330
+4.48387097 1.87096774 10.00000000 11.56528482 14.70576330
+4.48387097 2.16129032 10.00000000 11.56528482 14.70576330
+4.48387097 2.45161290 10.00000000 11.56528482 14.70576330
+4.48387097 2.74193548 10.00000000 11.56528482 14.70576330
+4.48387097 3.03225806 10.00351833 11.55997110 14.68853149
+4.48387097 3.32258065 10.03814879 11.54406758 14.59669714
+4.48387097 3.61290323 10.07937305 11.59012375 14.63057323
+4.48387097 3.90322581 10.12999914 11.71265167 14.82664243
+4.48387097 4.19354839 10.19514264 11.93798653 15.24939300
+4.48387097 4.48387097 10.28453809 12.29965873 15.97812311
+4.48387097 4.77419355 10.40728869 12.75130857 16.85678574
+4.48387097 5.06451613 10.56626545 13.21039199 17.64813719
+4.48387097 5.35483871 10.74201361 13.60560816 18.22456849
+4.48387097 5.64516129 10.91294483 13.94712330 18.67257728
+4.48387097 5.93548387 11.06666959 14.25051940 19.05879821
+4.48387097 6.22580645 11.19709582 14.51530775 19.39489256
+4.48387097 6.51612903 11.30393014 14.73651306 19.67429340
+4.48387097 6.80645161 11.39171986 14.91090478 19.89084781
+4.48387097 7.09677419 11.44506880 15.00128458 20.00000000
+4.48387097 7.38709677 11.44506880 15.00128458 20.00000000
+4.48387097 7.67741935 11.44506880 15.00128458 20.00000000
+4.48387097 7.96774194 11.44506880 15.00128458 20.00000000
+4.48387097 8.25806452 11.44506880 15.00128458 20.00000000
+4.48387097 8.54838710 11.44506880 15.00128458 20.00000000
+4.48387097 8.83870968 11.44506880 15.00128458 20.00000000
+4.48387097 9.12903226 11.44506880 15.00128458 20.00000000
+4.48387097 9.41935484 11.44506880 15.00128458 20.00000000
+4.48387097 9.70967742 11.44506880 15.00128458 20.00000000
+4.48387097 10.00000000 11.44506880 15.00128458 20.00000000
+4.77419355 1.00000000 10.00000000 12.05898046 15.70102169
+4.77419355 1.29032258 10.00000000 12.05898046 15.70102169
+4.77419355 1.58064516 10.00000000 12.05898046 15.70102169
+4.77419355 1.87096774 10.00000000 12.05898046 15.70102169
+4.77419355 2.16129032 10.00000000 12.05898046 15.70102169
+4.77419355 2.45161290 10.00000000 12.05898046 15.70102169
+4.77419355 2.74193548 10.00000000 12.05898046 15.70102169
+4.77419355 3.03225806 10.00425780 12.05183116 15.68076127
+4.77419355 3.32258065 10.04656050 12.02438408 15.57411145
+4.77419355 3.61290323 10.09802059 12.06833124 15.61725364
+4.77419355 3.90322581 10.16302652 12.19562117 15.84003779
+4.77419355 4.19354839 10.24884203 12.41521338 16.25899815
+4.77419355 4.48387097 10.36281190 12.69904450 16.77664315
+4.77419355 4.77419355 10.51269012 13.02442268 17.31761601
+4.77419355 5.06451613 10.70326374 13.37314904 17.83311892
+4.77419355 5.35483871 10.91644419 13.70398283 18.27798568
+4.77419355 5.64516129 11.13258860 14.01140956 18.68338981
+4.77419355 5.93548387 11.33885271 14.29485387 19.06262803
+4.77419355 6.22580645 11.52611738 14.54611158 19.40221067
+4.77419355 6.51612903 11.69068129 14.75656882 19.68409833
+4.77419355 6.80645161 11.83652379 14.92121904 19.89713492
+4.77419355 7.09677419 11.93184447 15.00571281 20.00000000
+4.77419355 7.38709677 11.93184447 15.00571281 20.00000000
+4.77419355 7.67741935 11.93184447 15.00571281 20.00000000
+4.77419355 7.96774194 11.93184447 15.00571281 20.00000000
+4.77419355 8.25806452 11.93184447 15.00571281 20.00000000
+4.77419355 8.54838710 11.93184447 15.00571281 20.00000000
+4.77419355 8.83870968 11.93184447 15.00571281 20.00000000
+4.77419355 9.12903226 11.93184447 15.00571281 20.00000000
+4.77419355 9.41935484 11.93184447 15.00571281 20.00000000
+4.77419355 9.70967742 11.93184447 15.00571281 20.00000000
+4.77419355 10.00000000 11.93184447 15.00571281 20.00000000
+5.06451613 1.00000000 10.00000000 12.62161977 16.93336867
+5.06451613 1.29032258 10.00000000 12.62161977 16.93336867
+5.06451613 1.58064516 10.00000000 12.62161977 16.93336867
+5.06451613 1.87096774 10.00000000 12.62161977 16.93336867
+5.06451613 2.16129032 10.00000000 12.62161977 16.93336867
+5.06451613 2.45161290 10.00000000 12.62161977 16.93336867
+5.06451613 2.74193548 10.00000000 12.62161977 16.93336867
+5.06451613 3.03225806 10.00514671 12.61436601 16.91498077
+5.06451613 3.32258065 10.05669829 12.58189344 16.81059366
+5.06451613 3.61290323 10.12016954 12.60900573 16.81743639
+5.06451613 3.90322581 10.20030048 12.69329287 16.92465057
+5.06451613 4.19354839 10.30333031 12.82979245 17.11064279
+5.06451613 4.48387097 10.43676106 13.01355965 17.35314038
+5.06451613 4.77419355 10.60858414 13.24246568 17.64074677
+5.06451613 5.06451613 10.82506593 13.51723830 17.97839577
+5.06451613 5.35483871 11.07335436 13.80267877 18.33779748
+5.06451613 5.64516129 11.33833932 14.08082078 18.70901812
+5.06451613 5.93548387 11.60813624 14.34372309 19.07791541
+5.06451613 6.22580645 11.87123458 14.58015261 19.41671660
+5.06451613 6.51612903 12.12014276 14.77981816 19.69800848
+5.06451613 6.80645161 12.35752048 14.93719431 19.90501710
+5.06451613 7.09677419 12.52110295 15.02031920 20.00000000
+5.06451613 7.38709677 12.52110295 15.02031920 20.00000000
+5.06451613 7.67741935 12.52110295 15.02031920 20.00000000
+5.06451613 7.96774194 12.52110295 15.02031920 20.00000000
+5.06451613 8.25806452 12.52110295 15.02031920 20.00000000
+5.06451613 8.54838710 12.52110295 15.02031920 20.00000000
+5.06451613 8.83870968 12.52110295 15.02031920 20.00000000
+5.06451613 9.12903226 12.52110295 15.02031920 20.00000000
+5.06451613 9.41935484 12.52110295 15.02031920 20.00000000
+5.06451613 9.70967742 12.52110295 15.02031920 20.00000000
+5.06451613 10.00000000 12.52110295 15.02031920 20.00000000
+5.35483871 1.00000000 10.00000000 13.01386190 17.72252667
+5.35483871 1.29032258 10.00000000 13.01386190 17.72252667
+5.35483871 1.58064516 10.00000000 13.01386190 17.72252667
+5.35483871 1.87096774 10.00000000 13.01386190 17.72252667
+5.35483871 2.16129032 10.00000000 13.01386190 17.72252667
+5.35483871 2.45161290 10.00000000 13.01386190 17.72252667
+5.35483871 2.74193548 10.00000000 13.01386190 17.72252667
+5.35483871 3.03225806 10.00601495 13.00686969 17.70685129
+5.35483871 3.32258065 10.06634293 12.96547134 17.59385080
+5.35483871 3.61290323 10.14023145 12.96440313 17.53452108
+5.35483871 3.90322581 10.23227056 13.00488842 17.52903392
+5.35483871 4.19354839 10.34858062 13.08810799 17.57595632
+5.35483871 4.48387097 10.49681892 13.21678700 17.67789446
+5.35483871 4.77419355 10.68605152 13.39618613 17.84588275
+5.35483871 5.06451613 10.92582927 13.63255921 18.09900113
+5.35483871 5.35483871 11.20991976 13.89010102 18.40855831
+5.35483871 5.64516129 11.52857074 14.14622502 18.75108786
+5.35483871 5.93548387 11.87259469 14.39188070 19.10579009
+5.35483871 6.22580645 12.23015522 14.61596607 19.43909490
+5.35483871 6.51612903 12.59107968 14.80868432 19.71627593
+5.35483871 6.80645161 12.95594174 14.96716502 19.91453659
+5.35483871 7.09677419 13.21476275 15.06095073 20.00000000
+5.35483871 7.38709677 13.21476275 15.06095073 20.00000000
+5.35483871 7.67741935 13.21476275 15.06095073 20.00000000
+5.35483871 7.96774194 13.21476275 15.06095073 20.00000000
+5.35483871 8.25806452 13.21476275 15.06095073 20.00000000
+5.35483871 8.54838710 13.21476275 15.06095073 20.00000000
+5.35483871 8.83870968 13.21476275 15.06095073 20.00000000
+5.35483871 9.12903226 13.21476275 15.06095073 20.00000000
+5.35483871 9.41935484 13.21476275 15.06095073 20.00000000
+5.35483871 9.70967742 13.21476275 15.06095073 20.00000000
+5.35483871 10.00000000 13.21476275 15.06095073 20.00000000
+5.64516129 1.00000000 10.00000000 13.24478345 18.10948914
+5.64516129 1.29032258 10.00000000 13.24478345 18.10948914
+5.64516129 1.58064516 10.00000000 13.24478345 18.10948914
+5.64516129 1.87096774 10.00000000 13.24478345 18.10948914
+5.64516129 2.16129032 10.00000000 13.24478345 18.10948914
+5.64516129 2.45161290 10.00000000 13.24478345 18.10948914
+5.64516129 2.74193548 10.00000000 13.24478345 18.10948914
+5.64516129 3.03225806 10.00676630 13.23777415 18.09507267
+5.64516129 3.32258065 10.07445919 13.19087287 17.97991142
+5.64516129 3.61290323 10.15668214 13.17534466 17.89493493
+5.64516129 3.90322581 10.25790645 13.19448141 17.84556990
+5.64516129 4.19354839 10.38436340 13.25231438 17.83870593
+5.64516129 4.48387097 10.54440886 13.35439086 17.88514140
+5.64516129 4.77419355 10.74903309 13.50842487 18.00199210
+5.64516129 5.06451613 11.01198391 13.72314620 18.21285792
+5.64516129 5.35483871 11.33358994 13.96248512 18.48921917
+5.64516129 5.64516129 11.71006848 14.20295570 18.80628061
+5.64516129 5.93548387 12.13699441 14.43664044 19.14441571
+5.64516129 6.22580645 12.60472073 14.65433972 19.46851033
+5.64516129 6.51612903 13.10163256 14.84960699 19.73841715
+5.64516129 6.80645161 13.62372773 15.02857701 19.92548914
+5.64516129 7.09677419 13.99614692 15.15882564 20.00000000
+5.64516129 7.38709677 13.99614692 15.15882564 20.00000000
+5.64516129 7.67741935 13.99614692 15.15882564 20.00000000
+5.64516129 7.96774194 13.99614692 15.15882564 20.00000000
+5.64516129 8.25806452 13.99614692 15.15882564 20.00000000
+5.64516129 8.54838710 13.99614692 15.15882564 20.00000000
+5.64516129 8.83870968 13.99614692 15.15882564 20.00000000
+5.64516129 9.12903226 13.99614692 15.15882564 20.00000000
+5.64516129 9.41935484 13.99614692 15.15882564 20.00000000
+5.64516129 9.70967742 13.99614692 15.15882564 20.00000000
+5.64516129 10.00000000 13.99614692 15.15882564 20.00000000
+5.93548387 1.00000000 10.00000000 13.40120867 18.33397089
+5.93548387 1.29032258 10.00000000 13.40120867 18.33397089
+5.93548387 1.58064516 10.00000000 13.40120867 18.33397089
+5.93548387 1.87096774 10.00000000 13.40120867 18.33397089
+5.93548387 2.16129032 10.00000000 13.40120867 18.33397089
+5.93548387 2.45161290 10.00000000 13.40120867 18.33397089
+5.93548387 2.74193548 10.00000000 13.40120867 18.33397089
+5.93548387 3.03225806 10.00744380 13.39407329 18.32019470
+5.93548387 3.32258065 10.08152139 13.34352984 18.20598565
+5.93548387 3.61290323 10.17060647 13.32009277 18.11340822
+5.93548387 3.90322581 10.27923715 13.32771096 18.04912878
+5.93548387 4.19354839 10.41406163 13.37128448 18.02197505
+5.93548387 4.48387097 10.58455108 13.45730945 18.04456687
+5.93548387 4.77419355 10.80408104 13.59471590 18.13562017
+5.93548387 5.06451613 11.09099369 13.79430829 18.32113067
+5.93548387 5.35483871 11.45208902 14.02065538 18.57338072
+5.93548387 5.64516129 11.89026400 14.25075408 18.86869733
+5.93548387 5.93548387 12.40745964 14.47898935 19.19011429
+5.93548387 6.22580645 12.99767141 14.70031056 19.50287840
+5.93548387 6.51612903 13.64712779 14.91660867 19.76327022
+5.93548387 6.80645161 14.34097951 15.15349351 19.93748440
+5.93548387 7.09677419 14.82768590 15.36421869 20.00000000
+5.93548387 7.38709677 14.82768590 15.36421869 20.00000000
+5.93548387 7.67741935 14.82768590 15.36421869 20.00000000
+5.93548387 7.96774194 14.82768590 15.36421869 20.00000000
+5.93548387 8.25806452 14.82768590 15.36421869 20.00000000
+5.93548387 8.54838710 14.82768590 15.36421869 20.00000000
+5.93548387 8.83870968 14.82768590 15.36421869 20.00000000
+5.93548387 9.12903226 14.82768590 15.36421869 20.00000000
+5.93548387 9.41935484 14.82768590 15.36421869 20.00000000
+5.93548387 9.70967742 14.82768590 15.36421869 20.00000000
+5.93548387 10.00000000 14.82768590 15.36421869 20.00000000
+6.22580645 1.00000000 10.00000000 13.52140723 18.49028183
+6.22580645 1.29032258 10.00000000 13.52140723 18.49028183
+6.22580645 1.58064516 10.00000000 13.52140723 18.49028183
+6.22580645 1.87096774 10.00000000 13.52140723 18.49028183
+6.22580645 2.16129032 10.00000000 13.52140723 18.49028183
+6.22580645 2.45161290 10.00000000 13.52140723 18.49028183
+6.22580645 2.74193548 10.00000000 13.52140723 18.49028183
+6.22580645 3.03225806 10.00810302 13.51414064 18.47696951
+6.22580645 3.32258065 10.08815300 13.46083531 18.36487771
+6.22580645 3.61290323 10.18335204 13.43182492 18.27056725
+6.22580645 3.90322581 10.29853084 13.43120310 18.20072122
+6.22580645 4.19354839 10.44105662 13.46414597 18.16435180
+6.22580645 4.48387097 10.62187043 13.53764372 18.17434053
+6.22580645 4.77419355 10.85711240 13.66162818 18.24992950
+6.22580645 5.06451613 11.17010593 13.84903800 18.41864073
+6.22580645 5.35483871 11.57429140 14.06601569 18.65350731
+6.22580645 5.64516129 12.07969940 14.29125163 18.93164466
+6.22580645 5.93548387 12.69488978 14.52340191 19.23816286
+6.22580645 6.22580645 13.41621771 14.76582129 19.53932638
+6.22580645 6.51612903 14.22291873 15.03682794 19.78943564
+6.22580645 6.80645161 15.07877121 15.39191301 19.95021830
+6.22580645 7.09677419 15.65721613 15.73541361 20.00000000
+6.22580645 7.38709677 15.65721613 15.73541361 20.00000000
+6.22580645 7.67741935 15.65721613 15.73541361 20.00000000
+6.22580645 7.96774194 15.65721613 15.73541361 20.00000000
+6.22580645 8.25806452 15.65721613 15.73541361 20.00000000
+6.22580645 8.54838710 15.65721613 15.73541361 20.00000000
+6.22580645 8.83870968 15.65721613 15.73541361 20.00000000
+6.22580645 9.12903226 15.65721613 15.73541361 20.00000000
+6.22580645 9.41935484 15.65721613 15.73541361 20.00000000
+6.22580645 9.70967742 15.65721613 15.73541361 20.00000000
+6.22580645 10.00000000 15.65721613 15.73541361 20.00000000
+6.51612903 1.00000000 10.00000000 13.61972094 18.60880619
+6.51612903 1.29032258 10.00000000 13.61972094 18.60880619
+6.51612903 1.58064516 10.00000000 13.61972094 18.60880619
+6.51612903 1.87096774 10.00000000 13.61972094 18.60880619
+6.51612903 2.16129032 10.00000000 13.61972094 18.60880619
+6.51612903 2.45161290 10.00000000 13.61972094 18.60880619
+6.51612903 2.74193548 10.00000000 13.61972094 18.60880619
+6.51612903 3.03225806 10.00879607 13.61234668 18.59585828
+6.51612903 3.32258065 10.09491449 13.55680524 18.48591333
+6.51612903 3.61290323 10.19606794 13.52317278 18.39148132
+6.51612903 3.90322581 10.31763361 13.51550375 18.31902161
+6.51612903 4.19354839 10.46805711 13.53910437 18.27742836
+6.51612903 4.48387097 10.66021718 13.60138870 18.27957680
+6.51612903 4.77419355 10.91360186 13.71334196 18.34495215
+6.51612903 5.06451613 11.25720210 13.89035326 18.50206810
+6.51612903 5.35483871 11.71156099 14.10154931 18.72464991
+6.51612903 5.64516129 12.29365018 14.32963573 18.99000850
+6.51612903 5.93548387 13.01651193 14.58179014 19.28447671
+6.51612903 6.22580645 13.87303537 14.87722915 19.57556793
+6.51612903 6.51612903 14.82531306 15.25898022 19.81660791
+6.51612903 6.80645161 15.80446772 15.80314051 19.96387362
+6.51612903 7.09677419 16.43160099 16.29997299 20.00000000
+6.51612903 7.38709677 16.43160099 16.29997299 20.00000000
+6.51612903 7.67741935 16.43160099 16.29997299 20.00000000
+6.51612903 7.96774194 16.43160099 16.29997299 20.00000000
+6.51612903 8.25806452 16.43160099 16.29997299 20.00000000
+6.51612903 8.54838710 16.43160099 16.29997299 20.00000000
+6.51612903 8.83870968 16.43160099 16.29997299 20.00000000
+6.51612903 9.12903226 16.43160099 16.29997299 20.00000000
+6.51612903 9.41935484 16.43160099 16.29997299 20.00000000
+6.51612903 9.70967742 16.43160099 16.29997299 20.00000000
+6.51612903 10.00000000 16.43160099 16.29997299 20.00000000
+6.80645161 1.00000000 10.00000000 13.70214059 18.70056855
+6.80645161 1.29032258 10.00000000 13.70214059 18.70056855
+6.80645161 1.58064516 10.00000000 13.70214059 18.70056855
+6.80645161 1.87096774 10.00000000 13.70214059 18.70056855
+6.80645161 2.16129032 10.00000000 13.70214059 18.70056855
+6.80645161 2.45161290 10.00000000 13.70214059 18.70056855
+6.80645161 2.74193548 10.00000000 13.70214059 18.70056855
+6.80645161 3.03225806 10.00956688 13.69469565 18.68788903
+6.80645161 3.32258065 10.10223923 13.63745767 18.57975796
+6.80645161 3.61290323 10.20959709 13.59997149 18.48577395
+6.80645161 3.90322581 10.33793179 13.58608880 18.41208791
+6.80645161 4.19354839 10.49735957 13.60114711 18.36739388
+6.80645161 4.48387097 10.70355023 13.65298813 18.36446614
+6.80645161 4.77419355 10.98045881 13.75389532 18.42285704
+6.80645161 5.06451613 11.36399277 13.92258835 18.57166481
+6.80645161 5.35483871 11.88233270 14.13399003 18.78543130
+6.80645161 5.64516129 12.55749197 14.38001472 19.04156376
+6.80645161 5.93548387 13.40037073 14.68481595 19.32760098
+6.80645161 6.22580645 14.38806526 15.09217911 19.61310066
+6.80645161 6.51612903 15.45207816 15.66063766 19.84876184
+6.80645161 6.80645161 16.48822744 16.42159603 19.97852673
+6.80645161 7.09677419 17.11075039 17.00762602 20.00000000
+6.80645161 7.38709677 17.11075039 17.00762602 20.00000000
+6.80645161 7.67741935 17.11075039 17.00762602 20.00000000
+6.80645161 7.96774194 17.11075039 17.00762602 20.00000000
+6.80645161 8.25806452 17.11075039 17.00762602 20.00000000
+6.80645161 8.54838710 17.11075039 17.00762602 20.00000000
+6.80645161 8.83870968 17.11075039 17.00762602 20.00000000
+6.80645161 9.12903226 17.11075039 17.00762602 20.00000000
+6.80645161 9.41935484 17.11075039 17.00762602 20.00000000
+6.80645161 9.70967742 17.11075039 17.00762602 20.00000000
+6.80645161 10.00000000 17.11075039 17.00762602 20.00000000
+7.09677419 1.00000000 10.00000000 13.75000000 18.75000000
+7.09677419 1.29032258 10.00000000 13.75000000 18.75000000
+7.09677419 1.58064516 10.00000000 13.75000000 18.75000000
+7.09677419 1.87096774 10.00000000 13.75000000 18.75000000
+7.09677419 2.16129032 10.00000000 13.75000000 18.75000000
+7.09677419 2.45161290 10.00000000 13.75000000 18.75000000
+7.09677419 2.74193548 10.00000000 13.75000000 18.75000000
+7.09677419 3.03225806 10.01014215 13.74253652 18.73745586
+7.09677419 3.32258065 10.10759368 13.68455725 18.63042380
+7.09677419 3.61290323 10.21937858 13.64503060 18.53708695
+7.09677419 3.90322581 10.35276814 13.62755769 18.46331909
+7.09677419 4.19354839 10.51962543 13.63742744 18.41759948
+7.09677419 4.48387097 10.73840842 13.68281858 18.41253579
+7.09677419 4.77419355 11.03721734 13.77727807 18.46758374
+7.09677419 5.06451613 11.45766304 13.94303282 18.61200965
+7.09677419 5.35483871 12.03283452 14.16229115 18.82112467
+7.09677419 5.64516129 12.78467382 14.43913152 19.07300014
+7.09677419 5.93548387 13.71462338 14.81596996 19.35739569
+7.09677419 6.22580645 14.77874402 15.35015506 19.64585006
+7.09677419 6.51612903 15.88319867 16.07541438 19.87869941
+7.09677419 6.80645161 16.90953845 16.93241475 19.98661180
+7.09677419 7.09677419 17.50000000 17.50000000 20.00000000
+7.09677419 7.38709677 17.50000000 17.50000000 20.00000000
+7.09677419 7.67741935 17.50000000 17.50000000 20.00000000
+7.09677419 7.96774194 17.50000000 17.50000000 20.00000000
+7.09677419 8.25806452 17.50000000 17.50000000 20.00000000
+7.09677419 8.54838710 17.50000000 17.50000000 20.00000000
+7.09677419 8.83870968 17.50000000 17.50000000 20.00000000
+7.09677419 9.12903226 17.50000000 17.50000000 20.00000000
+7.09677419 9.41935484 17.50000000 17.50000000 20.00000000
+7.09677419 9.70967742 17.50000000 17.50000000 20.00000000
+7.09677419 10.00000000 17.50000000 17.50000000 20.00000000
+7.38709677 1.00000000 10.00000000 13.75000000 18.75000000
+7.38709677 1.29032258 10.00000000 13.75000000 18.75000000
+7.38709677 1.58064516 10.00000000 13.75000000 18.75000000
+7.38709677 1.87096774 10.00000000 13.75000000 18.75000000
+7.38709677 2.16129032 10.00000000 13.75000000 18.75000000
+7.38709677 2.45161290 10.00000000 13.75000000 18.75000000
+7.38709677 2.74193548 10.00000000 13.75000000 18.75000000
+7.38709677 3.03225806 10.01014215 13.74253652 18.73745586
+7.38709677 3.32258065 10.10759368 13.68455725 18.63042380
+7.38709677 3.61290323 10.21937858 13.64503060 18.53708695
+7.38709677 3.90322581 10.35276814 13.62755769 18.46331909
+7.38709677 4.19354839 10.51962543 13.63742744 18.41759948
+7.38709677 4.48387097 10.73840842 13.68281858 18.41253579
+7.38709677 4.77419355 11.03721734 13.77727807 18.46758374
+7.38709677 5.06451613 11.45766304 13.94303282 18.61200965
+7.38709677 5.35483871 12.03283452 14.16229115 18.82112467
+7.38709677 5.64516129 12.78467382 14.43913152 19.07300014
+7.38709677 5.93548387 13.71462338 14.81596996 19.35739569
+7.38709677 6.22580645 14.77874402 15.35015506 19.64585006
+7.38709677 6.51612903 15.88319867 16.07541438 19.87869941
+7.38709677 6.80645161 16.90953845 16.93241475 19.98661180
+7.38709677 7.09677419 17.50000000 17.50000000 20.00000000
+7.38709677 7.38709677 17.50000000 17.50000000 20.00000000
+7.38709677 7.67741935 17.50000000 17.50000000 20.00000000
+7.38709677 7.96774194 17.50000000 17.50000000 20.00000000
+7.38709677 8.25806452 17.50000000 17.50000000 20.00000000
+7.38709677 8.54838710 17.50000000 17.50000000 20.00000000
+7.38709677 8.83870968 17.50000000 17.50000000 20.00000000
+7.38709677 9.12903226 17.50000000 17.50000000 20.00000000
+7.38709677 9.41935484 17.50000000 17.50000000 20.00000000
+7.38709677 9.70967742 17.50000000 17.50000000 20.00000000
+7.38709677 10.00000000 17.50000000 17.50000000 20.00000000
+7.67741935 1.00000000 10.00000000 13.75000000 18.75000000
+7.67741935 1.29032258 10.00000000 13.75000000 18.75000000
+7.67741935 1.58064516 10.00000000 13.75000000 18.75000000
+7.67741935 1.87096774 10.00000000 13.75000000 18.75000000
+7.67741935 2.16129032 10.00000000 13.75000000 18.75000000
+7.67741935 2.45161290 10.00000000 13.75000000 18.75000000
+7.67741935 2.74193548 10.00000000 13.75000000 18.75000000
+7.67741935 3.03225806 10.01014215 13.74253652 18.73745586
+7.67741935 3.32258065 10.10759368 13.68455725 18.63042380
+7.67741935 3.61290323 10.21937858 13.64503060 18.53708695
+7.67741935 3.90322581 10.35276814 13.62755769 18.46331909
+7.67741935 4.19354839 10.51962543 13.63742744 18.41759948
+7.67741935 4.48387097 10.73840842 13.68281858 18.41253579
+7.67741935 4.77419355 11.03721734 13.77727807 18.46758374
+7.67741935 5.06451613 11.45766304 13.94303282 18.61200965
+7.67741935 5.35483871 12.03283452 14.16229115 18.82112467
+7.67741935 5.64516129 12.78467382 14.43913152 19.07300014
+7.67741935 5.93548387 13.71462338 14.81596996 19.35739569
+7.67741935 6.22580645 14.77874402 15.35015506 19.64585006
+7.67741935 6.51612903 15.88319867 16.07541438 19.87869941
+7.67741935 6.80645161 16.90953845 16.93241475 19.98661180
+7.67741935 7.09677419 17.50000000 17.50000000 20.00000000
+7.67741935 7.38709677 17.50000000 17.50000000 20.00000000
+7.67741935 7.67741935 17.50000000 17.50000000 20.00000000
+7.67741935 7.96774194 17.50000000 17.50000000 20.00000000
+7.67741935 8.25806452 17.50000000 17.50000000 20.00000000
+7.67741935 8.54838710 17.50000000 17.50000000 20.00000000
+7.67741935 8.83870968 17.50000000 17.50000000 20.00000000
+7.67741935 9.12903226 17.50000000 17.50000000 20.00000000
+7.67741935 9.41935484 17.50000000 17.50000000 20.00000000
+7.67741935 9.70967742 17.50000000 17.50000000 20.00000000
+7.67741935 10.00000000 17.50000000 17.50000000 20.00000000
+7.96774194 1.00000000 10.00000000 13.75000000 18.75000000
+7.96774194 1.29032258 10.00000000 13.75000000 18.75000000
+7.96774194 1.58064516 10.00000000 13.75000000 18.75000000
+7.96774194 1.87096774 10.00000000 13.75000000 18.75000000
+7.96774194 2.16129032 10.00000000 13.75000000 18.75000000
+7.96774194 2.45161290 10.00000000 13.75000000 18.75000000
+7.96774194 2.74193548 10.00000000 13.75000000 18.75000000
+7.96774194 3.03225806 10.01014215 13.74253652 18.73745586
+7.96774194 3.32258065 10.10759368 13.68455725 18.63042380
+7.96774194 3.61290323 10.21937858 13.64503060 18.53708695
+7.96774194 3.90322581 10.35276814 13.62755769 18.46331909
+7.96774194 4.19354839 10.51962543 13.63742744 18.41759948
+7.96774194 4.48387097 10.73840842 13.68281858 18.41253579
+7.96774194 4.77419355 11.03721734 13.77727807 18.46758374
+7.96774194 5.06451613 11.45766304 13.94303282 18.61200965
+7.96774194 5.35483871 12.03283452 14.16229115 18.82112467
+7.96774194 5.64516129 12.78467382 14.43913152 19.07300014
+7.96774194 5.93548387 13.71462338 14.81596996 19.35739569
+7.96774194 6.22580645 14.77874402 15.35015506 19.64585006
+7.96774194 6.51612903 15.88319867 16.07541438 19.87869941
+7.96774194 6.80645161 16.90953845 16.93241475 19.98661180
+7.96774194 7.09677419 17.50000000 17.50000000 20.00000000
+7.96774194 7.38709677 17.50000000 17.50000000 20.00000000
+7.96774194 7.67741935 17.50000000 17.50000000 20.00000000
+7.96774194 7.96774194 17.50000000 17.50000000 20.00000000
+7.96774194 8.25806452 17.50000000 17.50000000 20.00000000
+7.96774194 8.54838710 17.50000000 17.50000000 20.00000000
+7.96774194 8.83870968 17.50000000 17.50000000 20.00000000
+7.96774194 9.12903226 17.50000000 17.50000000 20.00000000
+7.96774194 9.41935484 17.50000000 17.50000000 20.00000000
+7.96774194 9.70967742 17.50000000 17.50000000 20.00000000
+7.96774194 10.00000000 17.50000000 17.50000000 20.00000000
+8.25806452 1.00000000 10.00000000 13.75000000 18.75000000
+8.25806452 1.29032258 10.00000000 13.75000000 18.75000000
+8.25806452 1.58064516 10.00000000 13.75000000 18.75000000
+8.25806452 1.87096774 10.00000000 13.75000000 18.75000000
+8.25806452 2.16129032 10.00000000 13.75000000 18.75000000
+8.25806452 2.45161290 10.00000000 13.75000000 18.75000000
+8.25806452 2.74193548 10.00000000 13.75000000 18.75000000
+8.25806452 3.03225806 10.01014215 13.74253652 18.73745586
+8.25806452 3.32258065 10.10759368 13.68455725 18.63042380
+8.25806452 3.61290323 10.21937858 13.64503060 18.53708695
+8.25806452 3.90322581 10.35276814 13.62755769 18.46331909
+8.25806452 4.19354839 10.51962543 13.63742744 18.41759948
+8.25806452 4.48387097 10.73840842 13.68281858 18.41253579
+8.25806452 4.77419355 11.03721734 13.77727807 18.46758374
+8.25806452 5.06451613 11.45766304 13.94303282 18.61200965
+8.25806452 5.35483871 12.03283452 14.16229115 18.82112467
+8.25806452 5.64516129 12.78467382 14.43913152 19.07300014
+8.25806452 5.93548387 13.71462338 14.81596996 19.35739569
+8.25806452 6.22580645 14.77874402 15.35015506 19.64585006
+8.25806452 6.51612903 15.88319867 16.07541438 19.87869941
+8.25806452 6.80645161 16.90953845 16.93241475 19.98661180
+8.25806452 7.09677419 17.50000000 17.50000000 20.00000000
+8.25806452 7.38709677 17.50000000 17.50000000 20.00000000
+8.25806452 7.67741935 17.50000000 17.50000000 20.00000000
+8.25806452 7.96774194 17.50000000 17.50000000 20.00000000
+8.25806452 8.25806452 17.50000000 17.50000000 20.00000000
+8.25806452 8.54838710 17.50000000 17.50000000 20.00000000
+8.25806452 8.83870968 17.50000000 17.50000000 20.00000000
+8.25806452 9.12903226 17.50000000 17.50000000 20.00000000
+8.25806452 9.41935484 17.50000000 17.50000000 20.00000000
+8.25806452 9.70967742 17.50000000 17.50000000 20.00000000
+8.25806452 10.00000000 17.50000000 17.50000000 20.00000000
+8.54838710 1.00000000 10.00000000 13.75000000 18.75000000
+8.54838710 1.29032258 10.00000000 13.75000000 18.75000000
+8.54838710 1.58064516 10.00000000 13.75000000 18.75000000
+8.54838710 1.87096774 10.00000000 13.75000000 18.75000000
+8.54838710 2.16129032 10.00000000 13.75000000 18.75000000
+8.54838710 2.45161290 10.00000000 13.75000000 18.75000000
+8.54838710 2.74193548 10.00000000 13.75000000 18.75000000
+8.54838710 3.03225806 10.01014215 13.74253652 18.73745586
+8.54838710 3.32258065 10.10759368 13.68455725 18.63042380
+8.54838710 3.61290323 10.21937858 13.64503060 18.53708695
+8.54838710 3.90322581 10.35276814 13.62755769 18.46331909
+8.54838710 4.19354839 10.51962543 13.63742744 18.41759948
+8.54838710 4.48387097 10.73840842 13.68281858 18.41253579
+8.54838710 4.77419355 11.03721734 13.77727807 18.46758374
+8.54838710 5.06451613 11.45766304 13.94303282 18.61200965
+8.54838710 5.35483871 12.03283452 14.16229115 18.82112467
+8.54838710 5.64516129 12.78467382 14.43913152 19.07300014
+8.54838710 5.93548387 13.71462338 14.81596996 19.35739569
+8.54838710 6.22580645 14.77874402 15.35015506 19.64585006
+8.54838710 6.51612903 15.88319867 16.07541438 19.87869941
+8.54838710 6.80645161 16.90953845 16.93241475 19.98661180
+8.54838710 7.09677419 17.50000000 17.50000000 20.00000000
+8.54838710 7.38709677 17.50000000 17.50000000 20.00000000
+8.54838710 7.67741935 17.50000000 17.50000000 20.00000000
+8.54838710 7.96774194 17.50000000 17.50000000 20.00000000
+8.54838710 8.25806452 17.50000000 17.50000000 20.00000000
+8.54838710 8.54838710 17.50000000 17.50000000 20.00000000
+8.54838710 8.83870968 17.50000000 17.50000000 20.00000000
+8.54838710 9.12903226 17.50000000 17.50000000 20.00000000
+8.54838710 9.41935484 17.50000000 17.50000000 20.00000000
+8.54838710 9.70967742 17.50000000 17.50000000 20.00000000
+8.54838710 10.00000000 17.50000000 17.50000000 20.00000000
+8.83870968 1.00000000 10.00000000 13.75000000 18.75000000
+8.83870968 1.29032258 10.00000000 13.75000000 18.75000000
+8.83870968 1.58064516 10.00000000 13.75000000 18.75000000
+8.83870968 1.87096774 10.00000000 13.75000000 18.75000000
+8.83870968 2.16129032 10.00000000 13.75000000 18.75000000
+8.83870968 2.45161290 10.00000000 13.75000000 18.75000000
+8.83870968 2.74193548 10.00000000 13.75000000 18.75000000
+8.83870968 3.03225806 10.01014215 13.74253652 18.73745586
+8.83870968 3.32258065 10.10759368 13.68455725 18.63042380
+8.83870968 3.61290323 10.21937858 13.64503060 18.53708695
+8.83870968 3.90322581 10.35276814 13.62755769 18.46331909
+8.83870968 4.19354839 10.51962543 13.63742744 18.41759948
+8.83870968 4.48387097 10.73840842 13.68281858 18.41253579
+8.83870968 4.77419355 11.03721734 13.77727807 18.46758374
+8.83870968 5.06451613 11.45766304 13.94303282 18.61200965
+8.83870968 5.35483871 12.03283452 14.16229115 18.82112467
+8.83870968 5.64516129 12.78467382 14.43913152 19.07300014
+8.83870968 5.93548387 13.71462338 14.81596996 19.35739569
+8.83870968 6.22580645 14.77874402 15.35015506 19.64585006
+8.83870968 6.51612903 15.88319867 16.07541438 19.87869941
+8.83870968 6.80645161 16.90953845 16.93241475 19.98661180
+8.83870968 7.09677419 17.50000000 17.50000000 20.00000000
+8.83870968 7.38709677 17.50000000 17.50000000 20.00000000
+8.83870968 7.67741935 17.50000000 17.50000000 20.00000000
+8.83870968 7.96774194 17.50000000 17.50000000 20.00000000
+8.83870968 8.25806452 17.50000000 17.50000000 20.00000000
+8.83870968 8.54838710 17.50000000 17.50000000 20.00000000
+8.83870968 8.83870968 17.50000000 17.50000000 20.00000000
+8.83870968 9.12903226 17.50000000 17.50000000 20.00000000
+8.83870968 9.41935484 17.50000000 17.50000000 20.00000000
+8.83870968 9.70967742 17.50000000 17.50000000 20.00000000
+8.83870968 10.00000000 17.50000000 17.50000000 20.00000000
+9.12903226 1.00000000 10.00000000 13.75000000 18.75000000
+9.12903226 1.29032258 10.00000000 13.75000000 18.75000000
+9.12903226 1.58064516 10.00000000 13.75000000 18.75000000
+9.12903226 1.87096774 10.00000000 13.75000000 18.75000000
+9.12903226 2.16129032 10.00000000 13.75000000 18.75000000
+9.12903226 2.45161290 10.00000000 13.75000000 18.75000000
+9.12903226 2.74193548 10.00000000 13.75000000 18.75000000
+9.12903226 3.03225806 10.01014215 13.74253652 18.73745586
+9.12903226 3.32258065 10.10759368 13.68455725 18.63042380
+9.12903226 3.61290323 10.21937858 13.64503060 18.53708695
+9.12903226 3.90322581 10.35276814 13.62755769 18.46331909
+9.12903226 4.19354839 10.51962543 13.63742744 18.41759948
+9.12903226 4.48387097 10.73840842 13.68281858 18.41253579
+9.12903226 4.77419355 11.03721734 13.77727807 18.46758374
+9.12903226 5.06451613 11.45766304 13.94303282 18.61200965
+9.12903226 5.35483871 12.03283452 14.16229115 18.82112467
+9.12903226 5.64516129 12.78467382 14.43913152 19.07300014
+9.12903226 5.93548387 13.71462338 14.81596996 19.35739569
+9.12903226 6.22580645 14.77874402 15.35015506 19.64585006
+9.12903226 6.51612903 15.88319867 16.07541438 19.87869941
+9.12903226 6.80645161 16.90953845 16.93241475 19.98661180
+9.12903226 7.09677419 17.50000000 17.50000000 20.00000000
+9.12903226 7.38709677 17.50000000 17.50000000 20.00000000
+9.12903226 7.67741935 17.50000000 17.50000000 20.00000000
+9.12903226 7.96774194 17.50000000 17.50000000 20.00000000
+9.12903226 8.25806452 17.50000000 17.50000000 20.00000000
+9.12903226 8.54838710 17.50000000 17.50000000 20.00000000
+9.12903226 8.83870968 17.50000000 17.50000000 20.00000000
+9.12903226 9.12903226 17.50000000 17.50000000 20.00000000
+9.12903226 9.41935484 17.50000000 17.50000000 20.00000000
+9.12903226 9.70967742 17.50000000 17.50000000 20.00000000
+9.12903226 10.00000000 17.50000000 17.50000000 20.00000000
+9.41935484 1.00000000 10.00000000 13.75000000 18.75000000
+9.41935484 1.29032258 10.00000000 13.75000000 18.75000000
+9.41935484 1.58064516 10.00000000 13.75000000 18.75000000
+9.41935484 1.87096774 10.00000000 13.75000000 18.75000000
+9.41935484 2.16129032 10.00000000 13.75000000 18.75000000
+9.41935484 2.45161290 10.00000000 13.75000000 18.75000000
+9.41935484 2.74193548 10.00000000 13.75000000 18.75000000
+9.41935484 3.03225806 10.01014215 13.74253652 18.73745586
+9.41935484 3.32258065 10.10759368 13.68455725 18.63042380
+9.41935484 3.61290323 10.21937858 13.64503060 18.53708695
+9.41935484 3.90322581 10.35276814 13.62755769 18.46331909
+9.41935484 4.19354839 10.51962543 13.63742744 18.41759948
+9.41935484 4.48387097 10.73840842 13.68281858 18.41253579
+9.41935484 4.77419355 11.03721734 13.77727807 18.46758374
+9.41935484 5.06451613 11.45766304 13.94303282 18.61200965
+9.41935484 5.35483871 12.03283452 14.16229115 18.82112467
+9.41935484 5.64516129 12.78467382 14.43913152 19.07300014
+9.41935484 5.93548387 13.71462338 14.81596996 19.35739569
+9.41935484 6.22580645 14.77874402 15.35015506 19.64585006
+9.41935484 6.51612903 15.88319867 16.07541438 19.87869941
+9.41935484 6.80645161 16.90953845 16.93241475 19.98661180
+9.41935484 7.09677419 17.50000000 17.50000000 20.00000000
+9.41935484 7.38709677 17.50000000 17.50000000 20.00000000
+9.41935484 7.67741935 17.50000000 17.50000000 20.00000000
+9.41935484 7.96774194 17.50000000 17.50000000 20.00000000
+9.41935484 8.25806452 17.50000000 17.50000000 20.00000000
+9.41935484 8.54838710 17.50000000 17.50000000 20.00000000
+9.41935484 8.83870968 17.50000000 17.50000000 20.00000000
+9.41935484 9.12903226 17.50000000 17.50000000 20.00000000
+9.41935484 9.41935484 17.50000000 17.50000000 20.00000000
+9.41935484 9.70967742 17.50000000 17.50000000 20.00000000
+9.41935484 10.00000000 17.50000000 17.50000000 20.00000000
+9.70967742 1.00000000 10.00000000 13.75000000 18.75000000
+9.70967742 1.29032258 10.00000000 13.75000000 18.75000000
+9.70967742 1.58064516 10.00000000 13.75000000 18.75000000
+9.70967742 1.87096774 10.00000000 13.75000000 18.75000000
+9.70967742 2.16129032 10.00000000 13.75000000 18.75000000
+9.70967742 2.45161290 10.00000000 13.75000000 18.75000000
+9.70967742 2.74193548 10.00000000 13.75000000 18.75000000
+9.70967742 3.03225806 10.01014215 13.74253652 18.73745586
+9.70967742 3.32258065 10.10759368 13.68455725 18.63042380
+9.70967742 3.61290323 10.21937858 13.64503060 18.53708695
+9.70967742 3.90322581 10.35276814 13.62755769 18.46331909
+9.70967742 4.19354839 10.51962543 13.63742744 18.41759948
+9.70967742 4.48387097 10.73840842 13.68281858 18.41253579
+9.70967742 4.77419355 11.03721734 13.77727807 18.46758374
+9.70967742 5.06451613 11.45766304 13.94303282 18.61200965
+9.70967742 5.35483871 12.03283452 14.16229115 18.82112467
+9.70967742 5.64516129 12.78467382 14.43913152 19.07300014
+9.70967742 5.93548387 13.71462338 14.81596996 19.35739569
+9.70967742 6.22580645 14.77874402 15.35015506 19.64585006
+9.70967742 6.51612903 15.88319867 16.07541438 19.87869941
+9.70967742 6.80645161 16.90953845 16.93241475 19.98661180
+9.70967742 7.09677419 17.50000000 17.50000000 20.00000000
+9.70967742 7.38709677 17.50000000 17.50000000 20.00000000
+9.70967742 7.67741935 17.50000000 17.50000000 20.00000000
+9.70967742 7.96774194 17.50000000 17.50000000 20.00000000
+9.70967742 8.25806452 17.50000000 17.50000000 20.00000000
+9.70967742 8.54838710 17.50000000 17.50000000 20.00000000
+9.70967742 8.83870968 17.50000000 17.50000000 20.00000000
+9.70967742 9.12903226 17.50000000 17.50000000 20.00000000
+9.70967742 9.41935484 17.50000000 17.50000000 20.00000000
+9.70967742 9.70967742 17.50000000 17.50000000 20.00000000
+9.70967742 10.00000000 17.50000000 17.50000000 20.00000000
+10.00000000 1.00000000 10.00000000 13.75000000 18.75000000
+10.00000000 1.29032258 10.00000000 13.75000000 18.75000000
+10.00000000 1.58064516 10.00000000 13.75000000 18.75000000
+10.00000000 1.87096774 10.00000000 13.75000000 18.75000000
+10.00000000 2.16129032 10.00000000 13.75000000 18.75000000
+10.00000000 2.45161290 10.00000000 13.75000000 18.75000000
+10.00000000 2.74193548 10.00000000 13.75000000 18.75000000
+10.00000000 3.03225806 10.01014215 13.74253652 18.73745586
+10.00000000 3.32258065 10.10759368 13.68455725 18.63042380
+10.00000000 3.61290323 10.21937858 13.64503060 18.53708695
+10.00000000 3.90322581 10.35276814 13.62755769 18.46331909
+10.00000000 4.19354839 10.51962543 13.63742744 18.41759948
+10.00000000 4.48387097 10.73840842 13.68281858 18.41253579
+10.00000000 4.77419355 11.03721734 13.77727807 18.46758374
+10.00000000 5.06451613 11.45766304 13.94303282 18.61200965
+10.00000000 5.35483871 12.03283452 14.16229115 18.82112467
+10.00000000 5.64516129 12.78467382 14.43913152 19.07300014
+10.00000000 5.93548387 13.71462338 14.81596996 19.35739569
+10.00000000 6.22580645 14.77874402 15.35015506 19.64585006
+10.00000000 6.51612903 15.88319867 16.07541438 19.87869941
+10.00000000 6.80645161 16.90953845 16.93241475 19.98661180
+10.00000000 7.09677419 17.50000000 17.50000000 20.00000000
+10.00000000 7.38709677 17.50000000 17.50000000 20.00000000
+10.00000000 7.67741935 17.50000000 17.50000000 20.00000000
+10.00000000 7.96774194 17.50000000 17.50000000 20.00000000
+10.00000000 8.25806452 17.50000000 17.50000000 20.00000000
+10.00000000 8.54838710 17.50000000 17.50000000 20.00000000
+10.00000000 8.83870968 17.50000000 17.50000000 20.00000000
+10.00000000 9.12903226 17.50000000 17.50000000 20.00000000
+10.00000000 9.41935484 17.50000000 17.50000000 20.00000000
+10.00000000 9.70967742 17.50000000 17.50000000 20.00000000
+10.00000000 10.00000000 17.50000000 17.50000000 20.00000000
diff --git a/examples/takagi-sugeno/octave/sugeno_tip_calculator.fll b/examples/takagi-sugeno/octave/sugeno_tip_calculator.fll
new file mode 100644
index 0000000..611d6eb
--- /dev/null
+++ b/examples/takagi-sugeno/octave/sugeno_tip_calculator.fll
@@ -0,0 +1,59 @@
+Engine: Sugeno-Tip-Calculator
+InputVariable: FoodQuality
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+InputVariable: Service
+ enabled: true
+ range: 1.000 10.000
+ term: Bad Trapezoid 0.000 1.000 3.000 7.000
+ term: Good Trapezoid 3.000 7.000 10.000 11.000
+OutputVariable: CheapTip
+ enabled: true
+ range: 5.000 25.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: Low Constant 10.000
+ term: Medium Constant 15.000
+ term: High Constant 20.000
+OutputVariable: AverageTip
+ enabled: true
+ range: 5.000 25.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: Low Constant 10.000
+ term: Medium Constant 15.000
+ term: High Constant 20.000
+OutputVariable: GenerousTip
+ enabled: true
+ range: 5.000 25.000
+ accumulation: none
+ defuzzifier: WeightedAverage TakagiSugeno
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: Low Constant 10.000
+ term: Medium Constant 15.000
+ term: High Constant 20.000
+RuleBlock:
+ enabled: true
+ conjunction: EinsteinProduct
+ disjunction: none
+ activation: none
+ rule: if FoodQuality is extremely Bad and Service is extremely Bad then CheapTip is extremely Low and AverageTip is very Low and GenerousTip is Low
+ rule: if FoodQuality is Good and Service is extremely Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium
+ rule: if FoodQuality is very Good and Service is very Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ rule: if FoodQuality is Bad and Service is Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium
+ rule: if FoodQuality is Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ rule: if FoodQuality is extremely Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is very High
+ rule: if FoodQuality is Bad and Service is Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ rule: if FoodQuality is Good and Service is Good then CheapTip is Medium and AverageTip is Medium and GenerousTip is very High
+ rule: if FoodQuality is very Bad and Service is very Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High
+ rule: if FoodQuality is very very Good and Service is very very Good then CheapTip is High and AverageTip is very High and GenerousTip is extremely High \ No newline at end of file
diff --git a/examples/takagi-sugeno/octave/sugeno_tip_calculator.java b/examples/takagi-sugeno/octave/sugeno_tip_calculator.java
new file mode 100644
index 0000000..939649e
--- /dev/null
+++ b/examples/takagi-sugeno/octave/sugeno_tip_calculator.java
@@ -0,0 +1,96 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class sugeno_tip_calculator{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("Sugeno-Tip-Calculator");
+
+InputVariable inputVariable1 = new InputVariable();
+inputVariable1.setEnabled(true);
+inputVariable1.setName("FoodQuality");
+inputVariable1.setRange(1.000, 10.000);
+inputVariable1.addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable1.addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine.addInputVariable(inputVariable1);
+
+InputVariable inputVariable2 = new InputVariable();
+inputVariable2.setEnabled(true);
+inputVariable2.setName("Service");
+inputVariable2.setRange(1.000, 10.000);
+inputVariable2.addTerm(new Trapezoid("Bad", 0.000, 1.000, 3.000, 7.000));
+inputVariable2.addTerm(new Trapezoid("Good", 3.000, 7.000, 10.000, 11.000));
+engine.addInputVariable(inputVariable2);
+
+OutputVariable outputVariable1 = new OutputVariable();
+outputVariable1.setEnabled(true);
+outputVariable1.setName("CheapTip");
+outputVariable1.setRange(5.000, 25.000);
+outputVariable1.fuzzyOutput().setAccumulation(null);
+outputVariable1.setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable1.setDefaultValue(Double.NaN);
+outputVariable1.setLockPreviousOutputValue(false);
+outputVariable1.setLockOutputValueInRange(false);
+outputVariable1.addTerm(new Constant("Low", 10.000));
+outputVariable1.addTerm(new Constant("Medium", 15.000));
+outputVariable1.addTerm(new Constant("High", 20.000));
+engine.addOutputVariable(outputVariable1);
+
+OutputVariable outputVariable2 = new OutputVariable();
+outputVariable2.setEnabled(true);
+outputVariable2.setName("AverageTip");
+outputVariable2.setRange(5.000, 25.000);
+outputVariable2.fuzzyOutput().setAccumulation(null);
+outputVariable2.setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable2.setDefaultValue(Double.NaN);
+outputVariable2.setLockPreviousOutputValue(false);
+outputVariable2.setLockOutputValueInRange(false);
+outputVariable2.addTerm(new Constant("Low", 10.000));
+outputVariable2.addTerm(new Constant("Medium", 15.000));
+outputVariable2.addTerm(new Constant("High", 20.000));
+engine.addOutputVariable(outputVariable2);
+
+OutputVariable outputVariable3 = new OutputVariable();
+outputVariable3.setEnabled(true);
+outputVariable3.setName("GenerousTip");
+outputVariable3.setRange(5.000, 25.000);
+outputVariable3.fuzzyOutput().setAccumulation(null);
+outputVariable3.setDefuzzifier(new WeightedAverage("TakagiSugeno"));
+outputVariable3.setDefaultValue(Double.NaN);
+outputVariable3.setLockPreviousOutputValue(false);
+outputVariable3.setLockOutputValueInRange(false);
+outputVariable3.addTerm(new Constant("Low", 10.000));
+outputVariable3.addTerm(new Constant("Medium", 15.000));
+outputVariable3.addTerm(new Constant("High", 20.000));
+engine.addOutputVariable(outputVariable3);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(new EinsteinProduct());
+ruleBlock.setDisjunction(null);
+ruleBlock.setActivation(null);
+ruleBlock.addRule(Rule.parse("if FoodQuality is extremely Bad and Service is extremely Bad then CheapTip is extremely Low and AverageTip is very Low and GenerousTip is Low", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Good and Service is extremely Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is very Good and Service is very Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Bad and Service is Bad then CheapTip is Low and AverageTip is Low and GenerousTip is Medium", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is High", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is extremely Good and Service is Bad then CheapTip is Low and AverageTip is Medium and GenerousTip is very High", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Bad and Service is Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is Good and Service is Good then CheapTip is Medium and AverageTip is Medium and GenerousTip is very High", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is very Bad and Service is very Good then CheapTip is Low and AverageTip is Medium and GenerousTip is High", engine));
+ruleBlock.addRule(Rule.parse("if FoodQuality is very very Good and Service is very very Good then CheapTip is High and AverageTip is very High and GenerousTip is extremely High", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/examples/tsukamoto/tsukamoto.cpp b/examples/tsukamoto/tsukamoto.cpp
new file mode 100644
index 0000000..4432936
--- /dev/null
+++ b/examples/tsukamoto/tsukamoto.cpp
@@ -0,0 +1,86 @@
+#include <fl/Headers.h>
+
+int main(int argc, char** argv){
+using namespace fl;
+
+Engine* engine = new Engine;
+engine->setName("");
+
+InputVariable* inputVariable = new InputVariable;
+inputVariable->setEnabled(true);
+inputVariable->setName("X");
+inputVariable->setRange(-10.000, 10.000);
+inputVariable->addTerm(new Bell("small", -10.000, 5.000, 3.000));
+inputVariable->addTerm(new Bell("medium", 0.000, 5.000, 3.000));
+inputVariable->addTerm(new Bell("large", 10.000, 5.000, 3.000));
+engine->addInputVariable(inputVariable);
+
+OutputVariable* outputVariable1 = new OutputVariable;
+outputVariable1->setEnabled(true);
+outputVariable1->setName("Ramps");
+outputVariable1->setRange(0.000, 1.000);
+outputVariable1->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable1->setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable1->setDefaultValue(fl::nan);
+outputVariable1->setLockPreviousOutputValue(false);
+outputVariable1->setLockOutputValueInRange(false);
+outputVariable1->addTerm(new Ramp("b", 0.600, 0.400));
+outputVariable1->addTerm(new Ramp("a", 0.000, 0.250));
+outputVariable1->addTerm(new Ramp("c", 0.700, 1.000));
+engine->addOutputVariable(outputVariable1);
+
+OutputVariable* outputVariable2 = new OutputVariable;
+outputVariable2->setEnabled(true);
+outputVariable2->setName("Sigmoids");
+outputVariable2->setRange(0.020, 1.000);
+outputVariable2->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable2->setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable2->setDefaultValue(fl::nan);
+outputVariable2->setLockPreviousOutputValue(false);
+outputVariable2->setLockOutputValueInRange(false);
+outputVariable2->addTerm(new Sigmoid("b", 0.500, -30.000));
+outputVariable2->addTerm(new Sigmoid("a", 0.130, 30.000));
+outputVariable2->addTerm(new Sigmoid("c", 0.830, 30.000));
+engine->addOutputVariable(outputVariable2);
+
+OutputVariable* outputVariable3 = new OutputVariable;
+outputVariable3->setEnabled(true);
+outputVariable3->setName("ZSShapes");
+outputVariable3->setRange(0.000, 1.000);
+outputVariable3->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable3->setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable3->setDefaultValue(fl::nan);
+outputVariable3->setLockPreviousOutputValue(false);
+outputVariable3->setLockOutputValueInRange(false);
+outputVariable3->addTerm(new ZShape("b", 0.300, 0.600));
+outputVariable3->addTerm(new SShape("a", 0.000, 0.250));
+outputVariable3->addTerm(new SShape("c", 0.700, 1.000));
+engine->addOutputVariable(outputVariable3);
+
+OutputVariable* outputVariable4 = new OutputVariable;
+outputVariable4->setEnabled(true);
+outputVariable4->setName("Concaves");
+outputVariable4->setRange(0.000, 1.000);
+outputVariable4->fuzzyOutput()->setAccumulation(fl::null);
+outputVariable4->setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable4->setDefaultValue(fl::nan);
+outputVariable4->setLockPreviousOutputValue(false);
+outputVariable4->setLockOutputValueInRange(false);
+outputVariable4->addTerm(new Concave("b", 0.500, 0.400));
+outputVariable4->addTerm(new Concave("a", 0.240, 0.250));
+outputVariable4->addTerm(new Concave("c", 0.900, 1.000));
+engine->addOutputVariable(outputVariable4);
+
+RuleBlock* ruleBlock = new RuleBlock;
+ruleBlock->setEnabled(true);
+ruleBlock->setName("");
+ruleBlock->setConjunction(fl::null);
+ruleBlock->setDisjunction(fl::null);
+ruleBlock->setActivation(fl::null);
+ruleBlock->addRule(fl::Rule::parse("if X is small then Ramps is a and Sigmoids is a and ZSShapes is a and Concaves is a", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is medium then Ramps is b and Sigmoids is b and ZSShapes is b and Concaves is b", engine));
+ruleBlock->addRule(fl::Rule::parse("if X is large then Ramps is c and Sigmoids is c and ZSShapes is c and Concaves is c", engine));
+engine->addRuleBlock(ruleBlock);
+
+
+}
diff --git a/examples/tsukamoto/tsukamoto.fcl b/examples/tsukamoto/tsukamoto.fcl
new file mode 100644
index 0000000..16a4bbd
--- /dev/null
+++ b/examples/tsukamoto/tsukamoto.fcl
@@ -0,0 +1,63 @@
+FUNCTION_BLOCK
+
+VAR_INPUT
+ X: REAL;
+END_VAR
+
+VAR_OUTPUT
+ Ramps: REAL;
+ Sigmoids: REAL;
+ ZSShapes: REAL;
+ Concaves: REAL;
+END_VAR
+
+FUZZIFY X
+ RANGE := (-10.000 .. 10.000);
+ TERM small := Bell -10.000 5.000 3.000;
+ TERM medium := Bell 0.000 5.000 3.000;
+ TERM large := Bell 10.000 5.000 3.000;
+END_FUZZIFY
+
+DEFUZZIFY Ramps
+ RANGE := (0.000 .. 1.000);
+ TERM b := Ramp 0.600 0.400;
+ TERM a := Ramp 0.000 0.250;
+ TERM c := Ramp 0.700 1.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY Sigmoids
+ RANGE := (0.020 .. 1.000);
+ TERM b := Sigmoid 0.500 -30.000;
+ TERM a := Sigmoid 0.130 30.000;
+ TERM c := Sigmoid 0.830 30.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY ZSShapes
+ RANGE := (0.000 .. 1.000);
+ TERM b := ZShape 0.300 0.600;
+ TERM a := SShape 0.000 0.250;
+ TERM c := SShape 0.700 1.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+DEFUZZIFY Concaves
+ RANGE := (0.000 .. 1.000);
+ TERM b := Concave 0.500 0.400;
+ TERM a := Concave 0.240 0.250;
+ TERM c := Concave 0.900 1.000;
+ METHOD : COGS;
+ DEFAULT := nan;
+END_DEFUZZIFY
+
+RULEBLOCK
+ RULE 1 : if X is small then Ramps is a and Sigmoids is a and ZSShapes is a and Concaves is a
+ RULE 2 : if X is medium then Ramps is b and Sigmoids is b and ZSShapes is b and Concaves is b
+ RULE 3 : if X is large then Ramps is c and Sigmoids is c and ZSShapes is c and Concaves is c
+END_RULEBLOCK
+
+END_FUNCTION_BLOCK
diff --git a/examples/tsukamoto/tsukamoto.fis b/examples/tsukamoto/tsukamoto.fis
new file mode 100644
index 0000000..6dc1b4f
--- /dev/null
+++ b/examples/tsukamoto/tsukamoto.fis
@@ -0,0 +1,56 @@
+[System]
+Name=''
+Type='tsukamoto'
+NumInputs=1
+NumOutputs=4
+NumRules=3
+AndMethod=''
+OrMethod=''
+ImpMethod=''
+AggMethod=''
+DefuzzMethod='wtaver'
+
+[Input1]
+Name='X'
+Range=[-10.000 10.000]
+NumMFs=3
+MF1='small':'gbellmf',[5.000 3.000 -10.000]
+MF2='medium':'gbellmf',[5.000 3.000 0.000]
+MF3='large':'gbellmf',[5.000 3.000 10.000]
+
+[Output1]
+Name='Ramps'
+Range=[0.000 1.000]
+NumMFs=3
+MF1='b':'rampmf',[0.600 0.400]
+MF2='a':'rampmf',[0.000 0.250]
+MF3='c':'rampmf',[0.700 1.000]
+
+[Output2]
+Name='Sigmoids'
+Range=[0.020 1.000]
+NumMFs=3
+MF1='b':'sigmf',[-30.000 0.500]
+MF2='a':'sigmf',[30.000 0.130]
+MF3='c':'sigmf',[30.000 0.830]
+
+[Output3]
+Name='ZSShapes'
+Range=[0.000 1.000]
+NumMFs=3
+MF1='b':'zmf',[0.300 0.600]
+MF2='a':'smf',[0.000 0.250]
+MF3='c':'smf',[0.700 1.000]
+
+[Output4]
+Name='Concaves'
+Range=[0.000 1.000]
+NumMFs=3
+MF1='b':'concavemf',[0.500 0.400]
+MF2='a':'concavemf',[0.240 0.250]
+MF3='c':'concavemf',[0.900 1.000]
+
+[Rules]
+1.000 , 2.000 2.000 2.000 2.000 (1.000) : 1
+2.000 , 1.000 1.000 1.000 1.000 (1.000) : 1
+3.000 , 3.000 3.000 3.000 3.000 (1.000) : 1
diff --git a/examples/tsukamoto/tsukamoto.fld b/examples/tsukamoto/tsukamoto.fld
new file mode 100644
index 0000000..85e0cc3
--- /dev/null
+++ b/examples/tsukamoto/tsukamoto.fld
@@ -0,0 +1,1026 @@
+#@Engine: ;
+#@InputVariable: X; @OutputVariable: Ramps; @OutputVariable: Sigmoids; @OutputVariable: ZSShapes; @OutputVariable: Concaves;
+-10.00000000 0.25536331 0.99441852 0.25580927 0.25221216
+-9.98044966 0.25542354 0.99434929 0.25587749 0.25223783
+-9.96089932 0.25548454 0.99427909 0.25594671 0.25226383
+-9.94134897 0.25554631 0.99420791 0.25601699 0.25229018
+-9.92179863 0.25560889 0.99413572 0.25608842 0.25231688
+-9.90224829 0.25567226 0.99406252 0.25616107 0.25234393
+-9.88269795 0.25573645 0.99398828 0.25623502 0.25237134
+-9.86314761 0.25580146 0.99391299 0.25631034 0.25239911
+-9.84359726 0.25586731 0.99383664 0.25638712 0.25242725
+-9.82404692 0.25593401 0.99375920 0.25646543 0.25245576
+-9.80449658 0.25600158 0.99368066 0.25654534 0.25248466
+-9.78494624 0.25607001 0.99360101 0.25662695 0.25251393
+-9.76539589 0.25613933 0.99352023 0.25671031 0.25254360
+-9.74584555 0.25620954 0.99343829 0.25679552 0.25257366
+-9.72629521 0.25628067 0.99335519 0.25688266 0.25260413
+-9.70674487 0.25635271 0.99327090 0.25697179 0.25263500
+-9.68719453 0.25642570 0.99318540 0.25706301 0.25266629
+-9.66764418 0.25649962 0.99309868 0.25715639 0.25269800
+-9.64809384 0.25657451 0.99301071 0.25725200 0.25273013
+-9.62854350 0.25665038 0.99292148 0.25734994 0.25276269
+-9.60899316 0.25672722 0.99283097 0.25745027 0.25279570
+-9.58944282 0.25680507 0.99273915 0.25755308 0.25282915
+-9.56989247 0.25688393 0.99264601 0.25765846 0.25286305
+-9.55034213 0.25696382 0.99255153 0.25776647 0.25289740
+-9.53079179 0.25704474 0.99245567 0.25787721 0.25293223
+-9.51124145 0.25712672 0.99235844 0.25799075 0.25296752
+-9.49169110 0.25720976 0.58805202 0.25810718 0.25300329
+-9.47214076 0.25729388 0.58066402 0.25822657 0.25303955
+-9.45259042 0.25737909 0.57354840 0.25834901 0.25307630
+-9.43304008 0.25746541 0.56668617 0.25847459 0.25311356
+-9.41348974 0.25755285 0.56006026 0.25860337 0.25315132
+-9.39393939 0.25764143 0.55365530 0.25873546 0.25318959
+-9.37438905 0.25773114 0.54745738 0.25887092 0.25322839
+-9.35483871 0.25782202 0.54145387 0.25900985 0.25326772
+-9.33528837 0.25791407 0.53563327 0.25915232 0.25330758
+-9.31573803 0.25800731 0.52998510 0.25929843 0.25334800
+-9.29618768 0.25810174 0.52449975 0.25944825 0.25338896
+-9.27663734 0.25819739 0.51916841 0.25960187 0.25343050
+-9.25708700 0.25829425 0.51398297 0.25975938 0.25347260
+-9.23753666 0.25839236 0.50893596 0.25992086 0.25351528
+-9.21798631 0.25849171 0.50402049 0.26008639 0.25355855
+-9.19843597 0.25859233 0.49923015 0.26025607 0.25360242
+-9.17888563 0.25869422 0.49455902 0.26042997 0.25364689
+-9.15933529 0.25879739 0.49000161 0.26060819 0.25369198
+-9.13978495 0.25890186 0.48555278 0.26079081 0.25373769
+-9.12023460 0.25900763 0.48120775 0.26097791 0.25378404
+-9.10068426 0.25911473 0.47696208 0.26116960 0.25383103
+-9.08113392 0.25922315 0.47281158 0.26136594 0.25387867
+-9.06158358 0.25933291 0.46875235 0.26156704 0.25392698
+-9.04203324 0.25944402 0.46478074 0.26177298 0.25397596
+-9.02248289 0.25955649 0.46089330 0.26198385 0.25402563
+-9.00293255 0.25967032 0.45708680 0.26219974 0.25407598
+-8.98338221 0.25978553 0.45335820 0.26242074 0.25412704
+-8.96383187 0.25990212 0.44970464 0.26264693 0.25417882
+-8.94428152 0.26002010 0.44612342 0.26287842 0.25423132
+-8.92473118 0.26013948 0.44261197 0.26311528 0.25428456
+-8.90518084 0.26026027 0.43916789 0.26335761 0.25433855
+-8.88563050 0.26038246 0.43578890 0.26360551 0.25439330
+-8.86608016 0.26050607 0.43247284 0.26385906 0.25444882
+-8.84652981 0.26063110 0.42921765 0.26411836 0.25450512
+-8.82697947 0.26075756 0.42602140 0.26438350 0.25456221
+-8.80742913 0.26088545 0.42288224 0.26465457 0.25462012
+-8.78787879 0.26101476 0.41979841 0.26493167 0.25467884
+-8.76832845 0.26114551 0.41676826 0.26521489 0.25473840
+-8.74877810 0.26127769 0.41379019 0.26550432 0.25479880
+-8.72922776 0.26141131 0.41086270 0.26580007 0.25486006
+-8.70967742 0.26154637 0.40798435 0.26610222 0.25492219
+-8.69012708 0.26168285 0.40515377 0.26641087 0.25498521
+-8.67057674 0.26182077 0.40236964 0.26672612 0.25504913
+-8.65102639 0.26196012 0.39963073 0.26704806 0.25511396
+-8.63147605 0.26210090 0.39693583 0.26737680 0.25517972
+-8.61192571 0.26224309 0.39428381 0.26771243 0.25524642
+-8.59237537 0.26238670 0.39167359 0.26805504 0.25531408
+-8.57282502 0.26253172 0.38910410 0.26840474 0.25538271
+-8.55327468 0.26267815 0.38657437 0.26876163 0.25545233
+-8.53372434 0.26282596 0.38408343 0.26912580 0.25552295
+-8.51417400 0.26297516 0.38163037 0.26949735 0.25559459
+-8.49462366 0.26312573 0.37921432 0.26987640 0.25566727
+-8.47507331 0.26327766 0.37683443 0.27026303 0.25574100
+-8.45552297 0.26343094 0.37448990 0.27065735 0.25581580
+-8.43597263 0.26358556 0.37217995 0.27105946 0.25589168
+-8.41642229 0.26374149 0.36990385 0.27146946 0.25596867
+-8.39687195 0.26389873 0.36766087 0.27188746 0.25604678
+-8.37732160 0.26405725 0.36545035 0.27231356 0.25612603
+-8.35777126 0.26421704 0.36327163 0.27274787 0.25620644
+-8.33822092 0.26437808 0.36112406 0.27319049 0.25628802
+-8.31867058 0.26454034 0.35900705 0.27364153 0.25637081
+-8.29912023 0.26470380 0.35692002 0.27410108 0.25645480
+-8.27956989 0.26486844 0.35486241 0.27456927 0.25654004
+-8.26001955 0.26503424 0.35283367 0.27504619 0.25662653
+-8.24046921 0.26520116 0.35083330 0.27553195 0.25671429
+-8.22091887 0.26536918 0.34886080 0.27602666 0.25680336
+-8.20136852 0.26553826 0.34691568 0.27653044 0.25689375
+-8.18181818 0.26570839 0.34499749 0.27704338 0.25698547
+-8.16226784 0.26587952 0.34310579 0.27756560 0.25707856
+-8.14271750 0.26605163 0.34124015 0.27809722 0.25717304
+-8.12316716 0.26622467 0.33940016 0.27863833 0.25726893
+-8.10361681 0.26639862 0.33758544 0.27918905 0.25736625
+-8.08406647 0.26657343 0.33579560 0.27974951 0.25746504
+-8.06451613 0.26674906 0.33403029 0.28031979 0.25756530
+-8.04496579 0.26692548 0.33228915 0.28090003 0.25766708
+-8.02541544 0.26710264 0.33057184 0.28149034 0.25777038
+-8.00586510 0.26728050 0.32887806 0.28209082 0.25787525
+-7.98631476 0.26745901 0.32720748 0.28270160 0.25798171
+-7.96676442 0.26763813 0.32555981 0.28332279 0.25808978
+-7.94721408 0.26781782 0.32393477 0.28395451 0.25819950
+-7.92766373 0.26799801 0.32233209 0.28459687 0.25831088
+-7.90811339 0.26817867 0.32075149 0.28524999 0.25842397
+-7.88856305 0.26835973 0.31919274 0.28591400 0.25853879
+-7.86901271 0.26854116 0.31765559 0.28658900 0.25865536
+-7.84946237 0.26872288 0.31613980 0.28727512 0.25877373
+-7.82991202 0.26890486 0.31464517 0.28797248 0.25889393
+-7.81036168 0.26908703 0.31317148 0.28868119 0.25901598
+-7.79081134 0.26926933 0.31171853 0.28940139 0.25913991
+-7.77126100 0.26945171 0.31028613 0.29013319 0.25926577
+-7.75171065 0.26963410 0.30887410 0.29087671 0.25939359
+-7.73216031 0.26981645 0.30748225 0.29163208 0.25952340
+-7.71260997 0.26999870 0.30611044 0.29239941 0.25965524
+-7.69305963 0.27018077 0.30475850 0.29317884 0.25978914
+-7.67350929 0.27036262 0.30342628 0.29397049 0.25992514
+-7.65395894 0.27054417 0.30211365 0.29477449 0.26006328
+-7.63440860 0.27072536 0.30082047 0.29559095 0.26020361
+-7.61485826 0.27090613 0.29954662 0.29642001 0.26034615
+-7.59530792 0.27108641 0.29829198 0.29726179 0.26049095
+-7.57575758 0.27126613 0.29705644 0.29811642 0.26063805
+-7.55620723 0.27144524 0.29583991 0.29898403 0.26078749
+-7.53665689 0.27162365 0.29464228 0.29986474 0.26093932
+-7.51710655 0.27180131 0.29346347 0.30075869 0.26109358
+-7.49755621 0.27197815 0.29230341 0.30166600 0.26125032
+-7.47800587 0.27215410 0.29116201 0.30258681 0.26140958
+-7.45845552 0.27232911 0.29003921 0.30352124 0.26157141
+-7.43890518 0.27250309 0.28893495 0.30446943 0.26173586
+-7.41935484 0.27267600 0.28784918 0.30543150 0.26190297
+-7.39980450 0.27284776 0.28678185 0.30640760 0.26207280
+-7.38025415 0.27301831 0.28573293 0.30739784 0.26224540
+-7.36070381 0.27318759 0.28470237 0.30840237 0.26242082
+-7.34115347 0.27335555 0.28369016 0.30942131 0.26259911
+-7.32160313 0.27352212 0.28269627 0.31045480 0.26278032
+-7.30205279 0.27368724 0.28172069 0.31150298 0.26296452
+-7.28250244 0.27385086 0.28076341 0.31256597 0.26315176
+-7.26295210 0.27401293 0.27982443 0.31364392 0.26334210
+-7.24340176 0.27417340 0.27890375 0.31473695 0.26353559
+-7.22385142 0.27433221 0.27800139 0.31584521 0.26373230
+-7.20430108 0.27448932 0.27711736 0.31696883 0.26393229
+-7.18475073 0.27464470 0.27625167 0.31810794 0.26413562
+-7.16520039 0.27479829 0.27540437 0.31926268 0.26434235
+-7.14565005 0.27495007 0.27457548 0.32043318 0.26455255
+-7.12609971 0.27510001 0.27376505 0.32161959 0.26476629
+-7.10654936 0.27524806 0.27297311 0.32282204 0.26498362
+-7.08699902 0.27539422 0.27219973 0.32404067 0.26520463
+-7.06744868 0.27553845 0.27144495 0.30753520 0.26542938
+-7.04789834 0.27568076 0.27070885 0.30845025 0.26565794
+-7.02834800 0.27582111 0.26999148 0.30937445 0.26589039
+-7.00879765 0.27595952 0.26929292 0.31030773 0.26612679
+-6.98924731 0.27609598 0.26861326 0.31125006 0.26636723
+-6.96969697 0.27623051 0.26795257 0.31220136 0.26661178
+-6.95014663 0.27636310 0.26731094 0.31316160 0.26686051
+-6.93059629 0.27649379 0.26668847 0.31413068 0.26711352
+-6.91104594 0.27662260 0.26608527 0.31510855 0.26737086
+-6.89149560 0.27674956 0.26550142 0.31609512 0.26763264
+-6.87194526 0.27687471 0.26493705 0.31709032 0.26789893
+-6.85239492 0.27699811 0.26439227 0.31809405 0.26816981
+-6.83284457 0.27711981 0.26386720 0.31910623 0.26844537
+-6.81329423 0.27723987 0.26336196 0.32012674 0.26872570
+-6.79374389 0.27735837 0.26287669 0.32115549 0.26901088
+-6.77419355 0.27747540 0.26241151 0.32219236 0.26930100
+-6.75464321 0.27759103 0.26196656 0.32323723 0.26959616
+-6.73509286 0.27770537 0.26154199 0.32428998 0.26989644
+-6.71554252 0.27781854 0.26113794 0.32535049 0.27020193
+-6.69599218 0.27793065 0.26075456 0.32641860 0.27051273
+-6.67644184 0.27804182 0.26039201 0.32749418 0.27082893
+-6.65689150 0.27815221 0.26005044 0.32857707 0.27115063
+-6.63734115 0.27826197 0.25973002 0.32966712 0.27147791
+-6.61779081 0.27837124 0.25943090 0.33076416 0.27181089
+-6.59824047 0.27848021 0.25915325 0.33186801 0.27214965
+-6.57869013 0.27858906 0.25889725 0.33297850 0.27249429
+-6.55913978 0.27869798 0.25866306 0.33409544 0.27284492
+-6.53958944 0.27880717 0.25845086 0.33521862 0.27320162
+-6.52003910 0.27891685 0.25826082 0.33634786 0.27356450
+-6.50048876 0.27902726 0.25809313 0.33748292 0.27393366
+-6.48093842 0.27913862 0.25794795 0.33862361 0.27430919
+-6.46138807 0.27925118 0.25782548 0.22105200 0.27469120
+-6.44183773 0.27936521 0.25772589 0.22159093 0.27507979
+-6.42228739 0.27948098 0.25764936 0.22213788 0.27547505
+-6.40273705 0.27959877 0.25759607 0.22269302 0.27587708
+-6.38318671 0.27971888 0.25756620 0.22325651 0.27628599
+-6.36363636 0.27984160 0.25755993 0.22382853 0.27670186
+-6.34408602 0.27996726 0.25757744 0.22440924 0.27712480
+-6.32453568 0.28009616 0.25761891 0.22499883 0.27755490
+-6.30498534 0.28022866 0.25768450 0.22559746 0.27799226
+-6.28543500 0.28036509 0.25777439 0.22620530 0.27843697
+-6.26588465 0.28050581 0.25788874 0.22682253 0.27888913
+-6.24633431 0.28065117 0.25802772 0.22744932 0.27934881
+-6.22678397 0.28080154 0.25819149 0.22808583 0.27981612
+-6.20723363 0.28095730 0.25838019 0.22873224 0.28029113
+-6.18768328 0.28111883 0.25859399 0.22938871 0.28077394
+-6.16813294 0.28128652 0.25883301 0.23005539 0.28126462
+-6.14858260 0.28146076 0.25909739 0.23073246 0.28176325
+-6.12903226 0.28164195 0.25938726 0.23142006 0.28226991
+-6.10948192 0.28183050 0.25970274 0.23211835 0.28278467
+-6.08993157 0.28202680 0.26004394 0.23282747 0.28330760
+-6.07038123 0.28223127 0.26041095 0.23354755 0.28383876
+-6.05083089 0.28244431 0.26080387 0.23427874 0.28437822
+-6.03128055 0.28266633 0.26122278 0.23502115 0.28492603
+-6.01173021 0.28289774 0.26166773 0.23577491 0.28548224
+-5.99217986 0.28313895 0.26213878 0.23654012 0.28604690
+-5.97262952 0.28339035 0.26263598 0.23731689 0.28662005
+-5.95307918 0.28365234 0.26315935 0.23810530 0.28720173
+-5.93352884 0.28392532 0.26370889 0.23890543 0.28779197
+-5.91397849 0.28420967 0.26428461 0.23971736 0.28839080
+-5.89442815 0.28450577 0.26488648 0.24054113 0.28899822
+-5.87487781 0.28481399 0.26551446 0.24137679 0.28961426
+-5.85532747 0.28513468 0.26616849 0.24222438 0.29023892
+-5.83577713 0.28546820 0.26684850 0.24308390 0.29087220
+-5.81622678 0.28581486 0.26755440 0.24395535 0.29151408
+-5.79667644 0.28617500 0.26828606 0.24483872 0.29216456
+-5.77712610 0.28654892 0.26904334 0.24573397 0.29282359
+-5.75757576 0.28693689 0.26982610 0.24664106 0.29349116
+-5.73802542 0.28733919 0.27063415 0.24755991 0.29416722
+-5.71847507 0.28775607 0.27146727 0.24849044 0.29485171
+-5.69892473 0.28818775 0.27232525 0.24943254 0.29554458
+-5.67937439 0.28863444 0.27320784 0.25038609 0.29624576
+-5.65982405 0.28909631 0.27411475 0.25135093 0.29695517
+-5.64027370 0.28957354 0.27504568 0.25232690 0.29767272
+-5.62072336 0.29006624 0.27600031 0.25331381 0.29839832
+-5.60117302 0.29057452 0.27697829 0.25431144 0.29913186
+-5.58162268 0.29109847 0.27797922 0.25531956 0.29987322
+-5.56207234 0.29163813 0.27900271 0.25633792 0.30062228
+-5.54252199 0.29219351 0.28004832 0.25736622 0.30137889
+-5.52297165 0.29276463 0.28111560 0.25840417 0.30214291
+-5.50342131 0.29335143 0.28220405 0.25945144 0.30291419
+-5.48387097 0.29395384 0.28331316 0.26050768 0.30369256
+-5.46432063 0.29457176 0.28444240 0.26157251 0.30447783
+-5.44477028 0.29520506 0.28559119 0.26264553 0.30526982
+-5.42521994 0.29585357 0.28675895 0.26372632 0.30606834
+-5.40566960 0.29651711 0.28794504 0.26481444 0.30687318
+-5.38611926 0.29719542 0.28914883 0.26590941 0.30768412
+-5.36656891 0.29788827 0.29036965 0.26701075 0.30850093
+-5.34701857 0.29859534 0.29160680 0.26811794 0.30959606
+-5.32746823 0.29931632 0.29285957 0.26923045 0.31255914
+-5.30791789 0.30005086 0.29412720 0.27034772 0.31560324
+-5.28836755 0.30079856 0.29540894 0.27146917 0.31872899
+-5.26881720 0.30155902 0.29670400 0.27259421 0.32193695
+-5.24926686 0.30233179 0.29801157 0.27372222 0.32522758
+-5.22971652 0.30311639 0.29933084 0.27485258 0.32860128
+-5.21016618 0.30391234 0.30066094 0.27598463 0.33205837
+-5.19061584 0.30471910 0.30200102 0.27711771 0.33559908
+-5.17106549 0.30553614 0.30335020 0.27825115 0.33922353
+-5.15151515 0.30636288 0.30470760 0.27938424 0.34293178
+-5.13196481 0.30719873 0.30607229 0.28051629 0.34672379
+-5.11241447 0.30804308 0.30744337 0.28164658 0.35059941
+-5.09286413 0.30889530 0.30881991 0.28277439 0.35455840
+-5.07331378 0.30975474 0.31020096 0.28389899 0.35860043
+-5.05376344 0.31062076 0.31158558 0.28501965 0.36272505
+-5.03421310 0.31149268 0.31297283 0.28613561 0.36693173
+-5.01466276 0.31236980 0.31436174 0.28724615 0.37121982
+-4.99511241 0.31325146 0.31575135 0.28835051 0.37558859
+-4.97556207 0.31413694 0.31714072 0.28944794 0.38003717
+-4.95601173 0.31502554 0.31852887 0.29053772 0.38456461
+-4.93646139 0.31591657 0.31991485 0.29161908 0.38916987
+-4.91691105 0.31680931 0.32129770 0.29269131 0.39385177
+-4.89736070 0.31770307 0.32267649 0.29375368 0.39860905
+-4.87781036 0.31859713 0.32405026 0.29480546 0.40344034
+-4.85826002 0.31949082 0.32541809 0.29584595 0.40834419
+-4.83870968 0.32038343 0.32677905 0.29687444 0.41331902
+-4.81915934 0.32127429 0.32813223 0.29789027 0.41836318
+-4.79960899 0.32216274 0.32947674 0.29889274 0.42347491
+-4.78005865 0.32304812 0.33081168 0.29988122 0.42865235
+-4.76050831 0.32392979 0.33213619 0.30085506 0.43389358
+-4.74095797 0.32480712 0.33344941 0.30181365 0.43919656
+-4.72140762 0.32567952 0.33475052 0.30275638 0.44455918
+-4.70185728 0.32654638 0.33603870 0.30368268 0.44997927
+-4.68230694 0.32740716 0.33731315 0.30459200 0.45545454
+-4.66275660 0.32826130 0.33857310 0.30548380 0.46098267
+-4.64320626 0.32910828 0.33981780 0.30635758 0.46656124
+-4.62365591 0.32994760 0.34104652 0.30721284 0.47218778
+-4.60410557 0.33077879 0.34225856 0.30804914 0.47785976
+-4.58455523 0.33160141 0.34345323 0.30886605 0.48357458
+-4.56500489 0.33241502 0.34462988 0.30966315 0.48932962
+-4.54545455 0.33321925 0.34578788 0.31044008 0.49512217
+-4.52590420 0.33401372 0.34692662 0.31119648 0.50094952
+-4.50635386 0.33479809 0.34804554 0.31193203 0.50680889
+-4.48680352 0.33557205 0.34914407 0.31264645 0.51269748
+-4.46725318 0.33633532 0.35022169 0.31333947 0.51861248
+-4.44770283 0.33708765 0.35127791 0.31401085 0.52455103
+-4.42815249 0.33782881 0.35231226 0.31466039 0.53051027
+-4.40860215 0.33855860 0.35332428 0.31528792 0.53648733
+-4.38905181 0.33927686 0.35431358 0.31589329 0.54247930
+-4.36950147 0.33998343 0.35527974 0.31647638 0.54848332
+-4.34995112 0.34067821 0.35622242 0.31703709 0.55449650
+-4.33040078 0.34136111 0.35714127 0.31757537 0.56051596
+-4.31085044 0.34203205 0.35803598 0.31809118 0.56653883
+-4.29130010 0.34269101 0.35890626 0.31858450 0.57256227
+-4.27174976 0.34333796 0.35975186 0.31905537 0.57858345
+-4.25219941 0.34397292 0.36057253 0.31950381 0.58459957
+-4.23264907 0.34459593 0.36136807 0.31992991 0.59060786
+-4.21309873 0.34520703 0.36213827 0.32033374 0.59660557
+-4.19354839 0.34580630 0.36288299 0.32071544 0.60259002
+-4.17399804 0.34639383 0.36360206 0.32107514 0.60855853
+-4.15444770 0.34696975 0.36429536 0.32141299 0.61450850
+-4.13489736 0.34753417 0.36496280 0.32172919 0.62043736
+-4.11534702 0.34808726 0.36560429 0.32202393 0.62634260
+-4.09579668 0.34862917 0.36621977 0.32229745 0.63222176
+-4.07624633 0.34916008 0.36680918 0.32254997 0.63807243
+-4.05669599 0.34968019 0.36737251 0.32278177 0.64389229
+-4.03714565 0.35018970 0.36790973 0.32299311 0.64967904
+-4.01759531 0.35068883 0.36842087 0.32318430 0.65543047
+-3.99804497 0.35117780 0.36890593 0.32335563 0.66114445
+-3.97849462 0.35165685 0.36936495 0.32350743 0.66607967
+-3.95894428 0.35212622 0.36979798 0.32364003 0.67088865
+-3.93939394 0.35258618 0.37020509 0.32375378 0.67569095
+-3.91984360 0.35303697 0.37058635 0.32384905 0.68048353
+-3.90029326 0.35347885 0.37094184 0.32392619 0.68526345
+-3.88074291 0.35391210 0.37127166 0.32398558 0.69002788
+-3.86119257 0.35433698 0.37157593 0.32402762 0.69477409
+-3.84164223 0.35475378 0.37185474 0.32405270 0.69949943
+-3.82209189 0.35516275 0.37210824 0.32406121 0.70420138
+-3.80254154 0.35556419 0.37233655 0.32405358 0.70887750
+-3.78299120 0.35595836 0.37253982 0.32403020 0.71352546
+-3.76344086 0.35634554 0.37271818 0.32399150 0.71814304
+-3.74389052 0.35672600 0.37287180 0.32393791 0.72272810
+-3.72434018 0.35710002 0.37300083 0.32386984 0.72727863
+-3.70478983 0.35746787 0.37310544 0.32378772 0.73179269
+-3.68523949 0.35782980 0.37318579 0.32369198 0.73626848
+-3.66568915 0.35818609 0.37324205 0.32358305 0.74070425
+-3.64613881 0.35853699 0.37327440 0.32346137 0.74509839
+-3.62658847 0.35888275 0.37328302 0.32332736 0.74944936
+-3.60703812 0.35922362 0.37326808 0.32318145 0.75375574
+-3.58748778 0.35955985 0.37322976 0.32302407 0.75801618
+-3.56793744 0.35989167 0.37316825 0.32285564 0.76222942
+-3.54838710 0.36021932 0.37308373 0.32267660 0.76639432
+-3.52883675 0.36054301 0.37297638 0.32248736 0.77050981
+-3.50928641 0.36086296 0.37284639 0.32228834 0.77457490
+-3.48973607 0.36117939 0.37269393 0.32207995 0.77858868
+-3.47018573 0.36149250 0.37251919 0.32186261 0.78255036
+-3.45063539 0.36180248 0.37232235 0.32163672 0.78645919
+-3.43108504 0.36210952 0.37210359 0.32140268 0.79031451
+-3.41153470 0.36241382 0.37186308 0.32116089 0.79411575
+-3.39198436 0.36271553 0.37160101 0.32091174 0.79786239
+-3.37243402 0.36301483 0.37131753 0.32065561 0.80155400
+-3.35288368 0.36331188 0.37101284 0.32039289 0.80519021
+-3.33333333 0.36360682 0.37068708 0.32012395 0.80877072
+-3.31378299 0.36389981 0.37034043 0.31984915 0.81229530
+-3.29423265 0.36419098 0.36997305 0.31956887 0.81576376
+-3.27468231 0.36448046 0.36958509 0.31928344 0.81917600
+-3.25513196 0.36476837 0.36917672 0.31899322 0.82253195
+-3.23558162 0.36505483 0.36874807 0.31869855 0.82583161
+-3.21603128 0.36533994 0.36829930 0.31839976 0.82907504
+-3.19648094 0.36562381 0.36783056 0.31809719 0.83226232
+-3.17693060 0.36590653 0.36734197 0.31779114 0.83539361
+-3.15738025 0.36618819 0.36683367 0.31748193 0.83846910
+-3.13782991 0.36646888 0.36630580 0.31716987 0.84148902
+-3.11827957 0.36674865 0.36575847 0.31685526 0.84445365
+-3.09872923 0.36702760 0.36519182 0.31653838 0.84736331
+-3.07917889 0.36730577 0.36460594 0.31621951 0.85021835
+-3.05962854 0.36758323 0.36400096 0.31589894 0.85301915
+-3.04007820 0.36786002 0.36337697 0.31557693 0.85576614
+-3.02052786 0.36813620 0.36273409 0.31525375 0.85845977
+-3.00097752 0.36841181 0.36207240 0.31492964 0.86110051
+-2.98142717 0.36868687 0.36139199 0.31460485 0.86368888
+-2.96187683 0.36896143 0.36069296 0.31427963 0.86622540
+-2.94232649 0.36923551 0.35997537 0.31395420 0.86871062
+-2.92277615 0.36950913 0.35923931 0.31362880 0.87114513
+-2.90322581 0.36978231 0.35848484 0.31330363 0.87352952
+-2.88367546 0.37005506 0.35771203 0.31297891 0.87586441
+-2.86412512 0.37032740 0.35692093 0.31265485 0.87815042
+-2.84457478 0.37059933 0.35611159 0.31233164 0.88038820
+-2.82502444 0.37087086 0.35528407 0.31200948 0.88257841
+-2.80547410 0.37114199 0.35443839 0.31168854 0.88472172
+-2.78592375 0.37141271 0.35357461 0.31136901 0.88681882
+-2.76637341 0.37168301 0.35269274 0.31105106 0.88887039
+-2.74682307 0.37195290 0.35179281 0.31073485 0.89087714
+-2.72727273 0.37222235 0.35087484 0.31042055 0.89283977
+-2.70772239 0.37249137 0.34993884 0.31010831 0.89475900
+-2.68817204 0.37275992 0.34898482 0.30979827 0.89663554
+-2.66862170 0.37302800 0.34801277 0.30949058 0.89847013
+-2.64907136 0.37329558 0.34702268 0.30918537 0.90026347
+-2.62952102 0.37356265 0.34601456 0.30888278 0.90201630
+-2.60997067 0.37382919 0.34498837 0.30858292 0.90372935
+-2.59042033 0.37409516 0.34394409 0.30828592 0.90540334
+-2.57086999 0.37436055 0.34288169 0.30799190 0.90703900
+-2.55131965 0.37462533 0.34180113 0.30770095 0.90863705
+-2.53176931 0.37488947 0.34070238 0.30741319 0.91019823
+-2.51221896 0.37515294 0.33958537 0.30712872 0.91172323
+-2.49266862 0.37541573 0.33845005 0.30684763 0.91321279
+-2.47311828 0.37567779 0.33729635 0.30657001 0.91466762
+-2.45356794 0.37593911 0.33612422 0.30629594 0.91608841
+-2.43401760 0.37619964 0.33493356 0.30602552 0.91747588
+-2.41446725 0.37645936 0.33372429 0.30575880 0.91883071
+-2.39491691 0.37671824 0.33249633 0.30549587 0.92015360
+-2.37536657 0.37697625 0.33124957 0.30523680 0.92144523
+-2.35581623 0.37723336 0.32998391 0.30498165 0.92270627
+-2.33626588 0.37748954 0.32869922 0.30473048 0.92393739
+-2.31671554 0.37774476 0.32739540 0.30448334 0.92513926
+-2.29716520 0.37799899 0.32607232 0.30424029 0.92631251
+-2.27761486 0.37825219 0.32472983 0.30400139 0.92745780
+-2.25806452 0.37850435 0.32336779 0.30376667 0.92857575
+-2.23851417 0.37875542 0.32198605 0.30353617 0.92966700
+-2.21896383 0.37900539 0.32058445 0.30330995 0.93073215
+-2.19941349 0.37925422 0.31916281 0.30308803 0.93177181
+-2.17986315 0.37950189 0.31772096 0.30287045 0.93278658
+-2.16031281 0.37974838 0.31625872 0.30265723 0.93377705
+-2.14076246 0.37999364 0.31477587 0.30244841 0.93474379
+-2.12121212 0.38023766 0.31327223 0.30224402 0.93568736
+-2.10166178 0.38048042 0.31174757 0.30204406 0.93660833
+-2.08211144 0.38072189 0.31020166 0.30184856 0.93750724
+-2.06256109 0.38096205 0.30863427 0.30165754 0.93838462
+-2.04301075 0.38120086 0.30704516 0.30147101 0.93924099
+-2.02346041 0.38143833 0.30543406 0.30128899 0.94007688
+-2.00391007 0.38167441 0.30380071 0.30111147 0.94089279
+-1.98435973 0.38190910 0.30214483 0.30093848 0.94168921
+-1.96480938 0.38214237 0.30046612 0.30077001 0.94246662
+-1.94525904 0.38237421 0.29876429 0.30060607 0.94322550
+-1.92570870 0.38260459 0.29703900 0.30044665 0.94396631
+-1.90615836 0.38283351 0.29528995 0.30029176 0.94468950
+-1.88660802 0.38306095 0.29351677 0.30014139 0.94539552
+-1.86705767 0.38328689 0.29171912 0.29999555 0.94608479
+-1.84750733 0.38351131 0.28989661 0.29985421 0.94675774
+-1.82795699 0.38373422 0.28804887 0.29971737 0.94741478
+-1.80840665 0.38395559 0.28617550 0.29958503 0.94805630
+-1.78885630 0.38417542 0.28427606 0.29945716 0.94868271
+-1.76930596 0.38439369 0.28235013 0.29933377 0.94929439
+-1.74975562 0.38461040 0.28039725 0.29921482 0.94989169
+-1.73020528 0.38482553 0.27841695 0.29910031 0.95047500
+-1.71065494 0.38503909 0.27640875 0.29899021 0.95104466
+-1.69110459 0.38525107 0.27437212 0.29888451 0.95160102
+-1.67155425 0.38546146 0.27230653 0.29878319 0.95214440
+-1.65200391 0.38567026 0.27021144 0.29868623 0.95267514
+-1.63245357 0.38587746 0.26808627 0.29859359 0.95319355
+-1.61290323 0.38608307 0.26593042 0.29850526 0.95369994
+-1.59335288 0.38628708 0.26374326 0.29842122 0.95419460
+-1.57380254 0.38648949 0.26152415 0.29834142 0.95467784
+-1.55425220 0.38669030 0.25927240 0.29826586 0.95514992
+-1.53470186 0.38688951 0.25698731 0.29819449 0.95561113
+-1.51515152 0.38708713 0.25466815 0.29812729 0.95606172
+-1.49560117 0.38728316 0.25231415 0.29806423 0.95650196
+-1.47605083 0.38747760 0.24992451 0.29800528 0.95693210
+-1.45650049 0.38767046 0.24749839 0.29795039 0.95735237
+-1.43695015 0.38786174 0.24503493 0.29789955 0.95776302
+-1.41739980 0.38805144 0.24253321 0.29785271 0.95816426
+-1.39784946 0.38823958 0.23999229 0.29780985 0.95855632
+-1.37829912 0.38842616 0.23741118 0.29777091 0.95893941
+-1.35874878 0.38861120 0.23478883 0.29773588 0.95931374
+-1.33919844 0.38879469 0.23212416 0.29770470 0.95967950
+-1.31964809 0.38897665 0.22941604 0.29767735 0.96003688
+-1.30009775 0.38915709 0.22666328 0.29765378 0.96038608
+-1.28054741 0.38933602 0.22386463 0.29763395 0.96072727
+-1.26099707 0.38951345 0.22101879 0.29761783 0.96106062
+-1.24144673 0.38968940 0.21812439 0.29760537 0.96138631
+-1.22189638 0.38986387 0.21518000 0.29759653 0.96170448
+-1.20234604 0.39003688 0.21218409 0.29759127 0.96201530
+-1.18279570 0.39020844 0.20913510 0.29758955 0.96231892
+-1.16324536 0.39037857 0.20603135 0.29759132 0.96261547
+-1.14369501 0.39054728 0.20287109 0.29759655 0.96290511
+-1.12414467 0.39071459 0.19965248 0.29760518 0.96318796
+-1.10459433 0.39088052 0.19637355 0.29761717 0.96346415
+-1.08504399 0.39104507 0.19303228 0.29763248 0.96373380
+-1.06549365 0.39120826 0.18962647 0.29765106 0.96399703
+-1.04594330 0.39137012 0.18615385 0.29767287 0.96425397
+-1.02639296 0.39153066 0.18261198 0.29769787 0.96450470
+-1.00684262 0.39168990 0.17899831 0.29772599 0.96474935
+-0.98729228 0.39184786 0.17531012 0.29775720 0.96498801
+-0.96774194 0.39200455 0.17154451 0.29779146 0.96522078
+-0.94819159 0.39215999 0.16769843 0.29782870 0.96544775
+-0.92864125 0.39231420 0.16376861 0.29786890 0.96566902
+-0.90909091 0.39246721 0.15975159 0.29791198 0.96588465
+-0.88954057 0.39261903 0.15564368 0.29795792 0.96609474
+-0.86999022 0.39276968 0.15144091 0.29800666 0.96629937
+-0.85043988 0.39291918 0.14713908 0.29805815 0.96649861
+-0.83088954 0.39306756 0.14273366 0.29811234 0.96669252
+-0.81133920 0.39321483 0.13821982 0.29816918 0.96688118
+-0.79178886 0.39336101 0.13359235 0.29822862 0.96706465
+-0.77223851 0.39350614 0.12884566 0.29829062 0.96724300
+-0.75268817 0.39365021 0.12397373 0.29835512 0.96741628
+-0.73313783 0.39379327 0.11897006 0.29842207 0.96758455
+-0.71358749 0.39393532 0.11382760 0.29849142 0.96774786
+-0.69403715 0.39407640 0.10853873 0.29856312 0.96790626
+-0.67448680 0.39421653 0.10309517 0.29863712 0.96805980
+-0.65493646 0.39435571 0.09748790 0.29871337 0.96820853
+-0.63538612 0.39449399 0.09170709 0.29879182 0.96835249
+-0.61583578 0.39463138 0.08574196 0.29887242 0.96849172
+-0.59628543 0.39476790 0.07958071 0.29895510 0.96862627
+-0.57673509 0.39490358 0.07321033 0.29903984 0.96875616
+-0.55718475 0.39503843 0.06661648 0.29912656 0.96888143
+-0.53763441 0.39517249 0.05978327 0.29921522 0.96900212
+-0.51808407 0.39530577 0.05269303 0.29930577 0.96911826
+-0.49853372 0.39543829 0.02702221 0.29939816 0.96922987
+-0.47898338 0.39557009 0.02710570 0.29949233 0.96933699
+-0.45943304 0.39570118 0.02719048 0.29958823 0.96943964
+-0.43988270 0.39583158 0.02727658 0.29968581 0.96953785
+-0.42033236 0.39596132 0.02736399 0.29978501 0.96963164
+-0.40078201 0.39609042 0.02745275 0.29988580 0.96972102
+-0.38123167 0.39621890 0.02754285 0.29998810 0.96980603
+-0.36168133 0.39634679 0.02763432 0.30009187 0.96988668
+-0.34213099 0.39647411 0.02772717 0.30019707 0.96996299
+-0.32258065 0.39660088 0.02782142 0.30030362 0.97003498
+-0.30303030 0.39672712 0.02791707 0.30041150 0.97010265
+-0.28347996 0.39685287 0.02801416 0.30052063 0.97016603
+-0.26392962 0.39697813 0.02811268 0.30063097 0.97022513
+-0.24437928 0.39710294 0.02821267 0.30074246 0.97027996
+-0.22482893 0.39722731 0.02831413 0.30085507 0.97033053
+-0.20527859 0.39735127 0.02841709 0.30096872 0.97037685
+-0.18572825 0.39747485 0.02852157 0.30108337 0.97041893
+-0.16617791 0.39759805 0.02862757 0.30119897 0.97045678
+-0.14662757 0.39772092 0.02873512 0.30131547 0.97049041
+-0.12707722 0.39784346 0.02884424 0.30143281 0.97051982
+-0.10752688 0.39796571 0.02895495 0.30155094 0.97054502
+-0.08797654 0.39808768 0.02906727 0.30166981 0.97056601
+-0.06842620 0.39820940 0.02918122 0.30178937 0.97058280
+-0.04887586 0.39833089 0.02929681 0.30190957 0.97059539
+-0.02932551 0.39845217 0.02941408 0.30203035 0.97060378
+-0.00977517 0.39857327 0.02953303 0.30215167 0.97060797
+0.00977517 0.39869420 0.02965370 0.30227347 0.97060797
+0.02932551 0.39881500 0.02977611 0.30239578 0.97060378
+0.04887586 0.39893568 0.02990027 0.30251870 0.97059539
+0.06842620 0.39905626 0.03002622 0.30264232 0.97058280
+0.08797654 0.39917677 0.03015397 0.30276673 0.97056601
+0.10752688 0.39929724 0.03028355 0.30289204 0.97054502
+0.12707722 0.39941767 0.03041499 0.30301833 0.97051982
+0.14662757 0.39953811 0.03054831 0.30314572 0.97049041
+0.16617791 0.39965856 0.03068353 0.30327430 0.97045678
+0.18572825 0.39977905 0.03082068 0.30340416 0.97041893
+0.20527859 0.39989961 0.03095980 0.30353540 0.97037685
+0.22482893 0.40002026 0.03110089 0.30366813 0.97033053
+0.24437928 0.40014101 0.03124400 0.30380243 0.97027996
+0.26392962 0.40026190 0.03138915 0.30393841 0.97022513
+0.28347996 0.40038295 0.03153637 0.30407617 0.97016603
+0.30303030 0.40050418 0.03168569 0.30421581 0.97010265
+0.32258065 0.40062561 0.03183714 0.30435742 0.97003498
+0.34213099 0.40074727 0.03199074 0.30450111 0.96996299
+0.36168133 0.40086919 0.03214654 0.30464697 0.96988668
+0.38123167 0.40099137 0.03230455 0.30479511 0.96980603
+0.40078201 0.40111386 0.03246482 0.30494562 0.96972102
+0.42033236 0.40123667 0.03262737 0.30509860 0.96963164
+0.43988270 0.40135983 0.03279223 0.30525416 0.96953785
+0.45943304 0.40148337 0.03295945 0.30541239 0.96943964
+0.47898338 0.40160730 0.03312905 0.30557341 0.96933699
+0.49853372 0.40173166 0.03330108 0.30573729 0.96922987
+0.51808407 0.40185647 0.05922858 0.30590416 0.96911826
+0.53763441 0.40198175 0.06657672 0.30607411 0.96900212
+0.55718475 0.40210754 0.07366911 0.30624724 0.96888143
+0.57673509 0.40223386 0.08052345 0.30642365 0.96875616
+0.59628543 0.40236073 0.08715568 0.30660345 0.96862627
+0.61583578 0.40248819 0.09358021 0.30678673 0.96849172
+0.63538612 0.40261626 0.09981007 0.30697361 0.96835249
+0.65493646 0.40274497 0.10585714 0.30716418 0.96820853
+0.67448680 0.40287435 0.11173223 0.30735855 0.96805980
+0.69403715 0.40300443 0.11744524 0.30755682 0.96790626
+0.71358749 0.40313524 0.12300522 0.30775909 0.96774786
+0.73313783 0.40326681 0.12842052 0.30796547 0.96758455
+0.75268817 0.40339917 0.13369880 0.30817607 0.96741628
+0.77223851 0.40353235 0.13884717 0.30839098 0.96724300
+0.79178886 0.40366639 0.14387218 0.30861031 0.96706465
+0.81133920 0.40380131 0.14877990 0.30883417 0.96688118
+0.83088954 0.40393715 0.15357598 0.30906267 0.96669252
+0.85043988 0.40407395 0.15826569 0.30929590 0.96649861
+0.86999022 0.40421174 0.16285390 0.30953397 0.96629937
+0.88954057 0.40435056 0.16734521 0.30977699 0.96609474
+0.90909091 0.40449043 0.17174388 0.31002508 0.96588465
+0.92864125 0.40463141 0.17605391 0.31027832 0.96566902
+0.94819159 0.40477353 0.18027907 0.31053684 0.96544775
+0.96774194 0.40491682 0.18442287 0.31080073 0.96522078
+0.98729228 0.40506134 0.18848864 0.31107011 0.96498801
+1.00684262 0.40520711 0.19247951 0.31134509 0.96474935
+1.02639296 0.40535418 0.19639840 0.31162577 0.96450470
+1.04594330 0.40550260 0.20024811 0.31191226 0.96425397
+1.06549365 0.40565241 0.20403127 0.31220468 0.96399703
+1.08504399 0.40580365 0.20775035 0.31250312 0.96373380
+1.10459433 0.40595638 0.21140771 0.31280771 0.96346415
+1.12414467 0.40611063 0.21500558 0.31311855 0.96318796
+1.14369501 0.40626646 0.21854609 0.31343575 0.96290511
+1.16324536 0.40642392 0.22203123 0.31375942 0.96261547
+1.18279570 0.40658305 0.22546293 0.31408968 0.96231892
+1.20234604 0.40674392 0.22884301 0.31442663 0.96201530
+1.22189638 0.40690658 0.23217320 0.31477040 0.96170448
+1.24144673 0.40707108 0.23545515 0.31512109 0.96138631
+1.26099707 0.40723748 0.23869044 0.31547881 0.96106062
+1.28054741 0.40740583 0.24188058 0.31584368 0.96072727
+1.30009775 0.40757621 0.24502701 0.31621581 0.96038608
+1.31964809 0.40774867 0.24813110 0.31659532 0.96003688
+1.33919844 0.40792327 0.25119417 0.31698232 0.95967950
+1.35874878 0.40810008 0.25421749 0.31737693 0.95931374
+1.37829912 0.40827917 0.25720227 0.31777926 0.95893941
+1.39784946 0.40846060 0.26014966 0.31818942 0.95855632
+1.41739980 0.40864445 0.26306079 0.31860755 0.95816426
+1.43695015 0.40883079 0.26593671 0.31903374 0.95776302
+1.45650049 0.40901969 0.26877848 0.31946812 0.95735237
+1.47605083 0.40921123 0.27158706 0.31991081 0.95693210
+1.49560117 0.40940549 0.27436342 0.32036193 0.95650196
+1.51515152 0.40960255 0.27710847 0.32082159 0.95606172
+1.53470186 0.40980249 0.27982310 0.32128991 0.95561113
+1.55425220 0.41000539 0.28250816 0.32176702 0.95514992
+1.57380254 0.41021136 0.28516447 0.32225302 0.95467784
+1.59335288 0.41042046 0.28779284 0.32274806 0.95419460
+1.61290323 0.41063280 0.29039402 0.32325223 0.95369994
+1.63245357 0.41084847 0.29296875 0.32376568 0.95319355
+1.65200391 0.41106757 0.29551777 0.32428851 0.95267514
+1.67155425 0.41129019 0.29804175 0.32482085 0.95214440
+1.69110459 0.41151644 0.30054138 0.32536283 0.95160102
+1.71065494 0.41174642 0.30301730 0.32591456 0.95104466
+1.73020528 0.41198024 0.30547015 0.32647618 0.95047500
+1.74975562 0.41221802 0.30790053 0.32704780 0.94989169
+1.76930596 0.41245985 0.31030905 0.32762956 0.94929439
+1.78885630 0.41270586 0.31269628 0.32822157 0.94868271
+1.80840665 0.41295616 0.31506279 0.32882396 0.94805630
+1.82795699 0.41321089 0.31740911 0.32943686 0.94741478
+1.84750733 0.41347015 0.31973578 0.33006040 0.94675774
+1.86705767 0.41373409 0.32204331 0.33069471 0.94608479
+1.88660802 0.41400282 0.32433220 0.33133990 0.94539552
+1.90615836 0.41427649 0.32660296 0.33199611 0.94468950
+1.92570870 0.41455522 0.32885604 0.33266348 0.94396631
+1.94525904 0.41483917 0.33109193 0.33334212 0.94322550
+1.96480938 0.41512847 0.33331107 0.33403217 0.94246662
+1.98435973 0.41542327 0.33551390 0.33473375 0.94168921
+2.00391007 0.41572373 0.33770086 0.33544701 0.94089279
+2.02346041 0.41602999 0.33987237 0.33617207 0.94007688
+2.04301075 0.41634221 0.34202886 0.33690906 0.93924099
+2.06256109 0.41666056 0.34417071 0.33765812 0.93838462
+2.08211144 0.41698519 0.34629833 0.33841937 0.93750724
+2.10166178 0.41731628 0.34841211 0.33919295 0.93660833
+2.12121212 0.41765400 0.35051242 0.33997900 0.93568736
+2.14076246 0.41799853 0.35259965 0.34077764 0.93474379
+2.16031281 0.41835004 0.35467416 0.34158902 0.93377705
+2.17986315 0.41870872 0.35673630 0.34241327 0.93278658
+2.19941349 0.41907476 0.35878644 0.34325051 0.93177181
+2.21896383 0.41944834 0.36082491 0.34410090 0.93073215
+2.23851417 0.41982967 0.36285207 0.34496456 0.92966700
+2.25806452 0.42021893 0.36486824 0.34584163 0.92857575
+2.27761486 0.42061635 0.36687376 0.34673225 0.92745780
+2.29716520 0.42102212 0.36886895 0.34763655 0.92631251
+2.31671554 0.42143645 0.37085414 0.34855468 0.92513926
+2.33626588 0.42185957 0.37282964 0.34948677 0.92393739
+2.35581623 0.42229169 0.37479577 0.35043295 0.92270627
+2.37536657 0.42273303 0.37675284 0.35139337 0.92144523
+2.39491691 0.42318383 0.37870114 0.35236817 0.92015360
+2.41446725 0.42364432 0.38064099 0.35335748 0.91883071
+2.43401760 0.42411473 0.38257267 0.35436144 0.91747588
+2.45356794 0.42459530 0.38449650 0.35538020 0.91608841
+2.47311828 0.42508629 0.38641275 0.35641389 0.91466762
+2.49266862 0.42558794 0.38832172 0.35746266 0.91321279
+2.51221896 0.42610050 0.39022370 0.35852664 0.91172323
+2.53176931 0.42662423 0.39211897 0.35960597 0.91019823
+2.55131965 0.42715941 0.39400781 0.36070079 0.90863705
+2.57086999 0.42770628 0.39589052 0.36181125 0.90703900
+2.59042033 0.42826512 0.39776735 0.36293748 0.90540334
+2.60997067 0.42883622 0.39963860 0.36407963 0.90372935
+2.62952102 0.42941984 0.40150454 0.36523784 0.90201630
+2.64907136 0.43001627 0.40336544 0.36641224 0.90026347
+2.66862170 0.43062579 0.40522158 0.36760298 0.89847013
+2.68817204 0.43124871 0.40707323 0.36881020 0.89663554
+2.70772239 0.43188530 0.40892066 0.37003404 0.89475900
+2.72727273 0.43253588 0.41076414 0.37127464 0.89283977
+2.74682307 0.43320075 0.41260394 0.37253214 0.89087714
+2.76637341 0.43388020 0.41444034 0.37380669 0.88887039
+2.78592375 0.43457456 0.41627360 0.37509841 0.88681882
+2.80547410 0.43528413 0.41810399 0.37640745 0.88472172
+2.82502444 0.43600923 0.41993178 0.37773396 0.88257841
+2.84457478 0.43675018 0.42175723 0.37907806 0.88038820
+2.86412512 0.43750731 0.42358063 0.38043990 0.87815042
+2.88367546 0.43828094 0.42540223 0.38181962 0.87586441
+2.90322581 0.43907140 0.42722230 0.38321736 0.87352952
+2.92277615 0.43987902 0.42904112 0.38463325 0.87114513
+2.94232649 0.44070415 0.43085895 0.38606743 0.86871062
+2.96187683 0.44154710 0.43267607 0.38752004 0.86622540
+2.98142717 0.44240824 0.43449274 0.38899122 0.86368888
+3.00097752 0.44328789 0.43630924 0.39048109 0.86110051
+3.02052786 0.44418641 0.43812584 0.39198980 0.85845977
+3.04007820 0.44510413 0.43994281 0.39351747 0.85576614
+3.05962854 0.44604141 0.44176043 0.39506425 0.85301915
+3.07917889 0.44699859 0.44357897 0.39663027 0.85021835
+3.09872923 0.44797603 0.44539870 0.39821565 0.84736331
+3.11827957 0.44897407 0.44721990 0.39982052 0.84445365
+3.13782991 0.44999308 0.44904286 0.40144503 0.84148902
+3.15738025 0.45103339 0.45086784 0.40308929 0.83846910
+3.17693060 0.45209536 0.45269513 0.40475343 0.83539361
+3.19648094 0.45317935 0.45452500 0.40643757 0.83226232
+3.21603128 0.45428571 0.45635774 0.40814185 0.82907504
+3.23558162 0.45541479 0.45819363 0.40986639 0.82583161
+3.25513196 0.45656693 0.46003295 0.41161130 0.82253195
+3.27468231 0.45774250 0.46187599 0.41337671 0.81917600
+3.29423265 0.45894184 0.46372302 0.41516274 0.81576376
+3.31378299 0.46016529 0.46557435 0.41696950 0.81229530
+3.33333333 0.46141320 0.46743024 0.41879711 0.80877072
+3.35288368 0.46268591 0.46929099 0.42064567 0.80519021
+3.37243402 0.46398377 0.47115689 0.42251531 0.80155400
+3.39198436 0.46530710 0.47302822 0.42440612 0.79786239
+3.41153470 0.46665624 0.47490527 0.42631822 0.79411575
+3.43108504 0.46803152 0.47678833 0.42825170 0.79031451
+3.45063539 0.46943327 0.47867768 0.43020668 0.78645919
+3.47018573 0.47086180 0.48057362 0.43218323 0.78255036
+3.48973607 0.47231743 0.48247644 0.43418147 0.77858868
+3.50928641 0.47380048 0.48438641 0.43620148 0.77457490
+3.52883675 0.47531124 0.48630384 0.43824335 0.77050981
+3.54838710 0.47685002 0.48822899 0.44030716 0.76639432
+3.56793744 0.47841710 0.49016217 0.44239299 0.76222942
+3.58748778 0.48001278 0.49210365 0.44450093 0.75801618
+3.60703812 0.48163733 0.49405371 0.44663104 0.75375574
+3.62658847 0.48329102 0.49601264 0.44878339 0.74944936
+3.64613881 0.48497412 0.49798072 0.45095805 0.74509839
+3.66568915 0.48668688 0.49995821 0.45315507 0.74070425
+3.68523949 0.48842954 0.50194540 0.45537451 0.73626848
+3.70478983 0.49020234 0.50394256 0.45761641 0.73179269
+3.72434018 0.49200551 0.50594994 0.45988082 0.72727863
+3.74389052 0.49383927 0.50796783 0.46216778 0.72272810
+3.76344086 0.49570382 0.50999646 0.46447730 0.71814304
+3.78299120 0.49759935 0.51203610 0.46680943 0.71352546
+3.80254154 0.49952606 0.51408701 0.46916416 0.70887750
+3.82209189 0.50148411 0.51614941 0.47154152 0.70420138
+3.84164223 0.50347366 0.51822356 0.47394150 0.69949943
+3.86119257 0.50549486 0.52030968 0.47636409 0.69477409
+3.88074291 0.50754785 0.52240801 0.47880928 0.69002788
+3.90029326 0.50963274 0.52451875 0.48127704 0.68526345
+3.91984360 0.51174965 0.52664211 0.48376734 0.68048353
+3.93939394 0.51389867 0.52877831 0.48628014 0.67569095
+3.95894428 0.51607987 0.53092754 0.48881538 0.67088865
+3.97849462 0.51829332 0.53308997 0.49137299 0.66607967
+3.99804497 0.52053908 0.53526579 0.49395290 0.66126712
+4.01759531 0.52281717 0.53745515 0.49655503 0.65645423
+4.03714565 0.52512761 0.53965822 0.49917927 0.65164432
+4.05669599 0.52747040 0.54187512 0.50182551 0.64684078
+4.07624633 0.52984553 0.54410600 0.50449362 0.64204710
+4.09579668 0.53225297 0.54635096 0.50718347 0.63726685
+4.11534702 0.53469265 0.54861012 0.50989490 0.63250367
+4.13489736 0.53716452 0.55088356 0.51262775 0.62776129
+4.15444770 0.53966849 0.55317135 0.51538183 0.62304350
+4.17399804 0.54220446 0.55547356 0.51815694 0.61835416
+4.19354839 0.54477229 0.55779023 0.52095288 0.61369720
+4.21309873 0.54737185 0.56012140 0.52376941 0.60907659
+4.23264907 0.55000298 0.56246706 0.52660628 0.60449637
+4.25219941 0.55266550 0.56482723 0.52946322 0.59996060
+4.27174976 0.55535920 0.56720187 0.53233996 0.59547341
+4.29130010 0.55808386 0.56959095 0.53523620 0.59103894
+4.31085044 0.56083925 0.57199441 0.53815161 0.58666137
+4.33040078 0.56362510 0.57441217 0.54108585 0.58234490
+4.34995112 0.56644112 0.57684414 0.54403858 0.57809373
+4.36950147 0.56928702 0.57929020 0.54700940 0.57391209
+4.38905181 0.57216247 0.58175021 0.54999792 0.56980419
+4.40860215 0.57506712 0.58422403 0.55300373 0.56577423
+4.42815249 0.57800060 0.58671148 0.55602638 0.56182640
+4.44770283 0.58096254 0.58921236 0.55906541 0.55796486
+4.46725318 0.58395251 0.59172646 0.56212036 0.55419374
+4.48680352 0.58697008 0.59425354 0.56519070 0.55051713
+4.50635386 0.59001480 0.59679334 0.56827592 0.54693907
+4.52590420 0.59308621 0.59934560 0.57137549 0.54346354
+4.54545455 0.59618378 0.60191000 0.57448882 0.54009445
+4.56500489 0.59930702 0.60448623 0.57761535 0.53683563
+4.58455523 0.60245538 0.60707397 0.58075446 0.53369084
+4.60410557 0.60562829 0.60967284 0.58390552 0.53066374
+4.62365591 0.60882517 0.61228247 0.58706790 0.52775789
+4.64320626 0.61204543 0.61490247 0.59024092 0.52497674
+4.66275660 0.61528842 0.61753242 0.59342389 0.52232362
+4.68230694 0.61855351 0.62017190 0.59661613 0.51980173
+4.70185728 0.62184004 0.62282044 0.59981689 0.51741416
+4.72140762 0.62514730 0.62547759 0.60302544 0.51516383
+4.74095797 0.62847459 0.62814287 0.60624103 0.51305353
+4.76050831 0.63182120 0.63081577 0.60946287 0.51108589
+4.78005865 0.63518636 0.63349578 0.61269018 0.50926338
+4.79960899 0.63856932 0.63618238 0.61592215 0.50758830
+4.81915934 0.64196929 0.63887503 0.61915797 0.50606278
+4.83870968 0.64538547 0.64157318 0.62239680 0.50468876
+4.85826002 0.64881705 0.64427626 0.62563779 0.50346801
+4.87781036 0.65226318 0.64698371 0.62888010 0.50240209
+4.89736070 0.65572301 0.64969495 0.63212285 0.50149240
+4.91691105 0.65919569 0.65240939 0.63536518 0.50074011
+4.93646139 0.66268033 0.65512643 0.63860621 0.50014620
+4.95601173 0.66617603 0.65784548 0.64184504 0.49971146
+4.97556207 0.66968188 0.66056593 0.64508078 0.49943646
+4.99511241 0.67319697 0.66328718 0.64831254 0.49932156
+5.01466276 0.67672036 0.66600862 0.65153943 0.49936694
+5.03421310 0.68025111 0.66872965 0.65476053 0.49957254
+5.05376344 0.68378826 0.67144964 0.65797495 0.49993810
+5.07331378 0.68733086 0.67416801 0.66118179 0.50046317
+5.09286413 0.69087793 0.67688415 0.66438017 0.50114708
+5.11241447 0.69442850 0.67959745 0.66756917 0.50198896
+5.13196481 0.69798158 0.68230734 0.67074794 0.50298772
+5.15151515 0.70153618 0.68501322 0.67391557 0.50414211
+5.17106549 0.70509133 0.68771452 0.67707121 0.50545064
+5.19061584 0.70864600 0.69041066 0.68021399 0.50691167
+5.21016618 0.71219922 0.69310110 0.68334306 0.50852334
+5.22971652 0.71574999 0.69578529 0.68645759 0.51028363
+5.24926686 0.71929730 0.69846268 0.68955675 0.51219033
+5.26881720 0.72284016 0.70113276 0.69263974 0.51424107
+5.28836755 0.72637758 0.70379502 0.69570575 0.51643329
+5.30791789 0.72990856 0.70644897 0.69875400 0.51876431
+5.32746823 0.73343212 0.70909413 0.70178375 0.52123127
+5.34701857 0.73694728 0.71173004 0.70479424 0.52383116
+5.36656891 0.74045306 0.71435626 0.70778476 0.52834849
+5.38611926 0.74394850 0.71697236 0.71075459 0.53319112
+5.40566960 0.74743264 0.71957793 0.71370307 0.53808403
+5.42521994 0.75090453 0.72217258 0.71662953 0.54302486
+5.44477028 0.75436324 0.72475594 0.71953333 0.54801114
+5.46432063 0.75780784 0.72732767 0.72241387 0.55304039
+5.48387097 0.76123741 0.72988742 0.72527054 0.55811004
+5.50342131 0.76465106 0.73243490 0.72810280 0.56321751
+5.52297165 0.76804790 0.73496980 0.73091008 0.56836017
+5.54252199 0.77142706 0.73749186 0.73369189 0.57353534
+5.56207234 0.77478769 0.74000083 0.73644772 0.57874032
+5.58162268 0.77812895 0.74249647 0.73917711 0.58397239
+5.60117302 0.78145002 0.74497859 0.74187963 0.58922882
+5.62072336 0.78475011 0.74744698 0.74455485 0.59450683
+5.64027370 0.78802843 0.74990149 0.74720240 0.59980366
+5.65982405 0.79128423 0.75234195 0.74982190 0.60511654
+5.67937439 0.79451675 0.75476825 0.75241302 0.61044269
+5.69892473 0.79772529 0.75718028 0.75497545 0.61577935
+5.71847507 0.80090915 0.75957794 0.75750891 0.62112374
+5.73802542 0.80406764 0.76196116 0.76001313 0.62647314
+5.75757576 0.80720013 0.76432990 0.76248788 0.63182481
+5.77712610 0.81030597 0.76668411 0.76493294 0.63717604
+5.79667644 0.81338457 0.76902378 0.76734814 0.64252415
+5.81622678 0.81643535 0.77134891 0.76973330 0.64786651
+5.83577713 0.81945775 0.77365952 0.77208829 0.65320049
+5.85532747 0.82245123 0.77595565 0.77441300 0.65852353
+5.87487781 0.82541529 0.77823733 0.77670732 0.66383309
+5.89442815 0.82834944 0.78050464 0.77897120 0.66912668
+5.91397849 0.83125324 0.78275765 0.78120457 0.67440188
+5.93352884 0.83412624 0.78499646 0.78340742 0.67965630
+5.95307918 0.83696804 0.78722118 0.78557972 0.68488761
+5.97262952 0.83977827 0.78943193 0.78772150 0.69009354
+5.99217986 0.84255656 0.79162883 0.78983279 0.69527187
+6.01173021 0.84530258 0.79381204 0.79191363 0.70042046
+6.03128055 0.84801604 0.79598171 0.79396409 0.70553722
+6.05083089 0.85069664 0.79813800 0.79598427 0.71062014
+6.07038123 0.85334414 0.80028109 0.79797425 0.71566727
+6.08993157 0.85595830 0.80241118 0.79993416 0.72067672
+6.10948192 0.85853893 0.80452845 0.80186413 0.72564668
+6.12903226 0.86108583 0.80663311 0.80376431 0.73057543
+6.14858260 0.86359885 0.80872538 0.80563486 0.73546128
+6.16813294 0.86607786 0.81080547 0.80747596 0.74030266
+6.18768328 0.86852275 0.81287361 0.80928779 0.74509805
+6.20723363 0.87093343 0.81493003 0.81107057 0.74984600
+6.22678397 0.87330984 0.81697498 0.81282449 0.75454514
+6.24633431 0.87565193 0.81900870 0.81454979 0.75919419
+6.26588465 0.87795968 0.82103143 0.81624669 0.76379192
+6.28543500 0.88023310 0.82304345 0.81791545 0.76833719
+6.30498534 0.88247220 0.82504500 0.81955631 0.77282893
+6.32453568 0.88467703 0.82703636 0.82116954 0.77726615
+6.34408602 0.88684765 0.82901778 0.82275541 0.78164793
+6.36363636 0.88898414 0.83098955 0.82431419 0.78597341
+6.38318671 0.89108660 0.83295193 0.82584617 0.79024181
+6.40273705 0.89315515 0.83490520 0.82735164 0.79445242
+6.42228739 0.89518992 0.83684964 0.82883089 0.79860462
+6.44183773 0.89719107 0.83878553 0.83028423 0.80269781
+6.46138807 0.89915876 0.84071316 0.83171196 0.80673151
+6.48093842 0.90109317 0.84263280 0.97483764 0.81070526
+6.50048876 0.90299452 0.84454476 0.97547436 0.81461869
+6.52003910 0.90486301 0.84644930 0.97608412 0.81847150
+6.53958944 0.90669887 0.84834672 0.97666772 0.82226342
+6.55913978 0.90850234 0.85023730 0.97722592 0.82599427
+6.57869013 0.91027368 0.85212134 0.97775947 0.82966390
+6.59824047 0.91201316 0.85399912 0.97826913 0.83327224
+6.61779081 0.91372105 0.85587093 0.97875562 0.83681926
+6.63734115 0.91539764 0.85773706 0.97921968 0.84030499
+6.65689150 0.91704323 0.85959780 0.97966202 0.84372951
+6.67644184 0.91865814 0.86145344 0.98008333 0.84709293
+6.69599218 0.92024267 0.86330426 0.98048432 0.85039543
+6.71554252 0.92179717 0.86515054 0.98086564 0.85363723
+6.73509286 0.92332196 0.86699259 0.98122798 0.85681859
+6.75464321 0.92481739 0.86883067 0.98157197 0.85993981
+6.77419355 0.92628380 0.87066509 0.98189825 0.86300123
+6.79374389 0.92772156 0.87249611 0.98220746 0.86600323
+6.81329423 0.92913103 0.87432403 0.98250020 0.86894621
+6.83284457 0.93051258 0.87614913 0.98277707 0.87183064
+6.85239492 0.93186657 0.87797168 0.98303866 0.87465700
+6.87194526 0.93319339 0.87979197 0.98328553 0.87742578
+6.89149560 0.93449342 0.88161029 0.98351826 0.88013753
+6.91104594 0.93576703 0.88342689 0.98373738 0.88279282
+6.93059629 0.93701463 0.88524208 0.98394343 0.88539223
+6.95014663 0.93823660 0.88705612 0.98413693 0.88793639
+6.96969697 0.93943333 0.88886929 0.98431839 0.89042593
+6.98924731 0.94060521 0.89068186 0.98448831 0.89286151
+7.00879765 0.94175264 0.89249411 0.98464716 0.89524380
+7.02834800 0.94287603 0.89430632 0.98479541 0.89757349
+7.04789834 0.94397575 0.89611875 0.98493353 0.89985130
+7.06744868 0.94505222 0.89793168 0.98506196 0.90207795
+7.08699902 0.94610582 0.89974539 1.00259247 0.90425418
+7.10654936 0.94713696 0.90156014 1.00238083 0.90638073
+7.12609971 0.94814602 0.90337620 1.00216769 0.90845837
+7.14565005 0.94913341 0.90519386 1.00195327 0.91048786
+7.16520039 0.95009951 0.90701337 1.00173781 0.91246998
+7.18475073 0.95104471 0.90883501 1.00152151 0.91440550
+7.20430108 0.95196941 0.91065904 1.00130460 0.91629523
+7.22385142 0.95287399 0.91248575 1.00108726 0.91813995
+7.24340176 0.95375884 0.91431540 1.00086971 0.91994046
+7.26295210 0.95462433 0.91614827 1.00065213 0.92169756
+7.28250244 0.95547085 0.91798461 1.00043469 0.92341204
+7.30205279 0.95629877 0.91982472 1.00021759 0.92508472
+7.32160313 0.95710846 0.92166885 1.00000098 0.92671639
+7.34115347 0.95790029 0.92351729 0.99978504 0.92830784
+7.36070381 0.95867463 0.92537030 0.99956992 0.92985989
+7.38025415 0.95943184 0.92722817 0.99935578 0.93137332
+7.39980450 0.96017227 0.92909117 0.99914275 0.93284893
+7.41935484 0.96089627 0.93095958 0.99893099 0.93428750
+7.43890518 0.96160420 0.93283368 0.99872062 0.93568982
+7.45845552 0.96229640 0.93471375 0.99851177 0.93705667
+7.47800587 0.96297321 0.93660007 0.99830458 0.93838882
+7.49755621 0.96363497 0.93849292 0.99809915 0.93968703
+7.51710655 0.96428200 0.94039260 0.99789560 0.94095207
+7.53665689 0.96491463 0.94229940 0.99769404 0.94218468
+7.55620723 0.96553319 0.94421361 0.99749457 0.94338562
+7.57575758 0.96613799 0.94613551 0.99729729 0.94455562
+7.59530792 0.96672933 0.94806541 0.99710230 0.94569540
+7.61485826 0.96730754 0.95000362 0.99690968 0.94680568
+7.63440860 0.96787291 0.95195042 0.99671952 0.94788718
+7.65395894 0.96842573 0.95390614 0.99653190 0.94894060
+7.67350929 0.96896631 0.95587107 0.99634690 0.94996661
+7.69305963 0.96949491 0.95784555 0.99616458 0.95096592
+7.71260997 0.97001184 0.95982988 0.99598502 0.95193918
+7.73216031 0.97051736 0.96182438 0.99580829 0.95288706
+7.75171065 0.97101174 0.96382940 0.99563443 0.95381020
+7.77126100 0.97149526 0.96584525 0.99546352 0.95470925
+7.79081134 0.97196816 0.96787229 0.99529559 0.95558483
+7.81036168 0.97243072 0.96991084 0.99513071 0.95643756
+7.82991202 0.97288318 0.97196127 0.99496892 0.95726805
+7.84946237 0.97332579 0.97402392 0.99481026 0.95807688
+7.86901271 0.97375878 0.97609916 0.99465476 0.95886465
+7.88856305 0.97418240 0.97818736 0.99450248 0.95963193
+7.90811339 0.97459688 0.98028888 0.99435344 0.96037927
+7.92766373 0.97500244 0.98240413 0.99420766 0.96110724
+7.94721408 0.97539930 0.98453348 0.99406519 0.96181636
+7.96676442 0.97578769 0.98667733 0.99392605 0.96250716
+7.98631476 0.97616781 0.98883609 0.99379025 0.96318017
+8.00586510 0.97653987 0.99101018 0.99365782 0.96383588
+8.02541544 0.97690408 0.99320002 0.99352877 0.96447478
+8.04496579 0.97726064 0.99540605 0.99340312 0.96509738
+8.06451613 0.97760973 0.99762871 0.99328089 0.96570412
+8.08406647 0.97795155 0.99986845 0.99316207 0.96629548
+8.10361681 0.97828628 1.00212575 0.99304669 0.96687191
+8.12316716 0.97861410 1.00440109 0.99293474 0.96743383
+8.14271750 0.97893519 1.00669495 0.99282623 0.96798170
+8.16226784 0.97924973 1.00900784 0.99272116 0.96851591
+8.18181818 0.97955787 1.01134027 0.99261953 0.96903688
+8.20136852 0.97985979 1.01369278 0.99252134 0.96954500
+8.22091887 0.98015563 1.01606592 0.99242658 0.97004067
+8.24046921 0.98044557 1.01846025 0.99233525 0.97052425
+8.26001955 0.98072974 1.02087634 0.99224733 0.97099612
+8.27956989 0.98100831 1.02331480 0.99216283 0.97145664
+8.29912023 0.98128140 1.02577623 0.99208172 0.97190614
+8.31867058 0.98154917 1.02826127 0.99200400 0.97234497
+8.33822092 0.98181174 1.03077057 0.99192965 0.97277346
+8.35777126 0.98206926 1.03330481 0.99185866 0.97319192
+8.37732160 0.98232185 1.03586468 0.99179100 0.97360067
+8.39687195 0.98256963 1.03845090 0.99172666 0.97400001
+8.41642229 0.98281274 1.04106421 0.99166562 0.97439022
+8.43597263 0.98305128 1.04370538 0.99160786 0.97477159
+8.45552297 0.98328538 1.04637521 0.99155335 0.97514441
+8.47507331 0.98351515 1.04907452 0.99150208 0.97550893
+8.49462366 0.98374070 1.05180416 0.99145401 0.97586541
+8.51417400 0.98396213 1.05456502 0.99140911 0.97621410
+8.53372434 0.98417955 1.05735801 0.99136737 0.97655526
+8.55327468 0.98439305 1.06018409 0.99132875 0.97688910
+8.57282502 0.98460275 1.06304425 0.99129323 0.97721587
+8.59237537 0.98480873 1.06593951 0.99126076 0.97753578
+8.61192571 0.98501108 1.06887095 0.99123133 0.97784904
+8.63147605 0.98520990 1.07183967 0.99120489 0.97815586
+8.65102639 0.98540526 1.07484684 0.99118142 0.97845644
+8.67057674 0.98559727 1.07789367 0.99116087 0.97875098
+8.69012708 0.98578599 1.08098141 0.99114322 0.97903965
+8.70967742 0.98597150 1.08411138 0.99112843 0.97932265
+8.72922776 0.98615390 1.08728495 0.99111645 0.97960014
+8.74877810 0.98633324 1.09050355 0.99110726 0.97987228
+8.76832845 0.98650960 1.09376870 0.99110080 0.98013926
+8.78787879 0.98668306 1.09708195 0.99109706 0.98040121
+8.80742913 0.98685368 1.10044496 0.99109597 0.98065828
+8.82697947 0.98702152 1.10385944 0.99109750 0.98091064
+8.84652981 0.98718666 1.10732722 0.99110161 0.98115841
+8.86608016 0.98734915 1.11085019 0.99110826 0.98140172
+8.88563050 0.98750905 1.11443035 0.99111740 0.98164072
+8.90518084 0.98766643 1.11806981 0.99112899 0.98187552
+8.92473118 0.98782133 1.12177078 0.99114299 0.98210624
+8.94428152 0.98797382 1.12553560 0.99115934 0.98233301
+8.96383187 0.98812395 1.12936673 0.99117801 0.98255592
+8.98338221 0.98827177 1.13326677 0.99119894 0.98277510
+9.00293255 0.98841732 1.13723848 0.99122209 0.98299063
+9.02248289 0.98856067 1.14128478 0.99124742 0.98320263
+9.04203324 0.98870185 1.14540875 0.99127487 0.98341118
+9.06158358 0.98884091 1.14961369 0.99130439 0.98361638
+9.08113392 0.98897789 1.15390306 0.99133594 0.98381831
+9.10068426 0.98911284 1.15828058 0.99136946 0.98401706
+9.12023460 0.98924580 1.16275020 0.99140491 0.98421271
+9.13978495 0.98937681 1.16731614 0.99144224 0.98440534
+9.15933529 0.98950591 1.17198289 0.99148138 0.98459502
+9.17888563 0.98963313 1.17675529 0.99152230 0.98478183
+9.19843597 0.98975852 1.18163850 0.99156495 0.98496583
+9.21798631 0.98988210 1.18663807 0.99160925 0.98514709
+9.23753666 0.99000391 1.19175996 0.99165518 0.98532567
+9.25708700 0.99012399 1.19701060 0.99170266 0.98550164
+9.27663734 0.99024237 1.20239694 0.99175165 0.98567504
+9.29618768 0.99035907 1.20792650 0.99180209 0.98584595
+9.31573803 0.99047414 1.21360740 0.99185393 0.98601441
+9.33528837 0.99058759 1.21944852 0.99190712 0.98618047
+9.35483871 0.99069947 1.22545948 0.99196159 0.98634419
+9.37438905 0.99080979 1.23165082 0.99201729 0.98650560
+9.39393939 0.99091858 1.23803406 0.99207417 0.98666477
+9.41348974 0.99102587 1.24462188 0.99213217 0.98682172
+9.43304008 0.99113169 1.25142821 0.99219123 0.98697651
+9.45259042 0.99123605 1.25846848 0.99225130 0.98712918
+9.47214076 0.99133899 1.26575977 0.99231231 0.98727976
+9.49169110 0.99144053 1.27332111 0.99237422 0.98742829
+9.51124145 0.99154069 0.99216431 0.99243695 0.98757567
+9.53079179 0.99163949 0.99226267 0.99250046 0.98772003
+9.55034213 0.99173696 0.99235962 0.99256469 0.98786248
+9.56989247 0.99183312 0.99245521 0.99262957 0.98800306
+9.58944282 0.99192798 0.99254945 0.99269504 0.98814178
+9.60899316 0.99202157 0.99264235 0.99276106 0.98827868
+9.62854350 0.99211391 0.99273394 0.99282754 0.98841378
+9.64809384 0.99220501 0.99282425 0.99289445 0.98854710
+9.66764418 0.99229491 0.99291328 0.99296171 0.98867868
+9.68719453 0.99238360 0.99300107 0.99302927 0.98880853
+9.70674487 0.99247112 0.99308762 0.99309706 0.98893669
+9.72629521 0.99255748 0.99317296 0.99316502 0.98906317
+9.74584555 0.99264269 0.99325711 0.99323309 0.98918801
+9.76539589 0.99272679 0.99334008 0.99330122 0.98931121
+9.78494624 0.99280977 0.99342189 0.99336933 0.98943282
+9.80449658 0.99289166 0.99350256 0.99343736 0.98955285
+9.82404692 0.99297248 0.99358211 0.99350526 0.98967131
+9.84359726 0.99305223 0.99366056 0.99357296 0.98978825
+9.86314761 0.99313094 0.99373791 0.99364040 0.98990367
+9.88269795 0.99320862 0.99381420 0.99370751 0.99001760
+9.90224829 0.99328529 0.99388943 0.99377423 0.99013005
+9.92179863 0.99336096 0.99396362 0.99384049 0.99024106
+9.94134897 0.99343565 0.99403678 0.99390625 0.99035064
+9.96089932 0.99350936 0.99410894 0.99397142 0.99045881
+9.98044966 0.99358212 0.99418010 0.99403594 0.99056560
+10.00000000 0.99365393 0.99425029 0.99409976 0.99067101
diff --git a/examples/tsukamoto/tsukamoto.fll b/examples/tsukamoto/tsukamoto.fll
new file mode 100644
index 0000000..29ce437
--- /dev/null
+++ b/examples/tsukamoto/tsukamoto.fll
@@ -0,0 +1,59 @@
+Engine:
+InputVariable: X
+ enabled: true
+ range: -10.000 10.000
+ term: small Bell -10.000 5.000 3.000
+ term: medium Bell 0.000 5.000 3.000
+ term: large Bell 10.000 5.000 3.000
+OutputVariable: Ramps
+ enabled: true
+ range: 0.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage Automatic
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: b Ramp 0.600 0.400
+ term: a Ramp 0.000 0.250
+ term: c Ramp 0.700 1.000
+OutputVariable: Sigmoids
+ enabled: true
+ range: 0.020 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage Automatic
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: b Sigmoid 0.500 -30.000
+ term: a Sigmoid 0.130 30.000
+ term: c Sigmoid 0.830 30.000
+OutputVariable: ZSShapes
+ enabled: true
+ range: 0.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage Automatic
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: b ZShape 0.300 0.600
+ term: a SShape 0.000 0.250
+ term: c SShape 0.700 1.000
+OutputVariable: Concaves
+ enabled: true
+ range: 0.000 1.000
+ accumulation: none
+ defuzzifier: WeightedAverage Automatic
+ default: nan
+ lock-previous: false
+ lock-range: false
+ term: b Concave 0.500 0.400
+ term: a Concave 0.240 0.250
+ term: c Concave 0.900 1.000
+RuleBlock:
+ enabled: true
+ conjunction: none
+ disjunction: none
+ activation: none
+ rule: if X is small then Ramps is a and Sigmoids is a and ZSShapes is a and Concaves is a
+ rule: if X is medium then Ramps is b and Sigmoids is b and ZSShapes is b and Concaves is b
+ rule: if X is large then Ramps is c and Sigmoids is c and ZSShapes is c and Concaves is c \ No newline at end of file
diff --git a/examples/tsukamoto/tsukamoto.java b/examples/tsukamoto/tsukamoto.java
new file mode 100644
index 0000000..e8cc824
--- /dev/null
+++ b/examples/tsukamoto/tsukamoto.java
@@ -0,0 +1,96 @@
+import com.fuzzylite.*;
+import com.fuzzylite.defuzzifier.*;
+import com.fuzzylite.factory.*;
+import com.fuzzylite.hedge.*;
+import com.fuzzylite.imex.*;
+import com.fuzzylite.norm.*;
+import com.fuzzylite.norm.s.*;
+import com.fuzzylite.norm.t.*;
+import com.fuzzylite.rule.*;
+import com.fuzzylite.term.*;
+import com.fuzzylite.variable.*;
+
+public class tsukamoto{
+public static void main(String[] args){
+Engine engine = new Engine();
+engine.setName("");
+
+InputVariable inputVariable = new InputVariable();
+inputVariable.setEnabled(true);
+inputVariable.setName("X");
+inputVariable.setRange(-10.000, 10.000);
+inputVariable.addTerm(new Bell("small", -10.000, 5.000, 3.000));
+inputVariable.addTerm(new Bell("medium", 0.000, 5.000, 3.000));
+inputVariable.addTerm(new Bell("large", 10.000, 5.000, 3.000));
+engine.addInputVariable(inputVariable);
+
+OutputVariable outputVariable1 = new OutputVariable();
+outputVariable1.setEnabled(true);
+outputVariable1.setName("Ramps");
+outputVariable1.setRange(0.000, 1.000);
+outputVariable1.fuzzyOutput().setAccumulation(null);
+outputVariable1.setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable1.setDefaultValue(Double.NaN);
+outputVariable1.setLockPreviousOutputValue(false);
+outputVariable1.setLockOutputValueInRange(false);
+outputVariable1.addTerm(new Ramp("b", 0.600, 0.400));
+outputVariable1.addTerm(new Ramp("a", 0.000, 0.250));
+outputVariable1.addTerm(new Ramp("c", 0.700, 1.000));
+engine.addOutputVariable(outputVariable1);
+
+OutputVariable outputVariable2 = new OutputVariable();
+outputVariable2.setEnabled(true);
+outputVariable2.setName("Sigmoids");
+outputVariable2.setRange(0.020, 1.000);
+outputVariable2.fuzzyOutput().setAccumulation(null);
+outputVariable2.setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable2.setDefaultValue(Double.NaN);
+outputVariable2.setLockPreviousOutputValue(false);
+outputVariable2.setLockOutputValueInRange(false);
+outputVariable2.addTerm(new Sigmoid("b", 0.500, -30.000));
+outputVariable2.addTerm(new Sigmoid("a", 0.130, 30.000));
+outputVariable2.addTerm(new Sigmoid("c", 0.830, 30.000));
+engine.addOutputVariable(outputVariable2);
+
+OutputVariable outputVariable3 = new OutputVariable();
+outputVariable3.setEnabled(true);
+outputVariable3.setName("ZSShapes");
+outputVariable3.setRange(0.000, 1.000);
+outputVariable3.fuzzyOutput().setAccumulation(null);
+outputVariable3.setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable3.setDefaultValue(Double.NaN);
+outputVariable3.setLockPreviousOutputValue(false);
+outputVariable3.setLockOutputValueInRange(false);
+outputVariable3.addTerm(new ZShape("b", 0.300, 0.600));
+outputVariable3.addTerm(new SShape("a", 0.000, 0.250));
+outputVariable3.addTerm(new SShape("c", 0.700, 1.000));
+engine.addOutputVariable(outputVariable3);
+
+OutputVariable outputVariable4 = new OutputVariable();
+outputVariable4.setEnabled(true);
+outputVariable4.setName("Concaves");
+outputVariable4.setRange(0.000, 1.000);
+outputVariable4.fuzzyOutput().setAccumulation(null);
+outputVariable4.setDefuzzifier(new WeightedAverage("Automatic"));
+outputVariable4.setDefaultValue(Double.NaN);
+outputVariable4.setLockPreviousOutputValue(false);
+outputVariable4.setLockOutputValueInRange(false);
+outputVariable4.addTerm(new Concave("b", 0.500, 0.400));
+outputVariable4.addTerm(new Concave("a", 0.240, 0.250));
+outputVariable4.addTerm(new Concave("c", 0.900, 1.000));
+engine.addOutputVariable(outputVariable4);
+
+RuleBlock ruleBlock = new RuleBlock();
+ruleBlock.setEnabled(true);
+ruleBlock.setName("");
+ruleBlock.setConjunction(null);
+ruleBlock.setDisjunction(null);
+ruleBlock.setActivation(null);
+ruleBlock.addRule(Rule.parse("if X is small then Ramps is a and Sigmoids is a and ZSShapes is a and Concaves is a", engine));
+ruleBlock.addRule(Rule.parse("if X is medium then Ramps is b and Sigmoids is b and ZSShapes is b and Concaves is b", engine));
+ruleBlock.addRule(Rule.parse("if X is large then Ramps is c and Sigmoids is c and ZSShapes is c and Concaves is c", engine));
+engine.addRuleBlock(ruleBlock);
+
+
+}
+}
diff --git a/fuzzylite.png b/fuzzylite.png
new file mode 100644
index 0000000..f2ba82a
--- /dev/null
+++ b/fuzzylite.png
Binary files differ
diff --git a/fuzzylite/CMakeLists.txt b/fuzzylite/CMakeLists.txt
new file mode 100644
index 0000000..1fd21ec
--- /dev/null
+++ b/fuzzylite/CMakeLists.txt
@@ -0,0 +1,208 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(fuzzylite CXX)
+
+###DEFINES SECTION
+if(NOT CMAKE_VERBOSE_MAKEFILE)
+ set(CMAKE_VERBOSE_MAKEFILE false)
+endif()
+
+set(FL_VERSION 5.1)
+add_definitions(-DFL_VERSION="${FL_VERSION}")
+
+set(FL_DATE "1507")
+add_definitions(-DFL_DATE="${FL_DATE}")
+
+add_definitions(-DFL_BUILD_PATH="${CMAKE_SOURCE_DIR}") #used to determine FL__FILE__
+
+option(FL_BUILD_SHARED "Build shared library" ON)
+option(FL_BUILD_STATIC "Build static library" ON)
+if(FL_BUILD_SHARED)
+ option(FL_BUILD_BINARY "Build fuzzylite binary" ON)
+endif()
+
+option(FL_USE_FLOAT "Use fl::scalar as float" OFF)
+option(FL_BACKTRACE "Provide backtrace information in case of errors" OFF)
+option(FL_CPP11 "Builds utilizing C++11, i.e., passing -std=c++11" OFF)
+
+if(FL_CPP11 AND MSVC)
+ message("Warning: MSVC not compatible with FL_CPP11 flag")
+endif()
+
+if(FL_USE_FLOAT)
+ add_definitions(-DFL_USE_FLOAT)
+endif(FL_USE_FLOAT)
+
+if(NOT FL_BACKTRACE)
+ add_definitions(-DFL_BACKTRACE_OFF)
+endif()
+
+if(FL_CPP11)
+ add_definitions(-DFL_CPP11)
+ if(NOT MSVC)
+ add_definitions(-std=c++11)
+ endif(NOT MSVC)
+endif(FL_CPP11)
+
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY bin)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY bin)
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
+
+if(NOT MSVC)
+ set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra ${CMAKE_CXX_FLAGS}")
+ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
+ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
+
+ if(NOT APPLE)
+ set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}") #To avoid undefined methods in library
+ endif()
+endif()
+
+if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-non-literal-null-conversion")
+endif()
+
+set(FL_LIBS)
+
+if(MSVC)
+ set(CMAKE_CXX_FLAGS "/W4 /EHsc")
+ #Wx: Treat warnings as errors. W4: All warnings
+ #http://msdn.microsoft.com/en-us/library/thxezb7y.aspx
+ #EHsc: call destructors on __try __catch, and to ignore C4530: C++ exception handler used. Note, unwind semantics are not enabled
+ if (FL_BACKTRACE)
+ set(FL_LIBS dbghelp)
+ endif()
+endif()
+
+###BUILD SECTION
+
+include_directories(.)
+if (APPLE)
+ cmake_policy(SET CMP0042 NEW)
+endif()
+
+file(STRINGS FL_HEADERS fl-headers)
+file(STRINGS FL_SOURCES fl-sources)
+
+string(REGEX REPLACE "\n" " " ${fl-headers} ${fl-headers})
+string(REGEX REPLACE "\n" " " ${fl-sources} ${fl-sources})
+
+message("${exepath}")
+
+
+set(CMAKE_DEBUG_POSTFIX d)
+
+if (MSVC OR CMAKE_GENERATOR STREQUAL Xcode)
+ if(FL_BUILD_SHARED)
+ add_library(fl-shared SHARED ${fl-headers} ${fl-sources})
+ endif()
+
+ if(FL_BUILD_STATIC)
+ add_library(fl-static STATIC ${fl-headers} ${fl-sources})
+ endif()
+else()
+ if(FL_BUILD_SHARED OR FL_BUILD_STATIC)
+ add_library(fl-obj OBJECT ${fl-headers} ${fl-sources})
+ if(NOT MINGW)
+ set_target_properties(fl-obj PROPERTIES COMPILE_FLAGS "-fPIC")
+ endif()
+ endif()
+
+ if(FL_BUILD_SHARED)
+ add_library(fl-shared SHARED $<TARGET_OBJECTS:fl-obj>)
+ endif(FL_BUILD_SHARED)
+
+ if(FL_BUILD_STATIC)
+ add_library(fl-static STATIC $<TARGET_OBJECTS:fl-obj>)
+ endif(FL_BUILD_STATIC)
+endif()
+
+if(FL_BUILD_SHARED)
+ set_target_properties(fl-shared PROPERTIES OUTPUT_NAME fuzzylite)
+ set_target_properties(fl-shared PROPERTIES DEBUG_POSTFIX d)
+ set_target_properties(fl-shared PROPERTIES COMPILE_DEFINITIONS "FL_EXPORT_LIBRARY")
+ set_target_properties(fl-shared PROPERTIES VERSION 5.1)
+ target_link_libraries(fl-shared ${FL_LIBS})
+endif()
+
+if(FL_BUILD_STATIC)
+ set_target_properties(fl-static PROPERTIES OUTPUT_NAME fuzzylite-static)
+ set_target_properties(fl-static PROPERTIES DEBUG_POSTFIX d)
+ set_target_properties(fl-static PROPERTIES VERSION 5.1)
+ target_link_libraries(fl-static ${FL_LIBS})
+endif()
+
+if(FL_BUILD_BINARY)
+ add_executable(fl-bin src/main.cpp)
+ set_target_properties(fl-bin PROPERTIES OUTPUT_NAME fuzzylite)
+ set_target_properties(fl-bin PROPERTIES OUTPUT_NAME fuzzylite IMPORT_PREFIX tmp-) #To prevent LNK1149 in Windows
+ set_target_properties(fl-bin PROPERTIES DEBUG_POSTFIX d)
+
+ set_target_properties(fl-bin PROPERTIES COMPILE_DEFINITIONS "FL_IMPORT_LIBRARY")
+ target_link_libraries(fl-bin fl-shared ${FL_LIBS})
+endif(FL_BUILD_BINARY)
+
+###INSTALL SECTION
+if(NOT FL_INSTALL_BINDIR)
+ set(FL_INSTALL_BINDIR bin)
+endif()
+
+if(NOT FL_INSTALL_LIBDIR)
+ if(NOT CMAKE_INSTALL_LIBDIR)
+ set(FL_INSTALL_LIBDIR lib)
+ else()
+ set(FL_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
+ endif()
+endif()
+
+if(FL_BUILD_BINARY)
+ install(TARGETS fl-bin
+ RUNTIME DESTINATION ${FL_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${FL_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${FL_INSTALL_LIBDIR}
+ )
+endif()
+
+if(FL_BUILD_SHARED)
+ install(TARGETS fl-shared
+ RUNTIME DESTINATION ${FL_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${FL_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${FL_INSTALL_LIBDIR}
+ )
+endif()
+
+if(FL_BUILD_STATIC)
+ install(TARGETS fl-static
+ RUNTIME DESTINATION ${FL_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${FL_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${FL_INSTALL_LIBDIR}
+ )
+endif()
+
+install(DIRECTORY fl/ DESTINATION include/fl)
+
+#pkg-config
+configure_file(${CMAKE_SOURCE_DIR}/fuzzylite.pc.in ${CMAKE_BINARY_DIR}/fuzzylite.pc @ONLY)
+install(FILES ${CMAKE_BINARY_DIR}/fuzzylite.pc DESTINATION lib/pkgconfig)
+
+message("=====================================")
+message("fuzzylite v.${FL_VERSION}b${FL_DATE}\n")
+message("FL_USE_FLOAT=${FL_USE_FLOAT}")
+message("FL_CPP11=${FL_CPP11}")
+message("FL_BACKTRACE=${FL_BACKTRACE}")
+message("FL_INSTALL_BINDIR=${FL_INSTALL_BINDIR}")
+message("FL_INSTALL_LIBDIR=${FL_INSTALL_LIBDIR}")
+message("Build=${CMAKE_BUILD_TYPE}")
+message("=====================================\n")
+
+###UNINSTALL SECTION
+#configure_file(
+ #"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+ #"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+ #IMMEDIATE @ONLY)
+
+#add_custom_target(uninstall
+ #COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake)
+
+#unix uninstall
+#xargs rm < install_manifest.txt
diff --git a/fuzzylite/FL_HEADERS b/fuzzylite/FL_HEADERS
new file mode 100644
index 0000000..f8b578c
--- /dev/null
+++ b/fuzzylite/FL_HEADERS
@@ -0,0 +1,92 @@
+fl/Console.h
+fl/defuzzifier/Bisector.h
+fl/defuzzifier/Centroid.h
+fl/defuzzifier/Defuzzifier.h
+fl/defuzzifier/IntegralDefuzzifier.h
+fl/defuzzifier/LargestOfMaximum.h
+fl/defuzzifier/MeanOfMaximum.h
+fl/defuzzifier/SmallestOfMaximum.h
+fl/defuzzifier/WeightedAverage.h
+fl/defuzzifier/WeightedDefuzzifier.h
+fl/defuzzifier/WeightedSum.h
+fl/Engine.h
+fl/Exception.h
+fl/factory/CloningFactory.h
+fl/factory/ConstructionFactory.h
+fl/factory/DefuzzifierFactory.h
+fl/factory/FactoryManager.h
+fl/factory/FunctionFactory.h
+fl/factory/HedgeFactory.h
+fl/factory/SNormFactory.h
+fl/factory/TermFactory.h
+fl/factory/TNormFactory.h
+fl/fuzzylite.h
+fl/Headers.h
+fl/hedge/Any.h
+fl/hedge/Extremely.h
+fl/hedge/Hedge.h
+fl/hedge/Not.h
+fl/hedge/Seldom.h
+fl/hedge/Somewhat.h
+fl/hedge/Very.h
+fl/imex/CppExporter.h
+fl/imex/Exporter.h
+fl/imex/FclExporter.h
+fl/imex/FclImporter.h
+fl/imex/FisExporter.h
+fl/imex/FisImporter.h
+fl/imex/FldExporter.h
+fl/imex/FllExporter.h
+fl/imex/FllImporter.h
+fl/imex/Importer.h
+fl/imex/JavaExporter.h
+fl/norm/Norm.h
+fl/norm/s/AlgebraicSum.h
+fl/norm/s/BoundedSum.h
+fl/norm/s/DrasticSum.h
+fl/norm/s/EinsteinSum.h
+fl/norm/s/HamacherSum.h
+fl/norm/s/Maximum.h
+fl/norm/s/NilpotentMaximum.h
+fl/norm/s/NormalizedSum.h
+fl/norm/SNorm.h
+fl/norm/t/AlgebraicProduct.h
+fl/norm/t/BoundedDifference.h
+fl/norm/t/DrasticProduct.h
+fl/norm/t/EinsteinProduct.h
+fl/norm/t/HamacherProduct.h
+fl/norm/t/Minimum.h
+fl/norm/t/NilpotentMinimum.h
+fl/norm/TNorm.h
+fl/Operation.h
+fl/rule/Antecedent.h
+fl/rule/Consequent.h
+fl/rule/Expression.h
+fl/rule/RuleBlock.h
+fl/rule/Rule.h
+fl/term/Accumulated.h
+fl/term/Activated.h
+fl/term/Bell.h
+fl/term/Concave.h
+fl/term/Constant.h
+fl/term/Cosine.h
+fl/term/Discrete.h
+fl/term/Function.h
+fl/term/Gaussian.h
+fl/term/GaussianProduct.h
+fl/term/Linear.h
+fl/term/PiShape.h
+fl/term/Ramp.h
+fl/term/Rectangle.h
+fl/term/SigmoidDifference.h
+fl/term/Sigmoid.h
+fl/term/SigmoidProduct.h
+fl/term/Spike.h
+fl/term/SShape.h
+fl/term/Term.h
+fl/term/Trapezoid.h
+fl/term/Triangle.h
+fl/term/ZShape.h
+fl/variable/InputVariable.h
+fl/variable/OutputVariable.h
+fl/variable/Variable.h
diff --git a/fuzzylite/FL_SOURCES b/fuzzylite/FL_SOURCES
new file mode 100644
index 0000000..64d07f9
--- /dev/null
+++ b/fuzzylite/FL_SOURCES
@@ -0,0 +1,87 @@
+src/Console.cpp
+src/defuzzifier/Bisector.cpp
+src/defuzzifier/Centroid.cpp
+src/defuzzifier/IntegralDefuzzifier.cpp
+src/defuzzifier/LargestOfMaximum.cpp
+src/defuzzifier/MeanOfMaximum.cpp
+src/defuzzifier/SmallestOfMaximum.cpp
+src/defuzzifier/WeightedAverage.cpp
+src/defuzzifier/WeightedDefuzzifier.cpp
+src/defuzzifier/WeightedSum.cpp
+src/Engine.cpp
+src/Exception.cpp
+src/factory/CloningFactory.cpp
+src/factory/ConstructionFactory.cpp
+src/factory/DefuzzifierFactory.cpp
+src/factory/FactoryManager.cpp
+src/factory/FunctionFactory.cpp
+src/factory/HedgeFactory.cpp
+src/factory/SNormFactory.cpp
+src/factory/TermFactory.cpp
+src/factory/TNormFactory.cpp
+src/fuzzylite.cpp
+src/hedge/Any.cpp
+src/hedge/Extremely.cpp
+src/hedge/Not.cpp
+src/hedge/Seldom.cpp
+src/hedge/Somewhat.cpp
+src/hedge/Very.cpp
+src/imex/CppExporter.cpp
+src/imex/Exporter.cpp
+src/imex/FclExporter.cpp
+src/imex/FclImporter.cpp
+src/imex/FisExporter.cpp
+src/imex/FisImporter.cpp
+src/imex/FldExporter.cpp
+src/imex/FllExporter.cpp
+src/imex/FllImporter.cpp
+src/imex/Importer.cpp
+src/imex/JavaExporter.cpp
+src/main.cpp
+src/norm/s/AlgebraicSum.cpp
+src/norm/s/BoundedSum.cpp
+src/norm/s/DrasticSum.cpp
+src/norm/s/EinsteinSum.cpp
+src/norm/s/HamacherSum.cpp
+src/norm/s/Maximum.cpp
+src/norm/s/NilpotentMaximum.cpp
+src/norm/s/NormalizedSum.cpp
+src/norm/t/AlgebraicProduct.cpp
+src/norm/t/BoundedDifference.cpp
+src/norm/t/DrasticProduct.cpp
+src/norm/t/EinsteinProduct.cpp
+src/norm/t/HamacherProduct.cpp
+src/norm/t/Minimum.cpp
+src/norm/t/NilpotentMinimum.cpp
+src/Operation.cpp
+src/rule/Antecedent.cpp
+src/rule/Consequent.cpp
+src/rule/Expression.cpp
+src/rule/RuleBlock.cpp
+src/rule/Rule.cpp
+src/term/Accumulated.cpp
+src/term/Activated.cpp
+src/term/Bell.cpp
+src/term/Concave.cpp
+src/term/Constant.cpp
+src/term/Cosine.cpp
+src/term/Discrete.cpp
+src/term/Function.cpp
+src/term/Gaussian.cpp
+src/term/GaussianProduct.cpp
+src/term/Linear.cpp
+src/term/PiShape.cpp
+src/term/Ramp.cpp
+src/term/Rectangle.cpp
+src/term/Sigmoid.cpp
+src/term/SigmoidDifference.cpp
+src/term/SigmoidProduct.cpp
+src/term/Spike.cpp
+src/term/SShape.cpp
+src/term/Term.cpp
+src/term/Trapezoid.cpp
+src/term/Triangle.cpp
+src/term/ZShape.cpp
+src/variable/InputVariable.cpp
+src/variable/OutputVariable.cpp
+src/variable/Variable.cpp
diff --git a/fuzzylite/build.bat b/fuzzylite/build.bat
new file mode 100644
index 0000000..17f5b6d
--- /dev/null
+++ b/fuzzylite/build.bat
@@ -0,0 +1,105 @@
+@echo off
+setlocal EnableDelayedExpansion
+set argc=0
+set valid="no"
+
+for %%a in (%*) do (
+ set /A argc+=1
+ if /I "%%a"=="help" (
+ call:usage
+ goto:eof
+ )
+ if /I "%%a"=="all" set valid="yes"
+ if /I "%%a"=="release" set valid="yes"
+ if /I "%%a"=="debug" set valid="yes"
+ if /I "%%a"=="clean" set valid="yes"
+
+ if !valid!=="no" (
+ echo Invalid option: %%a
+ call:usage
+ goto:eof
+ )
+)
+
+if %argc%==0 echo Building schedule: all
+if not %argc%==0 echo Building schedule: %*
+echo Starting in 3 seconds...
+ping 1.1.1.1 -n 1 -w 3000 > nul
+rem sleep 3 ::This function makes command line DOS-esque C:\Archiv~1
+
+if %argc%==0 (call:all)
+
+for %%a in (%*) do (call:%%a)
+
+goto:eof
+
+:debug
+ echo.
+ echo.
+ echo ****************************************
+ echo STARTING: debug
+
+ if not exist debug mkdir debug
+ cd debug
+ cmake .. -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Debug -DFL_BACKTRACE=ON -DFL_USE_FLOAT=OFF -DFL_CPP11=OFF
+ nmake
+ cd ..
+
+ echo.
+ echo FINISHED: debug
+ echo ****************************************
+ goto:eof
+
+:release
+ echo.
+ echo.
+ echo ****************************************
+ echo STARTING: release
+
+ if not exist release mkdir release
+ cd release
+ cmake .. -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DFL_BACKTRACE=OFF -DFL_USE_FLOAT=OFF -DFL_CPP11=OFF
+ nmake
+ cd ..
+
+ echo.
+ echo FINISHED: release
+ echo ****************************************
+ goto:eof
+
+:all
+ echo.
+ echo.
+ echo ****************************************
+ echo STARTING: all
+ call:debug
+ call:release
+ echo.
+ echo FINISHED: all
+ echo ****************************************
+ goto:eof
+
+:clean
+ echo.
+ echo.
+ echo ****************************************
+ echo STARTING: clean
+ if exist debug rmdir /S /Q debug
+ if exist release rmdir /S /Q release
+ if exist CMakeFiles rmdir /S /Q CMakeFiles
+ echo.
+ echo FINISHED: clean
+ echo ****************************************
+ goto:eof
+
+:usage
+ echo Usage: build.bat [options]
+ echo where [options] can be any of the following:
+ echo ^ all builds fuzzylite in debug and release mode (default)
+ echo ^ debug builds fuzzylite in debug mode
+ echo ^ release builds fuzzylite in release mode
+ echo ^ clean erases previous builds
+ echo ^ help shows this information
+ echo.
+
+ENDLOCAL \ No newline at end of file
diff --git a/fuzzylite/build.sh b/fuzzylite/build.sh
new file mode 100755
index 0000000..78343c4
--- /dev/null
+++ b/fuzzylite/build.sh
@@ -0,0 +1,70 @@
+#!/bin/bash
+
+debug(){
+ mkdir -p debug
+ cd debug
+ cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DFL_BACKTRACE=ON -DFL_USE_FLOAT=OFF -DFL_CPP11=OFF
+ make
+ cd ..
+}
+
+release(){
+ mkdir -p release
+ cd release
+ cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DFL_BACKTRACE=ON -DFL_USE_FLOAT=OFF -DFL_CPP11=OFF
+ make
+ cd ..
+}
+
+all(){
+ debug
+ release
+}
+
+clean(){
+ rm -rf release debug CMakeFiles
+}
+
+usage(){
+ printf 'Usage:\t[bash] ./build.sh [options]\n'
+ printf "where\t[options] can be any of the following:\n"
+ printf "\tall\t\t builds fuzzylite in debug and release mode (default)\n"
+ printf "\tdebug\t\t builds fuzzylite in debug mode\n"
+ printf "\trelease\t\t builds fuzzylite in release mode\n"
+ printf "\tclean\t\t erases previous builds\n"
+ printf "\thelp\t\t shows this information\n"
+ printf "\n"
+}
+
+#############################
+
+OPTIONS=( "all" "debug" "release" "clean" "help")
+BUILD=( )
+
+for arg in "$@"
+do
+ if [[ "$arg" == "help" ]]; then usage && exit 0; fi
+
+ if [[ "$arg" == "all" || "$arg" == "debug" || "$arg" == "release" || "$arg" == "clean" ]];
+ then BUILD+=( $arg ); else echo "Invalid option: $arg" && usage && exit 2;
+ fi
+done
+
+if [ ${#BUILD[@]} -eq 0 ]; then BUILD+=( "all" ); fi
+
+echo "Building schedule: ${BUILD[@]}"
+echo "Starting in 3 seconds..."
+sleep 3
+
+for option in "${BUILD[@]}"
+do
+ printf "\n\n"
+ printf "******************************\n"
+ printf "STARTING: $option\n"
+ eval ${option}
+ printf "\nFINISHED: $option\n"
+ printf "******************************\n\n"
+done
+
+
+
diff --git a/fuzzylite/fl/Console.h b/fuzzylite/fl/Console.h
new file mode 100644
index 0000000..59e818d
--- /dev/null
+++ b/fuzzylite/fl/Console.h
@@ -0,0 +1,90 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_CONSOLE_H
+#define FL_CONSOLE_H
+
+#include "fl/fuzzylite.h"
+
+#include <map>
+#include <string>
+#include <vector>
+
+namespace fl {
+ class Engine;
+
+ class FL_API Console {
+ public:
+
+ struct Option {
+ std::string key, value, description;
+
+ explicit Option(const std::string& key = "", const std::string& value = "", const std::string& description = "") :
+ key(key), value(value), description(description) {
+ }
+ };
+
+ static const std::string KW_INPUT_FILE;
+ static const std::string KW_INPUT_FORMAT;
+ static const std::string KW_OUTPUT_FILE;
+ static const std::string KW_OUTPUT_FORMAT;
+ static const std::string KW_EXAMPLE;
+ static const std::string KW_DECIMALS;
+ static const std::string KW_DATA_INPUT;
+ static const std::string KW_DATA_MAXIMUM;
+ static const std::string KW_DATA_EXPORT_HEADER;
+ static const std::string KW_DATA_EXPORT_INPUTS;
+
+ static Engine* mamdani();
+ static Engine* takagiSugeno();
+
+ protected:
+ static std::map<std::string, std::string> parse(int argc, char** argv);
+ static void process(const std::map<std::string, std::string>& options);
+
+ static void process(const std::string& input, std::ostream& writer,
+ const std::string& inputFormat, const std::string& outputFormat,
+ const std::map<std::string, std::string>& options);
+
+ static int readCharacter();
+ static void interactive(std::ostream& writer, Engine* engine);
+ static std::string interactiveHelp();
+
+ static void exportAllExamples(const std::string& from, const std::string& to);
+ static void exportAllExamples(const std::string& from, const std::string& to, const std::string& path);
+#ifdef FL_CPP11
+ static void benchmarkExamples(const std::string& path, int runs);
+#endif
+
+ public:
+ static std::string usage();
+ static std::vector<Option> availableOptions();
+
+ static int main(int argc, char** argv);
+ };
+
+}
+
+#endif /* FL_CONSOLE_H */
+
diff --git a/fuzzylite/fl/Engine.h b/fuzzylite/fl/Engine.h
new file mode 100644
index 0000000..532c5e9
--- /dev/null
+++ b/fuzzylite/fl/Engine.h
@@ -0,0 +1,152 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_ENGINE_H
+#define FL_ENGINE_H
+
+#include "fl/fuzzylite.h"
+
+#include "fl/defuzzifier/IntegralDefuzzifier.h"
+
+#include <string>
+#include <vector>
+
+namespace fl {
+
+ class InputVariable;
+ class OutputVariable;
+ class Variable;
+ class RuleBlock;
+ class Hedge;
+ class TNorm;
+ class SNorm;
+ class Defuzzifier;
+
+ class FL_API Engine {
+ private:
+ void copyFrom(const Engine& source);
+ protected:
+ std::string _name;
+ std::vector<InputVariable*> _inputVariables;
+ std::vector<OutputVariable*> _outputVariables;
+ std::vector<RuleBlock*> _ruleblocks;
+
+ void updateReferences() const;
+
+ public:
+ explicit Engine(const std::string& name = "");
+ Engine(const Engine& other);
+ Engine& operator=(const Engine& other);
+ virtual ~Engine();
+ FL_DEFAULT_MOVE(Engine)
+
+ //TODO: remove int resolution in v6.0
+ virtual void configure(const std::string& conjunctionT,
+ const std::string& disjunctionS,
+ const std::string& activationT,
+ const std::string& accumulationS,
+ const std::string& defuzzifier,
+ int resolution = IntegralDefuzzifier::defaultResolution());
+
+ virtual void configure(TNorm* conjunction, SNorm* disjunction,
+ TNorm* activation, SNorm* accumulation,
+ Defuzzifier* defuzzifier);
+
+ virtual bool isReady(std::string* status = fl::null) const;
+
+ virtual void process();
+
+ virtual void restart();
+
+ virtual void setName(const std::string& name);
+ virtual std::string getName() const;
+
+ virtual void setInputValue(const std::string& name, scalar value);
+ virtual scalar getOutputValue(const std::string& name);
+
+
+ virtual std::string toString() const;
+
+ enum Type {
+ Mamdani, Larsen, TakagiSugeno,
+ Tsukamoto, InverseTsukamoto, Hybrid, Unknown
+ };
+ virtual Type type(std::string* name = fl::null, std::string* reason = fl::null) const;
+
+ virtual Engine* clone() const;
+
+ virtual std::vector<Variable*> variables() const;
+
+ /**
+ * Operations for iterable datatype _inputVariables
+ */
+ virtual void addInputVariable(InputVariable* inputVariable);
+ virtual InputVariable* setInputVariable(InputVariable* inputVariable, int index);
+ virtual void insertInputVariable(InputVariable* inputVariable, int index);
+ virtual InputVariable* getInputVariable(int index) const;
+ virtual InputVariable* getInputVariable(const std::string& name) const;
+ virtual InputVariable* removeInputVariable(int index);
+ virtual InputVariable* removeInputVariable(const std::string& name);
+ virtual bool hasInputVariable(const std::string& name) const;
+ virtual int numberOfInputVariables() const;
+ virtual const std::vector<InputVariable*>& inputVariables() const;
+ virtual void setInputVariables(const std::vector<InputVariable*>& inputVariables);
+ virtual std::vector<InputVariable*>& inputVariables();
+
+ /**
+ * Operations for iterable datatype _outputVariables
+ */
+ virtual void addOutputVariable(OutputVariable* outputVariable);
+ virtual OutputVariable* setOutputVariable(OutputVariable* outputVariable, int index);
+ virtual void insertOutputVariable(OutputVariable* outputVariable, int index);
+ virtual OutputVariable* getOutputVariable(int index) const;
+ virtual OutputVariable* getOutputVariable(const std::string& name) const;
+ virtual bool hasOutputVariable(const std::string& name) const;
+ virtual OutputVariable* removeOutputVariable(int index);
+ virtual OutputVariable* removeOutputVariable(const std::string& name);
+ virtual int numberOfOutputVariables() const;
+ virtual const std::vector<OutputVariable*>& outputVariables() const;
+ virtual void setOutputVariables(const std::vector<OutputVariable*>& outputVariables);
+ virtual std::vector<OutputVariable*>& outputVariables();
+
+ /**
+ * Operations for iterable datatype _ruleblocks
+ */
+ virtual void addRuleBlock(RuleBlock* ruleblock);
+ virtual RuleBlock* setRuleBlock(RuleBlock* ruleBlock, int index);
+ virtual void insertRuleBlock(RuleBlock* ruleblock, int index);
+ virtual RuleBlock* getRuleBlock(int index) const;
+ virtual RuleBlock* getRuleBlock(const std::string& name) const;
+ virtual bool hasRuleBlock(const std::string& name) const;
+ virtual RuleBlock* removeRuleBlock(int index);
+ virtual RuleBlock* removeRuleBlock(const std::string& name);
+ virtual int numberOfRuleBlocks() const;
+ virtual const std::vector<RuleBlock*>& ruleBlocks() const;
+ virtual void setRuleBlocks(const std::vector<RuleBlock*>& ruleBlocks);
+ virtual std::vector<RuleBlock*>& ruleBlocks();
+
+ };
+
+}
+#endif /* FL_ENGINE_H */
diff --git a/fuzzylite/fl/Exception.h b/fuzzylite/fl/Exception.h
new file mode 100644
index 0000000..f33fb13
--- /dev/null
+++ b/fuzzylite/fl/Exception.h
@@ -0,0 +1,66 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_EXCEPTION_H
+#define FL_EXCEPTION_H
+
+#include "fl/fuzzylite.h"
+
+#include <exception>
+#include <string>
+#include <vector>
+
+namespace fl {
+
+ class FL_API Exception : public std::exception {
+ protected:
+ std::string _what;
+ public:
+ explicit Exception(const std::string& what);
+ Exception(const std::string& what, const std::string& file, int line,
+ const std::string& function);
+ virtual ~Exception() FL_INOEXCEPT FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Exception)
+
+ virtual void setWhat(const std::string& what);
+ virtual std::string getWhat() const;
+ virtual const char* what() const FL_INOEXCEPT FL_IOVERRIDE;
+
+ virtual void append(const std::string& whatElse);
+ virtual void append(const std::string& file, int line, const std::string& function);
+ virtual void append(const std::string& whatElse,
+ const std::string& file, int line, const std::string& function);
+
+ static std::string btCallStack();
+
+ static void signalHandler(int signal);
+ static void convertToException(int signal);
+ static void terminate();
+ static void catchException(const std::exception& exception);
+
+
+ };
+
+}
+#endif /* FL_EXCEPTION_H */
diff --git a/fuzzylite/fl/Headers.h b/fuzzylite/fl/Headers.h
new file mode 100644
index 0000000..9c2299a
--- /dev/null
+++ b/fuzzylite/fl/Headers.h
@@ -0,0 +1,131 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_HEADERS_H
+#define FL_HEADERS_H
+
+#include "fl/fuzzylite.h"
+
+#include "fl/Console.h"
+#include "fl/Engine.h"
+#include "fl/Exception.h"
+
+#include "fl/defuzzifier/Bisector.h"
+#include "fl/defuzzifier/Centroid.h"
+#include "fl/defuzzifier/Defuzzifier.h"
+#include "fl/defuzzifier/IntegralDefuzzifier.h"
+#include "fl/defuzzifier/SmallestOfMaximum.h"
+#include "fl/defuzzifier/LargestOfMaximum.h"
+#include "fl/defuzzifier/MeanOfMaximum.h"
+#include "fl/defuzzifier/WeightedAverage.h"
+#include "fl/defuzzifier/WeightedDefuzzifier.h"
+#include "fl/defuzzifier/WeightedSum.h"
+
+#include "fl/factory/CloningFactory.h"
+#include "fl/factory/ConstructionFactory.h"
+#include "fl/factory/FactoryManager.h"
+#include "fl/factory/FunctionFactory.h"
+#include "fl/factory/DefuzzifierFactory.h"
+#include "fl/factory/HedgeFactory.h"
+#include "fl/factory/SNormFactory.h"
+#include "fl/factory/TNormFactory.h"
+#include "fl/factory/TermFactory.h"
+
+#include "fl/imex/CppExporter.h"
+#include "fl/imex/FclImporter.h"
+#include "fl/imex/FclExporter.h"
+#include "fl/imex/FisImporter.h"
+#include "fl/imex/FisExporter.h"
+#include "fl/imex/FldExporter.h"
+#include "fl/imex/FllImporter.h"
+#include "fl/imex/FllExporter.h"
+#include "fl/imex/JavaExporter.h"
+
+#include "fl/hedge/Any.h"
+#include "fl/hedge/Extremely.h"
+#include "fl/hedge/Hedge.h"
+#include "fl/hedge/Not.h"
+#include "fl/hedge/Seldom.h"
+#include "fl/hedge/Somewhat.h"
+#include "fl/hedge/Very.h"
+
+#include "fl/Operation.h"
+
+#include "fl/norm/Norm.h"
+#include "fl/norm/SNorm.h"
+#include "fl/norm/TNorm.h"
+
+#include "fl/norm/s/AlgebraicSum.h"
+#include "fl/norm/s/BoundedSum.h"
+#include "fl/norm/s/DrasticSum.h"
+#include "fl/norm/s/EinsteinSum.h"
+#include "fl/norm/s/HamacherSum.h"
+#include "fl/norm/s/Maximum.h"
+#include "fl/norm/s/NilpotentMaximum.h"
+#include "fl/norm/s/NormalizedSum.h"
+
+#include "fl/norm/t/AlgebraicProduct.h"
+#include "fl/norm/t/BoundedDifference.h"
+#include "fl/norm/t/DrasticProduct.h"
+#include "fl/norm/t/EinsteinProduct.h"
+#include "fl/norm/t/HamacherProduct.h"
+#include "fl/norm/t/Minimum.h"
+#include "fl/norm/t/NilpotentMinimum.h"
+
+#include "fl/rule/Antecedent.h"
+#include "fl/rule/Consequent.h"
+#include "fl/rule/Rule.h"
+#include "fl/rule/RuleBlock.h"
+#include "fl/rule/Expression.h"
+
+#include "fl/term/Accumulated.h"
+#include "fl/term/Bell.h"
+#include "fl/term/Concave.h"
+#include "fl/term/Constant.h"
+#include "fl/term/Cosine.h"
+#include "fl/term/Discrete.h"
+#include "fl/term/Function.h"
+#include "fl/term/Gaussian.h"
+#include "fl/term/GaussianProduct.h"
+#include "fl/term/Linear.h"
+#include "fl/term/PiShape.h"
+#include "fl/term/Ramp.h"
+#include "fl/term/Rectangle.h"
+#include "fl/term/SShape.h"
+#include "fl/term/Sigmoid.h"
+#include "fl/term/SigmoidDifference.h"
+#include "fl/term/SigmoidProduct.h"
+#include "fl/term/Spike.h"
+#include "fl/term/Term.h"
+#include "fl/term/Activated.h"
+#include "fl/term/Trapezoid.h"
+#include "fl/term/Triangle.h"
+#include "fl/term/ZShape.h"
+
+#include "fl/variable/InputVariable.h"
+#include "fl/variable/OutputVariable.h"
+#include "fl/variable/Variable.h"
+
+
+#endif /* FL_HEADERS_H */
diff --git a/fuzzylite/fl/Operation.h b/fuzzylite/fl/Operation.h
new file mode 100644
index 0000000..d92e66c
--- /dev/null
+++ b/fuzzylite/fl/Operation.h
@@ -0,0 +1,144 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_OPERATION_H
+#define FL_OPERATION_H
+
+#include "fl/fuzzylite.h"
+
+#include "fl/Exception.h"
+
+#include <string>
+#include <vector>
+
+namespace fl {
+
+ class FL_API Operation {
+ public:
+
+ template <typename T>
+ static T min(T a, T b);
+
+ template <typename T>
+ static T max(T a, T b);
+
+ template <typename T>
+ static T bound(T x, T min, T max);
+
+ template <typename T>
+ static bool in(T x, T min, T max, bool geq = true, bool leq = true);
+
+ template <typename T>
+ static bool isInf(T x);
+
+ template <typename T>
+ static bool isNaN(T x);
+
+ template <typename T>
+ static bool isFinite(T x);
+
+ //Is less than
+
+ static bool isLt(scalar a, scalar b, scalar macheps = fl::fuzzylite::macheps());
+ static bool isLE(scalar a, scalar b, scalar macheps = fl::fuzzylite::macheps());
+ static bool isEq(scalar a, scalar b, scalar macheps = fl::fuzzylite::macheps());
+ static bool isGt(scalar a, scalar b, scalar macheps = fl::fuzzylite::macheps());
+ static bool isGE(scalar a, scalar b, scalar macheps = fl::fuzzylite::macheps());
+
+ static scalar scale(scalar x, scalar fromMin, scalar fromMax,
+ scalar toMin, scalar toMax, bool bounded = false);
+
+ static scalar add(scalar a, scalar b);
+ static scalar subtract(scalar a, scalar b);
+ static scalar multiply(scalar a, scalar b);
+ static scalar divide(scalar a, scalar b);
+ static scalar modulo(scalar a, scalar b);
+ static scalar logicalAnd(scalar a, scalar b);
+ static scalar logicalOr(scalar a, scalar b);
+ static scalar logicalNot(scalar a);
+ static scalar negate(scalar a);
+ static scalar round(scalar x);
+
+ //greater than
+ static scalar gt(scalar a, scalar b);
+ //greater than or equal to
+ static scalar ge(scalar a, scalar b);
+ //equal to
+ static scalar eq(scalar a, scalar b);
+ //not equal to
+ static scalar neq(scalar a, scalar b);
+ //less than or equal to
+ static scalar le(scalar a, scalar b);
+ //less than
+ static scalar lt(scalar a, scalar b);
+
+ static bool increment(std::vector<int>& x, std::vector<int>& min, std::vector<int>& max);
+ static bool increment(std::vector<int>& x, int position, std::vector<int>& min, std::vector<int>& max);
+
+ static double mean(const std::vector<scalar>& x);
+ static double variance(const std::vector<scalar>& x);
+ static double variance(const std::vector<scalar>& x, scalar mean);
+ static double standardDeviation(const std::vector<scalar>& x);
+ static double standardDeviation(const std::vector<scalar>& x, scalar mean);
+
+ static std::string validName(const std::string& name);
+
+ static int isValidForName(int character);
+
+ static std::string findReplace(const std::string& str, const std::string& find,
+ const std::string& replace, bool replaceAll = true);
+
+ static std::vector<std::string> split(const std::string& str,
+ const std::string& delimiter = " ", bool ignoreEmpty = true);
+
+ static std::string trim(const std::string& text);
+
+ static std::string format(const std::string& text, int matchesChar(int),
+ const std::string& replacement = "");
+
+ //Intentionally results in a compiler error in C++11, or linker error in C++98
+ //in order to avoid the deprecated usage of this method from version 4.0
+ static scalar toScalar(const std::string& x, bool quiet,
+ scalar alternative = fl::nan) FL_IDELETE;
+
+ static scalar toScalar(const std::string& x); //throws fl::Exception
+
+ static scalar toScalar(const std::string& x, scalar alternative) FL_INOEXCEPT;
+
+ static bool isNumeric(const std::string& x);
+
+ template <typename T>
+ static std::string str(T x, int decimals = fuzzylite::decimals());
+
+ template <typename T>
+ static std::string join(const std::vector<T>& x, const std::string& separator);
+
+ template <typename T>
+ static std::string join(int items, const std::string& separator, T first, ...);
+ };
+
+ typedef Operation Op;
+}
+#endif /* FL_OPERATION_H */
+
diff --git a/fuzzylite/fl/defuzzifier/Bisector.h b/fuzzylite/fl/defuzzifier/Bisector.h
new file mode 100644
index 0000000..7ba8db2
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/Bisector.h
@@ -0,0 +1,49 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_BISECTOR_H
+#define FL_BISECTOR_H
+
+#include "fl/defuzzifier/IntegralDefuzzifier.h"
+
+namespace fl {
+
+ class FL_API Bisector : public IntegralDefuzzifier {
+ public:
+ explicit Bisector(int resolution = defaultResolution());
+ virtual ~Bisector() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Bisector)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual scalar defuzzify(const Term* term,
+ scalar minimum, scalar maximum) const FL_IOVERRIDE;
+ virtual Bisector* clone() const FL_IOVERRIDE;
+
+ static Defuzzifier* constructor();
+ };
+
+}
+
+#endif /* FL_BISECTOR_H */
+
diff --git a/fuzzylite/fl/defuzzifier/Centroid.h b/fuzzylite/fl/defuzzifier/Centroid.h
new file mode 100644
index 0000000..7510673
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/Centroid.h
@@ -0,0 +1,47 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_CENTROID_H
+#define FL_CENTROID_H
+
+#include "fl/defuzzifier/IntegralDefuzzifier.h"
+
+namespace fl {
+
+ class FL_API Centroid : public IntegralDefuzzifier {
+ public:
+ explicit Centroid(int resolution = defaultResolution());
+ virtual ~Centroid() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Centroid)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual scalar defuzzify(const Term* term,
+ scalar minimum, scalar maximum) const FL_IOVERRIDE;
+ virtual Centroid* clone() const FL_IOVERRIDE;
+
+ static Defuzzifier* constructor();
+ };
+
+}
+#endif /* FL_CENTROID_H */
diff --git a/fuzzylite/fl/defuzzifier/Defuzzifier.h b/fuzzylite/fl/defuzzifier/Defuzzifier.h
new file mode 100644
index 0000000..3598113
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/Defuzzifier.h
@@ -0,0 +1,53 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+//TODO Check http://en.wikipedia.org/wiki/Defuzzification for other defuzzifiers.
+
+#ifndef FL_DEFUZZIFIER_H
+#define FL_DEFUZZIFIER_H
+
+#include "fl/fuzzylite.h"
+#include <string>
+
+namespace fl {
+ class Term;
+
+ class FL_API Defuzzifier {
+ public:
+
+ Defuzzifier() {
+ }
+
+ virtual ~Defuzzifier() {
+ }
+ FL_DEFAULT_COPY_AND_MOVE(Defuzzifier)
+
+ virtual std::string className() const = 0;
+ virtual Defuzzifier* clone() const = 0;
+ virtual scalar defuzzify(const Term* term, scalar minimum, scalar maximum) const = 0;
+
+ };
+
+}
+#endif /* FL_DEFUZZIFIER_H */
diff --git a/fuzzylite/fl/defuzzifier/IntegralDefuzzifier.h b/fuzzylite/fl/defuzzifier/IntegralDefuzzifier.h
new file mode 100644
index 0000000..61aaf8a
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/IntegralDefuzzifier.h
@@ -0,0 +1,53 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_INTEGRALDEFUZZIFIER_H
+#define FL_INTEGRALDEFUZZIFIER_H
+
+#include "fl/defuzzifier/Defuzzifier.h"
+
+namespace fl {
+ //TODO: check http://en.wikipedia.org/wiki/Adaptive_quadrature
+
+ class FL_API IntegralDefuzzifier : public Defuzzifier {
+ protected:
+ static int _defaultResolution;
+
+ int _resolution;
+ public:
+
+ static void setDefaultResolution(int defaultResolution);
+ static int defaultResolution();
+
+ explicit IntegralDefuzzifier(int resolution = defaultResolution());
+ virtual ~IntegralDefuzzifier() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(IntegralDefuzzifier)
+
+ virtual void setResolution(int resolution);
+ virtual int getResolution() const;
+ };
+}
+
+#endif /* INTEGRALDEFUZZIFIER_H */
+
diff --git a/fuzzylite/fl/defuzzifier/LargestOfMaximum.h b/fuzzylite/fl/defuzzifier/LargestOfMaximum.h
new file mode 100644
index 0000000..8f1d3c8
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/LargestOfMaximum.h
@@ -0,0 +1,47 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_LARGESTOFMAXIMUM_H
+#define FL_LARGESTOFMAXIMUM_H
+
+#include "fl/defuzzifier/IntegralDefuzzifier.h"
+
+namespace fl {
+
+ class FL_API LargestOfMaximum : public IntegralDefuzzifier {
+ public:
+ explicit LargestOfMaximum(int resolution = defaultResolution());
+ virtual ~LargestOfMaximum() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(LargestOfMaximum)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual scalar defuzzify(const Term* term,
+ scalar minimum, scalar maximum) const FL_IOVERRIDE;
+ virtual LargestOfMaximum* clone() const FL_IOVERRIDE;
+
+ static Defuzzifier* constructor();
+ };
+}
+#endif /* FL_LARGESTOFMAXIMUM_H */
+
diff --git a/fuzzylite/fl/defuzzifier/MeanOfMaximum.h b/fuzzylite/fl/defuzzifier/MeanOfMaximum.h
new file mode 100644
index 0000000..2c09759
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/MeanOfMaximum.h
@@ -0,0 +1,48 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_MEANOFMAXIMUM_H
+#define FL_MEANOFMAXIMUM_H
+
+#include "fl/defuzzifier/IntegralDefuzzifier.h"
+
+namespace fl {
+
+ class FL_API MeanOfMaximum : public IntegralDefuzzifier {
+ public:
+ explicit MeanOfMaximum(int resolution = defaultResolution());
+ virtual ~MeanOfMaximum() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(MeanOfMaximum)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual scalar defuzzify(const Term* term,
+ scalar minimum, scalar maximum) const FL_IOVERRIDE;
+ virtual MeanOfMaximum* clone() const FL_IOVERRIDE;
+
+ static Defuzzifier* constructor();
+ };
+}
+
+#endif /* FL_MEANOFMAXIMUM_H */
+
diff --git a/fuzzylite/fl/defuzzifier/SmallestOfMaximum.h b/fuzzylite/fl/defuzzifier/SmallestOfMaximum.h
new file mode 100644
index 0000000..289e2a9
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/SmallestOfMaximum.h
@@ -0,0 +1,48 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_SMALLESTOFMAXIMUM_H
+#define FL_SMALLESTOFMAXIMUM_H
+
+#include "fl/defuzzifier/IntegralDefuzzifier.h"
+
+namespace fl {
+
+ class FL_API SmallestOfMaximum : public IntegralDefuzzifier {
+ public:
+ explicit SmallestOfMaximum(int resolution = defaultResolution());
+ virtual ~SmallestOfMaximum() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(SmallestOfMaximum)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual scalar defuzzify(const Term* term,
+ scalar minimum, scalar maximum) const FL_IOVERRIDE;
+ virtual SmallestOfMaximum* clone() const FL_IOVERRIDE;
+
+ static Defuzzifier* constructor();
+ };
+}
+
+#endif /* FL_SMALLESTOFMAXIMUM_H */
+
diff --git a/fuzzylite/fl/defuzzifier/WeightedAverage.h b/fuzzylite/fl/defuzzifier/WeightedAverage.h
new file mode 100644
index 0000000..3fbbd38
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/WeightedAverage.h
@@ -0,0 +1,50 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_WEIGHTEDAVERAGE_H
+#define FL_WEIGHTEDAVERAGE_H
+
+#include "fl/defuzzifier/WeightedDefuzzifier.h"
+
+namespace fl {
+ class Activated;
+
+ class FL_API WeightedAverage : public WeightedDefuzzifier {
+ public:
+ explicit WeightedAverage(Type type = Automatic);
+ explicit WeightedAverage(const std::string& type);
+ virtual ~WeightedAverage() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(WeightedAverage)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual scalar defuzzify(const Term* term,
+ scalar minimum, scalar maximum) const FL_IOVERRIDE;
+ virtual WeightedAverage* clone() const FL_IOVERRIDE;
+
+ static Defuzzifier* constructor();
+ };
+}
+
+#endif /* FL_WEIGHTEDAVERAGE_H */
+
diff --git a/fuzzylite/fl/defuzzifier/WeightedDefuzzifier.h b/fuzzylite/fl/defuzzifier/WeightedDefuzzifier.h
new file mode 100644
index 0000000..2bf0495
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/WeightedDefuzzifier.h
@@ -0,0 +1,63 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_WEIGHTEDDEFUZZIFIER_H
+#define FL_WEIGHTEDDEFUZZIFIER_H
+
+#include "fl/defuzzifier/Defuzzifier.h"
+
+namespace fl {
+ class Activated;
+
+ class FL_API WeightedDefuzzifier : public Defuzzifier {
+ public:
+
+ enum Type {
+ Automatic, TakagiSugeno, Tsukamoto
+ };
+ static std::string typeName(Type);
+
+ explicit WeightedDefuzzifier(Type type = Automatic);
+ explicit WeightedDefuzzifier(const std::string& type);
+ virtual ~WeightedDefuzzifier() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(WeightedDefuzzifier)
+
+ virtual void setType(Type type);
+ virtual Type getType() const;
+ virtual std::string getTypeName() const;
+ virtual Type inferType(const Term* term) const;
+ virtual bool isMonotonic(const Term* term) const;
+
+ virtual scalar tsukamoto(const Term* monotonic, scalar activationDegree,
+ scalar minimum, scalar maximum) const;
+
+ protected:
+ Type _type;
+
+ };
+
+}
+
+#endif /* FL_WEIGHTEDDEFUZZIFIER_H */
+
diff --git a/fuzzylite/fl/defuzzifier/WeightedSum.h b/fuzzylite/fl/defuzzifier/WeightedSum.h
new file mode 100644
index 0000000..a754023
--- /dev/null
+++ b/fuzzylite/fl/defuzzifier/WeightedSum.h
@@ -0,0 +1,50 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_WEIGHTEDSUM_H
+#define FL_WEIGHTEDSUM_H
+
+
+#include "fl/defuzzifier/WeightedDefuzzifier.h"
+
+namespace fl {
+
+ class FL_API WeightedSum : public WeightedDefuzzifier {
+ public:
+ explicit WeightedSum(Type type = Automatic);
+ explicit WeightedSum(const std::string& type);
+ virtual ~WeightedSum() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(WeightedSum)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual scalar defuzzify(const Term* term,
+ scalar minimum, scalar maximum) const FL_IOVERRIDE;
+ virtual WeightedSum* clone() const FL_IOVERRIDE;
+
+ static Defuzzifier* constructor();
+ };
+}
+
+#endif /* FL_WEIGHTEDSUM_H */
+
diff --git a/fuzzylite/fl/factory/CloningFactory.h b/fuzzylite/fl/factory/CloningFactory.h
new file mode 100644
index 0000000..3262721
--- /dev/null
+++ b/fuzzylite/fl/factory/CloningFactory.h
@@ -0,0 +1,62 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_CLONINGFACTORY_H
+#define FL_CLONINGFACTORY_H
+
+#include "fl/fuzzylite.h"
+
+#include <map>
+#include <string>
+#include <vector>
+
+namespace fl {
+
+ template <typename T>
+ class FL_API CloningFactory {
+ protected:
+ std::string _name;
+ std::map<std::string, T> _objects;
+
+ public:
+ explicit CloningFactory(const std::string& name = "");
+ CloningFactory(const CloningFactory& other);
+ CloningFactory& operator=(const CloningFactory& other);
+ virtual ~CloningFactory();
+ FL_DEFAULT_MOVE(CloningFactory)
+
+ virtual std::string name() const;
+
+ virtual void registerObject(const std::string& key, T object);
+ virtual void deregisterObject(const std::string& key);
+ virtual bool hasObject(const std::string& key) const;
+ virtual T getObject(const std::string& key) const;
+ virtual T cloneObject(const std::string& key) const;
+ virtual std::vector<std::string> available() const;
+
+ };
+}
+
+#endif /* FL_CLONINGFACTORY_H */
+
diff --git a/fuzzylite/fl/factory/ConstructionFactory.h b/fuzzylite/fl/factory/ConstructionFactory.h
new file mode 100644
index 0000000..d01ca7d
--- /dev/null
+++ b/fuzzylite/fl/factory/ConstructionFactory.h
@@ -0,0 +1,64 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FACTORY_H
+#define FL_FACTORY_H
+
+#include "fl/fuzzylite.h"
+
+#include <map>
+#include <string>
+#include <vector>
+
+namespace fl {
+
+ template <typename T>
+ class FL_API ConstructionFactory {
+ public:
+ typedef T(*Constructor)();
+
+ protected:
+ std::string _name;
+ std::map<std::string, Constructor> _constructors;
+
+ public:
+ explicit ConstructionFactory(const std::string& name);
+ virtual ~ConstructionFactory();
+ FL_DEFAULT_COPY_AND_MOVE(ConstructionFactory)
+
+ virtual std::string name() const;
+
+ virtual void registerConstructor(const std::string& key, Constructor constructor);
+ virtual void deregisterConstructor(const std::string& key);
+ virtual bool hasConstructor(const std::string& key) const;
+ virtual Constructor getConstructor(const std::string& key) const;
+ virtual T constructObject(const std::string& key) const;
+ virtual std::vector<std::string> available() const;
+
+ };
+
+}
+
+#endif /* FL_FACTORY_H */
+
diff --git a/fuzzylite/fl/factory/DefuzzifierFactory.h b/fuzzylite/fl/factory/DefuzzifierFactory.h
new file mode 100644
index 0000000..32d3ee7
--- /dev/null
+++ b/fuzzylite/fl/factory/DefuzzifierFactory.h
@@ -0,0 +1,51 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_DEFUZZIFIERFACTORY_H
+#define FL_DEFUZZIFIERFACTORY_H
+
+#include "fl/factory/ConstructionFactory.h"
+
+#include "fl/defuzzifier/Defuzzifier.h"
+#include "fl/defuzzifier/IntegralDefuzzifier.h"
+#include "fl/defuzzifier/WeightedDefuzzifier.h"
+
+namespace fl {
+
+ class FL_API DefuzzifierFactory : public ConstructionFactory<Defuzzifier*> {
+ public:
+ DefuzzifierFactory();
+ virtual ~DefuzzifierFactory() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(DefuzzifierFactory)
+
+ virtual Defuzzifier* constructDefuzzifier(const std::string& key,
+ int resolution, WeightedDefuzzifier::Type) const;
+
+ virtual Defuzzifier* constructDefuzzifier(const std::string& key, int resolution) const;
+
+ virtual Defuzzifier* constructDefuzzifier(const std::string& key, WeightedDefuzzifier::Type type);
+ };
+}
+#endif /* DEFUZZIFIERFACTORY_H */
+
diff --git a/fuzzylite/fl/factory/FactoryManager.h b/fuzzylite/fl/factory/FactoryManager.h
new file mode 100644
index 0000000..d853d93
--- /dev/null
+++ b/fuzzylite/fl/factory/FactoryManager.h
@@ -0,0 +1,81 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FACTORYMANAGER_H
+#define FL_FACTORYMANAGER_H
+
+#include "fl/fuzzylite.h"
+
+namespace fl {
+ class TNormFactory;
+ class SNormFactory;
+ class DefuzzifierFactory;
+ class TermFactory;
+ class HedgeFactory;
+ class FunctionFactory;
+
+ class FL_API FactoryManager {
+ protected:
+ static FactoryManager _instance;
+
+ FL_unique_ptr<TNormFactory> _tnorm;
+ FL_unique_ptr<SNormFactory> _snorm;
+ FL_unique_ptr<DefuzzifierFactory> _defuzzifier;
+ FL_unique_ptr<TermFactory> _term;
+ FL_unique_ptr<HedgeFactory> _hedge;
+ FL_unique_ptr<FunctionFactory> _function;
+
+ FactoryManager();
+ FactoryManager(TNormFactory* tnorm, SNormFactory* snorm,
+ DefuzzifierFactory* defuzzifier, TermFactory* term,
+ HedgeFactory* hedge, FunctionFactory* function);
+ FactoryManager(const FactoryManager& other);
+ FactoryManager& operator=(const FactoryManager& other);
+ FL_DEFAULT_MOVE(FactoryManager)
+ virtual ~FactoryManager();
+
+ public:
+ static FactoryManager* instance();
+
+ virtual void setTnorm(TNormFactory* tnorm);
+ virtual TNormFactory* tnorm() const;
+
+ virtual void setSnorm(SNormFactory* snorm);
+ virtual SNormFactory* snorm() const;
+
+ virtual void setDefuzzifier(DefuzzifierFactory* defuzzifier);
+ virtual DefuzzifierFactory* defuzzifier() const;
+
+ virtual void setTerm(TermFactory* term);
+ virtual TermFactory* term() const;
+
+ virtual void setHedge(HedgeFactory* hedge);
+ virtual HedgeFactory* hedge() const;
+
+ virtual void setFunction(FunctionFactory* function);
+ virtual FunctionFactory* function() const;
+ };
+}
+#endif /* FL_FACTORYMANAGER_H */
+
diff --git a/fuzzylite/fl/factory/FunctionFactory.h b/fuzzylite/fl/factory/FunctionFactory.h
new file mode 100644
index 0000000..c1ea9f1
--- /dev/null
+++ b/fuzzylite/fl/factory/FunctionFactory.h
@@ -0,0 +1,51 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FUNCTIONFACTORY_H
+#define FL_FUNCTIONFACTORY_H
+
+#include "fl/factory/CloningFactory.h"
+
+#include "fl/term/Function.h"
+
+namespace fl {
+
+ class FunctionFactory : public CloningFactory<Function::Element*> {
+ private:
+ void registerOperators();
+ void registerFunctions();
+ public:
+ FunctionFactory();
+ virtual ~FunctionFactory() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(FunctionFactory)
+
+ virtual std::vector<std::string> availableOperators() const;
+ virtual std::vector<std::string> availableFunctions() const;
+
+ };
+
+}
+
+#endif /* FL_FUNCTIONFACTORY_H */
+
diff --git a/fuzzylite/fl/factory/HedgeFactory.h b/fuzzylite/fl/factory/HedgeFactory.h
new file mode 100644
index 0000000..aca5d3a
--- /dev/null
+++ b/fuzzylite/fl/factory/HedgeFactory.h
@@ -0,0 +1,42 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_HEDGEFACTORY_H
+#define FL_HEDGEFACTORY_H
+
+#include "fl/factory/ConstructionFactory.h"
+
+#include "fl/hedge/Hedge.h"
+
+namespace fl {
+
+ class FL_API HedgeFactory : public ConstructionFactory<Hedge*> {
+ public:
+ HedgeFactory();
+ virtual ~HedgeFactory() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(HedgeFactory)
+ };
+}
+#endif /* FL_HEDGEFACTORY_H */
+
diff --git a/fuzzylite/fl/factory/SNormFactory.h b/fuzzylite/fl/factory/SNormFactory.h
new file mode 100644
index 0000000..ca8bf1a
--- /dev/null
+++ b/fuzzylite/fl/factory/SNormFactory.h
@@ -0,0 +1,42 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_SNORMFACTORY_H
+#define FL_SNORMFACTORY_H
+
+#include "fl/factory/ConstructionFactory.h"
+
+#include "fl/norm/SNorm.h"
+
+namespace fl {
+
+ class FL_API SNormFactory : public ConstructionFactory<SNorm*> {
+ public:
+ SNormFactory();
+ virtual ~SNormFactory() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(SNormFactory)
+ };
+}
+#endif /* FL_SNORMFACTORY_H */
+
diff --git a/fuzzylite/fl/factory/TNormFactory.h b/fuzzylite/fl/factory/TNormFactory.h
new file mode 100644
index 0000000..6af2249
--- /dev/null
+++ b/fuzzylite/fl/factory/TNormFactory.h
@@ -0,0 +1,42 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_TNORMFACTORY_H
+#define FL_TNORMFACTORY_H
+
+#include "fl/factory/ConstructionFactory.h"
+
+#include "fl/norm/TNorm.h"
+
+namespace fl {
+
+ class FL_API TNormFactory : public ConstructionFactory<TNorm*> {
+ public:
+ TNormFactory();
+ virtual ~TNormFactory() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(TNormFactory)
+ };
+}
+#endif /* FL_TNORMFACTORY_H */
+
diff --git a/fuzzylite/fl/factory/TermFactory.h b/fuzzylite/fl/factory/TermFactory.h
new file mode 100644
index 0000000..6fd0656
--- /dev/null
+++ b/fuzzylite/fl/factory/TermFactory.h
@@ -0,0 +1,43 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_TERMFACTORY_H
+#define FL_TERMFACTORY_H
+
+
+#include "fl/factory/ConstructionFactory.h"
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API TermFactory : public ConstructionFactory<Term*> {
+ public:
+ TermFactory();
+ virtual ~TermFactory() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(TermFactory)
+ };
+}
+#endif /* FL_TERMFACTORY_H */
+
diff --git a/fuzzylite/fl/fuzzylite.h b/fuzzylite/fl/fuzzylite.h
new file mode 100644
index 0000000..18c8dfa
--- /dev/null
+++ b/fuzzylite/fl/fuzzylite.h
@@ -0,0 +1,222 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FUZZYLITE_H
+#define FL_FUZZYLITE_H
+
+#include <algorithm>
+#include <cmath>
+#include <iostream>
+#include <sstream>
+#include <limits>
+#include <memory>
+
+#ifndef FL_VERSION
+#define FL_VERSION "?"
+#endif
+
+#ifndef FL_DATE
+#define FL_DATE "?"
+#endif
+
+#ifndef FL_BUILD_PATH
+#define FL_BUILD_PATH ""
+#endif
+
+#if defined(_WIN32) || defined(WIN32)
+#define FL_WINDOWS
+#endif
+
+#if defined(unix) || defined(__unix__) || defined(__unix)
+#define FL_UNIX
+#endif
+
+#ifdef __APPLE__
+#define FL_APPLE
+#endif
+
+#define FL__FILE__ std::string(__FILE__).substr(std::string(FL_BUILD_PATH).size())
+
+#define FL_LOG_PREFIX FL__FILE__ << " [" << __LINE__ << "]:"
+
+#define FL_AT FL__FILE__, __LINE__, __FUNCTION__
+
+
+#define FL_LOG(message) {if (fl::fuzzylite::logging()){std::cout << FL_LOG_PREFIX << message << std::endl;}}
+#define FL_LOGP(message) {if (fl::fuzzylite::logging()){std::cout << message << std::endl;}}
+
+#define FL_DEBUG_BEGIN if (fl::fuzzylite::debug()){
+#define FL_DEBUG_END }
+
+#define FL_DBG(message) FL_DEBUG_BEGIN\
+ std::cout << FL__FILE__ << "::" << __FUNCTION__ << "[" << __LINE__ << "]:" \
+ << message << std::endl;\
+ FL_DEBUG_END
+
+
+#ifdef FL_WINDOWS
+#include <ciso646> //alternative operator spellings:
+//#define and &&
+//#define or ||
+//#define not !
+//#define bitand &
+//#define bitor |
+
+//TODO: Address warning 4251 by exporting members?
+//http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html
+#ifdef _MSC_VER
+#pragma warning (disable:4251)
+#endif
+
+//fuzzylite as a shared library is exported
+//Applications linking with fuzzylite as a shared library need to import
+
+//fuzzylite as a static library does not export or import
+//Applications linking with fuzzylite as a static library do not import
+
+#if defined(FL_EXPORT_LIBRARY)
+#define FL_API __declspec(dllexport)
+#elif defined(FL_IMPORT_LIBRARY)
+#define FL_API __declspec(dllimport)
+#else
+#define FL_API
+#endif
+
+#else
+#define FL_API
+#endif
+
+
+namespace fl {
+#ifdef FL_USE_FLOAT
+ typedef float scalar;
+#else
+ typedef double scalar;
+#endif
+
+ const scalar nan = std::numeric_limits<scalar>::quiet_NaN();
+ const scalar inf = std::numeric_limits<scalar>::infinity();
+
+#ifdef FL_CPP11
+ //C++11 defines
+
+ //Pointers
+ const std::nullptr_t null = nullptr;
+#define FL_unique_ptr std::unique_ptr
+#define FL_move_ptr(x) std::move(x)
+
+ //Identifiers
+#define FL_IOVERRIDE override
+#define FL_IFINAL final
+#define FL_IDEFAULT = default
+#define FL_IDELETE = delete
+#define FL_INOEXCEPT noexcept
+
+ //Constructors
+#define FL_DEFAULT_COPY(Class) \
+ Class(const Class&) = default; \
+ Class& operator=(const Class&) = default;
+#define FL_DEFAULT_MOVE(Class) \
+ Class(Class&&) = default; \
+ Class& operator=(Class&&) = default;
+#define FL_DEFAULT_COPY_AND_MOVE(Class) \
+ Class(const Class&) = default; \
+ Class& operator=(const Class&) = default;\
+ Class(Class&&) = default; \
+ Class& operator=(Class&&) = default;
+
+#define FL_DISABLE_COPY(Class) \
+ Class(const Class &) = delete;\
+ Class &operator=(const Class &) = delete;
+
+#else
+ //C++98 defines
+
+ //Pointers
+ const long null = 0L;
+#define FL_unique_ptr std::auto_ptr
+#define FL_move_ptr(x) x
+
+ //Identifiers
+#define FL_IOVERRIDE
+#define FL_IFINAL
+#define FL_IDEFAULT
+#define FL_IDELETE
+#define FL_INOEXCEPT throw()
+
+ //Constructors
+#define FL_DEFAULT_COPY(Class)
+#define FL_DEFAULT_MOVE(Class)
+#define FL_DEFAULT_COPY_AND_MOVE(Class)
+
+#define FL_DISABLE_COPY(Class) \
+ Class(const Class &);\
+ Class &operator=(const Class &);
+
+#endif
+}
+
+
+namespace fl {
+
+ class FL_API fuzzylite {
+ protected:
+ static int _decimals;
+ static scalar _macheps;
+ static bool _debug;
+ static bool _logging;
+
+ public:
+ static std::string name();
+ static std::string fullname();
+ static std::string version();
+ static std::string longVersion();
+ static std::string license();
+ static std::string author();
+ static std::string company();
+ static std::string website();
+
+ static std::string date();
+ static std::string platform();
+
+ static std::string floatingPoint();
+
+ static bool debug();
+ static void setDebug(bool debug);
+
+ static int decimals();
+ static void setDecimals(int decimals);
+
+ static scalar macheps();
+ static void setMachEps(scalar macheps);
+
+ static bool logging();
+ static void setLogging(bool logging);
+
+ };
+}
+
+
+#endif /* FL_FUZZYLITE_H */
+
diff --git a/fuzzylite/fl/hedge/Any.h b/fuzzylite/fl/hedge/Any.h
new file mode 100644
index 0000000..c30b4c7
--- /dev/null
+++ b/fuzzylite/fl/hedge/Any.h
@@ -0,0 +1,47 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_ANY_H
+#define FL_ANY_H
+
+#include "fl/hedge/Hedge.h"
+
+namespace fl {
+ //Only this hedge has virtual methods due to its special case use.
+
+ class FL_API Any : public Hedge {
+ public:
+ Any();
+ virtual ~Any() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Any)
+
+ virtual std::string name() const FL_IOVERRIDE;
+ virtual scalar hedge(scalar x) const FL_IOVERRIDE;
+ virtual Any* clone() const FL_IOVERRIDE;
+
+ static Hedge* constructor();
+ };
+
+}
+#endif /* FL_ANY_H */
diff --git a/fuzzylite/fl/hedge/Extremely.h b/fuzzylite/fl/hedge/Extremely.h
new file mode 100644
index 0000000..7ecda66
--- /dev/null
+++ b/fuzzylite/fl/hedge/Extremely.h
@@ -0,0 +1,42 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_EXTREMELY_H
+#define FL_EXTREMELY_H
+
+#include "fl/hedge/Hedge.h"
+
+namespace fl {
+
+ class FL_API Extremely : public Hedge {
+ public:
+ std::string name() const;
+ scalar hedge(scalar x) const;
+ Extremely* clone() const;
+
+ static Hedge* constructor();
+ };
+
+}
+#endif /* FL_EXTREMELY_H */
diff --git a/fuzzylite/fl/hedge/Hedge.h b/fuzzylite/fl/hedge/Hedge.h
new file mode 100644
index 0000000..011c745
--- /dev/null
+++ b/fuzzylite/fl/hedge/Hedge.h
@@ -0,0 +1,51 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_HEDGE_H
+#define FL_HEDGE_H
+
+#include "fl/fuzzylite.h"
+
+#include <string>
+
+namespace fl {
+
+ class FL_API Hedge {
+ public:
+
+ Hedge() {
+ }
+
+ virtual ~Hedge() {
+ }
+ FL_DEFAULT_COPY_AND_MOVE(Hedge)
+
+ virtual std::string name() const = 0;
+ virtual scalar hedge(scalar x) const = 0;
+ virtual Hedge* clone() const = 0;
+
+ };
+}
+
+#endif /* FL_HEDGE_H */
diff --git a/fuzzylite/fl/hedge/Not.h b/fuzzylite/fl/hedge/Not.h
new file mode 100644
index 0000000..161fefd
--- /dev/null
+++ b/fuzzylite/fl/hedge/Not.h
@@ -0,0 +1,42 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_NOT_H
+#define FL_NOT_H
+
+#include "fl/hedge/Hedge.h"
+
+namespace fl {
+
+ class FL_API Not : public Hedge {
+ public:
+ std::string name() const FL_IOVERRIDE;
+ scalar hedge(scalar x) const FL_IOVERRIDE;
+ Not* clone() const FL_IOVERRIDE;
+
+ static Hedge* constructor();
+ };
+
+}
+#endif /* FL_NOT_H */
diff --git a/fuzzylite/fl/hedge/Seldom.h b/fuzzylite/fl/hedge/Seldom.h
new file mode 100644
index 0000000..a2a96c2
--- /dev/null
+++ b/fuzzylite/fl/hedge/Seldom.h
@@ -0,0 +1,42 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_SELDOM_H
+#define FL_SELDOM_H
+
+#include "fl/hedge/Hedge.h"
+
+namespace fl {
+
+ class FL_API Seldom : public Hedge {
+ public:
+ std::string name() const FL_IOVERRIDE;
+ scalar hedge(scalar x) const FL_IOVERRIDE;
+ Seldom* clone() const FL_IOVERRIDE;
+
+ static Hedge* constructor();
+ };
+
+}
+#endif /* FL_SELDOM_H */
diff --git a/fuzzylite/fl/hedge/Somewhat.h b/fuzzylite/fl/hedge/Somewhat.h
new file mode 100644
index 0000000..89a14a6
--- /dev/null
+++ b/fuzzylite/fl/hedge/Somewhat.h
@@ -0,0 +1,42 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_SOMEWHAT_H
+#define FL_SOMEWHAT_H
+
+#include "fl/hedge/Hedge.h"
+
+namespace fl {
+
+ class FL_API Somewhat : public Hedge {
+ public:
+ std::string name() const FL_IOVERRIDE;
+ scalar hedge(scalar x) const FL_IOVERRIDE;
+ Somewhat* clone() const FL_IOVERRIDE;
+
+ static Hedge* constructor();
+ };
+
+}
+#endif /* FL_SOMEWHAT_H */
diff --git a/fuzzylite/fl/hedge/Very.h b/fuzzylite/fl/hedge/Very.h
new file mode 100644
index 0000000..bcfe5e4
--- /dev/null
+++ b/fuzzylite/fl/hedge/Very.h
@@ -0,0 +1,42 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_VERY_H
+#define FL_VERY_H
+
+#include "fl/hedge/Hedge.h"
+
+namespace fl {
+
+ class FL_API Very : public Hedge {
+ public:
+ std::string name() const FL_IOVERRIDE;
+ scalar hedge(scalar x) const FL_IOVERRIDE;
+ Very* clone() const FL_IOVERRIDE;
+
+ static Hedge* constructor();
+ };
+
+}
+#endif /* FL_VERY_H */
diff --git a/fuzzylite/fl/imex/CppExporter.h b/fuzzylite/fl/imex/CppExporter.h
new file mode 100644
index 0000000..e53cf15
--- /dev/null
+++ b/fuzzylite/fl/imex/CppExporter.h
@@ -0,0 +1,70 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_CPPEXPORTER_H
+#define FL_CPPEXPORTER_H
+
+#include "fl/imex/Exporter.h"
+
+namespace fl {
+ class Engine;
+ class InputVariable;
+ class OutputVariable;
+ class Term;
+ class RuleBlock;
+ class Norm;
+ class Defuzzifier;
+ class Hedge;
+
+ class FL_API CppExporter : public Exporter {
+ protected:
+ bool _prefixNamespace;
+ virtual std::string fl(const std::string& clazz) const;
+ public:
+ explicit CppExporter(bool prefixNamespace = false);
+ virtual ~CppExporter() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(CppExporter)
+
+ virtual std::string name() const FL_IOVERRIDE;
+ virtual std::string toString(const Engine* engine) const FL_IOVERRIDE;
+
+ virtual void setPrefixNamespace(bool prefixNamespace);
+ virtual bool isPrefixNamespace() const;
+
+ virtual std::string toString(const InputVariable* inputVariable, const Engine* engine) const;
+ virtual std::string toString(const OutputVariable* outputVariable, const Engine* engine) const;
+ virtual std::string toString(const RuleBlock* ruleBlock, const Engine* engine) const;
+ virtual std::string toString(scalar value) const;
+
+ virtual std::string toString(const Hedge* hedge) const;
+ virtual std::string toString(const Term* term) const;
+ virtual std::string toString(const Norm* op) const;
+ virtual std::string toString(const Defuzzifier* defuzzifier) const;
+
+ virtual CppExporter* clone() const FL_IOVERRIDE;
+
+ };
+}
+#endif /* FL_CPPEXPORTER_H */
+
diff --git a/fuzzylite/fl/imex/Exporter.h b/fuzzylite/fl/imex/Exporter.h
new file mode 100644
index 0000000..8b55c21
--- /dev/null
+++ b/fuzzylite/fl/imex/Exporter.h
@@ -0,0 +1,52 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_EXPORTER_H
+#define FL_EXPORTER_H
+
+#include "fl/fuzzylite.h"
+
+#include <string>
+
+namespace fl {
+ class Engine;
+
+ class FL_API Exporter {
+ public:
+
+ Exporter();
+ virtual ~Exporter();
+ FL_DEFAULT_COPY_AND_MOVE(Exporter)
+
+ virtual std::string toString(const Engine* engine) const = 0;
+ virtual void toFile(const std::string& path, const Engine* engine) const;
+
+ virtual std::string name() const = 0;
+ virtual Exporter* clone() const = 0;
+ };
+
+}
+
+#endif /* FL_EXPORTER_H */
+
diff --git a/fuzzylite/fl/imex/FclExporter.h b/fuzzylite/fl/imex/FclExporter.h
new file mode 100644
index 0000000..9bfa3ed
--- /dev/null
+++ b/fuzzylite/fl/imex/FclExporter.h
@@ -0,0 +1,70 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FCLEXPORTER_H
+#define FL_FCLEXPORTER_H
+
+#include "fl/imex/Exporter.h"
+
+namespace fl {
+ class InputVariable;
+ class OutputVariable;
+ class RuleBlock;
+ class Norm;
+ class TNorm;
+ class SNorm;
+ class Defuzzifier;
+ class Term;
+
+ class FL_API FclExporter : public Exporter {
+ protected:
+ std::string _indent;
+
+ public:
+ explicit FclExporter(const std::string& indent = " ");
+ virtual ~FclExporter() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(FclExporter)
+
+ virtual void setIndent(const std::string& indent);
+ virtual std::string getIndent() const;
+
+ virtual std::string name() const FL_IOVERRIDE;
+ virtual std::string toString(const Engine* engine) const FL_IOVERRIDE;
+
+ virtual std::string toString(const InputVariable* variable) const;
+ virtual std::string toString(const OutputVariable* variable) const;
+ virtual std::string toString(const RuleBlock* ruleBlock) const;
+
+ virtual std::string toString(const Norm* norm) const;
+
+ virtual std::string toString(const TNorm* tnorm) const; //TODO: Delete in v6.0
+ virtual std::string toString(const SNorm* snorm) const; //TODO: Delete in v6.0
+ virtual std::string toString(const Defuzzifier* defuzzifier) const;
+ virtual std::string toString(const Term* term) const;
+
+ virtual FclExporter* clone() const FL_IOVERRIDE;
+ };
+
+}
+#endif /* FL_FCLEXPORTER_H */
diff --git a/fuzzylite/fl/imex/FclImporter.h b/fuzzylite/fl/imex/FclImporter.h
new file mode 100644
index 0000000..b219717
--- /dev/null
+++ b/fuzzylite/fl/imex/FclImporter.h
@@ -0,0 +1,74 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FCLIMPORTER_H
+#define FL_FCLIMPORTER_H
+
+#include "fl/imex/Importer.h"
+
+#include <string>
+#include <utility>
+#include <vector>
+
+
+namespace fl {
+ class Norm;
+ class TNorm;
+ class SNorm;
+ class Term;
+ class Defuzzifier;
+
+ class FL_API FclImporter : public Importer {
+ public:
+ FclImporter();
+ virtual ~FclImporter() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(FclImporter)
+
+ virtual std::string name() const FL_IOVERRIDE;
+
+ virtual Engine* fromString(const std::string& fcl) const FL_IOVERRIDE;
+
+ virtual FclImporter* clone() const FL_IOVERRIDE;
+
+ protected:
+ virtual void processBlock(const std::string& tag, const std::string& block, Engine* engine) const;
+ virtual void processVar(const std::string& var, const std::string& block, Engine* engine)const;
+ virtual void processFuzzify(const std::string& block, Engine* engine)const;
+ virtual void processDefuzzify(const std::string& block, Engine* engine)const;
+ virtual void processRuleBlock(const std::string& block, Engine* engine)const;
+
+ virtual TNorm* parseTNorm(const std::string& line) const;
+ virtual SNorm* parseSNorm(const std::string& line) const;
+ virtual Term* parseTerm(const std::string& line, const Engine* engine) const;
+
+ virtual Defuzzifier* parseDefuzzifier(const std::string& line) const;
+ virtual std::pair<scalar, bool> parseDefaultValue(const std::string& line) const;
+ virtual std::pair<scalar, scalar> parseRange(const std::string& line) const;
+ virtual std::pair<bool, bool> parseLocks(const std::string& line) const;
+ virtual bool parseEnabled(const std::string& line) const;
+
+ };
+
+}
+#endif /* FL_FCLIMPORTER_H */
diff --git a/fuzzylite/fl/imex/FisExporter.h b/fuzzylite/fl/imex/FisExporter.h
new file mode 100644
index 0000000..05d6a22
--- /dev/null
+++ b/fuzzylite/fl/imex/FisExporter.h
@@ -0,0 +1,74 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FISEXPORTER_H
+#define FL_FISEXPORTER_H
+
+#include "fl/imex/Exporter.h"
+
+#include <vector>
+
+namespace fl {
+ class Norm;
+ class TNorm;
+ class SNorm;
+ class Defuzzifier;
+ class Term;
+ class Rule;
+ class Proposition;
+ class Variable;
+
+ class FL_API FisExporter : public Exporter {
+ protected:
+
+ virtual std::string translate(const std::vector<Proposition*>& propositions,
+ const std::vector<Variable*> variables) const;
+
+ public:
+ FisExporter();
+ virtual ~FisExporter() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(FisExporter)
+
+ virtual std::string name() const FL_IOVERRIDE;
+ virtual std::string toString(const Engine* engine) const FL_IOVERRIDE;
+
+ virtual std::string toString(const Norm* norm) const;
+ virtual std::string toString(const TNorm* tnorm) const; //TODO: delete in v6.0
+ virtual std::string toString(const SNorm* snorm) const; //TODO: delete in v6.0
+ virtual std::string toString(const Defuzzifier* defuzzifier) const;
+ virtual std::string toString(const Term* term) const;
+
+ virtual std::string exportSystem(const Engine* engine) const;
+ virtual std::string exportInputs(const Engine* engine) const;
+ virtual std::string exportOutputs(const Engine* engine) const;
+ virtual std::string exportRules(const Engine* engine) const;
+ virtual std::string exportRule(const Rule* rule, const Engine* engine) const;
+
+ virtual FisExporter* clone() const FL_IOVERRIDE;
+ };
+
+}
+
+#endif /* FL_FISEXPORTER_H */
+
diff --git a/fuzzylite/fl/imex/FisImporter.h b/fuzzylite/fl/imex/FisImporter.h
new file mode 100644
index 0000000..b631a48
--- /dev/null
+++ b/fuzzylite/fl/imex/FisImporter.h
@@ -0,0 +1,79 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FISIMPORTER_H
+#define FL_FISIMPORTER_H
+
+#include "fl/imex/Importer.h"
+
+#include <utility>
+#include <vector>
+
+
+namespace fl {
+ class Norm;
+ class TNorm;
+ class SNorm;
+ class Term;
+ class Defuzzifier;
+ class Variable;
+
+ class FL_API FisImporter : public Importer {
+ public:
+ FisImporter();
+ virtual ~FisImporter() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(FisImporter)
+
+ virtual std::string name() const FL_IOVERRIDE;
+
+ virtual Engine* fromString(const std::string& fcl) const FL_IOVERRIDE;
+
+ virtual FisImporter* clone() const FL_IOVERRIDE;
+
+ protected:
+ virtual void importSystem(const std::string& section, Engine* engine,
+ std::string& andMethod, std::string& orMethod,
+ std::string& impMethod, std::string& aggMethod,
+ std::string& defuzzMethod) const;
+ virtual void importInput(const std::string& section, Engine* engine) const;
+ virtual void importOutput(const std::string& section, Engine* engine) const;
+ virtual void importRules(const std::string& section, Engine* engine) const;
+ virtual std::string translateProposition(scalar code, Variable* variable) const;
+
+ //TODO: rename extract to translate in v6.0
+ virtual std::string extractTNorm(const std::string& tnorm) const;
+ virtual std::string extractSNorm(const std::string& tnorm) const;
+ virtual std::string extractDefuzzifier(const std::string& defuzzifier) const;
+
+ virtual Term* parseTerm(const std::string& line, const Engine* engine) const;
+ virtual Term* createInstance(const std::string& termClass, const std::string& name,
+ const std::vector<std::string>& params, const Engine* engine) const;
+ //TODO: rename to parseRange in v6.0
+ virtual std::pair<scalar, scalar> range(const std::string& range) const;
+
+ };
+
+}
+#endif /* FL_FISIMPORTER_H */
+
diff --git a/fuzzylite/fl/imex/FldExporter.h b/fuzzylite/fl/imex/FldExporter.h
new file mode 100644
index 0000000..71679a6
--- /dev/null
+++ b/fuzzylite/fl/imex/FldExporter.h
@@ -0,0 +1,84 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FLDEXPORTER_H
+#define FL_FLDEXPORTER_H
+
+#include "fl/imex/Exporter.h"
+
+#include <vector>
+
+namespace fl {
+ class Engine;
+ class InputVariable;
+ class OutputVariable;
+
+ class FL_API FldExporter : public Exporter {
+ protected:
+ std::string _separator;
+ bool _exportHeaders;
+ bool _exportInputValues;
+ bool _exportOutputValues;
+ public:
+ explicit FldExporter(const std::string& separator = " ");
+ virtual ~FldExporter() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(FldExporter)
+
+ virtual std::string name() const FL_IOVERRIDE;
+
+ virtual void setSeparator(const std::string& separator);
+ virtual std::string getSeparator() const;
+
+ virtual void setExportHeader(bool exportHeaders);
+ virtual bool exportsHeader() const;
+
+ virtual void setExportInputValues(bool exportInputValues);
+ virtual bool exportsInputValues() const;
+
+ virtual void setExportOutputValues(bool exportOutputValues);
+ virtual bool exportsOutputValues() const;
+
+ virtual std::string header(const Engine* engine) const;
+
+ //WARNING: The engine will be const_casted in order to be processed!
+ virtual std::string toString(const Engine* engine) const FL_IOVERRIDE;
+ virtual std::string toString(Engine* engine, int maximumNumberOfResults) const;
+ virtual std::string toString(Engine* engine, const std::string& inputData) const;
+
+ using Exporter::toFile;
+ virtual void toFile(const std::string& path, Engine* engine, int maximumNumberOfResults) const;
+ virtual void toFile(const std::string& path, Engine* engine, const std::string& inputData) const;
+
+ virtual std::vector<scalar> parse(const std::string& x) const;
+
+ void write(Engine* engine, std::ostream& writer, int maximumNumberOfResults) const;
+ void write(Engine* engine, std::ostream& writer, std::istream& reader) const;
+ void write(Engine* engine, std::ostream& writer, const std::vector<scalar>& inputValues) const;
+
+ virtual FldExporter* clone() const FL_IOVERRIDE;
+ };
+}
+
+#endif /* FL_FLDEXPORTER_H */
+
diff --git a/fuzzylite/fl/imex/FllExporter.h b/fuzzylite/fl/imex/FllExporter.h
new file mode 100644
index 0000000..e6a89f5
--- /dev/null
+++ b/fuzzylite/fl/imex/FllExporter.h
@@ -0,0 +1,83 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FLLEXPORTER_H
+#define FL_FLLEXPORTER_H
+
+#include "fl/imex/Exporter.h"
+
+#include <vector>
+
+namespace fl {
+ class Variable;
+ class InputVariable;
+ class OutputVariable;
+ class RuleBlock;
+ class Rule;
+ class Norm;
+ class Defuzzifier;
+ class Term;
+
+ class FL_API FllExporter : public Exporter {
+ protected:
+ std::string _indent;
+ std::string _separator;
+ public:
+ explicit FllExporter(const std::string& indent = " ", const std::string& separator = "\n");
+ virtual ~FllExporter() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(FllExporter)
+
+ virtual std::string name() const FL_IOVERRIDE;
+
+ virtual void setIndent(const std::string& indent);
+ virtual std::string getIndent() const;
+
+ virtual void setSeparator(const std::string& separator);
+ virtual std::string getSeparator() const;
+
+ virtual std::string toString(const Engine* engine) const FL_IOVERRIDE;
+
+ virtual std::string toString(const std::vector<Variable*>& variables) const;
+ virtual std::string toString(const std::vector<InputVariable*>& inputVariables) const;
+ virtual std::string toString(const std::vector<OutputVariable*>& outputVariables) const;
+ virtual std::string toString(const std::vector<RuleBlock*>& ruleBlocks) const;
+
+ virtual std::string toString(const Variable* variable) const;
+ virtual std::string toString(const InputVariable* inputVariable) const;
+ virtual std::string toString(const OutputVariable* outputVariable) const;
+
+ virtual std::string toString(const RuleBlock* ruleBlock) const;
+ virtual std::string toString(const Rule* rule) const;
+
+ virtual std::string toString(const Norm* norm) const;
+ virtual std::string toString(const Defuzzifier* defuzzifier) const;
+ virtual std::string toString(const Term* term) const;
+
+ virtual FllExporter* clone() const FL_IOVERRIDE;
+ };
+
+}
+
+#endif /* FL_FLLEXPORTER_H */
+
diff --git a/fuzzylite/fl/imex/FllImporter.h b/fuzzylite/fl/imex/FllImporter.h
new file mode 100644
index 0000000..5be41c7
--- /dev/null
+++ b/fuzzylite/fl/imex/FllImporter.h
@@ -0,0 +1,77 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FLLIMPORTER_H
+#define FL_FLLIMPORTER_H
+
+#include "fl/imex/Importer.h"
+
+#include <utility>
+
+namespace fl {
+ class TNorm;
+ class SNorm;
+ class Term;
+ class Defuzzifier;
+
+ class FL_API FllImporter : public Importer {
+ protected:
+ std::string _separator;
+ public:
+ explicit FllImporter(const std::string& separator = "\n");
+ virtual ~FllImporter() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(FllImporter)
+
+ virtual void setSeparator(const std::string& separator);
+ virtual std::string getSeparator() const;
+
+ virtual std::string name() const FL_IOVERRIDE;
+ virtual Engine* fromString(const std::string& fll) const FL_IOVERRIDE;
+
+ virtual FllImporter* clone() const FL_IOVERRIDE;
+
+ protected:
+ virtual void process(const std::string& tag, const std::string& block, Engine* engine) const;
+ virtual void processInputVariable(const std::string& block, Engine* engine) const;
+ virtual void processOutputVariable(const std::string& block, Engine* engine) const;
+ virtual void processRuleBlock(const std::string& block, Engine* engine) const;
+
+ virtual TNorm* parseTNorm(const std::string& name) const;
+ virtual SNorm* parseSNorm(const std::string& name) const;
+
+ virtual Term* parseTerm(const std::string& text, Engine* engine) const;
+
+ virtual Defuzzifier* parseDefuzzifier(const std::string& line) const;
+ virtual std::pair<scalar, scalar> parseRange(const std::string& line) const;
+ virtual bool parseBoolean(const std::string& boolean) const;
+
+ virtual std::pair<std::string, std::string> parseKeyValue(const std::string& text,
+ char separator = ':') const;
+ virtual std::string clean(const std::string& line) const;
+
+ };
+}
+
+#endif /* FL_FLLIMPORTER_H */
+
diff --git a/fuzzylite/fl/imex/Importer.h b/fuzzylite/fl/imex/Importer.h
new file mode 100644
index 0000000..28d2b36
--- /dev/null
+++ b/fuzzylite/fl/imex/Importer.h
@@ -0,0 +1,52 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_IMPORTER_H
+#define FL_IMPORTER_H
+
+#include "fl/fuzzylite.h"
+
+#include <string>
+
+namespace fl {
+ class Engine;
+
+ class FL_API Importer {
+ public:
+
+ Importer();
+ virtual ~Importer();
+ FL_DEFAULT_COPY_AND_MOVE(Importer)
+
+ virtual Engine* fromString(const std::string& s) const = 0;
+ virtual Engine* fromFile(const std::string& path) const;
+
+ virtual std::string name() const = 0;
+ virtual Importer* clone() const = 0;
+ };
+
+}
+
+#endif /* IMPORTER_H */
+
diff --git a/fuzzylite/fl/imex/JavaExporter.h b/fuzzylite/fl/imex/JavaExporter.h
new file mode 100644
index 0000000..e882d4a
--- /dev/null
+++ b/fuzzylite/fl/imex/JavaExporter.h
@@ -0,0 +1,68 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_JAVAEXPORTER_H
+#define FL_JAVAEXPORTER_H
+
+#include "fl/imex/Exporter.h"
+
+namespace fl {
+
+ class Engine;
+ class InputVariable;
+ class OutputVariable;
+ class RuleBlock;
+ class Term;
+ class Defuzzifier;
+ class Norm;
+ class SNorm;
+ class TNorm;
+
+ class FL_API JavaExporter : public Exporter {
+ public:
+ JavaExporter();
+ virtual ~JavaExporter() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(JavaExporter)
+
+ virtual std::string name() const FL_IOVERRIDE;
+
+ virtual std::string toString(const Engine* engine) const FL_IOVERRIDE;
+ virtual std::string toString(const InputVariable* inputVariable, const Engine* engine) const;
+ virtual std::string toString(const OutputVariable* outputVariable, const Engine* engine) const;
+ virtual std::string toString(const RuleBlock* ruleBlock, const Engine* engine) const;
+ virtual std::string toString(const Term* term) const;
+ virtual std::string toString(const Defuzzifier* defuzzifier) const;
+ virtual std::string toString(const Norm* norm) const;
+ virtual std::string toString(const SNorm* norm) const;//TODO: delete in v6.0
+ virtual std::string toString(const TNorm* norm) const;//TODO: delete in v6.0
+ virtual std::string toString(scalar value) const;
+
+ virtual JavaExporter* clone() const FL_IOVERRIDE;
+
+ };
+
+}
+
+#endif /* FL_JAVAEXPORTER_H */
+
diff --git a/fuzzylite/fl/norm/Norm.h b/fuzzylite/fl/norm/Norm.h
new file mode 100644
index 0000000..5f1b578
--- /dev/null
+++ b/fuzzylite/fl/norm/Norm.h
@@ -0,0 +1,55 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_NORM_H
+#define FL_NORM_H
+
+#include "fl/fuzzylite.h"
+
+#include "fl/Operation.h"
+
+#include <string>
+
+namespace fl {
+
+ class FL_API Norm {
+ public:
+
+ Norm() {
+ }
+
+ virtual ~Norm() {
+ }
+
+ FL_DEFAULT_COPY_AND_MOVE(Norm)
+
+ virtual std::string className() const = 0;
+ virtual scalar compute(scalar a, scalar b) const = 0;
+
+ virtual Norm* clone() const = 0;
+
+ };
+}
+#endif /* FL_NORM_H */
+
diff --git a/fuzzylite/fl/norm/SNorm.h b/fuzzylite/fl/norm/SNorm.h
new file mode 100644
index 0000000..a281f52
--- /dev/null
+++ b/fuzzylite/fl/norm/SNorm.h
@@ -0,0 +1,47 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_SNORM_H
+#define FL_SNORM_H
+
+#include "fl/norm/Norm.h"
+
+namespace fl {
+
+ class FL_API SNorm : public Norm {
+ public:
+
+ SNorm() {
+ }
+
+ virtual ~SNorm() FL_IOVERRIDE {
+ }
+
+ FL_DEFAULT_COPY_AND_MOVE(SNorm)
+
+ virtual SNorm* clone() const FL_IOVERRIDE = 0;
+ };
+}
+#endif /* FL_SNORM_H */
+
diff --git a/fuzzylite/fl/norm/TNorm.h b/fuzzylite/fl/norm/TNorm.h
new file mode 100644
index 0000000..8ba8538
--- /dev/null
+++ b/fuzzylite/fl/norm/TNorm.h
@@ -0,0 +1,47 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_TNORM_H
+#define FL_TNORM_H
+
+#include "fl/norm/Norm.h"
+
+namespace fl {
+
+ class FL_API TNorm : public Norm {
+ public:
+
+ TNorm() {
+ }
+
+ virtual ~TNorm() FL_IOVERRIDE {
+ }
+
+ FL_DEFAULT_COPY_AND_MOVE(TNorm)
+
+ virtual TNorm* clone() const FL_IOVERRIDE = 0;
+ };
+}
+#endif /* TNORM_H */
+
diff --git a/fuzzylite/fl/norm/s/AlgebraicSum.h b/fuzzylite/fl/norm/s/AlgebraicSum.h
new file mode 100644
index 0000000..786bcbd
--- /dev/null
+++ b/fuzzylite/fl/norm/s/AlgebraicSum.h
@@ -0,0 +1,46 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_ALGEBRAICSUM_H
+#define FL_ALGEBRAICSUM_H
+
+#include "fl/norm/SNorm.h"
+
+
+namespace fl {
+
+ class FL_API AlgebraicSum : public SNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ AlgebraicSum* clone() const FL_IOVERRIDE;
+
+ static SNorm* constructor();
+ };
+
+
+}
+
+#endif /* FL_ALGEBRAICSUM_H */
+
diff --git a/fuzzylite/fl/norm/s/BoundedSum.h b/fuzzylite/fl/norm/s/BoundedSum.h
new file mode 100644
index 0000000..5231856
--- /dev/null
+++ b/fuzzylite/fl/norm/s/BoundedSum.h
@@ -0,0 +1,43 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_BOUNDEDSUM_H
+#define FL_BOUNDEDSUM_H
+
+#include "fl/norm/SNorm.h"
+
+namespace fl {
+
+ class FL_API BoundedSum : public SNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ BoundedSum* clone() const FL_IOVERRIDE;
+
+ static SNorm* constructor();
+ };
+}
+
+#endif /* FL_BOUNDEDSUM_H */
+
diff --git a/fuzzylite/fl/norm/s/DrasticSum.h b/fuzzylite/fl/norm/s/DrasticSum.h
new file mode 100644
index 0000000..65d4d4c
--- /dev/null
+++ b/fuzzylite/fl/norm/s/DrasticSum.h
@@ -0,0 +1,43 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_DRASTICSUM_H
+#define FL_DRASTICSUM_H
+
+#include "fl/norm/SNorm.h"
+namespace fl {
+
+ class FL_API DrasticSum : public SNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ DrasticSum* clone() const FL_IOVERRIDE;
+
+ static SNorm* constructor();
+ };
+
+}
+
+#endif /* FL_DRASTICSUM_H */
+
diff --git a/fuzzylite/fl/norm/s/EinsteinSum.h b/fuzzylite/fl/norm/s/EinsteinSum.h
new file mode 100644
index 0000000..8114c68
--- /dev/null
+++ b/fuzzylite/fl/norm/s/EinsteinSum.h
@@ -0,0 +1,44 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_EINSTEINSUM_H
+#define FL_EINSTEINSUM_H
+
+#include "fl/norm/SNorm.h"
+
+namespace fl {
+
+ class FL_API EinsteinSum : public SNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ EinsteinSum* clone() const FL_IOVERRIDE;
+
+ static SNorm* constructor();
+ };
+
+}
+
+#endif /* FL_EINSTEINSUM_H */
+
diff --git a/fuzzylite/fl/norm/s/HamacherSum.h b/fuzzylite/fl/norm/s/HamacherSum.h
new file mode 100644
index 0000000..3daf852
--- /dev/null
+++ b/fuzzylite/fl/norm/s/HamacherSum.h
@@ -0,0 +1,44 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_HAMACHERSUM_H
+#define FL_HAMACHERSUM_H
+
+#include "fl/norm/SNorm.h"
+
+namespace fl {
+
+ class FL_API HamacherSum : public SNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ HamacherSum* clone() const FL_IOVERRIDE;
+
+ static SNorm* constructor();
+ };
+
+}
+
+#endif /* FL_HAMACHERSUM_H */
+
diff --git a/fuzzylite/fl/norm/s/Maximum.h b/fuzzylite/fl/norm/s/Maximum.h
new file mode 100644
index 0000000..28a3b6d
--- /dev/null
+++ b/fuzzylite/fl/norm/s/Maximum.h
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_MAXIMUM_H
+#define FL_MAXIMUM_H
+
+#include "fl/norm/SNorm.h"
+
+namespace fl {
+
+ class FL_API Maximum : public SNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ Maximum* clone() const FL_IOVERRIDE;
+
+ static SNorm* constructor();
+ };
+
+
+}
+
+#endif /* FL_MAXIMUM_H */
+
diff --git a/fuzzylite/fl/norm/s/NilpotentMaximum.h b/fuzzylite/fl/norm/s/NilpotentMaximum.h
new file mode 100644
index 0000000..151d92d
--- /dev/null
+++ b/fuzzylite/fl/norm/s/NilpotentMaximum.h
@@ -0,0 +1,43 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_NILPOTENTMAXIMUM_H
+#define FL_NILPOTENTMAXIMUM_H
+
+#include "fl/norm/SNorm.h"
+
+namespace fl {
+
+ class FL_API NilpotentMaximum : public SNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ NilpotentMaximum* clone() const FL_IOVERRIDE;
+
+ static SNorm* constructor();
+ };
+}
+
+#endif /* FL_NILPOTENTMAXIMUM_H */
+
diff --git a/fuzzylite/fl/norm/s/NormalizedSum.h b/fuzzylite/fl/norm/s/NormalizedSum.h
new file mode 100644
index 0000000..59063a6
--- /dev/null
+++ b/fuzzylite/fl/norm/s/NormalizedSum.h
@@ -0,0 +1,44 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_NORMALIZEDSUM_H
+#define FL_NORMALIZEDSUM_H
+
+#include "fl/norm/SNorm.h"
+
+namespace fl {
+
+ class FL_API NormalizedSum : public SNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ NormalizedSum* clone() const FL_IOVERRIDE;
+
+ static SNorm* constructor();
+ };
+
+}
+
+#endif /* FL_NORMALIZEDSUM_H */
+
diff --git a/fuzzylite/fl/norm/t/AlgebraicProduct.h b/fuzzylite/fl/norm/t/AlgebraicProduct.h
new file mode 100644
index 0000000..e4b0865
--- /dev/null
+++ b/fuzzylite/fl/norm/t/AlgebraicProduct.h
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_ALGEBRAICPRODUCT_H
+#define FL_ALGEBRAICPRODUCT_H
+
+#include "fl/norm/TNorm.h"
+
+namespace fl {
+
+ class FL_API AlgebraicProduct : public TNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ AlgebraicProduct* clone() const FL_IOVERRIDE;
+
+ static TNorm* constructor();
+ };
+
+
+}
+
+#endif /* FL_ALGEBRAICPRODUCT_H */
+
diff --git a/fuzzylite/fl/norm/t/BoundedDifference.h b/fuzzylite/fl/norm/t/BoundedDifference.h
new file mode 100644
index 0000000..3dc9d3a
--- /dev/null
+++ b/fuzzylite/fl/norm/t/BoundedDifference.h
@@ -0,0 +1,44 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_BOUNDEDDIFFERENCE_H
+#define FL_BOUNDEDDIFFERENCE_H
+
+#include "fl/norm/TNorm.h"
+
+namespace fl {
+
+ class FL_API BoundedDifference : public TNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ BoundedDifference* clone() const FL_IOVERRIDE;
+
+ static TNorm* constructor();
+ };
+
+}
+
+#endif /* FL_BOUNDEDDIFFERENCE_H */
+
diff --git a/fuzzylite/fl/norm/t/DrasticProduct.h b/fuzzylite/fl/norm/t/DrasticProduct.h
new file mode 100644
index 0000000..efd589d
--- /dev/null
+++ b/fuzzylite/fl/norm/t/DrasticProduct.h
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_DRASTICPRODUCT_H
+#define FL_DRASTICPRODUCT_H
+
+#include "fl/norm/TNorm.h"
+
+namespace fl {
+
+ class FL_API DrasticProduct : public TNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ DrasticProduct* clone() const FL_IOVERRIDE;
+
+ static TNorm* constructor();
+ };
+
+
+}
+
+#endif /* FL_DRASTICPRODUCT_H */
+
diff --git a/fuzzylite/fl/norm/t/EinsteinProduct.h b/fuzzylite/fl/norm/t/EinsteinProduct.h
new file mode 100644
index 0000000..a4c1141
--- /dev/null
+++ b/fuzzylite/fl/norm/t/EinsteinProduct.h
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_EINSTEINPRODUCT_H
+#define FL_EINSTEINPRODUCT_H
+
+#include "fl/norm/TNorm.h"
+
+namespace fl {
+
+ class FL_API EinsteinProduct : public TNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ EinsteinProduct* clone() const FL_IOVERRIDE;
+
+ static TNorm* constructor();
+ };
+
+
+}
+
+#endif /* FL_EINSTEINPRODUCT_H */
+
diff --git a/fuzzylite/fl/norm/t/HamacherProduct.h b/fuzzylite/fl/norm/t/HamacherProduct.h
new file mode 100644
index 0000000..9bc6b40
--- /dev/null
+++ b/fuzzylite/fl/norm/t/HamacherProduct.h
@@ -0,0 +1,44 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_HAMACHERPRODUCT_H
+#define FL_HAMACHERPRODUCT_H
+
+#include "fl/norm/TNorm.h"
+
+namespace fl {
+
+ class FL_API HamacherProduct : public TNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ HamacherProduct* clone() const FL_IOVERRIDE;
+
+ static TNorm* constructor();
+ };
+
+}
+
+#endif /* FL_HAMACHERPRODUCT_H */
+
diff --git a/fuzzylite/fl/norm/t/Minimum.h b/fuzzylite/fl/norm/t/Minimum.h
new file mode 100644
index 0000000..3590e42
--- /dev/null
+++ b/fuzzylite/fl/norm/t/Minimum.h
@@ -0,0 +1,44 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_MINIMUM_H
+#define FL_MINIMUM_H
+
+#include "fl/norm/TNorm.h"
+
+namespace fl {
+
+ class FL_API Minimum : public TNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ Minimum* clone() const FL_IOVERRIDE;
+
+ static TNorm* constructor();
+ };
+
+}
+
+#endif /* FL_MINIMUM_H */
+
diff --git a/fuzzylite/fl/norm/t/NilpotentMinimum.h b/fuzzylite/fl/norm/t/NilpotentMinimum.h
new file mode 100644
index 0000000..b3c11e0
--- /dev/null
+++ b/fuzzylite/fl/norm/t/NilpotentMinimum.h
@@ -0,0 +1,43 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_NILPOTENTMINIMUM_H
+#define FL_NILPOTENTMINIMUM_H
+
+#include "fl/norm/TNorm.h"
+
+namespace fl {
+
+ class FL_API NilpotentMinimum : public TNorm {
+ public:
+ std::string className() const FL_IOVERRIDE;
+ scalar compute(scalar a, scalar b) const FL_IOVERRIDE;
+ NilpotentMinimum* clone() const FL_IOVERRIDE;
+
+ static TNorm* constructor();
+ };
+}
+
+#endif /* FL_NILPOTENTMINIMUM_H */
+
diff --git a/fuzzylite/fl/rule/Antecedent.h b/fuzzylite/fl/rule/Antecedent.h
new file mode 100644
index 0000000..02724e5
--- /dev/null
+++ b/fuzzylite/fl/rule/Antecedent.h
@@ -0,0 +1,77 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_ANTECEDENT_H
+#define FL_ANTECEDENT_H
+
+#include "fl/fuzzylite.h"
+
+#include <string>
+
+namespace fl {
+ class Engine;
+ class Rule;
+ class TNorm;
+ class SNorm;
+ class Expression;
+
+ class FL_API Antecedent {
+ protected:
+ std::string _text;
+ Expression* _expression;
+
+ public:
+ Antecedent();
+ virtual ~Antecedent();
+
+ virtual void setText(const std::string& text);
+ virtual std::string getText() const;
+
+ virtual Expression* getExpression() const;
+
+ virtual bool isLoaded() const;
+
+ virtual void unload();
+ virtual void load(Rule* rule, const Engine* engine);
+ virtual void load(const std::string& antecedent, Rule* rule, const Engine* engine);
+
+ virtual scalar activationDegree(const TNorm* conjunction, const SNorm* disjunction,
+ const Expression* node) const;
+
+ virtual scalar activationDegree(const TNorm* conjunction, const SNorm* disjunction) const;
+
+ virtual std::string toString() const;
+
+ virtual std::string toPrefix(const Expression* node = fl::null) const;
+ virtual std::string toInfix(const Expression* node = fl::null) const;
+ virtual std::string toPostfix(const Expression* node = fl::null) const;
+
+
+ private:
+ FL_DISABLE_COPY(Antecedent)
+ };
+
+}
+
+#endif /* FL_ANTECEDENT_H */
diff --git a/fuzzylite/fl/rule/Consequent.h b/fuzzylite/fl/rule/Consequent.h
new file mode 100644
index 0000000..5394dc0
--- /dev/null
+++ b/fuzzylite/fl/rule/Consequent.h
@@ -0,0 +1,68 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_CONSEQUENT_H
+#define FL_CONSEQUENT_H
+
+#include "fl/fuzzylite.h"
+
+#include <string>
+#include <vector>
+
+namespace fl {
+ class Engine;
+ class Rule;
+ class Proposition;
+ class TNorm;
+
+ class FL_API Consequent {
+ protected:
+ std::string _text;
+ std::vector<Proposition*> _conclusions;
+
+ public:
+ Consequent();
+ virtual ~Consequent();
+
+ virtual void setText(const std::string& text);
+ virtual std::string getText() const;
+
+ virtual const std::vector<Proposition*>& conclusions() const;
+
+ virtual bool isLoaded();
+ virtual void unload();
+ virtual void load(Rule* rule, const Engine* engine);
+ virtual void load(const std::string& consequent, Rule* rule, const Engine* engine);
+
+ virtual void modify(scalar activationDegree, const TNorm* activation);
+
+ virtual std::string toString() const;
+
+ private:
+ FL_DISABLE_COPY(Consequent)
+ };
+
+}
+
+#endif /* FL_CONSEQUENT_H */
diff --git a/fuzzylite/fl/rule/Expression.h b/fuzzylite/fl/rule/Expression.h
new file mode 100644
index 0000000..cb48355
--- /dev/null
+++ b/fuzzylite/fl/rule/Expression.h
@@ -0,0 +1,84 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_EXPRESSION_H
+#define FL_EXPRESSION_H
+
+#include "fl/fuzzylite.h"
+
+#include <string>
+#include <vector>
+
+
+
+namespace fl {
+ class Variable;
+ class Hedge;
+ class Term;
+
+ class FL_API Expression {
+ public:
+
+ Expression();
+ virtual ~Expression();
+
+ virtual std::string toString() const = 0;
+
+ private:
+ FL_DISABLE_COPY(Expression)
+ };
+
+ class FL_API Proposition : public Expression {
+ public:
+ Variable* variable;
+ std::vector<Hedge*> hedges;
+ Term* term;
+
+ Proposition();
+ virtual ~Proposition() FL_IOVERRIDE;
+
+ virtual std::string toString() const FL_IOVERRIDE;
+
+ private:
+ FL_DISABLE_COPY(Proposition)
+ };
+
+ class FL_API Operator : public Expression {
+ public:
+ std::string name;
+ Expression* left;
+ Expression* right;
+
+ Operator();
+ virtual ~Operator() FL_IOVERRIDE;
+
+ virtual std::string toString() const FL_IOVERRIDE;
+
+ private:
+ FL_DISABLE_COPY(Operator)
+
+ };
+
+}
+#endif /* FL_FUZZYEXPRESSION_H */
diff --git a/fuzzylite/fl/rule/Rule.h b/fuzzylite/fl/rule/Rule.h
new file mode 100644
index 0000000..20d39fb
--- /dev/null
+++ b/fuzzylite/fl/rule/Rule.h
@@ -0,0 +1,121 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_RULE_H
+#define FL_RULE_H
+
+#include "fl/fuzzylite.h"
+
+#include <map>
+#include <string>
+
+
+namespace fl {
+ class Engine;
+ class Antecedent;
+ class Consequent;
+ class Hedge;
+ class TNorm;
+ class SNorm;
+
+ class FL_API Rule {
+ protected:
+ std::string _text;
+ scalar _weight;
+ FL_unique_ptr<Antecedent> _antecedent;
+ FL_unique_ptr<Consequent> _consequent;
+ std::map<std::string, Hedge*> _hedges;
+
+ public:
+ explicit Rule(const std::string& text = "", scalar weight = 1.0);
+ Rule(const Rule& other);
+ Rule& operator=(const Rule& other);
+ virtual ~Rule();
+ FL_DEFAULT_MOVE(Rule)
+
+ virtual void setText(const std::string& text);
+ virtual std::string getText() const;
+
+ virtual void setWeight(scalar weight);
+ virtual scalar getWeight() const;
+
+ virtual void setAntecedent(Antecedent* antecedent);
+ virtual Antecedent* getAntecedent() const;
+
+ virtual void setConsequent(Consequent* consequent);
+ virtual Consequent* getConsequent() const;
+
+ virtual void addHedge(Hedge* hedge);
+ virtual Hedge* getHedge(const std::string& name) const;
+ virtual Hedge* removeHedge(const std::string& hedge);
+ virtual bool hasHedge(const std::string& name) const;
+ virtual int numberOfHedges() const;
+ virtual void setHedges(const std::map<std::string, Hedge*>& hedges);
+ virtual const std::map<std::string, Hedge*>& hedges() const;
+ virtual std::map<std::string, Hedge*>& hedges();
+
+ virtual scalar activationDegree(const TNorm* conjunction, const SNorm* disjunction) const;
+ virtual void activate(scalar degree, const TNorm* activation) const;
+
+ virtual std::string toString() const;
+
+ virtual bool isLoaded() const;
+ virtual void unload();
+ virtual void load(const Engine* engine);
+ virtual void load(const std::string& rule, const Engine* engine);
+
+ virtual Rule* clone() const;
+
+ static Rule* parse(const std::string& rule, const Engine* engine);
+
+ static std::string ifKeyword() {
+ return "if";
+ }
+
+ static std::string isKeyword() {
+ return "is";
+ }
+
+ static std::string thenKeyword() {
+ return "then";
+ }
+
+ static std::string andKeyword() {
+ return "and";
+ }
+
+ static std::string orKeyword() {
+ return "or";
+ }
+
+ static std::string withKeyword() {
+ return "with";
+ }
+
+ };
+
+}
+
+
+#endif /* FL_RULE_H */
diff --git a/fuzzylite/fl/rule/RuleBlock.h b/fuzzylite/fl/rule/RuleBlock.h
new file mode 100644
index 0000000..35fe62e
--- /dev/null
+++ b/fuzzylite/fl/rule/RuleBlock.h
@@ -0,0 +1,97 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_RULEBLOCK_H
+#define FL_RULEBLOCK_H
+
+#include "fl/fuzzylite.h"
+
+#include <string>
+#include <vector>
+
+
+namespace fl {
+
+ class Engine;
+ class Rule;
+ class TNorm;
+ class SNorm;
+
+ class FL_API RuleBlock {
+ private:
+ void copyFrom(const RuleBlock& source);
+ protected:
+ std::string _name;
+ std::vector<Rule*> _rules;
+ FL_unique_ptr<TNorm> _conjunction;
+ FL_unique_ptr<SNorm> _disjunction;
+ FL_unique_ptr<TNorm> _activation;
+ bool _enabled;
+
+ public:
+ explicit RuleBlock(const std::string& name = "");
+ RuleBlock(const RuleBlock& other);
+ RuleBlock& operator=(const RuleBlock& other);
+ virtual ~RuleBlock();
+ FL_DEFAULT_MOVE(RuleBlock)
+
+ virtual void activate();
+
+ virtual void setName(std::string name);
+ virtual std::string getName() const;
+
+ virtual void setConjunction(TNorm* conjunction);
+ virtual TNorm* getConjunction() const;
+
+ virtual void setDisjunction(SNorm* disjunction);
+ virtual SNorm* getDisjunction() const;
+
+ virtual void setActivation(TNorm* activation);
+ virtual TNorm* getActivation() const;
+
+ virtual void setEnabled(bool enabled);
+ virtual bool isEnabled() const;
+
+ virtual void unloadRules() const;
+ virtual void loadRules(const Engine* engine);
+ virtual void reloadRules(const Engine* engine);
+
+ virtual std::string toString() const;
+
+ /**
+ * Operations for iterable datatype _rules
+ */
+ virtual void addRule(Rule* rule);
+ virtual void insertRule(Rule* rule, int index);
+ virtual Rule* getRule(int index) const;
+ virtual Rule* removeRule(int index);
+ virtual int numberOfRules() const;
+ virtual void setRules(const std::vector<Rule*>& rules);
+ virtual const std::vector<Rule*>& rules() const;
+ virtual std::vector<Rule*>& rules();
+
+ };
+
+}
+#endif /* RULEBLOCK_H */
diff --git a/fuzzylite/fl/term/Accumulated.h b/fuzzylite/fl/term/Accumulated.h
new file mode 100644
index 0000000..51625d0
--- /dev/null
+++ b/fuzzylite/fl/term/Accumulated.h
@@ -0,0 +1,94 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_ACCUMULATED_H
+#define FL_ACCUMULATED_H
+
+#include "fl/term/Term.h"
+
+#include <vector>
+
+namespace fl {
+
+ class Activated;
+ class SNorm;
+ class TNorm;
+
+ class FL_API Accumulated : public Term {
+ private:
+ void copyFrom(const Accumulated& source);
+ protected:
+ std::vector<Activated*> _terms;
+ scalar _minimum, _maximum;
+ FL_unique_ptr<SNorm> _accumulation;
+ public:
+ explicit Accumulated(const std::string& name = "",
+ scalar minimum = fl::nan,
+ scalar maximum = fl::nan,
+ SNorm* accumulation = fl::null);
+ Accumulated(const Accumulated& other);
+ Accumulated& operator=(const Accumulated& other);
+ virtual ~Accumulated() FL_IOVERRIDE;
+ FL_DEFAULT_MOVE(Accumulated)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual Accumulated* clone() const FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+ virtual scalar activationDegree(const Term* forTerm) const;
+
+ virtual std::string toString() const FL_IOVERRIDE;
+
+
+ virtual void setMinimum(scalar minimum);
+ virtual scalar getMinimum() const;
+
+ virtual void setMaximum(scalar maximum);
+ virtual scalar getMaximum() const;
+
+ virtual void setRange(scalar minimum, scalar maximum);
+ virtual scalar range() const;
+
+ virtual void setAccumulation(SNorm* accumulation);
+ virtual SNorm* getAccumulation() const;
+
+ /**
+ * Operations for std::vector _terms
+ */
+ virtual void addTerm(const Term* term, scalar degree, const TNorm* activation);
+ virtual void addTerm(Activated* term);
+ virtual Activated* getTerm(int index) const;
+ virtual Activated* removeTerm(int index);
+ virtual int numberOfTerms() const;
+ virtual const std::vector<Activated*>& terms() const;
+ virtual std::vector<Activated*>& terms();
+ virtual bool isEmpty() const;
+ virtual void clear();
+ };
+
+}
+#endif /* FL_ACCUMULATED_H */
diff --git a/fuzzylite/fl/term/Activated.h b/fuzzylite/fl/term/Activated.h
new file mode 100644
index 0000000..10c1b40
--- /dev/null
+++ b/fuzzylite/fl/term/Activated.h
@@ -0,0 +1,65 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_ACTIVATED_H
+#define FL_ACTIVATED_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+ class TNorm;
+
+ class FL_API Activated : public Term {
+ protected:
+ const Term* _term;
+ scalar _degree;
+ const TNorm* _activation;
+
+ public:
+ explicit Activated(const Term* term = fl::null, scalar degree = 1.0,
+ const TNorm* activationOperator = fl::null);
+ virtual ~Activated() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Activated)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+ virtual std::string toString() const FL_IOVERRIDE;
+
+ virtual void setTerm(const Term* term);
+ virtual const Term* getTerm() const;
+
+ virtual void setDegree(scalar degree);
+ virtual scalar getDegree() const;
+
+ virtual void setActivation(const TNorm* activation);
+ virtual const TNorm* getActivation() const;
+
+ virtual Activated* clone() const FL_IOVERRIDE;
+ };
+
+}
+#endif /* FL_ACTIVATED_H */
diff --git a/fuzzylite/fl/term/Bell.h b/fuzzylite/fl/term/Bell.h
new file mode 100644
index 0000000..115479c
--- /dev/null
+++ b/fuzzylite/fl/term/Bell.h
@@ -0,0 +1,68 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_BELL_H
+#define FL_BELL_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Bell : public Term {
+ protected:
+ scalar _center;
+ scalar _width;
+ scalar _slope;
+ public:
+ explicit Bell(const std::string& name = "",
+ scalar center = fl::nan,
+ scalar width = fl::nan,
+ scalar slope = fl::nan,
+ scalar height = 1.0);
+ virtual ~Bell() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Bell)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setCenter(scalar center);
+ virtual scalar getCenter() const;
+
+ virtual void setWidth(scalar width);
+ virtual scalar getWidth() const;
+
+ virtual void setSlope(scalar slope);
+ virtual scalar getSlope() const;
+
+ virtual Bell* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+
+ };
+
+}
+#endif /* FL_BELL_H */
diff --git a/fuzzylite/fl/term/Concave.h b/fuzzylite/fl/term/Concave.h
new file mode 100644
index 0000000..b3aabe6
--- /dev/null
+++ b/fuzzylite/fl/term/Concave.h
@@ -0,0 +1,64 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_CONCAVE_H
+#define FL_CONCAVE_H
+
+#include "fl/term/Term.h"
+
+
+namespace fl {
+
+ class FL_API Concave : public Term {
+ protected:
+ scalar _inflection, _end;
+ public:
+ explicit Concave(const std::string& name = "",
+ scalar inflection = fl::nan,
+ scalar end = fl::nan,
+ scalar height = 1.0);
+ virtual ~Concave() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Concave)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setInflection(scalar inflection);
+ virtual scalar getInflection() const;
+
+ virtual void setEnd(scalar end);
+ virtual scalar getEnd() const;
+
+ virtual Concave* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+
+
+#endif /* FL_CONCAVE_H */
+
diff --git a/fuzzylite/fl/term/Constant.h b/fuzzylite/fl/term/Constant.h
new file mode 100644
index 0000000..c4ed17d
--- /dev/null
+++ b/fuzzylite/fl/term/Constant.h
@@ -0,0 +1,58 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_CONSTANT_H
+#define FL_CONSTANT_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Constant : public Term {
+ protected:
+ scalar _value;
+
+ public:
+ explicit Constant(const std::string& name = "",
+ scalar value = fl::nan);
+ virtual ~Constant() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Constant)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setValue(scalar value);
+ virtual scalar getValue() const;
+
+ virtual Constant* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+
+#endif /* FL_CONSTANT_H */
+
diff --git a/fuzzylite/fl/term/Cosine.h b/fuzzylite/fl/term/Cosine.h
new file mode 100644
index 0000000..510669f
--- /dev/null
+++ b/fuzzylite/fl/term/Cosine.h
@@ -0,0 +1,62 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_COSINE_H
+#define FL_COSINE_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Cosine : public Term {
+ protected:
+ scalar _center, _width;
+ public:
+ explicit Cosine(const std::string& name = "",
+ scalar center = fl::nan,
+ scalar width = fl::nan,
+ scalar height = 1.0);
+ virtual ~Cosine() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Cosine)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setCenter(scalar center);
+ virtual scalar getCenter() const;
+
+ virtual void setWidth(scalar width);
+ virtual scalar getWidth() const;
+
+ virtual Cosine* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+
+#endif /* FL_COSINE_H */
+
diff --git a/fuzzylite/fl/term/Discrete.h b/fuzzylite/fl/term/Discrete.h
new file mode 100644
index 0000000..fc554b3
--- /dev/null
+++ b/fuzzylite/fl/term/Discrete.h
@@ -0,0 +1,81 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_DISCRETE_H
+#define FL_DISCRETE_H
+
+#include "fl/term/Term.h"
+
+#include <vector>
+#include <utility>
+
+namespace fl {
+
+ class FL_API Discrete : public Term {
+ public:
+ typedef std::pair<scalar, scalar> Pair;
+ protected:
+ std::vector<Pair> _xy;
+ public:
+ explicit Discrete(const std::string& name = "",
+ const std::vector<Pair>& xy = std::vector<Pair>(),
+ scalar height = 1.0);
+ virtual ~Discrete() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Discrete)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ //Warning: this method is unsafe. Make sure you use it correctly.
+ template <typename T>
+ static Discrete* create(const std::string& name, int argc,
+ T x1, T y1, ...); // throw (fl::Exception);
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setXY(const std::vector<Pair>& pairs);
+ virtual const std::vector<Pair>& xy() const;
+ virtual std::vector<Pair>& xy();
+ virtual const Pair& xy(int index) const;
+ virtual Pair& xy(int index);
+
+
+ static std::vector<scalar> toVector(const std::vector<Pair>& xy);
+ static std::vector<Pair> toPairs(const std::vector<scalar>& xy);
+ static std::vector<Pair> toPairs(const std::vector<scalar>& xy,
+ scalar missingValue) FL_INOEXCEPT;
+
+ static std::string formatXY(const std::vector<Pair>& xy,
+ const std::string& prefix = "(", const std::string& innerSeparator = ",",
+ const std::string& postfix = ")", const std::string& outerSeparator = " ");
+
+ virtual Discrete* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+
+ };
+
+}
+#endif /* FL_DISCRETE_H */
diff --git a/fuzzylite/fl/term/Function.h b/fuzzylite/fl/term/Function.h
new file mode 100644
index 0000000..99580b7
--- /dev/null
+++ b/fuzzylite/fl/term/Function.h
@@ -0,0 +1,171 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_FUNCTION_H
+#define FL_FUNCTION_H
+
+#include "fl/term/Term.h"
+
+#include <map>
+#include <string>
+
+namespace fl {
+
+ class Engine;
+
+ class FL_API Function : public Term {
+ /****************************
+ * Parsing Elements
+ ****************************/
+
+ public:
+ typedef scalar(*Unary)(scalar);
+ typedef scalar(*Binary)(scalar, scalar);
+
+ struct FL_API Element {
+
+ enum Type {
+ OPERATOR, FUNCTION
+ };
+ std::string name;
+ std::string description;
+ Type type;
+ Unary unary;
+ Binary binary;
+ int arity;
+ int precedence; //Operator
+ int associativity;
+ Element(const std::string& name, const std::string& description, Type type);
+ Element(const std::string& name, const std::string& description,
+ Type type, Unary unary, int precedence = 0, int associativity = -1);
+ Element(const std::string& name, const std::string& description,
+ Type type, Binary binary, int precedence = 0, int associativity = -1);
+ virtual ~Element();
+ FL_DEFAULT_COPY_AND_MOVE(Element)
+
+ virtual bool isOperator() const;
+ virtual bool isFunction() const;
+
+ virtual Element* clone() const;
+
+ virtual std::string toString() const;
+
+ };
+
+ /**************************
+ * Tree elements, wrap Elements into Nodes.
+ **************************/
+
+ struct FL_API Node {
+ FL_unique_ptr<Element> element;
+ FL_unique_ptr<Node> left;
+ FL_unique_ptr<Node> right;
+ std::string variable;
+ scalar value;
+
+ explicit Node(Element* element, Node* left = fl::null, Node* right = fl::null);
+ explicit Node(const std::string& variable);
+ explicit Node(scalar value);
+ Node(const Node& source);
+ Node& operator=(const Node& rhs);
+ virtual ~Node();
+ FL_DEFAULT_MOVE(Node)
+
+ virtual scalar evaluate(const std::map<std::string, scalar>*
+ variables = fl::null) const;
+
+ virtual Node* clone() const;
+
+ virtual std::string toString() const;
+ virtual std::string toPrefix(const Node* node = fl::null) const;
+ virtual std::string toInfix(const Node* node = fl::null) const;
+ virtual std::string toPostfix(const Node* node = fl::null) const;
+ private:
+ void copyFrom(const Node& source);
+ };
+
+
+
+
+ /******************************
+ * Term
+ ******************************/
+
+ protected:
+ FL_unique_ptr<Node> _root;
+ std::string _formula;
+ const Engine* _engine;
+ public:
+ mutable std::map<std::string, scalar> variables;
+ explicit Function(const std::string& name = "",
+ const std::string& formula = "", const Engine* engine = fl::null);
+ Function(const Function& other);
+ Function& operator=(const Function& other);
+ virtual ~Function() FL_IOVERRIDE;
+ FL_DEFAULT_MOVE(Function)
+
+ static Function* create(const std::string& name,
+ const std::string& formula,
+ const Engine* engine = fl::null); // throw (fl::Exception);
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual scalar evaluate(const std::map<std::string, scalar>* variables) const;
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual void setFormula(const std::string& formula);
+ virtual std::string getFormula() const;
+
+ virtual void setEngine(const Engine* engine);
+ virtual const Engine* getEngine() const;
+
+ virtual Node* root() const;
+
+ virtual bool isLoaded() const;
+ virtual void unload();
+ virtual void load(); // throw (fl::Exception);
+ virtual void load(const std::string& formula); // throw (fl::Exception);
+ virtual void load(const std::string& formula, const Engine* engine); // throw (fl::Exception);
+
+ virtual Node* parse(const std::string& formula); // throw (fl::Exception);
+
+ virtual std::string toPostfix(const std::string& formula) const; //throw (fl::Exception);
+
+ virtual std::string space(const std::string& formula) const;
+
+ virtual Function* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+
+ static void main();
+
+ };
+
+}
+
+#endif /* FL_FUNCTION_H */
+
diff --git a/fuzzylite/fl/term/Gaussian.h b/fuzzylite/fl/term/Gaussian.h
new file mode 100644
index 0000000..a5b8055
--- /dev/null
+++ b/fuzzylite/fl/term/Gaussian.h
@@ -0,0 +1,63 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_GAUSSIAN_H
+#define FL_GAUSSIAN_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Gaussian : public Term {
+ protected:
+ scalar _mean;
+ scalar _standardDeviation;
+
+ public:
+ explicit Gaussian(const std::string& name = "",
+ scalar mean = fl::nan,
+ scalar standardDeviation = fl::nan,
+ scalar height = 1.0);
+ virtual ~Gaussian() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Gaussian)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setMean(scalar c);
+ virtual scalar getMean() const;
+
+ virtual void setStandardDeviation(scalar sigma);
+ virtual scalar getStandardDeviation() const;
+
+ virtual Gaussian* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+
+}
+#endif /* FL_GAUSSIAN_H */
diff --git a/fuzzylite/fl/term/GaussianProduct.h b/fuzzylite/fl/term/GaussianProduct.h
new file mode 100644
index 0000000..bd1eaaa
--- /dev/null
+++ b/fuzzylite/fl/term/GaussianProduct.h
@@ -0,0 +1,73 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_GAUSSIANPRODUCT_H
+#define FL_GAUSSIANPRODUCT_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API GaussianProduct : public Term {
+ protected:
+ scalar _meanA;
+ scalar _standardDeviationA;
+ scalar _meanB;
+ scalar _standardDeviationB;
+
+ public:
+ explicit GaussianProduct(const std::string& name = "",
+ scalar meanA = fl::nan,
+ scalar standardDeviationA = fl::nan,
+ scalar meanB = fl::nan,
+ scalar standardDeviationB = fl::nan,
+ scalar height = 1.0);
+ virtual ~GaussianProduct() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(GaussianProduct)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setMeanA(scalar meanA);
+ virtual scalar getMeanA() const;
+
+ virtual void setStandardDeviationA(scalar sigmaA);
+ virtual scalar getStandardDeviationA() const;
+
+ virtual void setMeanB(scalar meanB);
+ virtual scalar getMeanB() const;
+
+ virtual void setStandardDeviationB(scalar sigmaB);
+ virtual scalar getStandardDeviationB() const;
+
+ virtual GaussianProduct* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+#endif /* FL_GAUSSIANPRODUCT_H */
+
diff --git a/fuzzylite/fl/term/Linear.h b/fuzzylite/fl/term/Linear.h
new file mode 100644
index 0000000..67ede04
--- /dev/null
+++ b/fuzzylite/fl/term/Linear.h
@@ -0,0 +1,72 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_LINEAR_H
+#define FL_LINEAR_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+ class Engine;
+
+ class FL_API Linear : public Term {
+ protected:
+ std::vector<scalar> _coefficients;
+ const Engine* _engine;
+ public:
+ explicit Linear(const std::string& name = "",
+ const std::vector<scalar>& coefficients = std::vector<scalar>(),
+ const Engine* engine = fl::null);
+ virtual ~Linear() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Linear)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void set(const std::vector<scalar>& coeffs, const Engine* engine);
+
+ virtual void setCoefficients(const std::vector<scalar>& coeffs);
+ virtual const std::vector<scalar>& coefficients() const;
+ virtual std::vector<scalar>& coefficients();
+
+ virtual void setEngine(const Engine* engine);
+ virtual const Engine* getEngine() const;
+
+ virtual Linear* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+
+ //Warning: this method is unsafe, make sure you use it correctly.
+ template <typename T>
+ static Linear* create(const std::string& name, const Engine* engine,
+ T firstCoefficient, ...); // throw (fl::Exception);
+ };
+
+}
+
+#endif /* FL_LINEAR_H */
+
diff --git a/fuzzylite/fl/term/PiShape.h b/fuzzylite/fl/term/PiShape.h
new file mode 100644
index 0000000..a0c2f78
--- /dev/null
+++ b/fuzzylite/fl/term/PiShape.h
@@ -0,0 +1,74 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_PISHAPE_H
+#define FL_PISHAPE_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API PiShape : public Term {
+ protected:
+ scalar _bottomLeft;
+ scalar _topLeft;
+ scalar _topRight;
+ scalar _bottomRight;
+
+ public:
+ explicit PiShape(const std::string& name = "",
+ scalar bottomLeft = fl::nan,
+ scalar topLeft = fl::nan,
+ scalar topRight = fl::nan,
+ scalar bottomRight = fl::nan,
+ scalar height = 1.0);
+ virtual ~PiShape() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(PiShape)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setBottomLeft(scalar a);
+ virtual scalar getBottomLeft() const;
+
+ virtual void setTopLeft(scalar b);
+ virtual scalar getTopLeft() const;
+
+ virtual void setTopRight(scalar d);
+ virtual scalar getTopRight() const;
+
+ virtual void setBottomRight(scalar c);
+ virtual scalar getBottomRight() const;
+
+ virtual PiShape* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+
+#endif /* FL_PISHAPE_H */
+
diff --git a/fuzzylite/fl/term/Ramp.h b/fuzzylite/fl/term/Ramp.h
new file mode 100644
index 0000000..63a683c
--- /dev/null
+++ b/fuzzylite/fl/term/Ramp.h
@@ -0,0 +1,68 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_RAMP_H
+#define FL_RAMP_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Ramp : public Term {
+ protected:
+ scalar _start, _end;
+
+ public:
+
+ enum Direction {
+ POSITIVE, ZERO, NEGATIVE
+ };
+ explicit Ramp(const std::string& name = "",
+ scalar start = fl::nan,
+ scalar end = fl::nan,
+ scalar height = 1.0);
+ virtual ~Ramp() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Ramp)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setStart(scalar start);
+ virtual scalar getStart() const;
+
+ virtual void setEnd(scalar end);
+ virtual scalar getEnd() const;
+
+ virtual Direction direction() const;
+
+ virtual Ramp* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+#endif /* FL_RAMP_H */
+
diff --git a/fuzzylite/fl/term/Rectangle.h b/fuzzylite/fl/term/Rectangle.h
new file mode 100644
index 0000000..23b5eda
--- /dev/null
+++ b/fuzzylite/fl/term/Rectangle.h
@@ -0,0 +1,62 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_RECTANGLE_H
+#define FL_RECTANGLE_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Rectangle : public Term {
+ protected:
+ scalar _start, _end;
+
+ public:
+ explicit Rectangle(const std::string& name = "",
+ scalar start = fl::nan,
+ scalar end = fl::nan,
+ scalar height = 1.0);
+ virtual ~Rectangle() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Rectangle)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setStart(scalar start);
+ virtual scalar getStart() const;
+
+ virtual void setEnd(scalar end);
+ virtual scalar getEnd() const;
+
+ virtual Rectangle* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+
+}
+#endif /* FL_RECTANGLE_H */
diff --git a/fuzzylite/fl/term/SShape.h b/fuzzylite/fl/term/SShape.h
new file mode 100644
index 0000000..0891357
--- /dev/null
+++ b/fuzzylite/fl/term/SShape.h
@@ -0,0 +1,64 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+
+#ifndef FL_SSHAPE_H
+#define FL_SSHAPE_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API SShape : public Term {
+ protected:
+ scalar _start, _end;
+
+ public:
+ explicit SShape(const std::string& name = "",
+ scalar start = fl::nan,
+ scalar end = fl::nan,
+ scalar height = 1.0);
+ virtual ~SShape() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(SShape)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setStart(scalar start);
+ virtual scalar getStart() const;
+
+ virtual void setEnd(scalar end);
+ virtual scalar getEnd() const;
+
+ virtual SShape* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+
+#endif /* FL_SSHAPE_H */
+
diff --git a/fuzzylite/fl/term/Sigmoid.h b/fuzzylite/fl/term/Sigmoid.h
new file mode 100644
index 0000000..b37b1be
--- /dev/null
+++ b/fuzzylite/fl/term/Sigmoid.h
@@ -0,0 +1,68 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_SIGMOID_H
+#define FL_SIGMOID_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Sigmoid : public Term {
+ protected:
+ scalar _inflection;
+ scalar _slope;
+ public:
+
+ enum Direction {
+ POSITIVE, ZERO, NEGATIVE
+ };
+ explicit Sigmoid(const std::string& name = "",
+ scalar inflection = fl::nan,
+ scalar slope = fl::nan,
+ scalar height = 1.0);
+ virtual ~Sigmoid() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Sigmoid)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setInflection(scalar inflection);
+ virtual scalar getInflection() const;
+
+ virtual void setSlope(scalar slope);
+ virtual scalar getSlope() const;
+
+ virtual Direction direction() const;
+
+ virtual Sigmoid* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+
+}
+#endif /* FL_SIGMOID_H */
diff --git a/fuzzylite/fl/term/SigmoidDifference.h b/fuzzylite/fl/term/SigmoidDifference.h
new file mode 100644
index 0000000..020f164
--- /dev/null
+++ b/fuzzylite/fl/term/SigmoidDifference.h
@@ -0,0 +1,73 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_SIGMOIDDIFFERENCE_H
+#define FL_SIGMOIDDIFFERENCE_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API SigmoidDifference : public Term {
+ protected:
+ scalar _left;
+ scalar _rising;
+ scalar _falling;
+ scalar _right;
+
+ public:
+ explicit SigmoidDifference(const std::string& name = "",
+ scalar left = fl::nan,
+ scalar rising = fl::nan,
+ scalar falling = fl::nan,
+ scalar right = fl::nan,
+ scalar height = 1.0);
+ virtual ~SigmoidDifference() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(SigmoidDifference)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setLeft(scalar leftInflection);
+ virtual scalar getLeft() const;
+
+ virtual void setRising(scalar risingSlope);
+ virtual scalar getRising() const;
+
+ virtual void setFalling(scalar fallingSlope);
+ virtual scalar getFalling() const;
+
+ virtual void setRight(scalar rightInflection);
+ virtual scalar getRight() const;
+
+ virtual SigmoidDifference* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+#endif /* FL_SIGMOIDDIFFERENCE_H */
+
diff --git a/fuzzylite/fl/term/SigmoidProduct.h b/fuzzylite/fl/term/SigmoidProduct.h
new file mode 100644
index 0000000..cb83f30
--- /dev/null
+++ b/fuzzylite/fl/term/SigmoidProduct.h
@@ -0,0 +1,73 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_SIGMOIDPRODUCT_H
+#define FL_SIGMOIDPRODUCT_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API SigmoidProduct : public Term {
+ protected:
+ scalar _left;
+ scalar _rising;
+ scalar _falling;
+ scalar _right;
+
+ public:
+ explicit SigmoidProduct(const std::string& name = "",
+ scalar left = fl::nan,
+ scalar rising = fl::nan,
+ scalar falling = fl::nan,
+ scalar right = fl::nan,
+ scalar height = 1.0);
+ virtual ~SigmoidProduct() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(SigmoidProduct)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setLeft(scalar leftInflection);
+ virtual scalar getLeft() const;
+
+ virtual void setRising(scalar risingSlope);
+ virtual scalar getRising() const;
+
+ virtual void setFalling(scalar fallingSlope);
+ virtual scalar getFalling() const;
+
+ virtual void setRight(scalar rightInflection);
+ virtual scalar getRight() const;
+
+ virtual SigmoidProduct* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+#endif /* FL_SIGMOIDPRODUCT_H */
+
diff --git a/fuzzylite/fl/term/Spike.h b/fuzzylite/fl/term/Spike.h
new file mode 100644
index 0000000..7e520c9
--- /dev/null
+++ b/fuzzylite/fl/term/Spike.h
@@ -0,0 +1,62 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_SPIKE_H
+#define FL_SPIKE_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Spike : public Term {
+ protected:
+ scalar _center, _width;
+ public:
+ explicit Spike(const std::string& name = "",
+ scalar center = fl::nan,
+ scalar width = fl::nan,
+ scalar height = 1.0);
+ virtual ~Spike() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Spike)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setCenter(scalar center);
+ virtual scalar getCenter() const;
+
+ virtual void setWidth(scalar width);
+ virtual scalar getWidth() const;
+
+ virtual Spike* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+}
+
+#endif /* FL_SPIKE_H */
+
diff --git a/fuzzylite/fl/term/Term.h b/fuzzylite/fl/term/Term.h
new file mode 100644
index 0000000..6c2b2b1
--- /dev/null
+++ b/fuzzylite/fl/term/Term.h
@@ -0,0 +1,71 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+
+#ifndef FL_TERM_H
+#define FL_TERM_H
+
+#include "fl/fuzzylite.h"
+
+#include "fl/Operation.h"
+
+#include <cmath>
+#include <string>
+#include <vector>
+
+namespace fl {
+ class Engine;
+
+ class FL_API Term {
+ protected:
+ std::string _name;
+ scalar _height;
+ public:
+
+ explicit Term(const std::string& name = "", scalar height = 1.0);
+ virtual ~Term();
+ FL_DEFAULT_COPY_AND_MOVE(Term)
+
+ virtual void setName(const std::string& name);
+ virtual std::string getName() const;
+
+ virtual void setHeight(scalar height);
+ virtual scalar getHeight() const;
+
+ virtual std::string toString() const;
+
+ virtual std::string className() const = 0;
+ virtual std::string parameters() const = 0;
+ virtual void configure(const std::string& parameters) = 0;
+
+ virtual scalar membership(scalar x) const = 0;
+
+ virtual Term* clone() const = 0;
+
+ //FIXME: This should not be static, and may not be here either.
+ static void updateReference(Term* term, const Engine* engine);
+ };
+
+}
+#endif /* FL_TERM_H */
diff --git a/fuzzylite/fl/term/Trapezoid.h b/fuzzylite/fl/term/Trapezoid.h
new file mode 100644
index 0000000..f896997
--- /dev/null
+++ b/fuzzylite/fl/term/Trapezoid.h
@@ -0,0 +1,69 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_TRAPEZOID_H
+#define FL_TRAPEZOID_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Trapezoid : public Term {
+ protected:
+ scalar _vertexA, _vertexB, _vertexC, _vertexD;
+ public:
+ explicit Trapezoid(const std::string& name = "",
+ scalar vertexA = fl::nan,
+ scalar vertexB = fl::nan,
+ scalar vertexC = fl::nan,
+ scalar vertexD = fl::nan,
+ scalar height = 1.0);
+ virtual ~Trapezoid() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Trapezoid)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setVertexA(scalar a);
+ virtual scalar getVertexA() const;
+
+ virtual void setVertexB(scalar b);
+ virtual scalar getVertexB() const;
+
+ virtual void setVertexC(scalar c);
+ virtual scalar getVertexC() const;
+
+ virtual void setVertexD(scalar d);
+ virtual scalar getVertexD() const;
+
+ virtual Trapezoid* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+ };
+
+}
+#endif /* FL_TRAPEZOID_H */
diff --git a/fuzzylite/fl/term/Triangle.h b/fuzzylite/fl/term/Triangle.h
new file mode 100644
index 0000000..9311687
--- /dev/null
+++ b/fuzzylite/fl/term/Triangle.h
@@ -0,0 +1,68 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_TRIANGLE_H
+#define FL_TRIANGLE_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API Triangle : public Term {
+ protected:
+ scalar _vertexA;
+ scalar _vertexB;
+ scalar _vertexC;
+ public:
+ explicit Triangle(const std::string& name = "",
+ scalar vertexA = fl::nan,
+ scalar vertexB = fl::nan,
+ scalar vertexC = fl::nan,
+ scalar height = 1.0);
+ virtual ~Triangle() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(Triangle)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setVertexA(scalar a);
+ virtual scalar getVertexA() const;
+
+ virtual void setVertexB(scalar b);
+ virtual scalar getVertexB() const;
+
+ virtual void setVertexC(scalar c);
+ virtual scalar getVertexC() const;
+
+ virtual Triangle* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+
+ };
+
+}
+#endif /* FL_TRIANGLE_H */
diff --git a/fuzzylite/fl/term/ZShape.h b/fuzzylite/fl/term/ZShape.h
new file mode 100644
index 0000000..b53906e
--- /dev/null
+++ b/fuzzylite/fl/term/ZShape.h
@@ -0,0 +1,63 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_ZSHAPE_H
+#define FL_ZSHAPE_H
+
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ class FL_API ZShape : public Term {
+ protected:
+ scalar _start, _end;
+
+ public:
+ explicit ZShape(const std::string& name = "",
+ scalar _start = fl::nan,
+ scalar _end = fl::nan,
+ scalar _height = 1.0);
+ virtual ~ZShape() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(ZShape)
+
+ virtual std::string className() const FL_IOVERRIDE;
+ virtual std::string parameters() const FL_IOVERRIDE;
+ virtual void configure(const std::string& parameters) FL_IOVERRIDE;
+
+ virtual scalar membership(scalar x) const FL_IOVERRIDE;
+
+ virtual void setStart(scalar start);
+ virtual scalar getStart() const;
+
+ virtual void setEnd(scalar end);
+ virtual scalar getEnd() const;
+
+ virtual ZShape* clone() const FL_IOVERRIDE;
+
+ static Term* constructor();
+
+ };
+}
+#endif /* ZSHAPE_H */
+
diff --git a/fuzzylite/fl/variable/InputVariable.h b/fuzzylite/fl/variable/InputVariable.h
new file mode 100644
index 0000000..bba3c7d
--- /dev/null
+++ b/fuzzylite/fl/variable/InputVariable.h
@@ -0,0 +1,52 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_INPUTVARIABLE_H
+#define FL_INPUTVARIABLE_H
+
+#include "fl/variable/Variable.h"
+
+namespace fl {
+
+ class FL_API InputVariable : public Variable {
+ protected:
+ scalar _inputValue;
+ public:
+ explicit InputVariable(const std::string& name = "",
+ scalar minimum = -fl::inf,
+ scalar maximum = fl::inf);
+ virtual ~InputVariable() FL_IOVERRIDE;
+ FL_DEFAULT_COPY_AND_MOVE(InputVariable)
+
+ virtual void setInputValue(scalar inputValue);
+ virtual scalar getInputValue() const;
+
+ virtual std::string fuzzyInputValue() const;
+
+ virtual std::string toString() const FL_IOVERRIDE;
+
+ };
+
+}
+#endif /* FL_INPUTVARIABLE_H */
diff --git a/fuzzylite/fl/variable/OutputVariable.h b/fuzzylite/fl/variable/OutputVariable.h
new file mode 100644
index 0000000..9d00aaf
--- /dev/null
+++ b/fuzzylite/fl/variable/OutputVariable.h
@@ -0,0 +1,90 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_OUTPUTVARIABLE_H
+#define FL_OUTPUTVARIABLE_H
+
+#include "fl/variable/Variable.h"
+
+namespace fl {
+ class Accumulated;
+ class Defuzzifier;
+
+ class FL_API OutputVariable : public Variable {
+ private:
+ void copyFrom(const OutputVariable& other);
+ protected:
+ FL_unique_ptr<Accumulated> _fuzzyOutput;
+ FL_unique_ptr<Defuzzifier> _defuzzifier;
+ scalar _outputValue;
+ scalar _previousOutputValue;
+ scalar _defaultValue;
+ bool _lockOutputValueInRange;
+ bool _lockPreviousOutputValue;
+
+ public:
+ explicit OutputVariable(const std::string& name = "",
+ scalar minimum = -fl::inf, scalar maximum = fl::inf);
+ OutputVariable(const OutputVariable& other);
+ OutputVariable& operator=(const OutputVariable& other);
+ virtual ~OutputVariable() FL_IOVERRIDE;
+ FL_DEFAULT_MOVE(OutputVariable)
+
+ virtual Accumulated* fuzzyOutput() const;
+
+ virtual void setName(const std::string& name) FL_IOVERRIDE;
+
+ virtual void setMinimum(scalar minimum) FL_IOVERRIDE;
+ virtual void setMaximum(scalar maximum) FL_IOVERRIDE;
+
+ virtual void setDefuzzifier(Defuzzifier* defuzzifier);
+ virtual Defuzzifier* getDefuzzifier() const;
+
+ virtual void setOutputValue(scalar outputValue);
+ virtual scalar getOutputValue() const;
+
+ virtual void setPreviousOutputValue(scalar defuzzifiedValue);
+ virtual scalar getPreviousOutputValue() const;
+
+ virtual void setDefaultValue(scalar defaultValue);
+ virtual scalar getDefaultValue() const;
+
+ virtual void setLockOutputValueInRange(bool lockOutputValueInRange);
+ virtual bool isLockedOutputValueInRange() const;
+
+ virtual void setLockPreviousOutputValue(bool lockPreviousOutputValue);
+ virtual bool isLockedPreviousOutputValue() const;
+
+ virtual void defuzzify();
+
+ virtual std::string fuzzyOutputValue() const;
+
+ virtual void clear();
+
+ virtual std::string toString() const FL_IOVERRIDE;
+
+ };
+
+}
+#endif /* FL_OUTPUTVARIABLE_H */
diff --git a/fuzzylite/fl/variable/Variable.h b/fuzzylite/fl/variable/Variable.h
new file mode 100644
index 0000000..61870af
--- /dev/null
+++ b/fuzzylite/fl/variable/Variable.h
@@ -0,0 +1,96 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#ifndef FL_VARIABLE_H
+#define FL_VARIABLE_H
+
+#include "fl/fuzzylite.h"
+#include "fl/defuzzifier/Centroid.h"
+
+#include <string>
+#include <vector>
+
+namespace fl {
+
+ class Term;
+
+ class FL_API Variable {
+ private:
+ void copyFrom(const Variable& source);
+
+ protected:
+ std::string _name;
+ std::vector<Term*> _terms;
+ scalar _minimum, _maximum;
+ bool _enabled;
+
+ public:
+ explicit Variable(const std::string& name = "",
+ scalar minimum = -fl::inf,
+ scalar maximum = fl::inf);
+ Variable(const Variable& other);
+ Variable& operator=(const Variable& other);
+ virtual ~Variable();
+ FL_DEFAULT_MOVE(Variable)
+
+ virtual void setName(const std::string& name);
+ virtual std::string getName() const;
+
+ virtual void setRange(scalar minimum, scalar maximum);
+ virtual scalar range() const;
+
+ virtual void setMinimum(scalar minimum);
+ virtual scalar getMinimum() const;
+
+ virtual void setMaximum(scalar maximum);
+ virtual scalar getMaximum() const;
+
+ virtual void setEnabled(bool enabled);
+ virtual bool isEnabled() const;
+
+ virtual std::string fuzzify(scalar x) const;
+ virtual Term* highestMembership(scalar x, scalar* yhighest = fl::null) const;
+
+ virtual std::string toString() const;
+
+ /**
+ * Operations for iterable datatype _terms
+ */
+ virtual void sort();
+ virtual void addTerm(Term* term);
+ virtual void insertTerm(Term* term, int index);
+ virtual Term* getTerm(int index) const;
+ virtual Term* getTerm(const std::string& name) const;
+ virtual bool hasTerm(const std::string& name) const;
+ virtual Term* removeTerm(int index);
+ virtual int numberOfTerms() const;
+ virtual void setTerms(const std::vector<Term*>& terms);
+ virtual const std::vector<Term*>& terms() const;
+ virtual std::vector<Term*>& terms();
+
+ };
+
+}
+
+#endif /* FL_VARIABLE_H */
diff --git a/fuzzylite/fuzzylite.1 b/fuzzylite/fuzzylite.1
new file mode 100644
index 0000000..22d08d0
--- /dev/null
+++ b/fuzzylite/fuzzylite.1
@@ -0,0 +1,39 @@
+.TH fuzzylite 1 "October 26, 2014" "version 5.0" "USER COMMANDS"
+.SH NAME
+fuzzylite \- a fuzzy logic control library
+.SH SYNOPSIS
+.B fuzzylite
+[\-i inputfile] [\-if format] [\-o outputfile] [\-of format] [\-example letter] [\-decimals number] [\-d datafile] [\-dmaximum number] [\-dheader boolean] [\-dinputs boolean]
+.SH OPTIONS
+.TP
+\-i inputfile
+file to import your engine from
+.TP
+\-if format
+format of the file to import (fll | fis | fcl)
+.TP
+\-o outputfile
+file to export your engine to
+.TP
+\-of format
+format of the file to export (fll | fld | cpp | java | fis | fcl)
+.TP
+\-example letter
+if not inputfile, built\-in example to use as engine: (m)amdani or (t)akagi\-sugeno
+.TP
+\-decimals number
+number of decimals to write floating\-poing values
+.TP
+\-d datafile
+if exporting to fld, file of input values to evaluate your engine on
+.TP
+\-dmaximum number
+if exporting to fld without datafile, maximum number of results to export
+.TP
+\-dheader boolean
+if true and exporting to fld, include headers
+.TP
+\-dinputs boolean
+if true and exporting to fld, include input values
+.SH AUTHOR
+Juan Rada\-Vilela
diff --git a/fuzzylite/fuzzylite.doxygen b/fuzzylite/fuzzylite.doxygen
new file mode 100644
index 0000000..4ee925f
--- /dev/null
+++ b/fuzzylite/fuzzylite.doxygen
@@ -0,0 +1,1781 @@
+# Doxyfile 1.7.6.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# All text after a hash (#) is considered a comment and will be ignored.
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ").
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+DOXYFILE_ENCODING = UTF-8
+
+# The PROJECT_NAME tag is a single word (or sequence of words) that should
+# identify the project. Note that if you do not use Doxywizard you need
+# to put quotes around the project name if it contains spaces.
+
+PROJECT_NAME = "fuzzylite"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER = 4.0
+
+# Using the PROJECT_BRIEF tag one can provide an optional one line description
+# for a project that appears at the top of each page and should give viewer
+# a quick idea about the purpose of the project. Keep the description short.
+
+PROJECT_BRIEF = "A Fuzzy Logic Control Library in C++"
+
+# With the PROJECT_LOGO tag one can specify an logo or icon that is
+# included in the documentation. The maximum height of the logo should not
+# exceed 55 pixels and the maximum width should not exceed 200 pixels.
+# Doxygen will copy the logo to the output directory.
+
+PROJECT_LOGO = ../fuzzylite.png
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY = docs
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF = NO
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF = NO
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 8
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# This tag can be used to specify a number of word-keyword mappings (TCL only).
+# A mapping has the form "name=value". For example adding
+# "class=itcl::class" will allow you to use the command class in the
+# itcl::class meaning.
+
+TCL_SUBST =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING =
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
+# to include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+SIP_SUPPORT = NO
+
+# For Microsoft's IDL there are propget and propput attributes to indicate getter
+# and setter methods for a property. Setting this option to YES (the default)
+# will make doxygen replace the get and set methods by a property in the
+# documentation. This will only work if the methods are indeed getting or
+# setting a simple type. If this is not the case, or you want to show the
+# methods anyway, you should set this option to NO.
+
+IDL_PROPERTY_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
+# unions are shown inside the group in which they are included (e.g. using
+# @ingroup) instead of on a separate page (for HTML and Man pages) or
+# section (for LaTeX and RTF).
+
+INLINE_GROUPED_CLASSES = NO
+
+# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
+# unions with only public data fields will be shown inline in the documentation
+# of the scope in which they are defined (i.e. file, namespace, or group
+# documentation), provided this scope is documented. If set to NO (the default),
+# structs, classes, and unions are shown on a separate page (for HTML and Man
+# pages) or section (for LaTeX and RTF).
+
+INLINE_SIMPLE_STRUCTS = NO
+
+# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
+# is documented as struct, union, or enum with the name of the typedef. So
+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# For small to medium size projects (<1000 input files) the default value is
+# probably good enough. For larger projects a too small cache size can cause
+# doxygen to be busy swapping symbols to and from disk most of the time
+# causing a significant performance penalty.
+# If the system has enough physical memory increasing the cache will improve the
+# performance by keeping more symbols in memory. Note that the value works on
+# a logarithmic scale so increasing the size by one will roughly double the
+# memory usage. The cache size is given by this formula:
+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+SYMBOL_CACHE_SIZE = 0
+
+# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
+# their name and scope. Since this can be an expensive process and often the
+# same symbol appear multiple times in the code, doxygen keeps a cache of
+# pre-resolved symbols. If the cache is too small doxygen will become slower.
+# If the cache is too large, memory is wasted. The cache size is given by this
+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
+# corresponding to a cache size of 2^16 = 65536 symbols.
+
+LOOKUP_CACHE_SIZE = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# extracted and appear in the documentation as a namespace called
+# 'anonymous_namespace{file}', where file will be replaced with the base
+# name of the file that contains the anonymous namespace. By default
+# anonymous namespaces are hidden.
+
+EXTRACT_ANON_NSPACES = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
+# do proper type resolution of all parameters of a function it will reject a
+# match between the prototype and the implementation of a member function even
+# if there is only one candidate or it is obvious which candidate to choose
+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
+# will still accept a match between prototype and implementation in such cases.
+
+STRICT_PROTO_MATCHING = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or macro consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE =
+
+# The CITE_BIB_FILES tag can be used to specify one or more bib files
+# containing the references data. This must be a list of .bib files. The
+# .bib extension is automatically appended if omitted. Using this command
+# requires the bibtex tool to be installed. See also
+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
+# feature you need bibtex and perl available in the search path.
+
+CITE_BIB_FILES =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# The WARN_NO_PARAMDOC option can be enabled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = YES
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT =
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
+# *.f90 *.f *.for *.vhd *.vhdl
+
+FILE_PATTERNS = *.h *.cpp
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should be
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+# Note that relative paths are relative to the directory from which doxygen is
+# run.
+
+EXCLUDE = bin/ CMakeFiles/ docs/ lib/ nbproject/
+
+# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
+# (namespaces, classes, functions, etc.) that should be excluded from the
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match.
+# The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
+# and it is also possible to disable source filtering for a specific pattern
+# using *.ext= (so without naming a filter). This option only has effect when
+# FILTER_SOURCE_FILES is enabled.
+
+FILTER_SOURCE_PATTERNS =
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header. Note that when using a custom header you are responsible
+# for the proper inclusion of any scripts and style sheets that doxygen
+# needs, which is dependent on the configuration options used.
+# It is advised to generate a default header using "doxygen -w html
+# header.html footer.html stylesheet.css YourConfigFile" and then modify
+# that header. Note that the header is subject to change so you typically
+# have to redo this when upgrading to a newer version of doxygen or when
+# changing the value of configuration settings such as GENERATE_TREEVIEW!
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# style sheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
+# other source files which should be copied to the HTML output directory. Note
+# that these files will be copied to the base HTML output directory. Use the
+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
+# files. In the HTML_STYLESHEET file, use the file name only. Also note that
+# the files will be copied as-is; there are no commands or markers available.
+
+HTML_EXTRA_FILES =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the style sheet and background images
+# according to this color. Hue is specified as an angle on a colorwheel,
+# see http://en.wikipedia.org/wiki/Hue for more information.
+# For instance the value 0 represents red, 60 is yellow, 120 is green,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS = NO
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID = com.fuzzylite
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID = com.fuzzylite.documentation
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME = Juan Rada-Vilela
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+# will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+ECLIPSE_DOC_ID = org.doxygen.Project
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
+# at top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it. Since the tabs have the same information as the
+# navigation tree you can set this option to NO if you already set
+# GENERATE_TREEVIEW to YES.
+
+DISABLE_INDEX = NO
+
+# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
+# structure should be generated to display hierarchical information.
+# If the tag value is set to YES, a side panel will be generated
+# containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
+# Windows users are probably better off using the HTML help feature.
+# Since the tree basically has the same information as the tab index you
+# could consider to set DISABLE_INDEX to NO when enabling this option.
+
+GENERATE_TREEVIEW = YES
+
+# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
+# (range [0,1..20]) that doxygen will group on one line in the generated HTML
+# documentation. Note that a value of 0 will completely suppress the enum
+# values from appearing in the overview section.
+
+ENUM_VALUES_PER_LINE = 4
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT = YES
+
+# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
+# (see http://www.mathjax.org) which uses client side Javascript for the
+# rendering instead of using prerendered bitmaps. Use this if you do not
+# have LaTeX installed or if you want to formulas look prettier in the HTML
+# output. When enabled you also need to install MathJax separately and
+# configure the path to it using the MATHJAX_RELPATH option.
+
+USE_MATHJAX = NO
+
+# When MathJax is enabled you need to specify the location relative to the
+# HTML output directory using the MATHJAX_RELPATH option. The destination
+# directory should contain the MathJax.js script. For instance, if the mathjax
+# directory is located at the same level as the HTML output directory, then
+# MATHJAX_RELPATH should be ../mathjax. The default value points to the
+# mathjax.org site, so you can quickly see the result without installing
+# MathJax, but it is strongly recommended to install a local copy of MathJax
+# before deployment.
+
+MATHJAX_RELPATH = http://www.mathjax.org/mathjax
+
+# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
+# names that should be enabled during MathJax rendering.
+
+MATHJAX_EXTENSIONS =
+
+# When the SEARCHENGINE tag is enabled doxygen will generate a search box
+# for the HTML output. The underlying search engine uses javascript
+# and DHTML and should work on any modern browser. Note that when using
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE = YES
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# using Javascript. Doxygen will generate the search PHP script and index
+# file to put on the web server. The advantage of the server
+# based approach is that it scales better to large projects and allows
+# full text search. The disadvantages are that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
+# the generated latex document. The footer should contain everything after
+# the last chapter. If it is left blank doxygen will generate a
+# standard footer. Notice: only use this tag if you know what you are doing!
+
+LATEX_FOOTER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE = NO
+
+# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
+# http://en.wikipedia.org/wiki/BibTeX for more info.
+
+LATEX_BIB_STYLE = plain
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load style sheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# pointed to by INCLUDE_PATH will be searched when a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition that
+# overrules the definition found in the source code.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all references to function-like macros
+# that are alone on a line, have an all uppercase name, and do not end with a
+# semicolon, because these will confuse the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+#
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+#
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = YES
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS = 0
+
+# By default doxygen will use the Helvetica font for all dot files that
+# doxygen generates. When you want a differently looking font you can specify
+# the font name using DOT_FONTNAME. You need to make sure dot is able to find
+# the font, which can be done by putting it in a standard location or by setting
+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
+# directory containing the font.
+
+DOT_FONTNAME = Helvetica
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+DOT_FONTSIZE = 10
+
+# By default doxygen will tell dot to use the Helvetica font.
+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
+# set the path where dot can find it.
+
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are svg, png, jpg, or gif.
+# If left blank png will be used. If you choose svg you need to set
+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible in IE 9+ (other browsers do not have this requirement).
+
+DOT_IMAGE_FORMAT = png
+
+# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
+# enable generation of interactive SVG images that allow zooming and panning.
+# Note that this requires a modern browser other than Internet Explorer.
+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
+# visible. Older versions of IE do not have SVG support.
+
+INTERACTIVE_SVG = YES
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MSCFILE_DIRS tag can be used to specify one or more directories that
+# contain msc files that are included in the documentation (see the
+# \mscfile command).
+
+MSCFILE_DIRS =
+
+# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
+# nodes that will be shown in the graph. If the number of nodes in a graph
+# becomes larger than this value, doxygen will truncate the graph, which is
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
diff --git a/fuzzylite/fuzzylite.pc.in b/fuzzylite/fuzzylite.pc.in
new file mode 100644
index 0000000..421c61a
--- /dev/null
+++ b/fuzzylite/fuzzylite.pc.in
@@ -0,0 +1,10 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+includedir=${exec_prefix}/include
+libdir=@CMAKE_INSTALL_LIBDIR@
+
+Name: fuzzylite
+Description: A fuzzy logic control library in C++
+Version: @FL_VERSION@
+Libs: -L${libdir} -lfuzzylite
+Cflags: -I${includedir}/fl
diff --git a/fuzzylite/src/Console.cpp b/fuzzylite/src/Console.cpp
new file mode 100644
index 0000000..3a55fc5
--- /dev/null
+++ b/fuzzylite/src/Console.cpp
@@ -0,0 +1,820 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/Console.h"
+
+#include "fl/Headers.h"
+
+#include <algorithm>
+#include <cctype>
+#include <fstream>
+#include <stdlib.h>
+#include <utility>
+#include <vector>
+
+#ifdef FL_UNIX
+#include <termios.h>
+#include <unistd.h>
+#elif defined(FL_WINDOWS)
+#include <conio.h>
+#endif
+
+#ifdef FL_CPP11
+#include <chrono>
+#endif
+
+namespace fl {
+ const std::string Console::KW_INPUT_FILE = "-i";
+ const std::string Console::KW_INPUT_FORMAT = "-if";
+ const std::string Console::KW_OUTPUT_FILE = "-o";
+ const std::string Console::KW_OUTPUT_FORMAT = "-of";
+ const std::string Console::KW_EXAMPLE = "-example";
+ const std::string Console::KW_DECIMALS = "-decimals";
+ const std::string Console::KW_DATA_INPUT = "-d";
+ const std::string Console::KW_DATA_MAXIMUM = "-dmaximum";
+ const std::string Console::KW_DATA_EXPORT_HEADER = "-dheader";
+ const std::string Console::KW_DATA_EXPORT_INPUTS = "-dinputs";
+
+ std::vector<Console::Option> Console::availableOptions() {
+ std::vector<Console::Option> options;
+ options.push_back(Option(KW_INPUT_FILE, "inputfile", "file to import your engine from"));
+ options.push_back(Option(KW_INPUT_FORMAT, "format", "format of the file to import (fll | fis | fcl)"));
+ options.push_back(Option(KW_OUTPUT_FILE, "outputfile", "file to export your engine to"));
+ options.push_back(Option(KW_OUTPUT_FORMAT, "format", "format of the file to export (fll | fld | cpp | java | fis | fcl)"));
+ options.push_back(Option(KW_EXAMPLE, "letter", "if not inputfile, built-in example to use as engine: (m)amdani or (t)akagi-sugeno"));
+ options.push_back(Option(KW_DECIMALS, "number", "number of decimals to write floating-poing values"));
+ options.push_back(Option(KW_DATA_INPUT, "datafile", "if exporting to fld, file of input values to evaluate your engine on"));
+ options.push_back(Option(KW_DATA_MAXIMUM, "number", "if exporting to fld without datafile, maximum number of results to export"));
+ options.push_back(Option(KW_DATA_EXPORT_HEADER, "boolean", "if true and exporting to fld, include headers"));
+ options.push_back(Option(KW_DATA_EXPORT_INPUTS, "boolean", "if true and exporting to fld, include input values"));
+ return options;
+ }
+
+ std::string Console::usage() {
+ std::vector<Console::Option> options = availableOptions();
+ std::ostringstream ss;
+
+ ss << "========================================\n";
+ ss << "fuzzylite: a fuzzy logic control library\n";
+ ss << "version: " << fuzzylite::longVersion() << "\n";
+ ss << "author: " << fuzzylite::author() << "\n";
+ ss << "license: " << fuzzylite::license() << "\n";
+ ss << "========================================\n\n";
+ ss << "usage: fuzzylite inputfile outputfile\n";
+ ss << " or: fuzzylite ";
+ for (std::size_t i = 0; i < options.size(); ++i) {
+ ss << "[" << options.at(i).key << " " << options.at(i).value << "] ";
+ }
+ ss << "\n\nwhere:\n";
+ for (std::size_t i = 0; i < options.size(); ++i) {
+ std::string spacedKey(12, ' ');
+ std::string key = options.at(i).key;
+ std::copy(key.begin(), key.end(), spacedKey.begin());
+
+ std::string spacedValue(13, ' ');
+ std::string value = options.at(i).value;
+ std::copy(value.begin(), value.end(), spacedValue.begin());
+
+ std::string description = options.at(i).description;
+
+ ss << spacedKey << spacedValue << description << "\n";
+ }
+
+ ss << "\n";
+ ss << "Visit " << fuzzylite::website() << " for more information.\n\n";
+ ss << "Copyright (C) 2010-2015 FuzzyLite Limited.\n";
+ ss << "All rights reserved.";
+
+ return ss.str();
+ }
+
+ std::map<std::string, std::string> Console::parse(int argc, char** argv) {
+ if ((argc - 1) % 2 != 0) {
+ throw fl::Exception("[option error] incomplete number of parameters [key value]", FL_AT);
+ }
+ std::map<std::string, std::string> options;
+ for (int i = 1; i < argc - 1; i += 2) {
+ std::string key = std::string(argv[i]);
+ std::string value = std::string(argv[i + 1]);
+ options[key] = value;
+ }
+ if (options.size() == 1) {
+ std::map<std::string, std::string>::const_iterator it = options.begin();
+ if (it->first.at(0) != '-') {
+ options[KW_INPUT_FILE] = it->first;
+ options[KW_OUTPUT_FILE] = it->second;
+ }
+ } else {
+ std::vector<Console::Option> validOptions = availableOptions();
+
+ for (std::map<std::string, std::string>::const_iterator it = options.begin();
+ it != options.end(); ++it) {
+ bool isValid = false;
+ for (std::size_t i = 0; i < validOptions.size(); ++i) {
+ std::string key = validOptions.at(i).key;
+ if (key == it->first) {
+ isValid = true;
+ break;
+ }
+ }
+ if (not isValid) {
+ throw fl::Exception("[option error] option <" + it->first + "> not recognized", FL_AT);
+ }
+ }
+ }
+ return options;
+ }
+
+ void Console::process(const std::map<std::string, std::string>& options) {
+ std::map<std::string, std::string>::const_iterator it;
+
+ it = options.find(KW_DECIMALS);
+ if (it != options.end()) {
+ fl::fuzzylite::setDecimals((int) fl::Op::toScalar(it->second));
+ }
+
+ std::string example;
+ std::string inputFormat;
+ std::ostringstream textEngine;
+
+ it = options.find(KW_EXAMPLE);
+
+ bool isExample = (it != options.end());
+
+ if (isExample) {
+ example = it->second;
+ Engine* engine;
+ if (example == "m" or example == "mamdani") {
+ engine = mamdani();
+ } else if (example == "t" or example == "ts" or example == "takagi-sugeno") {
+ engine = takagiSugeno();
+ } else {
+ throw fl::Exception("[option error] example <" + example + "> not available", FL_AT);
+ }
+ inputFormat = "fll";
+ textEngine << FllExporter().toString(engine);
+ delete engine;
+
+ } else {
+ it = options.find(KW_INPUT_FILE);
+ if (it == options.end()) {
+ throw fl::Exception("[option error] no input file specified", FL_AT);
+ }
+ std::string inputFilename = it->second;
+ std::ifstream inputFile(inputFilename.c_str());
+ if (not inputFile.is_open()) {
+ throw fl::Exception("[file error] file <" + inputFilename + "> could not be opened", FL_AT);
+ }
+ std::string line;
+ while (std::getline(inputFile, line)) {
+ textEngine << line << std::endl;
+ }
+ inputFile.close();
+
+ it = options.find(KW_INPUT_FORMAT);
+ if (it != options.end()) {
+ inputFormat = it->second;
+ } else {
+ std::size_t extensionIndex = inputFilename.find_last_of(".");
+ if (extensionIndex != std::string::npos) {
+ inputFormat = inputFilename.substr(extensionIndex + 1);
+ } else {
+ throw fl::Exception("[format error] unspecified format of input file", FL_AT);
+ }
+ }
+ }
+
+ std::string outputFilename;
+ it = options.find(KW_OUTPUT_FILE);
+ if (it != options.end()) {
+ outputFilename = it->second;
+ }
+
+ std::string outputFormat;
+ it = options.find(KW_OUTPUT_FORMAT);
+ if (it != options.end()) {
+ outputFormat = it->second;
+ } else {
+ std::size_t extensionIndex = outputFilename.find_last_of(".");
+ if (extensionIndex != std::string::npos) {
+ outputFormat = outputFilename.substr(extensionIndex + 1);
+ } else {
+ throw fl::Exception("[format error] unspecified format of output file", FL_AT);
+ }
+ }
+
+
+ if (outputFilename.empty()) {
+ process(textEngine.str(), std::cout, inputFormat, outputFormat, options);
+ } else {
+ std::ofstream writer(outputFilename.c_str());
+ if (not writer.is_open()) {
+ throw fl::Exception("[file error] file <" + outputFilename + "> could not be created", FL_AT);
+ }
+ process(textEngine.str(), writer, inputFormat, outputFormat, options);
+ writer.flush();
+ writer.close();
+ }
+ }
+
+ void Console::process(const std::string& input, std::ostream& writer,
+ const std::string& inputFormat, const std::string& outputFormat,
+ const std::map<std::string, std::string>& options) {
+ FL_unique_ptr<Importer> importer;
+ FL_unique_ptr<Exporter> exporter;
+ FL_unique_ptr<Engine> engine;
+
+ if ("fll" == inputFormat) {
+ importer.reset(new FllImporter);
+ } else if ("fcl" == inputFormat) {
+ importer.reset(new FclImporter);
+ } else if ("fis" == inputFormat) {
+ importer.reset(new FisImporter);
+ } else {
+ throw fl::Exception("[import error] format <" + inputFormat + "> "
+ "not supported", FL_AT);
+ }
+
+ engine.reset(importer->fromString(input));
+
+ if ("fld" == outputFormat) {
+ std::map<std::string, std::string>::const_iterator it;
+
+ FldExporter fldExporter;
+ fldExporter.setSeparator("\t");
+ bool exportHeaders = true;
+ if ((it = options.find(KW_DATA_EXPORT_HEADER)) != options.end()) {
+ exportHeaders = ("true" == it->second);
+ }
+ fldExporter.setExportHeader(exportHeaders);
+ bool exportInputValues = true;
+ if ((it = options.find(KW_DATA_EXPORT_INPUTS)) != options.end()) {
+ exportInputValues = ("true" == it->second);
+ }
+ fldExporter.setExportInputValues(exportInputValues);
+ if ((it = options.find(KW_DATA_INPUT)) != options.end()) {
+ std::ifstream dataFile(it->second.c_str());
+ if (not dataFile.is_open()) {
+ throw fl::Exception("[export error] file <" + it->second + "> could not be opened", FL_AT);
+ }
+ try {
+ fldExporter.write(engine.get(), writer, dataFile);
+ } catch (std::exception& ex) {
+ (void) ex;
+ dataFile.close();
+ throw;
+ }
+
+ } else {
+ if ((it = options.find(KW_DATA_MAXIMUM)) != options.end()) {
+ fldExporter.write(engine.get(), writer, (int) fl::Op::toScalar(it->second));
+ } else {
+ std::ostringstream buffer;
+ buffer << "#FuzzyLite Interactive Console (press H for help)\n";
+ buffer << fldExporter.header(engine.get()) << "\n";
+ bool showCout = &writer != &std::cout;
+ writer << buffer.str();
+ if (showCout) std::cout << buffer.str();
+ else writer.flush();
+ interactive(writer, engine.get());
+ }
+ }
+ } else {
+ if ("fll" == outputFormat) {
+ exporter.reset(new FllExporter);
+ } else if ("fcl" == outputFormat) {
+ exporter.reset(new FclExporter);
+ } else if ("fis" == outputFormat) {
+ exporter.reset(new FisExporter);
+ } else if ("cpp" == outputFormat) {
+ exporter.reset(new CppExporter);
+ } else if ("java" == outputFormat) {
+ exporter.reset(new JavaExporter);
+ } else throw fl::Exception("[export error] format <" + outputFormat + "> "
+ "not supported", FL_AT);
+ writer << exporter->toString(engine.get());
+ }
+ }
+
+ int Console::readCharacter() {
+ int ch = 0;
+#ifdef FL_UNIX
+ struct termios oldt, newt;
+ tcgetattr(STDIN_FILENO, &oldt);
+ newt = oldt;
+ newt.c_lflag &= ~(ICANON | ECHO);
+ tcsetattr(STDIN_FILENO, TCSANOW, &newt);
+ ch = getchar();
+ tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
+#elif defined(FL_WINDOWS)
+ ch = _getch();
+#endif
+ return ch;
+ }
+
+ void Console::interactive(std::ostream& writer, Engine* engine) {
+ std::ostringstream buffer;
+ buffer << ">";
+ bool showCout = &writer != &std::cout;
+ const std::string space("\t");
+ std::vector<scalar> inputValues;
+ std::ostringstream inputValue;
+ int ch = 0;
+ do {
+ writer << buffer.str();
+ if (showCout) std::cout << buffer.str();
+ else writer.flush();
+ buffer.str("");
+
+ ch = readCharacter();
+
+ if (std::isspace(ch)) {
+ scalar value = engine->getInputVariable(inputValues.size())->getInputValue();
+ try {
+ value = fl::Op::toScalar(inputValue.str());
+ } catch (std::exception& ex) {
+ (void) ex;
+ buffer << "[" << fl::Op::str(value) << "]";
+ }
+ buffer << space;
+ inputValue.str("");
+ inputValues.push_back(value);
+ if (inputValues.size() == engine->inputVariables().size()) {
+ ch = 'P'; //fall through to process;
+ } else continue;
+ }
+
+ if (not std::isgraph(ch)) continue;
+
+ switch (ch) {
+ default:
+ inputValue << char(ch);
+ buffer << char(ch);
+ break;
+ case 'r':
+ case 'R': engine->restart();
+ buffer << "#[Restart]";
+ //fall through
+ case 'd':
+ case 'D': inputValues.clear();
+ buffer << "#[Discard]\n>";
+ inputValue.str("");
+ break;
+ case 'p':
+ case 'P': //Process
+ {
+ inputValue.str("");
+
+ for (std::size_t i = 0; i < inputValues.size(); ++i) {
+ InputVariable* inputVariable = engine->inputVariables().at(i);
+ inputVariable->setInputValue(inputValues.at(i));
+ }
+ std::vector<scalar> missingInputs;
+ for (std::size_t i = inputValues.size(); i < engine->inputVariables().size(); ++i) {
+ InputVariable* inputVariable = engine->inputVariables().at(i);
+ missingInputs.push_back(inputVariable->getInputValue());
+ }
+ inputValues.clear();
+ buffer << fl::Op::join(missingInputs, space);
+ if (not missingInputs.empty()) buffer << space;
+ buffer << "=" << space;
+ try {
+ engine->process();
+ std::vector<scalar> outputValues;
+ for (std::size_t i = 0; i < engine->outputVariables().size(); ++i) {
+ OutputVariable* outputVariable = engine->outputVariables().at(i);
+ outputVariable->defuzzify();
+ outputValues.push_back(outputVariable->getOutputValue());
+ }
+ buffer << fl::Op::join(outputValues, space) << "\n>";
+
+ } catch (std::exception& ex) {
+ buffer << "#[Error: " << ex.what() << "]";
+ }
+ break;
+ }
+ case 'q':
+ case 'Q': buffer << "#[Quit]\n";
+ break;
+ case 'h':
+ case 'H': buffer << "\n>" << interactiveHelp() << "\n>";
+ inputValue.str("");
+ break;
+ }
+ } while (not (ch == 'Q' or ch == 'q'));
+ writer << std::endl;
+ }
+
+ std::string Console::interactiveHelp() {
+ return
+ "#Special Keys\n"
+ "#=============\n"
+ "#\tR\tRestart engine and discard current inputs\n"
+ "#\tD\tDiscard current inputs\n"
+ "#\tP\tProcess engine\n"
+ "#\tQ\tQuit interactive console\n"
+ "#\tH\tShow this help\n"
+ "#=============\n";
+ }
+
+ Engine* Console::mamdani() {
+ Engine* engine = new Engine("simple-dimmer");
+
+ InputVariable* ambient = new InputVariable("Ambient", 0, 1);
+ ambient->addTerm(new Triangle("DARK", .0, .25, .5));
+ ambient->addTerm(new Triangle("MEDIUM", .25, .5, .75));
+ ambient->addTerm(new Triangle("BRIGHT", .5, .75, 1));
+ engine->addInputVariable(ambient);
+
+
+ OutputVariable* power = new OutputVariable("Power", 0, 2);
+ power->setDefaultValue(fl::nan);
+ power->addTerm(new Triangle("LOW", 0.0, 0.5, 1));
+ power->addTerm(new Triangle("MEDIUM", 0.5, 1, 1.5));
+ power->addTerm(new Triangle("HIGH", 1, 1.5, 2));
+ engine->addOutputVariable(power);
+
+ RuleBlock* ruleblock = new RuleBlock();
+ ruleblock->addRule(Rule::parse("if Ambient is DARK then Power is HIGH", engine));
+ ruleblock->addRule(Rule::parse("if Ambient is MEDIUM then Power is MEDIUM", engine));
+ ruleblock->addRule(Rule::parse("if Ambient is BRIGHT then Power is LOW", engine));
+
+ engine->addRuleBlock(ruleblock);
+
+ engine->configure("", "", "Minimum", "Maximum", "Centroid");
+
+ return engine;
+ }
+
+ Engine* Console::takagiSugeno() {
+ Engine* engine = new Engine("approximation of sin(x)/x");
+
+ fl::InputVariable* inputX = new fl::InputVariable("inputX");
+ inputX->setRange(0, 10);
+ inputX->addTerm(new fl::Triangle("NEAR_1", 0, 1, 2));
+ inputX->addTerm(new fl::Triangle("NEAR_2", 1, 2, 3));
+ inputX->addTerm(new fl::Triangle("NEAR_3", 2, 3, 4));
+ inputX->addTerm(new fl::Triangle("NEAR_4", 3, 4, 5));
+ inputX->addTerm(new fl::Triangle("NEAR_5", 4, 5, 6));
+ inputX->addTerm(new fl::Triangle("NEAR_6", 5, 6, 7));
+ inputX->addTerm(new fl::Triangle("NEAR_7", 6, 7, 8));
+ inputX->addTerm(new fl::Triangle("NEAR_8", 7, 8, 9));
+ inputX->addTerm(new fl::Triangle("NEAR_9", 8, 9, 10));
+ engine->addInputVariable(inputX);
+
+
+ fl::OutputVariable* outputFx = new fl::OutputVariable("outputFx");
+ outputFx->setRange(-1, 1);
+ outputFx->setDefaultValue(fl::nan);
+ outputFx->setLockPreviousOutputValue(true); //To use its value with diffFx
+ outputFx->addTerm(new Constant("f1", 0.84));
+ outputFx->addTerm(new Constant("f2", 0.45));
+ outputFx->addTerm(new Constant("f3", 0.04));
+ outputFx->addTerm(new Constant("f4", -0.18));
+ outputFx->addTerm(new Constant("f5", -0.19));
+ outputFx->addTerm(new Constant("f6", -0.04));
+ outputFx->addTerm(new Constant("f7", 0.09));
+ outputFx->addTerm(new Constant("f8", 0.12));
+ outputFx->addTerm(new Constant("f9", 0.04));
+ engine->addOutputVariable(outputFx);
+
+ fl::OutputVariable* trueFx = new fl::OutputVariable("trueFx");
+ trueFx->setRange(fl::nan, fl::nan);
+ trueFx->setLockPreviousOutputValue(true); //To use its value with diffFx
+ trueFx->addTerm(fl::Function::create("fx", "sin(inputX)/inputX", engine));
+ engine->addOutputVariable(trueFx);
+
+ fl::OutputVariable* diffFx = new fl::OutputVariable("diffFx");
+ diffFx->addTerm(fl::Function::create("diff", "fabs(outputFx-trueFx)", engine));
+ diffFx->setRange(fl::nan, fl::nan);
+ // diffFx->setLockValidOutput(true); //To use in input diffPreviousFx
+ engine->addOutputVariable(diffFx);
+
+ fl::RuleBlock* block = new fl::RuleBlock();
+ block->addRule(fl::Rule::parse("if inputX is NEAR_1 then outputFx is f1", engine));
+ block->addRule(fl::Rule::parse("if inputX is NEAR_2 then outputFx is f2", engine));
+ block->addRule(fl::Rule::parse("if inputX is NEAR_3 then outputFx is f3", engine));
+ block->addRule(fl::Rule::parse("if inputX is NEAR_4 then outputFx is f4", engine));
+ block->addRule(fl::Rule::parse("if inputX is NEAR_5 then outputFx is f5", engine));
+ block->addRule(fl::Rule::parse("if inputX is NEAR_6 then outputFx is f6", engine));
+ block->addRule(fl::Rule::parse("if inputX is NEAR_7 then outputFx is f7", engine));
+ block->addRule(fl::Rule::parse("if inputX is NEAR_8 then outputFx is f8", engine));
+ block->addRule(fl::Rule::parse("if inputX is NEAR_9 then outputFx is f9", engine));
+ block->addRule(fl::Rule::parse("if inputX is any then trueFx is fx and diffFx is diff", engine));
+ engine->addRuleBlock(block);
+
+ engine->configure("", "", "AlgebraicProduct", "AlgebraicSum", "WeightedAverage");
+
+ return engine;
+ }
+
+ void Console::exportAllExamples(const std::string& from, const std::string& to) {
+ Console::exportAllExamples(from, to, ".");
+ }
+
+ void Console::exportAllExamples(const std::string& from, const std::string& to, const std::string& path) {
+ std::vector<std::string> examples;
+ examples.push_back("/mamdani/AllTerms");
+ // examples.push_back("/mamdani/Laundry");
+ examples.push_back("/mamdani/SimpleDimmer");
+ // examples.push_back("/mamdani/SimpleDimmerInverse");
+ examples.push_back("/mamdani/matlab/mam21");
+ examples.push_back("/mamdani/matlab/mam22");
+ examples.push_back("/mamdani/matlab/shower");
+ examples.push_back("/mamdani/matlab/tank");
+ examples.push_back("/mamdani/matlab/tank2");
+ examples.push_back("/mamdani/matlab/tipper");
+ examples.push_back("/mamdani/matlab/tipper1");
+ examples.push_back("/mamdani/octave/investment_portfolio");
+ examples.push_back("/mamdani/octave/mamdani_tip_calculator");
+ examples.push_back("/takagi-sugeno/approximation");
+ examples.push_back("/takagi-sugeno/SimpleDimmer");
+ examples.push_back("/takagi-sugeno/matlab/fpeaks");
+ examples.push_back("/takagi-sugeno/matlab/invkine1");
+ examples.push_back("/takagi-sugeno/matlab/invkine2");
+ examples.push_back("/takagi-sugeno/matlab/juggler");
+ examples.push_back("/takagi-sugeno/matlab/membrn1");
+ examples.push_back("/takagi-sugeno/matlab/membrn2");
+ examples.push_back("/takagi-sugeno/matlab/slbb");
+ examples.push_back("/takagi-sugeno/matlab/slcp");
+ examples.push_back("/takagi-sugeno/matlab/slcp1");
+ examples.push_back("/takagi-sugeno/matlab/slcpp1");
+ examples.push_back("/takagi-sugeno/matlab/sltbu_fl");
+ examples.push_back("/takagi-sugeno/matlab/sugeno1");
+ examples.push_back("/takagi-sugeno/matlab/tanksg");
+ examples.push_back("/takagi-sugeno/matlab/tippersg");
+ examples.push_back("/takagi-sugeno/octave/cubic_approximator");
+ examples.push_back("/takagi-sugeno/octave/heart_disease_risk");
+ examples.push_back("/takagi-sugeno/octave/linear_tip_calculator");
+ examples.push_back("/takagi-sugeno/octave/sugeno_tip_calculator");
+ examples.push_back("/tsukamoto/tsukamoto");
+
+ std::string sourceBase = path + "/original";
+ std::string targetBase = path + "/tmp/";
+
+ FL_unique_ptr<Importer> importer;
+ if (from == "fll") importer.reset(new FllImporter);
+ else if (from == "fis") importer.reset(new FisImporter);
+ else if (from == "fcl") importer.reset(new FclImporter);
+ else throw fl::Exception("[examples error] unrecognized format <" + from + "> to import", FL_AT);
+
+ FL_unique_ptr<Exporter> exporter;
+ if (to == "fll") exporter.reset(new FllExporter);
+ else if (to == "fld") exporter.reset(new FldExporter(" "));
+ else if (to == "fcl") exporter.reset(new FclExporter);
+ else if (to == "fis") exporter.reset(new FisExporter);
+ else if (to == "cpp") exporter.reset(new CppExporter);
+ else if (to == "java") exporter.reset(new JavaExporter);
+ else throw fl::Exception("[examples error] unrecognized format <" + to + "> to export", FL_AT);
+
+ std::vector<std::pair<Exporter*, Importer*> > tests;
+ tests.push_back(std::pair<Exporter*, Importer*>(new FllExporter, new FllImporter));
+ tests.push_back(std::pair<Exporter*, Importer*>(new FisExporter, new FisImporter));
+ tests.push_back(std::pair<Exporter*, Importer*>(new FclExporter, new FclImporter));
+ for (std::size_t i = 0; i < examples.size(); ++i) {
+ FL_LOG("Processing " << (i + 1) << "/" << examples.size() << ": " << examples.at(i));
+ std::ostringstream ss;
+ std::string input = sourceBase + examples.at(i) + "." + from;
+ std::ifstream source(input.c_str());
+ if (source.is_open()) {
+ std::string line;
+ while (source.good()) {
+ std::getline(source, line);
+ ss << line << "\n";
+ }
+ source.close();
+ } else throw fl::Exception("[examples error] file not found: " + input, FL_AT);
+
+ FL_unique_ptr<Engine> engine(importer->fromString(ss.str()));
+
+ for (std::size_t t = 0; t < tests.size(); ++t) {
+ std::string out = tests.at(t).first->toString(engine.get());
+ FL_unique_ptr<Engine> copy(tests.at(t).second->fromString(out));
+ std::string out_copy = tests.at(t).first->toString(copy.get());
+
+ if (out != out_copy) {
+ std::ostringstream ss;
+ ss << "[imex error] different results <"
+ << importer->name() << "," << exporter->name() << "> "
+ "at " + examples.at(t) + "." + from + ":\n";
+ ss << "<Engine A>\n" << out << "\n\n" <<
+ "================================\n\n" <<
+ "<Engine B>\n" << out_copy;
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+ }
+
+ std::string output = targetBase + examples.at(i) + "." + to;
+ std::ofstream target(output.c_str());
+ if (target.is_open()) {
+ if (to == "cpp") {
+ target << "#include <fl/Headers.h>\n\n"
+ << "int main(int argc, char** argv){\n"
+ << exporter->toString(engine.get())
+ << "\n}\n";
+ } else if (to == "java") {
+ std::string className = examples.at(i).substr(examples.at(i).find_last_of('/') + 1);
+ target << "import com.fuzzylite.*;\n"
+ << "import com.fuzzylite.defuzzifier.*;\n"
+ << "import com.fuzzylite.factory.*;\n"
+ << "import com.fuzzylite.hedge.*;\n"
+ << "import com.fuzzylite.imex.*;\n"
+ << "import com.fuzzylite.norm.*;\n"
+ << "import com.fuzzylite.norm.s.*;\n"
+ << "import com.fuzzylite.norm.t.*;\n"
+ << "import com.fuzzylite.rule.*;\n"
+ << "import com.fuzzylite.term.*;\n"
+ << "import com.fuzzylite.variable.*;\n\n"
+ << "public class " << Op::validName(className) << "{\n"
+ << "public static void main(String[] args){\n"
+ << exporter->toString(engine.get())
+ << "\n}\n}\n";
+ } else {
+ target << exporter->toString(engine.get());
+ }
+ target.close();
+ }
+ Engine copyConstructor(*engine.get());
+ (void) copyConstructor;
+ Engine assignmentOperator = *engine.get();
+ (void) assignmentOperator;
+ }
+ for (std::size_t i = 0; i < tests.size(); ++i) {
+ delete tests.at(i).first;
+ delete tests.at(i).second;
+ }
+ }
+
+#ifdef FL_CPP11
+
+ void Console::benchmarkExamples(const std::string& path, int runs) {
+ std::string sourceBase = path + "/original";
+ typedef std::pair<std::string, int > Example;
+ std::vector<Example> examples;
+ examples.push_back(Example("/mamdani/AllTerms", 1e4));
+ examples.push_back(Example("/mamdani/SimpleDimmer", 1e5));
+ examples.push_back(Example("/mamdani/matlab/mam21", 128));
+ examples.push_back(Example("/mamdani/matlab/mam22", 128));
+ examples.push_back(Example("/mamdani/matlab/shower", 256));
+ examples.push_back(Example("/mamdani/matlab/tank", 256));
+ examples.push_back(Example("/mamdani/matlab/tank2", 512));
+ examples.push_back(Example("/mamdani/matlab/tipper", 256));
+ examples.push_back(Example("/mamdani/matlab/tipper1", 1e5));
+ examples.push_back(Example("/mamdani/octave/investment_portfolio", 256));
+ examples.push_back(Example("/mamdani/octave/mamdani_tip_calculator", 256));
+ examples.push_back(Example("/takagi-sugeno/approximation", 1e6));
+ examples.push_back(Example("/takagi-sugeno/SimpleDimmer", 2e6));
+ examples.push_back(Example("/takagi-sugeno/matlab/fpeaks", 512));
+ examples.push_back(Example("/takagi-sugeno/matlab/invkine1", 256));
+ examples.push_back(Example("/takagi-sugeno/matlab/invkine2", 256));
+ examples.push_back(Example("/takagi-sugeno/matlab/juggler", 512));
+ examples.push_back(Example("/takagi-sugeno/matlab/membrn1", 1024));
+ examples.push_back(Example("/takagi-sugeno/matlab/membrn2", 512));
+ examples.push_back(Example("/takagi-sugeno/matlab/slbb", 20));
+ examples.push_back(Example("/takagi-sugeno/matlab/slcp", 20));
+ examples.push_back(Example("/takagi-sugeno/matlab/slcp1", 15));
+ examples.push_back(Example("/takagi-sugeno/matlab/slcpp1", 9));
+ examples.push_back(Example("/takagi-sugeno/matlab/sltbu_fl", 128));
+ examples.push_back(Example("/takagi-sugeno/matlab/sugeno1", 2e6));
+ examples.push_back(Example("/takagi-sugeno/matlab/tanksg", 1024));
+ examples.push_back(Example("/takagi-sugeno/matlab/tippersg", 1024));
+ examples.push_back(Example("/takagi-sugeno/octave/cubic_approximator", 2e6));
+ examples.push_back(Example("/takagi-sugeno/octave/heart_disease_risk", 1024));
+ examples.push_back(Example("/takagi-sugeno/octave/linear_tip_calculator", 1024));
+ examples.push_back(Example("/takagi-sugeno/octave/sugeno_tip_calculator", 512));
+ examples.push_back(Example("/tsukamoto/tsukamoto", 1e6));
+
+ for (std::size_t i = 0; i < examples.size(); ++i) {
+ FL_LOG(examples.at(i).first << "\t" << examples.at(i).second);
+ }
+
+ std::vector<std::string> runNumbers(runs);
+ for (int i = 0; i < runs; ++i) {
+ runNumbers.at(i) = std::to_string(i + 1);
+ }
+ std::string spacedPath(40, ' ');
+ std::copy(path.begin(), path.end(), spacedPath.begin());
+ FL_LOG(spacedPath << "\t" << "mean\tstdev\n" << Op::join(runNumbers, "\t"));
+
+ FllImporter importer;
+ FldExporter exporter;
+ exporter.setExportHeader(false);
+ exporter.setExportInputValues(false);
+ exporter.setExportOutputValues(false);
+ std::ostream dummy(0);
+
+ for (std::size_t e = 0; e < examples.size(); ++e) {
+ FL_unique_ptr<Engine> engine(importer.fromFile(sourceBase + examples.at(e).first + ".fll"));
+
+ std::vector<scalar> seconds;
+ int results = std::pow(1.0 * examples.at(e).second, engine->numberOfInputVariables());
+
+ for (int r = 0; r < runs; ++r) {
+ auto start = std::chrono::system_clock::now();
+ exporter.write(engine.get(), dummy, results);
+ auto end = std::chrono::system_clock::now();
+
+ auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds> (end - start);
+
+ seconds.push_back(elapsed.count() / 1e3);
+ }
+ scalar mean = Op::mean(seconds);
+ scalar stdev = Op::standardDeviation(seconds, mean);
+
+ std::string spacedExample(40, ' ');
+ std::string exampleName = examples.at(e).first;
+ std::copy(exampleName.begin(), exampleName.end(), spacedExample.begin());
+ FL_LOG(spacedExample << "\t" << fl::Op::str(mean) << "\t" << fl::Op::str(stdev) << "\n" <<
+ Op::join(seconds, "\t"));
+ }
+ }
+#endif
+
+ int Console::main(int argc, char** argv) {
+ (void) argc;
+ (void) argv;
+ if (argc <= 2) {
+ std::cout << usage() << std::endl;
+ return EXIT_SUCCESS;
+ }
+
+ const std::string firstArgument = std::string(argv[1]);
+
+ if (firstArgument == "export-examples") {
+ std::string path = ".";
+ if (argc > 2) {
+ path = std::string(argv[2]);
+ }
+ FL_LOG("Path=" << path);
+ try {
+ fuzzylite::setDecimals(3);
+ FL_LOG("Processing fll->fll");
+ exportAllExamples("fll", "fll", path);
+ FL_LOG("Processing fll->fcl");
+ exportAllExamples("fll", "fcl", path);
+ FL_LOG("Processing fll->fis");
+ exportAllExamples("fll", "fis", path);
+ FL_LOG("Processing fll->cpp");
+ exportAllExamples("fll", "cpp", path);
+ FL_LOG("Processing fll->java");
+ exportAllExamples("fll", "java", path);
+ fuzzylite::setDecimals(8);
+ fuzzylite::setMachEps(1e-6);
+ FL_LOG("Processing fll->fld");
+ exportAllExamples("fll", "fld", path);
+ } catch (std::exception& ex) {
+ std::cout << ex.what() << "\nBACKTRACE:\n" <<
+ fl::Exception::btCallStack() << std::endl;
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
+ } else if (firstArgument == "benchmarks") {
+#ifdef FL_CPP11
+ std::string path = ".";
+ if (argc > 2) {
+ path = std::string(argv[2]);
+ }
+ int runs = 10;
+ if (argc > 3) {
+ runs = (int) Op::toScalar(argv[3]);
+ }
+ fuzzylite::setDecimals(3);
+ Console::benchmarkExamples(path, runs);
+ return EXIT_SUCCESS;
+#else
+ throw fl::Exception("[benchmarks error] implementation available only when built with C++11 (-DFL_CPP11)", FL_AT);
+#endif
+ }
+
+ try {
+ std::map<std::string, std::string> options = parse(argc, argv);
+ process(options);
+ } catch (std::exception& ex) {
+ std::cout << ex.what() << "\n" << std::endl;
+ // std::cout << fl::Exception::btCallStack() << std::endl;
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
+ }
+}
diff --git a/fuzzylite/src/Engine.cpp b/fuzzylite/src/Engine.cpp
new file mode 100644
index 0000000..f1e23c0
--- /dev/null
+++ b/fuzzylite/src/Engine.cpp
@@ -0,0 +1,698 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/Engine.h"
+
+#include "fl/defuzzifier/WeightedAverage.h"
+#include "fl/defuzzifier/WeightedSum.h"
+#include "fl/factory/DefuzzifierFactory.h"
+#include "fl/factory/FactoryManager.h"
+#include "fl/factory/SNormFactory.h"
+#include "fl/factory/TNormFactory.h"
+#include "fl/hedge/Hedge.h"
+#include "fl/imex/FllExporter.h"
+#include "fl/norm/t/AlgebraicProduct.h"
+#include "fl/rule/Consequent.h"
+#include "fl/rule/Expression.h"
+#include "fl/rule/Rule.h"
+#include "fl/rule/RuleBlock.h"
+#include "fl/term/Accumulated.h"
+#include "fl/term/Constant.h"
+#include "fl/term/Linear.h"
+#include "fl/term/Function.h"
+#include "fl/term/Ramp.h"
+#include "fl/term/Sigmoid.h"
+#include "fl/term/SShape.h"
+#include "fl/term/ZShape.h"
+#include "fl/variable/InputVariable.h"
+#include "fl/variable/OutputVariable.h"
+
+
+namespace fl {
+
+ Engine::Engine(const std::string& name) : _name(name) {
+ }
+
+ Engine::Engine(const Engine& other) : _name("") {
+ copyFrom(other);
+ }
+
+ Engine& Engine::operator=(const Engine& other) {
+ if (this != &other) {
+ for (std::size_t i = 0; i < _ruleblocks.size(); ++i)
+ delete _ruleblocks.at(i);
+ _ruleblocks.clear();
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i)
+ delete _outputVariables.at(i);
+ _outputVariables.clear();
+ for (std::size_t i = 0; i < _inputVariables.size(); ++i)
+ delete _inputVariables.at(i);
+ _inputVariables.clear();
+
+ copyFrom(other);
+ }
+ return *this;
+ }
+
+ void Engine::copyFrom(const Engine& other) {
+ _name = other._name;
+ for (std::size_t i = 0; i < other._inputVariables.size(); ++i)
+ _inputVariables.push_back(new InputVariable(*other._inputVariables.at(i)));
+ for (std::size_t i = 0; i < other._outputVariables.size(); ++i)
+ _outputVariables.push_back(new OutputVariable(*other._outputVariables.at(i)));
+
+ updateReferences();
+
+ for (std::size_t i = 0; i < other._ruleblocks.size(); ++i) {
+ RuleBlock* ruleBlock = new RuleBlock(*other._ruleblocks.at(i));
+ try {
+ ruleBlock->loadRules(this);
+ } catch (...) {
+ }
+ _ruleblocks.push_back(ruleBlock);
+ }
+ }
+
+ void Engine::updateReferences() const {
+ std::vector<Variable*> myVariables = variables();
+ for (std::size_t i = 0; i < myVariables.size(); ++i) {
+ Variable* variable = myVariables.at(i);
+ for (int t = 0; t < variable->numberOfTerms(); ++t) {
+ Term::updateReference(variable->getTerm(t), this);
+ }
+ }
+ }
+
+ Engine::~Engine() {
+ for (std::size_t i = 0; i < _ruleblocks.size(); ++i) delete _ruleblocks.at(i);
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) delete _outputVariables.at(i);
+ for (std::size_t i = 0; i < _inputVariables.size(); ++i) delete _inputVariables.at(i);
+ }
+
+ void Engine::configure(const std::string& conjunctionT, const std::string& disjunctionS,
+ const std::string& activationT, const std::string& accumulationS,
+ const std::string& defuzzifierName, int resolution) {
+ TNormFactory* tnormFactory = FactoryManager::instance()->tnorm();
+ SNormFactory* snormFactory = FactoryManager::instance()->snorm();
+ DefuzzifierFactory* defuzzFactory = FactoryManager::instance()->defuzzifier();
+ TNorm* conjunction = tnormFactory->constructObject(conjunctionT);
+ SNorm* disjunction = snormFactory->constructObject(disjunctionS);
+ TNorm* activation = tnormFactory->constructObject(activationT);
+ SNorm* accumulation = snormFactory->constructObject(accumulationS);
+ Defuzzifier* defuzzifier = defuzzFactory->constructObject(defuzzifierName);
+ IntegralDefuzzifier* integralDefuzzifier = dynamic_cast<IntegralDefuzzifier*> (defuzzifier);
+ if (integralDefuzzifier) integralDefuzzifier->setResolution(resolution);
+
+ configure(conjunction, disjunction, activation, accumulation, defuzzifier);
+ }
+
+ void Engine::configure(TNorm* conjunction, SNorm* disjunction,
+ TNorm* activation, SNorm* accumulation, Defuzzifier* defuzzifier) {
+ for (std::size_t i = 0; i < _ruleblocks.size(); ++i) {
+ _ruleblocks.at(i)->setConjunction(conjunction ? conjunction->clone() : fl::null);
+ _ruleblocks.at(i)->setDisjunction(disjunction ? disjunction->clone() : fl::null);
+ _ruleblocks.at(i)->setActivation(activation ? activation->clone() : fl::null);
+ }
+
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ _outputVariables.at(i)->setDefuzzifier(defuzzifier ? defuzzifier->clone() : fl::null);
+ _outputVariables.at(i)->fuzzyOutput()->setAccumulation(
+ accumulation ? accumulation->clone() : fl::null);
+ }
+ if (defuzzifier) delete defuzzifier;
+ if (accumulation) delete accumulation;
+ if (activation) delete activation;
+ if (disjunction) delete disjunction;
+ if (conjunction) delete conjunction;
+ }
+
+ bool Engine::isReady(std::string* status) const {
+ std::ostringstream ss;
+ if (_inputVariables.empty()) {
+ ss << "- Engine <" << _name << "> has no input variables\n";
+ }
+ for (std::size_t i = 0; i < _inputVariables.size(); ++i) {
+ InputVariable* inputVariable = _inputVariables.at(i);
+ if (not inputVariable) {
+ ss << "- Engine <" << _name << "> has a fl::null input variable at index <" << i << ">\n";
+ } else if (inputVariable->terms().empty()) {
+ //ignore because sometimes inputs can be empty: takagi-sugeno/matlab/slcpp1.fis
+ // ss << "- Input variable <" << _inputVariables.at(i)->getName() << ">"
+ // << " has no terms\n";
+ }
+ }
+
+ if (_outputVariables.empty()) {
+ ss << "- Engine <" << _name << "> has no output variables\n";
+ }
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ OutputVariable* outputVariable = _outputVariables.at(i);
+ if (not outputVariable) {
+ ss << "- Engine <" << _name << "> has a fl::null output variable at index <" << i << ">\n";
+ } else {
+ if (outputVariable->terms().empty()) {
+ ss << "- Output variable <" << outputVariable->getName() << ">"
+ << " has no terms\n";
+ }
+ Defuzzifier* defuzzifier = outputVariable->getDefuzzifier();
+ if (not defuzzifier) {
+ ss << "- Output variable <" << outputVariable->getName() << ">"
+ << " has no defuzzifier\n";
+ }
+ SNorm* accumulation = outputVariable->fuzzyOutput()->getAccumulation();
+ if (not accumulation and dynamic_cast<IntegralDefuzzifier*> (defuzzifier)) {
+ ss << "- Output variable <" << outputVariable->getName() << ">"
+ << " has no accumulation operator\n";
+ }
+ }
+ }
+
+ if (_ruleblocks.empty()) {
+ ss << "- Engine <" << _name << "> has no rule blocks\n";
+ }
+ for (std::size_t i = 0; i < _ruleblocks.size(); ++i) {
+ RuleBlock* ruleblock = _ruleblocks.at(i);
+ if (not ruleblock) {
+ ss << "- Engine <" << _name << "> has a fl::null rule block at index <" << i << ">\n";
+ } else {
+ if (ruleblock->rules().empty()) {
+ ss << "- Rule block " << (i + 1) << " <" << ruleblock->getName() << "> has no rules\n";
+ }
+ int requiresConjunction = 0;
+ int requiresDisjunction = 0;
+ int requiresActivation = 0;
+ for (int r = 0; r < ruleblock->numberOfRules(); ++r) {
+ Rule* rule = ruleblock->getRule(r);
+ if (not rule) {
+ ss << "- Rule block " << (i + 1) << " <" << ruleblock->getName()
+ << "> has a fl::null rule at index <" << r << ">\n";
+ } else {
+ std::size_t thenIndex = rule->getText().find(" " + Rule::thenKeyword() + " ");
+ std::size_t andIndex = rule->getText().find(" " + Rule::andKeyword() + " ");
+ std::size_t orIndex = rule->getText().find(" " + Rule::orKeyword() + " ");
+ if (andIndex != std::string::npos and andIndex < thenIndex) {
+ ++requiresConjunction;
+ }
+ if (orIndex != std::string::npos and orIndex < thenIndex) {
+ ++requiresDisjunction;
+ }
+ if (rule->isLoaded()) {
+ Consequent* consequent = rule->getConsequent();
+ for (std::size_t c = 0; c < consequent->conclusions().size(); ++c) {
+ Proposition* proposition = consequent->conclusions().at(c);
+ const OutputVariable* outputVariable =
+ dynamic_cast<const OutputVariable*> (proposition->variable);
+ if (outputVariable and dynamic_cast<IntegralDefuzzifier*> (outputVariable->getDefuzzifier())) {
+ ++requiresActivation;
+ break;
+ }
+ }
+ }
+ }
+ }
+ const TNorm* conjunction = ruleblock->getConjunction();
+ if (requiresConjunction > 0 and not conjunction) {
+ ss << "- Rule block " << (i + 1) << " <" << ruleblock->getName() << "> has no conjunction operator\n";
+ ss << "- Rule block " << (i + 1) << " <" << ruleblock->getName() << "> has "
+ << requiresConjunction << " rules that require conjunction operator\n";
+ }
+ const SNorm* disjunction = ruleblock->getDisjunction();
+ if (requiresDisjunction > 0 and not disjunction) {
+ ss << "- Rule block " << (i + 1) << " <" << ruleblock->getName() << "> has no disjunction operator\n";
+ ss << "- Rule block " << (i + 1) << " <" << ruleblock->getName() << "> has "
+ << requiresDisjunction << " rules that require disjunction operator\n";
+ }
+ const TNorm* activation = ruleblock->getActivation();
+ if (requiresActivation > 0 and not activation) {
+ ss << "- Rule block " << (i + 1) << " <" << ruleblock->getName() << "> has no activation operator\n";
+ ss << "- Rule block " << (i + 1) << " <" << ruleblock->getName() << "> has "
+ << requiresActivation << " rules that require activation operator\n";
+ }
+ }
+ }
+ if (status) *status = ss.str();
+ return ss.str().empty();
+ }
+
+ void Engine::restart() {
+ for (std::size_t i = 0; i < _inputVariables.size(); ++i) {
+ _inputVariables.at(i)->setInputValue(fl::nan);
+ }
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ _outputVariables.at(i)->clear();
+ }
+ }
+
+ void Engine::process() {
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ _outputVariables.at(i)->fuzzyOutput()->clear();
+ }
+
+ FL_DEBUG_BEGIN;
+ FL_DBG("===============");
+ FL_DBG("CURRENT INPUTS:");
+ for (std::size_t i = 0; i < _inputVariables.size(); ++i) {
+ InputVariable* inputVariable = _inputVariables.at(i);
+ scalar inputValue = inputVariable->getInputValue();
+ if (inputVariable->isEnabled()) {
+ FL_DBG(inputVariable->getName() << ".input = " << Op::str(inputValue));
+ FL_DBG(inputVariable->getName() << ".fuzzy = " << inputVariable->fuzzify(inputValue));
+ } else {
+ FL_DBG(inputVariable->getName() << ".enabled = false");
+ }
+ }
+ FL_DEBUG_END;
+
+
+ for (std::size_t i = 0; i < _ruleblocks.size(); ++i) {
+ RuleBlock* ruleBlock = _ruleblocks.at(i);
+ if (ruleBlock->isEnabled()) {
+ ruleBlock->activate();
+ }
+ }
+
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ _outputVariables.at(i)->defuzzify();
+ }
+
+ FL_DEBUG_BEGIN;
+ FL_DBG("===============");
+ FL_DBG("CURRENT OUTPUTS:");
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ OutputVariable* outputVariable = _outputVariables.at(i);
+ if (outputVariable->isEnabled()) {
+ FL_DBG(outputVariable->getName() << ".default = "
+ << outputVariable->getDefaultValue());
+
+ FL_DBG(outputVariable->getName() << ".lockValueInRange = "
+ << outputVariable->isLockedOutputValueInRange());
+
+ FL_DBG(outputVariable->getName() << ".lockPreviousValue= "
+ << outputVariable->isLockedPreviousOutputValue());
+
+ scalar output = outputVariable->getOutputValue();
+ FL_DBG(outputVariable->getName() << ".output = " << output);
+ FL_DBG(outputVariable->getName() << ".fuzzy = " <<
+ outputVariable->fuzzify(output));
+ FL_DBG(outputVariable->fuzzyOutput()->toString());
+ } else {
+ FL_DBG(outputVariable->getName() << ".enabled = false");
+ }
+ }
+ FL_DBG("==============");
+ FL_DEBUG_END;
+ }
+
+ void Engine::setName(const std::string& name) {
+ this->_name = name;
+ }
+
+ std::string Engine::getName() const {
+ return this->_name;
+ }
+
+ std::string Engine::toString() const {
+ return FllExporter().toString(this);
+ }
+
+ Engine::Type Engine::type(std::string* name, std::string* reason) const {
+ if (_outputVariables.empty()) {
+ if (name) *name = "Unknown";
+ if (reason) *reason = "- Engine has no output variables";
+ return Engine::Unknown;
+ }
+
+ //Mamdani
+ bool mamdani = true;
+ for (std::size_t i = 0; mamdani and i < _outputVariables.size(); ++i) {
+ OutputVariable* outputVariable = _outputVariables.at(i);
+ //Defuzzifier must be integral
+ mamdani = mamdani and dynamic_cast<IntegralDefuzzifier*> (outputVariable->getDefuzzifier());
+ }
+ //Larsen
+ bool larsen = mamdani and not _ruleblocks.empty();
+ //Larsen is Mamdani with AlgebraicProduct as Activation
+ if (mamdani) {
+ for (std::size_t i = 0; larsen and i < _ruleblocks.size(); ++i) {
+ RuleBlock* ruleBlock = _ruleblocks.at(i);
+ larsen = larsen and dynamic_cast<const AlgebraicProduct*> (ruleBlock->getActivation());
+ }
+ }
+ if (larsen) {
+ if (name) *name = "Larsen";
+ if (reason) *reason = "- Output variables have integral defuzzifiers\n"
+ "- Rule blocks activate using the algebraic product T-Norm";
+ return Engine::Larsen;
+ }
+ if (mamdani) {
+ if (name) *name = "Mamdani";
+ if (reason) *reason = "-Output variables have integral defuzzifiers";
+ return Engine::Mamdani;
+ }
+ //Else, keep checking
+
+ //TakagiSugeno
+ bool takagiSugeno = true;
+ for (std::size_t i = 0; takagiSugeno and i < _outputVariables.size(); ++i) {
+ OutputVariable* outputVariable = _outputVariables.at(i);
+ //Defuzzifier is Weighted
+ WeightedDefuzzifier* weightedDefuzzifier =
+ dynamic_cast<WeightedDefuzzifier*> (outputVariable->getDefuzzifier());
+
+ takagiSugeno = takagiSugeno and weightedDefuzzifier and
+ (weightedDefuzzifier->getType() == WeightedDefuzzifier::Automatic or
+ weightedDefuzzifier->getType() == WeightedDefuzzifier::TakagiSugeno);
+
+ if (takagiSugeno) {
+ //Takagi-Sugeno has only Constant, Linear or Function terms
+ for (int t = 0; takagiSugeno and t < outputVariable->numberOfTerms(); ++t) {
+ Term* term = outputVariable->getTerm(t);
+ takagiSugeno = takagiSugeno and
+ weightedDefuzzifier->inferType(term) == WeightedDefuzzifier::TakagiSugeno;
+ }
+ }
+ }
+ if (takagiSugeno) {
+ if (name) *name = "Takagi-Sugeno";
+ if (reason) *reason = "- Output variables have weighted defuzzifiers\n"
+ "- Output variables have constant, linear or function terms";
+ return Engine::TakagiSugeno;
+ }
+
+ //Tsukamoto
+ bool tsukamoto = true;
+ for (std::size_t i = 0; tsukamoto and i < _outputVariables.size(); ++i) {
+ OutputVariable* outputVariable = _outputVariables.at(i);
+ //Defuzzifier is Weighted
+ WeightedDefuzzifier* weightedDefuzzifier =
+ dynamic_cast<WeightedDefuzzifier*> (outputVariable->getDefuzzifier());
+
+ tsukamoto = tsukamoto and weightedDefuzzifier and
+ (weightedDefuzzifier->getType() == WeightedDefuzzifier::Automatic or
+ weightedDefuzzifier->getType() == WeightedDefuzzifier::Tsukamoto);
+ if (tsukamoto) {
+ //Tsukamoto has only monotonic terms: Concave, Ramp, Sigmoid, SShape, or ZShape
+ for (int t = 0; tsukamoto and t < outputVariable->numberOfTerms(); ++t) {
+ Term* term = outputVariable->getTerm(t);
+ tsukamoto = tsukamoto and weightedDefuzzifier->isMonotonic(term);
+ }
+ }
+ }
+ if (tsukamoto) {
+ if (name) *name = "Tsukamoto";
+ if (reason) *reason = "- Output variables have weighted defuzzifiers\n"
+ "- Output variables only have monotonic terms";
+ return Engine::Tsukamoto;
+ }
+
+ //Inverse Tsukamoto
+ bool inverseTsukamoto = true;
+ for (std::size_t i = 0; inverseTsukamoto and i < _outputVariables.size(); ++i) {
+ OutputVariable* outputVariable = _outputVariables.at(i);
+ //Defuzzifier cannot be integral
+ WeightedDefuzzifier* weightedDefuzzifier =
+ dynamic_cast<WeightedDefuzzifier*> (outputVariable->getDefuzzifier());
+ inverseTsukamoto = inverseTsukamoto and weightedDefuzzifier;
+ }
+ if (inverseTsukamoto) {
+ if (name) *name = "Inverse Tsukamoto";
+ if (reason) *reason = "- Output variables have weighted defuzzifiers\n"
+ "- Output variables do not only have constant, linear or function terms\n"
+ "- Output variables do not only have monotonic terms";
+ return Engine::InverseTsukamoto;
+ }
+
+ bool hybrid = true;
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ OutputVariable* outputVariable = _outputVariables.at(i);
+ //Output variables have non-fl::null defuzzifiers
+ hybrid = hybrid and outputVariable->getDefuzzifier();
+ }
+ if (hybrid) {
+ if (name) *name = "Hybrid";
+ if (reason) *reason = "- Output variables have different defuzzifiers";
+ return Engine::Hybrid;
+ }
+
+ if (name) *name = "Unknown";
+ if (reason) *reason = "- There are output variables without a defuzzifier";
+ return Engine::Unknown;
+ }
+
+ Engine* Engine::clone() const {
+ return new Engine(*this);
+ }
+
+ std::vector<Variable*> Engine::variables() const {
+ std::vector<Variable*> result;
+ result.reserve(_inputVariables.size() + _outputVariables.size());
+ result.insert(result.end(), _inputVariables.begin(), _inputVariables.end());
+ result.insert(result.end(), _outputVariables.begin(), _outputVariables.end());
+ return result;
+ }
+
+ /**
+ * Operations for InputVariables
+ */
+ void Engine::setInputValue(const std::string& name, scalar value) {
+ InputVariable* inputVariable = getInputVariable(name);
+ inputVariable->setInputValue(value);
+ }
+
+ void Engine::addInputVariable(InputVariable* inputVariable) {
+ this->_inputVariables.push_back(inputVariable);
+ }
+
+ InputVariable* Engine::setInputVariable(InputVariable* inputVariable, int index) {
+ InputVariable* result = this->_inputVariables.at(index);
+ this->_inputVariables.at(index) = inputVariable;
+ return result;
+ }
+
+ void Engine::insertInputVariable(InputVariable* inputVariable, int index) {
+ this->_inputVariables.insert(this->_inputVariables.begin() + index,
+ inputVariable);
+ }
+
+ InputVariable* Engine::getInputVariable(int index) const {
+ return this->_inputVariables.at(index);
+ }
+
+ InputVariable* Engine::getInputVariable(const std::string& name) const {
+ for (std::size_t i = 0; i < _inputVariables.size(); ++i) {
+ if (_inputVariables.at(i)->getName() == name)
+ return _inputVariables.at(i);
+ }
+ throw fl::Exception("[engine error] input variable <" + name + "> not found", FL_AT);
+ }
+
+ bool Engine::hasInputVariable(const std::string& name) const {
+ for (std::size_t i = 0; i < _inputVariables.size(); ++i) {
+ if (_inputVariables.at(i)->getName() == name)
+ return true;
+ }
+ return false;
+ }
+
+ InputVariable* Engine::removeInputVariable(int index) {
+ InputVariable* result = this->_inputVariables.at(index);
+ this->_inputVariables.erase(this->_inputVariables.begin() + index);
+ return result;
+ }
+
+ InputVariable* Engine::removeInputVariable(const std::string& name) {
+ for (std::size_t i = 0; i < _inputVariables.size(); ++i) {
+ if (_inputVariables.at(i)->getName() == name) {
+ InputVariable* result = this->_inputVariables.at(i);
+ this->_inputVariables.erase(this->_inputVariables.begin() + i);
+ return result;
+ }
+ }
+ throw fl::Exception("[engine error] input variable <" + name + "> not found", FL_AT);
+ }
+
+ int Engine::numberOfInputVariables() const {
+ return this->_inputVariables.size();
+ }
+
+ const std::vector<InputVariable*>& Engine::inputVariables() const {
+ return this->_inputVariables;
+ }
+
+ void Engine::setInputVariables(const std::vector<InputVariable*>& inputVariables) {
+ this->_inputVariables = inputVariables;
+ }
+
+ std::vector<InputVariable*>& Engine::inputVariables() {
+ return this->_inputVariables;
+ }
+
+ /**
+ * Operations for OutputVariables
+ */
+ scalar Engine::getOutputValue(const std::string& name) {
+ OutputVariable* outputVariable = getOutputVariable(name);
+ return outputVariable->getOutputValue();
+ }
+
+ void Engine::addOutputVariable(OutputVariable* outputVariable) {
+ this->_outputVariables.push_back(outputVariable);
+ }
+
+ OutputVariable* Engine::setOutputVariable(OutputVariable* outputVariable, int index) {
+ OutputVariable* result = this->_outputVariables.at(index);
+ this->_outputVariables.at(index) = outputVariable;
+ return result;
+ }
+
+ void Engine::insertOutputVariable(OutputVariable* outputVariable, int index) {
+ this->_outputVariables.insert(this->_outputVariables.begin() + index,
+ outputVariable);
+ }
+
+ OutputVariable* Engine::getOutputVariable(int index) const {
+ return this->_outputVariables.at(index);
+ }
+
+ OutputVariable* Engine::getOutputVariable(const std::string& name) const {
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ if (_outputVariables.at(i)->getName() == name)
+ return _outputVariables.at(i);
+ }
+ throw fl::Exception("[engine error] output variable <" + name + "> not found", FL_AT);
+ }
+
+ bool Engine::hasOutputVariable(const std::string& name) const {
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ if (_outputVariables.at(i)->getName() == name)
+ return true;
+ }
+ return false;
+ }
+
+ OutputVariable* Engine::removeOutputVariable(int index) {
+ OutputVariable* result = this->_outputVariables.at(index);
+ this->_outputVariables.erase(this->_outputVariables.begin() + index);
+ return result;
+ }
+
+ OutputVariable* Engine::removeOutputVariable(const std::string& name) {
+ for (std::size_t i = 0; i < _outputVariables.size(); ++i) {
+ if (_outputVariables.at(i)->getName() == name) {
+ OutputVariable* result = this->_outputVariables.at(i);
+ this->_outputVariables.erase(this->_outputVariables.begin() + i);
+ return result;
+ }
+ }
+ throw fl::Exception("[engine error] output variable <" + name + "> not found", FL_AT);
+ }
+
+ int Engine::numberOfOutputVariables() const {
+ return this->_outputVariables.size();
+ }
+
+ const std::vector<OutputVariable*>& Engine::outputVariables() const {
+ return this->_outputVariables;
+ }
+
+ void Engine::setOutputVariables(const std::vector<OutputVariable*>& outputVariables) {
+ this->_outputVariables = outputVariables;
+ }
+
+ std::vector<OutputVariable*>& Engine::outputVariables() {
+ return this->_outputVariables;
+ }
+
+ /**
+ * Operations for iterable datatype _ruleblocks
+ */
+ void Engine::addRuleBlock(RuleBlock* ruleblock) {
+ this->_ruleblocks.push_back(ruleblock);
+ }
+
+ RuleBlock* Engine::setRuleBlock(RuleBlock* ruleBlock, int index) {
+ RuleBlock* result = this->_ruleblocks.at(index);
+ this->_ruleblocks.at(index) = ruleBlock;
+ return result;
+ }
+
+ void Engine::insertRuleBlock(RuleBlock* ruleblock, int index) {
+ this->_ruleblocks.insert(this->_ruleblocks.begin() + index, ruleblock);
+ }
+
+ RuleBlock* Engine::getRuleBlock(int index) const {
+ return this->_ruleblocks.at(index);
+ }
+
+ RuleBlock* Engine::getRuleBlock(const std::string& name) const {
+ for (std::size_t i = 0; i < _ruleblocks.size(); ++i) {
+ if (_ruleblocks.at(i)->getName() == name)
+ return _ruleblocks.at(i);
+ }
+ throw fl::Exception("[engine error] rule block <" + name + "> not found", FL_AT);
+ }
+
+ bool Engine::hasRuleBlock(const std::string& name) const {
+ for (std::size_t i = 0; i < _ruleblocks.size(); ++i) {
+ if (_ruleblocks.at(i)->getName() == name)
+ return true;
+ }
+ return false;
+ }
+
+ RuleBlock* Engine::removeRuleBlock(int index) {
+ RuleBlock* result = this->_ruleblocks.at(index);
+ this->_ruleblocks.erase(this->_ruleblocks.begin() + index);
+ return result;
+ }
+
+ RuleBlock* Engine::removeRuleBlock(const std::string& name) {
+ for (std::size_t i = 0; i < _ruleblocks.size(); ++i) {
+ if (_ruleblocks.at(i)->getName() == name) {
+ RuleBlock* result = this->_ruleblocks.at(i);
+ this->_ruleblocks.erase(this->_ruleblocks.begin() + i);
+ return result;
+ }
+ }
+ throw fl::Exception("[engine error] rule block <" + name + "> not found", FL_AT);
+ }
+
+ int Engine::numberOfRuleBlocks() const {
+ return this->_ruleblocks.size();
+ }
+
+ const std::vector<RuleBlock*>& Engine::ruleBlocks() const {
+ return this->_ruleblocks;
+ }
+
+ void Engine::setRuleBlocks(const std::vector<RuleBlock*>& ruleBlocks) {
+ this->_ruleblocks = ruleBlocks;
+ }
+
+ std::vector<RuleBlock*>& Engine::ruleBlocks() {
+ return this->_ruleblocks;
+ }
+
+
+}
diff --git a/fuzzylite/src/Exception.cpp b/fuzzylite/src/Exception.cpp
new file mode 100644
index 0000000..d24adac
--- /dev/null
+++ b/fuzzylite/src/Exception.cpp
@@ -0,0 +1,183 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/Exception.h"
+
+
+#ifdef FL_BACKTRACE_OFF
+//do nothing
+
+#elif defined FL_UNIX
+#include <execinfo.h>
+
+#elif defined FL_WINDOWS
+#include <windows.h>
+#include <winbase.h>
+#ifndef __MINGW32__
+#include <dbghelp.h>
+#endif
+#endif
+
+
+#include <signal.h>
+#include <stdlib.h>
+#include <string.h>
+
+namespace fl {
+
+ Exception::Exception(const std::string& what)
+ : std::exception(), _what(what) {
+ FL_DBG(this->what());
+ }
+
+ Exception::Exception(const std::string& what, const std::string& file, int line,
+ const std::string& function)
+ : std::exception(), _what(what) {
+ append(file, line, function);
+ FL_DBG(this->what());
+ }
+
+ Exception::~Exception() FL_INOEXCEPT {
+ }
+
+ void Exception::setWhat(const std::string& what) {
+ this->_what = what;
+ }
+
+ std::string Exception::getWhat() const {
+ return this->_what;
+ }
+
+ const char* Exception::what() const FL_INOEXCEPT {
+ return this->_what.c_str();
+ }
+
+ void Exception::append(const std::string& whatElse) {
+ this->_what += whatElse + "\n";
+ }
+
+ void Exception::append(const std::string& file, int line, const std::string& function) {
+ std::ostringstream ss;
+ ss << "\n{at " << file << "::" << function << "() [line:" << line << "]}";
+ _what += ss.str();
+ }
+
+ void Exception::append(const std::string& whatElse,
+ const std::string& file, int line, const std::string& function) {
+ append(whatElse);
+ append(file, line, function);
+ }
+
+ std::string Exception::btCallStack() {
+#ifdef FL_BACKTRACE_OFF
+ return "[backtrace disabled] fuzzylite was built with option -DFL_BACKTRACE_OFF";
+#elif defined FL_UNIX
+ std::ostringstream btStream;
+ const int bufferSize = 30;
+ void* buffer[bufferSize];
+ int backtraceSize = backtrace(buffer, bufferSize);
+ char **btSymbols = backtrace_symbols(buffer, backtraceSize);
+ if (btSymbols == fl::null) {
+ btStream << "[backtrace error] no symbols could be retrieved";
+ } else {
+ if (backtraceSize == 0) btStream << "[backtrace is empty]";
+ for (int i = 0; i < backtraceSize; ++i) {
+ btStream << btSymbols[i] << "\n";
+ }
+ }
+ free(btSymbols);
+ return btStream.str();
+
+
+#elif defined FL_WINDOWS && ! defined __MINGW32__
+ std::ostringstream btStream;
+ const int bufferSize = 30;
+ void* buffer[bufferSize];
+ SymInitialize(GetCurrentProcess(), fl::null, TRUE);
+
+ int backtraceSize = CaptureStackBackTrace(0, bufferSize, buffer, fl::null);
+ SYMBOL_INFO* btSymbol = (SYMBOL_INFO *) calloc(sizeof ( SYMBOL_INFO) + 256 * sizeof ( char), 1);
+ if (not btSymbol) {
+ btStream << "[backtrace error] no symbols could be retrieved";
+ } else {
+ btSymbol->MaxNameLen = 255;
+ btSymbol->SizeOfStruct = sizeof ( SYMBOL_INFO);
+ if (backtraceSize == 0) btStream << "[backtrace is empty]";
+ for (int i = 0; i < backtraceSize; ++i) {
+ SymFromAddr(GetCurrentProcess(), (DWORD64) (buffer[ i ]), 0, btSymbol);
+ btStream << (backtraceSize - i - 1) << ": " <<
+ btSymbol->Name << " at 0x" << btSymbol->Address << "\n";
+ }
+ }
+ free(btSymbol);
+ return btStream.str();
+#else
+ return "[backtrace missing] supported only in Unix and Windows platforms";
+#endif
+ }
+ //execinfo
+
+ void Exception::signalHandler(int signal) {
+ std::ostringstream ex;
+ ex << "[unexpected signal " << signal << "] ";
+#ifdef FL_UNIX
+ ex << strsignal(signal);
+#endif
+ ex << "\nBACKTRACE:\n" << btCallStack();
+ fl::Exception::catchException(fl::Exception(ex.str(), FL_AT));
+ exit(EXIT_FAILURE);
+ }
+
+ void Exception::convertToException(int signal) {
+ std::string signalDescription;
+#ifdef FL_UNIX
+ //Unblock the signal
+ sigset_t empty;
+ sigemptyset(&empty);
+ sigaddset(&empty, signal);
+ sigprocmask(SIG_UNBLOCK, &empty, fl::null);
+ signalDescription = strsignal(signal);
+#endif
+ std::ostringstream ex;
+ ex << "[signal " << signal << "] " << signalDescription << "\n";
+ ex << "BACKTRACE:\n" << btCallStack();
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ void Exception::terminate() {
+ fl::Exception::catchException(fl::Exception("[unexpected exception] BACKTRACE:\n" + btCallStack(), FL_AT));
+ exit(EXIT_FAILURE);
+ }
+
+ void Exception::catchException(const std::exception& exception) {
+ std::ostringstream ss;
+ ss << exception.what();
+ std::string backtrace = btCallStack();
+ if (not backtrace.empty()) {
+ ss << "\n\nBACKTRACE:\n" << backtrace;
+ }
+ FL_LOG(ss.str());
+ }
+
+}
diff --git a/fuzzylite/src/Operation.cpp b/fuzzylite/src/Operation.cpp
new file mode 100644
index 0000000..1596ea4
--- /dev/null
+++ b/fuzzylite/src/Operation.cpp
@@ -0,0 +1,477 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/Operation.h"
+
+#include "fl/defuzzifier/Defuzzifier.h"
+#include "fl/norm/Norm.h"
+#include "fl/norm/SNorm.h"
+#include "fl/norm/TNorm.h"
+
+#include <algorithm>
+#include <iomanip>
+#include <cstdarg>
+#include <cctype>
+
+namespace fl {
+
+ template <typename T>
+ T Operation::min(T a, T b) {
+ if (isNaN(a)) return b;
+ if (isNaN(b)) return a;
+ return a < b ? a : b;
+ }
+ template FL_API scalar Operation::min(scalar a, scalar b);
+ template FL_API int Operation::min(int a, int b);
+
+ template <typename T>
+ T Operation::max(T a, T b) {
+ if (isNaN(a)) return b;
+ if (isNaN(b)) return a;
+ return a > b ? a : b;
+ }
+ template FL_API scalar Operation::max(scalar a, scalar b);
+ template FL_API int Operation::max(int a, int b);
+
+ template <typename T>
+ T Operation::bound(T x, T min, T max) {
+ if (isGt(x, max)) return max;
+ if (isLt(x, min)) return min;
+ return x;
+ }
+ template FL_API scalar Operation::bound(scalar x, scalar min, scalar max);
+ template FL_API int Operation::bound(int x, int min, int max);
+
+ template <typename T>
+ bool Operation::in(T x, T min, T max, bool geq, bool leq) {
+ bool left = geq ? isGE(x, min) : isGt(x, min);
+ bool right = leq ? isLE(x, max) : isLt(x, max);
+ return (left and right);
+ }
+ template FL_API bool Operation::in(scalar x, scalar min, scalar max, bool geq, bool leq);
+ template FL_API bool Operation::in(int x, int min, int max, bool geq, bool leq);
+
+ template <typename T>
+ bool Operation::isInf(T x) {
+ return std::abs(x) == fl::inf;
+ }
+ template FL_API bool Operation::isInf(int x);
+ template FL_API bool Operation::isInf(scalar x);
+
+ template <typename T>
+ bool Operation::isNaN(T x) {
+ return not (x == x);
+ }
+ template FL_API bool Operation::isNaN(int x);
+ template FL_API bool Operation::isNaN(scalar x);
+
+ template<typename T>
+ bool Operation::isFinite(T x) {
+ return not (isNaN(x) or isInf(x));
+ }
+ template FL_API bool Operation::isFinite(int x);
+ template FL_API bool Operation::isFinite(scalar x);
+
+ bool Operation::isLt(scalar a, scalar b, scalar macheps) {
+ return not isEq(a, b, macheps) and a < b;
+ }
+
+ bool Operation::isLE(scalar a, scalar b, scalar macheps) {
+ return isEq(a, b, macheps) or a < b;
+ }
+
+ bool Operation::isEq(scalar a, scalar b, scalar macheps) {
+ return a == b or std::fabs(a - b) < macheps or (isNaN(a) and isNaN(b));
+ }
+
+ bool Operation::isGt(scalar a, scalar b, scalar macheps) {
+ return not isEq(a, b, macheps) and a > b;
+ }
+
+ bool Operation::isGE(scalar a, scalar b, scalar macheps) {
+ return isEq(a, b, macheps) or a > b;
+ }
+
+ scalar Operation::scale(scalar x, scalar fromMin, scalar fromMax, scalar toMin, scalar toMax, bool bounded) {
+ scalar result = (toMax - toMin) / (fromMax - fromMin) * (x - fromMin) + toMin;
+ return bounded ? fl::Op::bound(result, toMin, toMax) : result;
+ }
+
+ scalar Operation::add(scalar a, scalar b) {
+ return a + b;
+ }
+
+ scalar Operation::subtract(scalar a, scalar b) {
+ return a - b;
+ }
+
+ scalar Operation::multiply(scalar a, scalar b) {
+ return a * b;
+ }
+
+ scalar Operation::divide(scalar a, scalar b) {
+ return a / b;
+ }
+
+ scalar Operation::modulo(scalar a, scalar b) {
+ return fmod(a, b);
+ }
+
+ scalar Operation::logicalAnd(scalar a, scalar b) {
+ return (isEq(a, 1.0) and isEq(b, 1.0)) ? 1.0 : 0.0;
+ }
+
+ scalar Operation::logicalOr(scalar a, scalar b) {
+ return (isEq(a, 1.0) or isEq(b, 1.0)) ? 1.0 : 0.0;
+ }
+
+ scalar Operation::logicalNot(scalar a) {
+ return isEq(a, 1.0) ? 0.0 : 1.0;
+ }
+
+ scalar Operation::negate(scalar a) {
+ return -a;
+ }
+
+ scalar Operation::round(scalar x) {
+ return (x > 0.0) ? std::floor(x + 0.5) : std::ceil(x - 0.5);
+ }
+
+ scalar Operation::gt(scalar a, scalar b) {
+ return isGt(a, b);
+ }
+
+ scalar Operation::ge(scalar a, scalar b) {
+ return isGE(a, b);
+ }
+
+ scalar Operation::eq(scalar a, scalar b) {
+ return isEq(a, b);
+ }
+
+ scalar Operation::neq(scalar a, scalar b) {
+ return not isEq(a, b);
+ }
+
+ scalar Operation::le(scalar a, scalar b) {
+ return isLE(a, b);
+ }
+
+ scalar Operation::lt(scalar a, scalar b) {
+ return isLt(a, b);
+ }
+
+ bool Operation::increment(std::vector<int>& x, std::vector<int>& min, std::vector<int>& max) {
+ return increment(x, (int) x.size() - 1, min, max);
+ }
+
+ bool Operation::increment(std::vector<int>& x, int position, std::vector<int>& min, std::vector<int>& max) {
+ if (x.empty() or position < 0) return true;
+
+ bool overflow = false;
+ if (x.at(position) < max.at(position)) {
+ ++x.at(position);
+ } else {
+ overflow = (position == 0);
+ x.at(position) = min.at(position);
+ --position;
+ if (position >= 0) {
+ overflow = increment(x, position, min, max);
+ }
+ }
+ return overflow;
+ }
+
+ double Operation::mean(const std::vector<scalar>& x) {
+ if (x.size() == 0) return fl::nan;
+ scalar sum = 0.0;
+ for (std::size_t i = 0; i < x.size(); ++i) sum += x.at(i);
+ return sum / x.size();
+ }
+
+ double Operation::standardDeviation(const std::vector<scalar>& x) {
+ if (x.size() <= 1) return 0.0;
+ return standardDeviation(x, mean(x));
+ }
+
+ double Operation::standardDeviation(const std::vector<scalar>& x, scalar mean) {
+ if (x.size() <= 1) return 0.0;
+ return std::sqrt(variance(x, mean));
+ }
+
+ double Operation::variance(const std::vector<scalar>& x) {
+ if (x.size() <= 1) return 0.0;
+ return variance(x, mean(x));
+ }
+
+ double Operation::variance(const std::vector<scalar>& x, scalar mean) {
+ if (x.size() <= 1) return 0.0;
+ scalar result = 0;
+ for (std::size_t i = 0; i < x.size(); ++i) {
+ result += (x.at(i) - mean) * (x.at(i) - mean);
+ }
+ result /= -1 + x.size();
+ return result;
+ }
+
+
+
+ //Text Operations:
+
+ std::string Operation::validName(const std::string& name) {
+ if (trim(name).empty()) return "unnamed";
+ std::ostringstream ss;
+ for (std::size_t i = 0; i < name.length(); ++i) {
+ char c = name[i];
+ if (c == '_' or c == '.' or isalnum(c)) {
+ ss << c;
+ }
+ }
+ return ss.str();
+ }
+
+ int Operation::isValidForName(int character) {
+ return character == '_' or character == '.' or isalnum(character);
+ }
+
+ std::string Operation::findReplace(const std::string& str, const std::string& find,
+ const std::string& replace, bool replaceAll) {
+ std::ostringstream result;
+ std::size_t fromIndex = 0, nextIndex;
+ do {
+ nextIndex = str.find(find, fromIndex);
+ result << str.substr(fromIndex, nextIndex - fromIndex);
+ if (nextIndex != std::string::npos)
+ result << replace;
+ fromIndex = nextIndex + find.size();
+ } while (replaceAll and nextIndex != std::string::npos);
+ return result.str();
+ }
+
+ std::vector<std::string> Operation::split(const std::string& str,
+ const std::string& delimiter, bool ignoreEmpty) {
+ std::vector<std::string> result;
+ if (str.empty() or delimiter.empty()) {
+ result.push_back(str);
+ return result;
+ }
+ std::string::const_iterator position = str.begin(), next = str.begin();
+ while (next != str.end()) {
+ next = std::search(position, str.end(), delimiter.begin(), delimiter.end());
+ std::string token(position, next);
+ if (not (token.empty() and ignoreEmpty)) {
+ result.push_back(token);
+ }
+ if (next != str.end()) {
+ position = next + delimiter.size();
+ }
+ }
+ return result;
+ }
+
+ std::string Operation::trim(const std::string& text) {
+ if (text.empty()) return text;
+ if (not (std::isspace(text.at(0)) or std::isspace(text.at(text.size() - 1))))
+ return text;
+ int start = 0, end = text.size() - 1;
+ while (start <= end and std::isspace(text.at(start))) {
+ ++start;
+ }
+ while (end >= start and std::isspace(text.at(end))) {
+ --end;
+ }
+ int length = end - start + 1;
+ if (length <= 0) return "";
+ return text.substr(start, length);
+ }
+
+ std::string Operation::format(const std::string& text, int matchesChar(int),
+ const std::string& replacement) {
+ std::ostringstream ss;
+ std::string::const_iterator it = text.begin();
+ while (it != text.end()) {
+ if (matchesChar(*it)) {
+ ss << *it;
+ } else {
+ ss << replacement;
+ }
+ ++it;
+ }
+ return ss.str();
+ }
+
+ scalar Operation::toScalar(const std::string& x) {
+ std::istringstream iss(x);
+ scalar result;
+ iss >> result;
+ char strict;
+ if (not (iss.fail() or iss.get(strict))) return result;
+
+ std::ostringstream nan, pInf, nInf;
+ nan << fl::nan;
+ pInf << fl::inf;
+ nInf << (-fl::inf);
+
+ if (x == nan.str() or x == "nan")
+ return fl::nan;
+ if (x == pInf.str() or x == "inf")
+ return fl::inf;
+ if (x == nInf.str() or x == "-inf")
+ return -fl::inf;
+
+ std::ostringstream ex;
+ ex << "[conversion error] from <" << x << "> to scalar";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ scalar Operation::toScalar(const std::string& x, scalar alternative) FL_INOEXCEPT {
+ std::istringstream iss(x);
+ scalar result;
+ iss >> result;
+ char strict;
+ if (not (iss.fail() or iss.get(strict))) return result;
+
+ std::ostringstream nan, pInf, nInf;
+ nan << fl::nan;
+ pInf << fl::inf;
+ nInf << (-fl::inf);
+
+ if (x == nan.str() or x == "nan")
+ return fl::nan;
+ if (x == pInf.str() or x == "inf")
+ return fl::inf;
+ if (x == nInf.str() or x == "-inf")
+ return -fl::inf;
+
+ return alternative;
+ }
+
+ bool Operation::isNumeric(const std::string& x) {
+ try {
+ fl::Op::toScalar(x);
+ return true;
+ } catch (std::exception& ex) {
+ (void) ex;
+ return false;
+ }
+ }
+
+ template <typename T>
+ std::string Operation::str(T x, int decimals) {
+ std::ostringstream ss;
+ ss << std::setprecision(decimals) << std::fixed;
+ if (fl::Op::isNaN(x)) {
+ ss << "nan";
+ } else if (fl::Op::isInf(x)) {
+ ss << (fl::Op::isLt(x, 0.0) ? "-inf" : "inf");
+ } else if (fl::Op::isEq(x, 0.0)) {
+ ss << 0.0;
+ } else ss << x;
+ return ss.str();
+ }
+ template FL_API std::string Operation::str(int x, int precision);
+ template FL_API std::string Operation::str(scalar x, int precision);
+
+ template <> FL_API std::string Operation::str(const std::string& x, int precision) {
+ (void) precision;
+ return x;
+ }
+
+ template <typename T>
+ std::string Operation::join(const std::vector<T>& x,
+ const std::string& separator) {
+ std::ostringstream ss;
+ for (std::size_t i = 0; i < x.size(); ++i) {
+ ss << str(x.at(i));
+ if (i + 1 < x.size()) ss << separator;
+ }
+ return ss.str();
+ }
+ template FL_API std::string Operation::join(const std::vector<int>& x,
+ const std::string& separator);
+ template FL_API std::string Operation::join(const std::vector<scalar>& x,
+ const std::string& separator);
+
+ template <> FL_API
+ std::string Operation::join(const std::vector<std::string>& x,
+ const std::string& separator) {
+ std::ostringstream ss;
+ for (std::size_t i = 0; i < x.size(); ++i) {
+ ss << x.at(i);
+ if (i + 1 < x.size()) ss << separator;
+ }
+ return ss.str();
+ }
+
+ template <typename T>
+ std::string Operation::join(int items, const std::string& separator, T first, ...) {
+ std::ostringstream ss;
+ ss << str(first);
+ if (items > 1) ss << separator;
+ va_list args;
+ va_start(args, first);
+ for (int i = 0; i < items - 1; ++i) {
+ ss << str(va_arg(args, T));
+ if (i + 1 < items - 1) ss << separator;
+ }
+ va_end(args);
+ return ss.str();
+ }
+
+ template FL_API std::string Operation::join(int items, const std::string& separator,
+ int first, ...);
+ template FL_API std::string Operation::join(int items, const std::string& separator,
+ double first, ...);
+
+ template <> FL_API std::string Operation::join(int items, const std::string& separator,
+ float first, ...) {
+ std::ostringstream ss;
+ ss << str(first);
+ if (items > 1) ss << separator;
+ va_list args;
+ va_start(args, first);
+ for (int i = 0; i < items - 1; ++i) {
+ ss << str(va_arg(args, double)); //automatic promotion
+ if (i + 1 < items - 1) ss << separator;
+ }
+ va_end(args);
+ return ss.str();
+ }
+
+ template <> FL_API
+ std::string Operation::join(int items, const std::string& separator, const char* first, ...) {
+ std::ostringstream ss;
+ ss << first;
+ if (items > 1) ss << separator;
+ va_list args;
+ va_start(args, first);
+ for (int i = 0; i < items - 1; ++i) {
+ ss << va_arg(args, const char*);
+ if (i + 1 < items - 1) ss << separator;
+ }
+ va_end(args);
+ return ss.str();
+ }
+
+}
diff --git a/fuzzylite/src/defuzzifier/Bisector.cpp b/fuzzylite/src/defuzzifier/Bisector.cpp
new file mode 100644
index 0000000..ee4d2fc
--- /dev/null
+++ b/fuzzylite/src/defuzzifier/Bisector.cpp
@@ -0,0 +1,85 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/defuzzifier/Bisector.h"
+
+#include "fl/term/Accumulated.h"
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ Bisector::Bisector(int resolution)
+ : IntegralDefuzzifier(resolution) {
+ }
+
+ Bisector::~Bisector() {
+
+ }
+
+ std::string Bisector::className() const {
+ return "Bisector";
+ }
+
+ scalar Bisector::defuzzify(const Term* term, scalar minimum, scalar maximum) const {
+ if (not fl::Op::isFinite(minimum + maximum)) {
+ return fl::nan;
+ }
+ if (maximum - minimum > _resolution) {
+ FL_DBG("[accuracy warning] the resolution <" << _resolution << "> "
+ "is smaller than the range <" << minimum << ", " << maximum << ">. In order to "
+ "improve the accuracy, the resolution should be at least equal to the range.");
+ }
+ scalar dx = (maximum - minimum) / _resolution;
+
+ int counter = _resolution;
+ int left = 0, right = 0;
+ scalar leftArea = 0, rightArea = 0;
+ scalar xLeft = minimum, xRight = maximum;
+ while (counter-- > 0) {
+ if (fl::Op::isLE(leftArea, rightArea)) {
+ xLeft = minimum + (left + 0.5) * dx;
+ leftArea += term->membership(xLeft);
+ left++;
+ } else {
+ xRight = maximum - (right + 0.5) * dx;
+ rightArea += term->membership(xRight);
+ right++;
+ }
+ }
+
+ //Inverse weighted average to compensate
+ scalar bisector = (leftArea * xRight + rightArea * xLeft) / (leftArea + rightArea);
+ return bisector;
+ }
+
+ Bisector* Bisector::clone() const {
+ return new Bisector(*this);
+ }
+
+ Defuzzifier* Bisector::constructor() {
+ return new Bisector;
+ }
+
+
+}
diff --git a/fuzzylite/src/defuzzifier/Centroid.cpp b/fuzzylite/src/defuzzifier/Centroid.cpp
new file mode 100644
index 0000000..01490d3
--- /dev/null
+++ b/fuzzylite/src/defuzzifier/Centroid.cpp
@@ -0,0 +1,80 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/defuzzifier/Centroid.h"
+
+#include "fl/term/Accumulated.h"
+#include "fl/term/Term.h"
+
+
+namespace fl {
+
+ Centroid::Centroid(int resolution)
+ : IntegralDefuzzifier(resolution) {
+ }
+
+ Centroid::~Centroid() {
+
+ }
+
+ std::string Centroid::className() const {
+ return "Centroid";
+ }
+
+ scalar Centroid::defuzzify(const Term* term, scalar minimum, scalar maximum) const {
+ if (not fl::Op::isFinite(minimum + maximum)) {
+ return fl::nan;
+ }
+ if (maximum - minimum > _resolution) {
+ FL_DBG("[accuracy warning] the resolution <" << _resolution << "> "
+ "is smaller than the range <" << minimum << ", " << maximum << ">. In order to "
+ "improve the accuracy, the resolution should be at least equal to the range.");
+ }
+ scalar dx = (maximum - minimum) / _resolution;
+ scalar x, y;
+ scalar area = 0, xcentroid = 0, ycentroid = 0;
+ for (int i = 0; i < _resolution; ++i) {
+ x = minimum + (i + 0.5) * dx;
+ y = term->membership(x);
+
+ xcentroid += y * x;
+ ycentroid += y * y;
+ area += y;
+ }
+ xcentroid /= area;
+ ycentroid /= 2 * area;
+ area *= dx; //total area... unused, but for future reference.
+ return xcentroid;
+ }
+
+ Centroid* Centroid::clone() const {
+ return new Centroid(*this);
+ }
+
+ Defuzzifier* Centroid::constructor() {
+ return new Centroid;
+ }
+
+
+}
diff --git a/fuzzylite/src/defuzzifier/IntegralDefuzzifier.cpp b/fuzzylite/src/defuzzifier/IntegralDefuzzifier.cpp
new file mode 100644
index 0000000..2badf14
--- /dev/null
+++ b/fuzzylite/src/defuzzifier/IntegralDefuzzifier.cpp
@@ -0,0 +1,53 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/defuzzifier/IntegralDefuzzifier.h"
+
+namespace fl {
+
+ int IntegralDefuzzifier::_defaultResolution = 200;
+
+ void IntegralDefuzzifier::setDefaultResolution(int defaultResolution) {
+ _defaultResolution = defaultResolution;
+ }
+
+ int IntegralDefuzzifier::defaultResolution() {
+ return _defaultResolution;
+ }
+
+ IntegralDefuzzifier::IntegralDefuzzifier(int resolution)
+ : Defuzzifier(), _resolution(resolution) {
+ }
+
+ IntegralDefuzzifier::~IntegralDefuzzifier() {
+ }
+
+ void IntegralDefuzzifier::setResolution(int resolution) {
+ this->_resolution = resolution;
+ }
+
+ int IntegralDefuzzifier::getResolution() const {
+ return this->_resolution;
+ }
+}
diff --git a/fuzzylite/src/defuzzifier/LargestOfMaximum.cpp b/fuzzylite/src/defuzzifier/LargestOfMaximum.cpp
new file mode 100644
index 0000000..470af52
--- /dev/null
+++ b/fuzzylite/src/defuzzifier/LargestOfMaximum.cpp
@@ -0,0 +1,75 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/defuzzifier/LargestOfMaximum.h"
+
+#include "fl/Exception.h"
+#include "fl/term/Term.h"
+
+namespace fl {
+
+ LargestOfMaximum::LargestOfMaximum(int resolution)
+ : IntegralDefuzzifier(resolution) {
+ }
+
+ LargestOfMaximum::~LargestOfMaximum() {
+ }
+
+ std::string LargestOfMaximum::className() const {
+ return "LargestOfMaximum";
+ }
+
+ scalar LargestOfMaximum::defuzzify(const Term* term, scalar minimum, scalar maximum) const {
+ if (not fl::Op::isFinite(minimum + maximum)) {
+ return fl::nan;
+ }
+ if (maximum - minimum > _resolution) {
+ FL_DBG("[accuracy warning] the resolution <" << _resolution << "> "
+ "is smaller than the range <" << minimum << ", " << maximum << ">. In order to "
+ "improve the accuracy, the resolution should be at least equal to the range.");
+ }
+ scalar dx = (maximum - minimum) / _resolution;
+ scalar x, y;
+ scalar ymax = -1.0, xlargest = maximum;
+ for (int i = 0; i < _resolution; ++i) {
+ x = minimum + (i + 0.5) * dx;
+ y = term->membership(x);
+
+ if (Op::isGE(y, ymax)) {
+ ymax = y;
+ xlargest = x;
+ }
+ }
+ return xlargest;
+ }
+
+ LargestOfMaximum* LargestOfMaximum::clone() const {
+ return new LargestOfMaximum(*this);
+ }
+
+ Defuzzifier* LargestOfMaximum::constructor() {
+ return new LargestOfMaximum;
+ }
+
+}
diff --git a/fuzzylite/src/defuzzifier/MeanOfMaximum.cpp b/fuzzylite/src/defuzzifier/MeanOfMaximum.cpp
new file mode 100644
index 0000000..7c40527
--- /dev/null
+++ b/fuzzylite/src/defuzzifier/MeanOfMaximum.cpp
@@ -0,0 +1,88 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/defuzzifier/MeanOfMaximum.h"
+
+#include "fl/Exception.h"
+#include "fl/term/Term.h"
+
+
+namespace fl {
+
+ MeanOfMaximum::MeanOfMaximum(int resolution)
+ : IntegralDefuzzifier(resolution) {
+ }
+
+ MeanOfMaximum::~MeanOfMaximum() {
+ }
+
+ std::string MeanOfMaximum::className() const {
+ return "MeanOfMaximum";
+ }
+
+ scalar MeanOfMaximum::defuzzify(const Term* term, scalar minimum, scalar maximum) const {
+ if (not fl::Op::isFinite(minimum + maximum)) {
+ return fl::nan;
+ }
+ if (maximum - minimum > _resolution) {
+ FL_DBG("[accuracy warning] the resolution <" << _resolution << "> "
+ "is smaller than the range <" << minimum << ", " << maximum << ">. In order to "
+ "improve the accuracy, the resolution should be at least equal to the range.");
+ }
+ scalar dx = (maximum - minimum) / _resolution;
+ scalar x, y;
+ scalar ymax = -1.0;
+ scalar xsmallest = minimum;
+ scalar xlargest = maximum;
+ bool samePlateau = false;
+ for (int i = 0; i < _resolution; ++i) {
+ x = minimum + (i + 0.5) * dx;
+ y = term->membership(x);
+
+ if (Op::isGt(y, ymax)) {
+ ymax = y;
+
+ xsmallest = x;
+ xlargest = x;
+
+ samePlateau = true;
+ } else if (Op::isEq(y, ymax) and samePlateau) {
+ xlargest = x;
+ } else if (Op::isLt(y, ymax)) {
+ samePlateau = false;
+ }
+ }
+
+ return (xlargest + xsmallest) / 2.0;
+ }
+
+ MeanOfMaximum* MeanOfMaximum::clone() const {
+ return new MeanOfMaximum(*this);
+ }
+
+ Defuzzifier* MeanOfMaximum::constructor() {
+ return new MeanOfMaximum;
+ }
+
+}
diff --git a/fuzzylite/src/defuzzifier/SmallestOfMaximum.cpp b/fuzzylite/src/defuzzifier/SmallestOfMaximum.cpp
new file mode 100644
index 0000000..1e67395
--- /dev/null
+++ b/fuzzylite/src/defuzzifier/SmallestOfMaximum.cpp
@@ -0,0 +1,77 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/defuzzifier/SmallestOfMaximum.h"
+
+#include "fl/Exception.h"
+#include "fl/term/Term.h"
+
+
+namespace fl {
+
+ SmallestOfMaximum::SmallestOfMaximum(int resolution)
+ : IntegralDefuzzifier(resolution) {
+ }
+
+ SmallestOfMaximum::~SmallestOfMaximum() {
+ }
+
+ std::string SmallestOfMaximum::className() const {
+ return "SmallestOfMaximum";
+ }
+
+ scalar SmallestOfMaximum::defuzzify(const Term* term, scalar minimum, scalar maximum) const {
+ if (not fl::Op::isFinite(minimum + maximum)) {
+ return fl::nan;
+ }
+ if (maximum - minimum > _resolution) {
+ FL_DBG("[accuracy warning] the resolution <" << _resolution << "> "
+ "is smaller than the range <" << minimum << ", " << maximum << ">. In order to "
+ "improve the accuracy, the resolution should be at least equal to the range.");
+ }
+ scalar dx = (maximum - minimum) / _resolution;
+ scalar x, y;
+ scalar ymax = -1.0, xsmallest = minimum;
+ for (int i = 0; i < _resolution; ++i) {
+ x = minimum + (i + 0.5) * dx;
+ y = term->membership(x);
+
+ if (Op::isGt(y, ymax)) {
+ xsmallest = x;
+ ymax = y;
+ }
+ }
+ return xsmallest;
+ }
+
+ SmallestOfMaximum* SmallestOfMaximum::clone() const {
+ return new SmallestOfMaximum(*this);
+ }
+
+ Defuzzifier* SmallestOfMaximum::constructor() {
+ return new SmallestOfMaximum;
+ }
+
+}
+
diff --git a/fuzzylite/src/defuzzifier/WeightedAverage.cpp b/fuzzylite/src/defuzzifier/WeightedAverage.cpp
new file mode 100644
index 0000000..105c9d4
--- /dev/null
+++ b/fuzzylite/src/defuzzifier/WeightedAverage.cpp
@@ -0,0 +1,123 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/defuzzifier/WeightedAverage.h"
+
+#include "fl/term/Accumulated.h"
+#include "fl/term/Activated.h"
+#include "fl/norm/Norm.h"
+#include "fl/norm/SNorm.h"
+#include "fl/norm/TNorm.h"
+
+#include <map>
+
+namespace fl {
+
+ WeightedAverage::WeightedAverage(Type type) : WeightedDefuzzifier(type) {
+ }
+
+ WeightedAverage::WeightedAverage(const std::string& type) : WeightedDefuzzifier(type) {
+ }
+
+ WeightedAverage::~WeightedAverage() {
+ }
+
+ std::string WeightedAverage::className() const {
+ return "WeightedAverage";
+ }
+
+ scalar WeightedAverage::defuzzify(const Term* term,
+ scalar minimum, scalar maximum) const {
+ const Accumulated* fuzzyOutput = dynamic_cast<const Accumulated*> (term);
+ if (not fuzzyOutput) {
+ std::ostringstream ss;
+ ss << "[defuzzification error]"
+ << "expected an Accumulated term instead of"
+ << "<" << term->toString() << ">";
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+
+ minimum = fuzzyOutput->getMinimum();
+ maximum = fuzzyOutput->getMaximum();
+
+ scalar sum = 0.0;
+ scalar weights = 0.0;
+
+ if (not fuzzyOutput->getAccumulation()) {
+ Type type = _type;
+ for (int i = 0; i < fuzzyOutput->numberOfTerms(); ++i) {
+ Activated* activated = fuzzyOutput->getTerm(i);
+ scalar w = activated->getDegree();
+
+ if (type == Automatic) type = inferType(activated->getTerm());
+
+ scalar z = (type == TakagiSugeno)
+ //? activated.getTerm()->membership(fl::nan) Would ensure no Tsukamoto applies, but Inverse Tsukamoto with Functions would not work.
+ ? activated->getTerm()->membership(w) //Provides Takagi-Sugeno and Inverse Tsukamoto of Functions
+ : tsukamoto(activated->getTerm(), w, minimum, maximum);
+
+ sum += w * z;
+ weights += w;
+ }
+ } else {
+ typedef std::map<const Term*, std::vector<Activated*> > TermGroup;
+ TermGroup groups;
+ for (int i = 0; i < fuzzyOutput->numberOfTerms(); ++i) {
+ Activated* value = fuzzyOutput->getTerm(i);
+ const Term* key = value->getTerm();
+ groups[key].push_back(value);
+ }
+ TermGroup::const_iterator it = groups.begin();
+ Type type = _type;
+ while (it != groups.end()) {
+ const Term* activatedTerm = it->first;
+ scalar accumulatedDegree = 0.0;
+ for (std::size_t i = 0; i < it->second.size(); ++i)
+ accumulatedDegree = fuzzyOutput->getAccumulation()->compute(
+ accumulatedDegree, it->second.at(i)->getDegree());
+
+ if (type == Automatic) type = inferType(activatedTerm);
+
+ scalar z = (type == TakagiSugeno)
+ //? activated.getTerm()->membership(fl::nan) Would ensure no Tsukamoto applies, but Inverse Tsukamoto with Functions would not work.
+ ? activatedTerm->membership(accumulatedDegree) //Provides Takagi-Sugeno and Inverse Tsukamoto of Functions
+ : tsukamoto(activatedTerm, accumulatedDegree, minimum, maximum);
+
+ sum += accumulatedDegree * z;
+ weights += accumulatedDegree;
+
+ ++it;
+ }
+ }
+ return sum / weights;
+ }
+
+ WeightedAverage* WeightedAverage::clone() const {
+ return new WeightedAverage(*this);
+ }
+
+ Defuzzifier* WeightedAverage::constructor() {
+ return new WeightedAverage;
+ }
+}
diff --git a/fuzzylite/src/defuzzifier/WeightedDefuzzifier.cpp b/fuzzylite/src/defuzzifier/WeightedDefuzzifier.cpp
new file mode 100644
index 0000000..760a5dc
--- /dev/null
+++ b/fuzzylite/src/defuzzifier/WeightedDefuzzifier.cpp
@@ -0,0 +1,178 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/defuzzifier/WeightedDefuzzifier.h"
+
+#include "fl/term/Activated.h"
+#include "fl/term/Concave.h"
+#include "fl/term/Constant.h"
+#include "fl/term/Function.h"
+#include "fl/term/Linear.h"
+#include "fl/term/Ramp.h"
+#include "fl/term/Sigmoid.h"
+#include "fl/term/SShape.h"
+#include "fl/term/ZShape.h"
+
+namespace fl {
+
+ WeightedDefuzzifier::WeightedDefuzzifier(Type type) : _type(type) {
+
+ }
+
+ WeightedDefuzzifier::WeightedDefuzzifier(const std::string& type) {
+ if (type == "Automatic") _type = Automatic;
+ else if (type == "TakagiSugeno") _type = TakagiSugeno;
+ else if (type == "Tsukamoto") _type = Tsukamoto;
+ else {
+ _type = Automatic;
+ FL_LOG("[warning] incorrect type <" + type + "> of WeightedDefuzzifier"
+ + " has been defaulted to <Automatic>");
+ }
+ }
+
+ WeightedDefuzzifier::~WeightedDefuzzifier() {
+
+ }
+
+ std::string WeightedDefuzzifier::typeName(Type type) {
+ switch (type) {
+ case Automatic: return "Automatic";
+ case TakagiSugeno: return "TakagiSugeno";
+ case Tsukamoto: return "Tsukamoto";
+ default: return "";
+ }
+ }
+
+ void WeightedDefuzzifier::setType(Type type) {
+ this->_type = type;
+ }
+
+ WeightedDefuzzifier::Type WeightedDefuzzifier::getType() const {
+ return this->_type;
+ }
+
+ std::string WeightedDefuzzifier::getTypeName() const {
+ return typeName(this->_type);
+ }
+
+ WeightedDefuzzifier::Type WeightedDefuzzifier::inferType(const Term* term) const {
+ if (dynamic_cast<const Constant*> (term)
+ or dynamic_cast<const Linear*> (term)
+ or dynamic_cast<const Function*> (term)) {
+ return TakagiSugeno;
+ }
+ return Tsukamoto;
+ }
+
+ bool WeightedDefuzzifier::isMonotonic(const Term* term) const {
+ return (dynamic_cast<const Concave*> (term)) or
+ (dynamic_cast<const Ramp*> (term)) or
+ (dynamic_cast<const Sigmoid*> (term)) or
+ (dynamic_cast<const SShape*> (term)) or
+ (dynamic_cast<const ZShape*> (term));
+ }
+
+ /**
+ * Instead of computing y=f(x), the goal of Tsukamoto is to find x=f(w),
+ * where f is monotonic.
+ */
+ scalar WeightedDefuzzifier::tsukamoto(const Term* monotonic, scalar activationDegree,
+ scalar minimum, scalar maximum) const {
+ scalar w = activationDegree;
+ scalar z = fl::nan; //result;
+ bool isTsukamoto = true;
+ if (const Ramp* ramp = dynamic_cast<const Ramp*> (monotonic)) {
+ z = Op::scale(w, 0, 1, ramp->getStart(), ramp->getEnd());
+
+ } else if (const Sigmoid* sigmoid = dynamic_cast<const Sigmoid*> (monotonic)) {
+ if (Op::isEq(w, 1.0)) {
+ if (Op::isGE(sigmoid->getSlope(), 0.0)) {
+ z = maximum;
+ } else {
+ z = minimum;
+ }
+
+ } else if (Op::isEq(w, 0.0)) {
+ if (Op::isGE(sigmoid->getSlope(), 0.0)) {
+ z = minimum;
+ } else {
+ z = maximum;
+ }
+ } else {
+ scalar a = sigmoid->getSlope();
+ scalar b = sigmoid->getInflection();
+ z = b + (std::log(1.0 / w - 1.0) / -a);
+ }
+
+ } else if (const SShape* sshape = dynamic_cast<const SShape*> (monotonic)) {
+ scalar difference = sshape->getEnd() - sshape->getStart();
+ scalar a = sshape->getStart() + std::sqrt(w * difference * difference / 2.0);
+ scalar b = sshape->getEnd() + std::sqrt(difference * difference * (w - 1.0) / -2.0);
+ if (std::fabs(w - monotonic->membership(a)) <
+ std::fabs(w - monotonic->membership(b))) {
+ z = a;
+ } else {
+ z = b;
+ }
+
+ } else if (const ZShape* zshape = dynamic_cast<const ZShape*> (monotonic)) {
+ scalar difference = zshape->getEnd() - zshape->getStart();
+ scalar a = zshape->getStart() + std::sqrt(difference * difference * (w - 1.0) / -2.0);
+ scalar b = zshape->getEnd() + std::sqrt(w * difference * difference / 2.0);
+ if (std::fabs(w - monotonic->membership(a)) <
+ std::fabs(w - monotonic->membership(b))) {
+ z = a;
+ } else {
+ z = b;
+ }
+
+ } else if (const Concave* concave = dynamic_cast<const Concave*> (monotonic)) {
+ scalar i = concave->getInflection();
+ scalar e = concave->getEnd();
+ z = (i - e) / concave->membership(w) + 2 * e - i;
+ } else {
+ isTsukamoto = false;
+ }
+
+ if (isTsukamoto) {
+ //Compare difference between estimated and true value
+ scalar fz = monotonic->membership(z);
+ if (not Op::isEq(w, fz, 1e-2)) {
+ FL_DBG("[tsukamoto warning] difference <" << Op::str(std::abs(w - fz)) << "> "
+ "might suggest an inaccurate computation of z because it is "
+ "expected w=f(z) in " << monotonic->className() <<
+ " term <" << monotonic->getName() << ">, but "
+ "w=" << w << " "
+ "f(z)=" << fz << " and "
+ "z=" << Op::str(z));
+ }
+ } else {
+ // else fallback to the regular Takagi-Sugeno or inverse Tsukamoto (according to term)
+ z = monotonic->membership(w);
+ }
+ return z;
+ }
+
+
+}
diff --git a/fuzzylite/src/defuzzifier/WeightedSum.cpp b/fuzzylite/src/defuzzifier/WeightedSum.cpp
new file mode 100644
index 0000000..fb3e2e3
--- /dev/null
+++ b/fuzzylite/src/defuzzifier/WeightedSum.cpp
@@ -0,0 +1,121 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/defuzzifier/WeightedSum.h"
+
+#include "fl/term/Accumulated.h"
+#include "fl/term/Activated.h"
+#include "fl/norm/SNorm.h"
+#include "fl/norm/TNorm.h"
+
+#include <map>
+namespace fl {
+
+ WeightedSum::WeightedSum(Type type) : WeightedDefuzzifier(type) {
+ }
+
+ WeightedSum::WeightedSum(const std::string& type) : WeightedDefuzzifier(type) {
+
+ }
+
+ WeightedSum::~WeightedSum() {
+ }
+
+ std::string WeightedSum::className() const {
+ return "WeightedSum";
+ }
+
+ scalar WeightedSum::defuzzify(const Term* term,
+ scalar minimum, scalar maximum) const {
+ const Accumulated* fuzzyOutput = dynamic_cast<const Accumulated*> (term);
+ if (not fuzzyOutput) {
+ std::ostringstream ss;
+ ss << "[defuzzification error]"
+ << "expected an Accumulated term instead of"
+ << "<" << term->toString() << ">";
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+
+ minimum = fuzzyOutput->getMinimum();
+ maximum = fuzzyOutput->getMaximum();
+
+
+ scalar sum = 0.0;
+
+ if (not fuzzyOutput->getAccumulation()) {
+ Type type = _type;
+ for (int i = 0; i < fuzzyOutput->numberOfTerms(); ++i) {
+ Activated* activated = fuzzyOutput->getTerm(i);
+ scalar w = activated->getDegree();
+
+ if (type == Automatic) type = inferType(activated->getTerm());
+
+ scalar z = (type == TakagiSugeno)
+ //? activated.getTerm()->membership(fl::nan) Would ensure no Tsukamoto applies, but Inverse Tsukamoto with Functions would not work.
+ ? activated->getTerm()->membership(w) //Provides Takagi-Sugeno and Inverse Tsukamoto of Functions
+ : tsukamoto(activated->getTerm(), w, minimum, maximum);
+
+ sum += w * z;
+ }
+ } else {
+ typedef std::map<const Term*, std::vector<Activated*> > TermGroup;
+ TermGroup groups;
+ for (int i = 0; i < fuzzyOutput->numberOfTerms(); ++i) {
+ Activated* value = fuzzyOutput->getTerm(i);
+ const Term* key = value->getTerm();
+ groups[key].push_back(value);
+ }
+ TermGroup::const_iterator it = groups.begin();
+ Type type = _type;
+ while (it != groups.end()) {
+ const Term* activatedTerm = it->first;
+ scalar accumulatedDegree = 0.0;
+ for (std::size_t i = 0; i < it->second.size(); ++i)
+ accumulatedDegree = fuzzyOutput->getAccumulation()->compute(
+ accumulatedDegree, it->second.at(i)->getDegree());
+
+ if (type == Automatic) type = inferType(activatedTerm);
+
+ scalar z = (type == TakagiSugeno)
+ //? activated.getTerm()->membership(fl::nan) Would ensure no Tsukamoto applies, but Inverse Tsukamoto with Functions would not work.
+ ? activatedTerm->membership(accumulatedDegree) //Provides Takagi-Sugeno and Inverse Tsukamoto of Functions
+ : tsukamoto(activatedTerm, accumulatedDegree, minimum, maximum);
+
+ sum += accumulatedDegree * z;
+
+ ++it;
+ }
+ }
+ return sum;
+ }
+
+ WeightedSum* WeightedSum::clone() const {
+ return new WeightedSum(*this);
+ }
+
+ Defuzzifier* WeightedSum::constructor() {
+ return new WeightedSum;
+ }
+
+}
diff --git a/fuzzylite/src/factory/CloningFactory.cpp b/fuzzylite/src/factory/CloningFactory.cpp
new file mode 100644
index 0000000..b187171
--- /dev/null
+++ b/fuzzylite/src/factory/CloningFactory.cpp
@@ -0,0 +1,135 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/factory/CloningFactory.h"
+
+#include "fl/Exception.h"
+#include "fl/term/Function.h"
+
+namespace fl {
+
+ template<typename T>
+ CloningFactory<T>::CloningFactory(const std::string& name) : _name(name) {
+
+ }
+
+ template<typename T>
+ CloningFactory<T>::CloningFactory(const CloningFactory& other) {
+ typename std::map<std::string, T>::const_iterator it = other._objects.begin();
+ while (it != other._objects.end()) {
+ T clone = fl::null;
+ if (it->second) clone = it->second->clone();
+ this->_objects[it->first] = clone;
+ ++it;
+ }
+ }
+
+ template<typename T>
+ CloningFactory<T>& CloningFactory<T>::operator=(const CloningFactory& other) {
+ if (this != &other) {
+ typename std::map<std::string, T>::const_iterator it = this->_objects.begin();
+ while (it != this->_objects.end()) {
+ if (it->second) delete it->second;
+ ++it;
+ }
+ this->_objects.clear();
+
+ it = other._objects.begin();
+ while (it != other._objects.end()) {
+ T clone = fl::null;
+ if (it->second) clone = it->second->clone();
+ this->_objects[it->first] = clone;
+ ++it;
+ }
+ }
+ return *this;
+ }
+
+ template<typename T>
+ CloningFactory<T>::~CloningFactory() {
+ typename std::map<std::string, T>::const_iterator it = this->_objects.begin();
+ while (it != this->_objects.end()) {
+ if (it->second) delete it->second;
+ ++it;
+ }
+ }
+
+ template<typename T>
+ std::string CloningFactory<T>::name() const {
+ return this->_name;
+ }
+
+ template<typename T>
+ void CloningFactory<T>::registerObject(const std::string& key, T object) {
+ this->_objects[key] = object;
+ }
+
+ template<typename T>
+ void CloningFactory<T>::deregisterObject(const std::string& key) {
+ typename std::map<std::string, T>::iterator it = this->_objects.find(key);
+ if (it != this->_objects.end()) {
+ this->_objects.erase(it);
+ delete it->second;
+ }
+ }
+
+ template<typename T>
+ bool CloningFactory<T>::hasObject(const std::string& key) const {
+ typename std::map<std::string, T>::const_iterator it = this->_objects.find(key);
+ return (it != this->_objects.end());
+ }
+
+ template<typename T>
+ T CloningFactory<T>::getObject(const std::string& key) const {
+ typename std::map<std::string, T>::const_iterator it = this->_objects.find(key);
+ if (it != this->_objects.end()) {
+ if (it->second) return it->second;
+ }
+ return fl::null;
+ }
+
+ template<typename T>
+ T CloningFactory<T>::cloneObject(const std::string& key) const {
+ typename std::map<std::string, T>::const_iterator it = this->_objects.find(key);
+ if (it != this->_objects.end()) {
+ if (it->second) return it->second->clone();
+ return fl::null;
+ }
+ throw fl::Exception("[cloning error] " + _name + " object by name <" + key + "> not registered", FL_AT);
+ }
+
+ template<typename T>
+ std::vector<std::string> CloningFactory<T>::available() const {
+ std::vector<std::string> result;
+ typename std::map<std::string, T>::const_iterator it = this->_objects.begin();
+ while (it != this->_objects.end()) {
+ result.push_back(it->first);
+ }
+ return result;
+ }
+
+ template class fl::CloningFactory<fl::Function::Element*>;
+}
+
+
diff --git a/fuzzylite/src/factory/ConstructionFactory.cpp b/fuzzylite/src/factory/ConstructionFactory.cpp
new file mode 100644
index 0000000..b316e52
--- /dev/null
+++ b/fuzzylite/src/factory/ConstructionFactory.cpp
@@ -0,0 +1,114 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/factory/ConstructionFactory.h"
+
+#include "fl/Exception.h"
+#include "fl/defuzzifier/Defuzzifier.h"
+#include "fl/hedge/Hedge.h"
+#include "fl/norm/SNorm.h"
+#include "fl/norm/TNorm.h"
+#include "fl/term/Function.h"
+#include "fl/term/Term.h"
+
+
+
+namespace fl {
+
+ template <typename T>
+ ConstructionFactory<T>::ConstructionFactory(const std::string& name) : _name(name) {
+
+ }
+
+ template <typename T>
+ ConstructionFactory<T>::~ConstructionFactory() {
+ }
+
+ template<typename T>
+ std::string ConstructionFactory<T>::name() const {
+ return this->_name;
+ }
+
+ template <typename T>
+ void ConstructionFactory<T>::registerConstructor(const std::string& key, Constructor constructor) {
+ this->_constructors[key] = constructor;
+ }
+
+ template <typename T>
+ void ConstructionFactory<T>::deregisterConstructor(const std::string& key) {
+ typename std::map<std::string, Constructor>::iterator it = this->_constructors.find(key);
+ if (it != this->_constructors.end()) {
+ this->_constructors.erase(it);
+ }
+ }
+
+ template <typename T>
+ bool ConstructionFactory<T>::hasConstructor(const std::string& key) const {
+ typename std::map<std::string, Constructor>::const_iterator it = this->_constructors.find(key);
+ return (it != this->_constructors.end());
+ }
+
+ template <typename T>
+ typename ConstructionFactory<T>::Constructor ConstructionFactory<T>::getConstructor(const std::string& key) const {
+ typename std::map<std::string, Constructor>::const_iterator it = this->_constructors.find(key);
+ if (it != this->_constructors.end()) {
+ return it->second;
+ }
+ return fl::null;
+ }
+
+ template <typename T>
+ T ConstructionFactory<T>::constructObject(const std::string& key) const {
+ typename std::map<std::string, Constructor>::const_iterator it = this->_constructors.find(key);
+ if (it != this->_constructors.end()) {
+ if (it->second) {
+ return it->second();
+ }
+ return fl::null;
+ }
+ std::ostringstream ss;
+ ss << "[factory error] constructor of " + _name + " <" << key << "> not registered";
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+
+ template <typename T>
+ std::vector<std::string> ConstructionFactory<T>::available() const {
+ std::vector<std::string> result;
+ typename std::map<std::string, Constructor>::const_iterator it = this->_constructors.begin();
+ while (it != this->_constructors.end()) {
+ result.push_back(it->first);
+ ++it;
+ }
+ return result;
+ }
+
+ template class ConstructionFactory<Defuzzifier*>;
+ template class ConstructionFactory<Hedge*>;
+ template class ConstructionFactory<SNorm*>;
+ template class ConstructionFactory<TNorm*>;
+ template class ConstructionFactory<Term*>;
+}
+
+
+
diff --git a/fuzzylite/src/factory/DefuzzifierFactory.cpp b/fuzzylite/src/factory/DefuzzifierFactory.cpp
new file mode 100644
index 0000000..8d89c2d
--- /dev/null
+++ b/fuzzylite/src/factory/DefuzzifierFactory.cpp
@@ -0,0 +1,78 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/factory/DefuzzifierFactory.h"
+
+#include "fl/defuzzifier/Bisector.h"
+#include "fl/defuzzifier/Centroid.h"
+#include "fl/defuzzifier/SmallestOfMaximum.h"
+#include "fl/defuzzifier/LargestOfMaximum.h"
+#include "fl/defuzzifier/MeanOfMaximum.h"
+#include "fl/defuzzifier/WeightedAverage.h"
+#include "fl/defuzzifier/WeightedSum.h"
+
+namespace fl {
+
+ DefuzzifierFactory::DefuzzifierFactory() : ConstructionFactory<Defuzzifier*>("Defuzzifier") {
+ registerConstructor("", fl::null);
+ registerConstructor(Bisector().className(), &(Bisector::constructor));
+ registerConstructor(Centroid().className(), &(Centroid::constructor));
+ registerConstructor(LargestOfMaximum().className(), &(LargestOfMaximum::constructor));
+ registerConstructor(MeanOfMaximum().className(), &(MeanOfMaximum::constructor));
+ registerConstructor(SmallestOfMaximum().className(), &(SmallestOfMaximum::constructor));
+ registerConstructor(WeightedAverage().className(), &(WeightedAverage::constructor));
+ registerConstructor(WeightedSum().className(), &(WeightedSum::constructor));
+ }
+
+ DefuzzifierFactory::~DefuzzifierFactory() {
+
+ }
+
+ Defuzzifier* DefuzzifierFactory::constructDefuzzifier(const std::string& key,
+ int resolution, WeightedDefuzzifier::Type type) const {
+ Defuzzifier* result = constructObject(key);
+ if (IntegralDefuzzifier * integralDefuzzifier = dynamic_cast<IntegralDefuzzifier*> (result)) {
+ integralDefuzzifier->setResolution(resolution);
+ } else if (WeightedDefuzzifier * weightedDefuzzifier = dynamic_cast<WeightedDefuzzifier*> (result)) {
+ weightedDefuzzifier->setType(type);
+ }
+ return result;
+ }
+
+ Defuzzifier* DefuzzifierFactory::constructDefuzzifier(const std::string& key, int resolution) const {
+ Defuzzifier* result = constructObject(key);
+ if (IntegralDefuzzifier * integralDefuzzifier = dynamic_cast<IntegralDefuzzifier*> (result)) {
+ integralDefuzzifier->setResolution(resolution);
+ }
+ return result;
+ }
+
+ Defuzzifier* DefuzzifierFactory::constructDefuzzifier(const std::string& key, WeightedDefuzzifier::Type type) {
+ Defuzzifier* result = constructObject(key);
+ if (WeightedDefuzzifier * weightedDefuzzifier = dynamic_cast<WeightedDefuzzifier*> (result)) {
+ weightedDefuzzifier->setType(type);
+ }
+ return result;
+ }
+}
diff --git a/fuzzylite/src/factory/FactoryManager.cpp b/fuzzylite/src/factory/FactoryManager.cpp
new file mode 100644
index 0000000..c2374dc
--- /dev/null
+++ b/fuzzylite/src/factory/FactoryManager.cpp
@@ -0,0 +1,127 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/factory/FactoryManager.h"
+
+#include "fl/factory/DefuzzifierFactory.h"
+#include "fl/factory/FunctionFactory.h"
+#include "fl/factory/HedgeFactory.h"
+#include "fl/factory/SNormFactory.h"
+#include "fl/factory/TermFactory.h"
+#include "fl/factory/TNormFactory.h"
+
+namespace fl {
+
+ FactoryManager FactoryManager::_instance;
+
+ FactoryManager* FactoryManager::instance() {
+ return &_instance;
+ }
+
+ FactoryManager::FactoryManager() :
+ _tnorm(new TNormFactory), _snorm(new SNormFactory), _defuzzifier(new DefuzzifierFactory),
+ _term(new TermFactory), _hedge(new HedgeFactory), _function(new FunctionFactory) {
+ }
+
+ FactoryManager::FactoryManager(TNormFactory* tnorm, SNormFactory* snorm,
+ DefuzzifierFactory* defuzzifier, TermFactory* term,
+ HedgeFactory* hedge, FunctionFactory* function) :
+ _tnorm(tnorm), _snorm(snorm), _defuzzifier(defuzzifier), _term(term), _hedge(hedge),
+ _function(function) {
+ }
+
+ FactoryManager::FactoryManager(const FactoryManager& other)
+ : _tnorm(fl::null), _snorm(fl::null), _defuzzifier(fl::null), _term(fl::null), _hedge(fl::null), _function(fl::null) {
+ if (other._tnorm.get()) this->_tnorm.reset(new TNormFactory(*other._tnorm.get()));
+ if (other._snorm.get()) this->_snorm.reset(new SNormFactory(*other._snorm.get()));
+ if (other._defuzzifier.get()) this->_defuzzifier.reset(new DefuzzifierFactory(*other._defuzzifier.get()));
+ if (other._term.get()) this->_term.reset(new TermFactory(*other._term.get()));
+ if (other._hedge.get()) this->_hedge.reset(new HedgeFactory(*other._hedge.get()));
+ if (other._function.get()) this->_function.reset(new FunctionFactory(*other._function.get()));
+ }
+
+ FactoryManager& FactoryManager::operator=(const FactoryManager& other) {
+ if (this != &other) {
+ if (other._tnorm.get()) this->_tnorm.reset(new TNormFactory(*other._tnorm.get()));
+ if (other._snorm.get()) this->_snorm.reset(new SNormFactory(*other._snorm.get()));
+ if (other._defuzzifier.get()) this->_defuzzifier.reset(new DefuzzifierFactory(*other._defuzzifier.get()));
+ if (other._term.get()) this->_term.reset(new TermFactory(*other._term.get()));
+ if (other._hedge.get()) this->_hedge.reset(new HedgeFactory(*other._hedge.get()));
+ if (other._function.get()) this->_function.reset(new FunctionFactory(*other._function.get()));
+ }
+ return *this;
+ }
+
+ FactoryManager::~FactoryManager() {
+ }
+
+ void FactoryManager::setTnorm(TNormFactory* tnorm) {
+ this->_tnorm.reset(tnorm);
+ }
+
+ TNormFactory* FactoryManager::tnorm() const {
+ return this->_tnorm.get();
+ }
+
+ void FactoryManager::setSnorm(SNormFactory* snorm) {
+ this->_snorm.reset(snorm);
+ }
+
+ SNormFactory* FactoryManager::snorm() const {
+ return this->_snorm.get();
+ }
+
+ void FactoryManager::setDefuzzifier(DefuzzifierFactory* defuzzifier) {
+ this->_defuzzifier.reset(defuzzifier);
+ }
+
+ DefuzzifierFactory* FactoryManager::defuzzifier() const {
+ return this->_defuzzifier.get();
+ }
+
+ void FactoryManager::setTerm(TermFactory* term) {
+ this->_term.reset(term);
+ }
+
+ TermFactory* FactoryManager::term() const {
+ return this->_term.get();
+ }
+
+ void FactoryManager::setHedge(HedgeFactory* hedge) {
+ this->_hedge.reset(hedge);
+ }
+
+ HedgeFactory* FactoryManager::hedge() const {
+ return this->_hedge.get();
+ }
+
+ void FactoryManager::setFunction(FunctionFactory* function) {
+ this->_function.reset(function);
+ }
+
+ FunctionFactory* FactoryManager::function() const {
+ return this->_function.get();
+ }
+
+}
diff --git a/fuzzylite/src/factory/FunctionFactory.cpp b/fuzzylite/src/factory/FunctionFactory.cpp
new file mode 100644
index 0000000..3c0718d
--- /dev/null
+++ b/fuzzylite/src/factory/FunctionFactory.cpp
@@ -0,0 +1,172 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/factory/FunctionFactory.h"
+
+#include "fl/rule/Rule.h"
+
+namespace fl {
+
+ FunctionFactory::FunctionFactory() : CloningFactory<Function::Element*>("Function::Element") {
+ registerOperators();
+ registerFunctions();
+ }
+
+ FunctionFactory::~FunctionFactory() {
+
+ }
+
+ void FunctionFactory::registerOperators() {
+ //OPERATORS:
+ int p = 100;
+ //First order: not, negate:
+ registerObject("!", new Function::Element("!", "Logical NOT",
+ Function::Element::OPERATOR, &(fl::Op::logicalNot), p, 1)); //logical not
+ registerObject("~", new Function::Element("~", "Negation",
+ Function::Element::OPERATOR, &(fl::Op::negate), p, 1)); // ~ negates a number
+
+ p -= 10;
+ //Second order: power
+ registerObject("^", new Function::Element("^", "Power",
+ Function::Element::OPERATOR, &(std::pow), p, 1));
+
+ p -= 10;
+ //Third order: multiplication, division, modulo
+ registerObject("*", new Function::Element("*", "Multiplication",
+ Function::Element::OPERATOR, &(fl::Op::multiply), p));
+ registerObject("/", new Function::Element("/", "Division",
+ Function::Element::OPERATOR, &(fl::Op::divide), p));
+ registerObject("%", new Function::Element("%", "Modulo",
+ Function::Element::OPERATOR, &(fl::Op::modulo), p));
+
+ p -= 10;
+ //Fourth order: addition, subtraction
+ registerObject("+", new Function::Element("+", "Addition",
+ Function::Element::OPERATOR, &(fl::Op::add), p));
+ registerObject("-", new Function::Element("-", "Subtraction",
+ Function::Element::OPERATOR, &(fl::Op::subtract), p));
+
+ //Fifth order: logical and, logical or
+ p -= 10; //Logical AND
+ registerObject(fl::Rule::andKeyword(), new Function::Element(fl::Rule::andKeyword(), "Logical AND",
+ Function::Element::OPERATOR, &(fl::Op::logicalAnd), p));
+ p -= 10; //Logical OR
+ registerObject(fl::Rule::orKeyword(), new Function::Element(fl::Rule::orKeyword(), "Logical OR",
+ Function::Element::OPERATOR, &(fl::Op::logicalOr), p));
+ }
+
+ void FunctionFactory::registerFunctions() {
+ //FUNCTIONS
+ registerObject("gt", new Function::Element("gt", "Greater than (>)",
+ Function::Element::FUNCTION, &(fl::Op::gt)));
+ registerObject("ge", new Function::Element("ge", "Greater than or equal to (>=)",
+ Function::Element::FUNCTION, &(fl::Op::ge)));
+ registerObject("eq", new Function::Element("eq", "Equal to (==)",
+ Function::Element::FUNCTION, &(fl::Op::eq)));
+ registerObject("neq", new Function::Element("neq", "Not equal to (!=)",
+ Function::Element::FUNCTION, &(fl::Op::neq)));
+ registerObject("le", new Function::Element("le", "Less than or equal to (<=)",
+ Function::Element::FUNCTION, &(fl::Op::le)));
+ registerObject("lt", new Function::Element("lt", "Less than (<)",
+ Function::Element::FUNCTION, &(fl::Op::lt)));
+
+ registerObject("acos", new Function::Element("acos", "Inverse cosine",
+ Function::Element::FUNCTION, &(std::acos)));
+ registerObject("asin", new Function::Element("asin", "Inverse sine",
+ Function::Element::FUNCTION, &(std::asin)));
+ registerObject("atan", new Function::Element("atan", "Inverse tangent",
+ Function::Element::FUNCTION, &(std::atan)));
+
+ registerObject("ceil", new Function::Element("ceil", "Ceiling",
+ Function::Element::FUNCTION, &(std::ceil)));
+ registerObject("cos", new Function::Element("cos", "Cosine",
+ Function::Element::FUNCTION, &(std::cos)));
+ registerObject("cosh", new Function::Element("cosh", "Hyperbolic cosine",
+ Function::Element::FUNCTION, &(std::cosh)));
+ registerObject("exp", new Function::Element("exp", "Exponential",
+ Function::Element::FUNCTION, &(std::exp)));
+ registerObject("fabs", new Function::Element("fabs", "Absolute",
+ Function::Element::FUNCTION, &(std::fabs)));
+ registerObject("floor", new Function::Element("floor", "Floor",
+ Function::Element::FUNCTION, &(std::floor)));
+ registerObject("log", new Function::Element("log", "Natural logarithm",
+ Function::Element::FUNCTION, &(std::log)));
+ registerObject("log10", new Function::Element("log10", "Common logarithm",
+ Function::Element::FUNCTION, &(std::log10)));
+ registerObject("round", new Function::Element("round", "Round",
+ Function::Element::FUNCTION, &(fl::Op::round)));
+ registerObject("sin", new Function::Element("sin", "Sine",
+ Function::Element::FUNCTION, &(std::sin)));
+ registerObject("sinh", new Function::Element("sinh", "Hyperbolic sine",
+ Function::Element::FUNCTION, &(std::sinh)));
+ registerObject("sqrt", new Function::Element("sqrt", "Square root",
+ Function::Element::FUNCTION, &(std::sqrt)));
+ registerObject("tan", new Function::Element("tan", "Tangent",
+ Function::Element::FUNCTION, &(std::tan)));
+ registerObject("tanh", new Function::Element("tanh", "Hyperbolic tangent",
+ Function::Element::FUNCTION, &(std::tanh)));
+
+#if defined(FL_UNIX) && !defined(FL_USE_FLOAT)
+ //found in Unix when using double precision. not found in Windows.
+ registerObject("log1p", new Function::Element("log1p", "Natural logarithm plus one",
+ Function::Element::FUNCTION, &(log1p)));
+ registerObject("acosh", new Function::Element("acosh", "Inverse hyperbolic cosine",
+ Function::Element::FUNCTION, &(acosh)));
+ registerObject("asinh", new Function::Element("asinh", "Inverse hyperbolic sine",
+ Function::Element::FUNCTION, &(asinh)));
+ registerObject("atanh", new Function::Element("atanh", "Inverse hyperbolic tangent",
+ Function::Element::FUNCTION, &(atanh)));
+#endif
+
+ registerObject("pow", new Function::Element("pow", "Power",
+ Function::Element::FUNCTION, &(std::pow)));
+ registerObject("atan2", new Function::Element("atan2", "Inverse tangent (y,x)",
+ Function::Element::FUNCTION, &(std::atan2)));
+ registerObject("fmod", new Function::Element("fmod", "Floating-point remainder",
+ Function::Element::FUNCTION, &(std::fmod)));
+ }
+
+ std::vector<std::string> FunctionFactory::availableOperators() const {
+ std::vector<std::string> result;
+ std::map<std::string, Function::Element*>::const_iterator it = this->_objects.begin();
+ while (it != this->_objects.end()) {
+ if (it->second and it->second->type == Function::Element::OPERATOR)
+ result.push_back(it->first);
+ ++it;
+ }
+ return result;
+ }
+
+ std::vector<std::string> FunctionFactory::availableFunctions() const {
+ std::vector<std::string> result;
+ std::map<std::string, Function::Element*>::const_iterator it = this->_objects.begin();
+ while (it != this->_objects.end()) {
+ if (it->second and it->second->type == Function::Element::FUNCTION)
+ result.push_back(it->first);
+ ++it;
+ }
+ return result;
+ }
+
+}
diff --git a/fuzzylite/src/factory/HedgeFactory.cpp b/fuzzylite/src/factory/HedgeFactory.cpp
new file mode 100644
index 0000000..ea5f77a
--- /dev/null
+++ b/fuzzylite/src/factory/HedgeFactory.cpp
@@ -0,0 +1,51 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/factory/HedgeFactory.h"
+
+#include "fl/hedge/Any.h"
+#include "fl/hedge/Extremely.h"
+#include "fl/hedge/Not.h"
+#include "fl/hedge/Seldom.h"
+#include "fl/hedge/Somewhat.h"
+#include "fl/hedge/Very.h"
+
+
+namespace fl {
+
+ HedgeFactory::HedgeFactory() : ConstructionFactory<Hedge*>("Hedge") {
+ registerConstructor("", fl::null);
+ registerConstructor(Any().name(), &(Any::constructor));
+ registerConstructor(Extremely().name(), &(Extremely::constructor));
+ registerConstructor(Not().name(), &(Not::constructor));
+ registerConstructor(Seldom().name(), &(Seldom::constructor));
+ registerConstructor(Somewhat().name(), &(Somewhat::constructor));
+ registerConstructor(Very().name(), &(Very::constructor));
+ }
+
+ HedgeFactory::~HedgeFactory() {
+
+ }
+
+}
diff --git a/fuzzylite/src/factory/SNormFactory.cpp b/fuzzylite/src/factory/SNormFactory.cpp
new file mode 100644
index 0000000..6e42551
--- /dev/null
+++ b/fuzzylite/src/factory/SNormFactory.cpp
@@ -0,0 +1,55 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/factory/SNormFactory.h"
+
+#include "fl/norm/s/AlgebraicSum.h"
+#include "fl/norm/s/BoundedSum.h"
+#include "fl/norm/s/DrasticSum.h"
+#include "fl/norm/s/EinsteinSum.h"
+#include "fl/norm/s/HamacherSum.h"
+#include "fl/norm/s/Maximum.h"
+#include "fl/norm/s/NilpotentMaximum.h"
+#include "fl/norm/s/NormalizedSum.h"
+
+namespace fl {
+
+ SNormFactory::SNormFactory() : ConstructionFactory<SNorm*>("SNorm") {
+ registerConstructor("", fl::null);
+ registerConstructor(AlgebraicSum().className(), &(AlgebraicSum::constructor));
+ registerConstructor(BoundedSum().className(), &(BoundedSum::constructor));
+ registerConstructor(DrasticSum().className(), &(DrasticSum::constructor));
+ registerConstructor(EinsteinSum().className(), &(EinsteinSum::constructor));
+ registerConstructor(HamacherSum().className(), &(HamacherSum::constructor));
+ registerConstructor(Maximum().className(), &(Maximum::constructor));
+ registerConstructor(NilpotentMaximum().className(), &(NilpotentMaximum::constructor));
+ registerConstructor(NormalizedSum().className(), &(NormalizedSum::constructor));
+ }
+
+ SNormFactory::~SNormFactory() {
+
+ }
+
+
+}
diff --git a/fuzzylite/src/factory/TNormFactory.cpp b/fuzzylite/src/factory/TNormFactory.cpp
new file mode 100644
index 0000000..95628cc
--- /dev/null
+++ b/fuzzylite/src/factory/TNormFactory.cpp
@@ -0,0 +1,53 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/factory/TNormFactory.h"
+
+#include "fl/norm/t/AlgebraicProduct.h"
+#include "fl/norm/t/BoundedDifference.h"
+#include "fl/norm/t/DrasticProduct.h"
+#include "fl/norm/t/EinsteinProduct.h"
+#include "fl/norm/t/HamacherProduct.h"
+#include "fl/norm/t/Minimum.h"
+#include "fl/norm/t/NilpotentMinimum.h"
+
+namespace fl {
+
+ TNormFactory::TNormFactory() : ConstructionFactory<TNorm*>("TNorm") {
+ registerConstructor("", fl::null);
+ registerConstructor(AlgebraicProduct().className(), &(AlgebraicProduct::constructor));
+ registerConstructor(BoundedDifference().className(), &(BoundedDifference::constructor));
+ registerConstructor(DrasticProduct().className(), &(DrasticProduct::constructor));
+ registerConstructor(EinsteinProduct().className(), &(EinsteinProduct::constructor));
+ registerConstructor(HamacherProduct().className(), &(HamacherProduct::constructor));
+ registerConstructor(Minimum().className(), &(Minimum::constructor));
+ registerConstructor(NilpotentMinimum().className(), &(NilpotentMinimum::constructor));
+ }
+
+ TNormFactory::~TNormFactory() {
+
+ }
+
+
+}
diff --git a/fuzzylite/src/factory/TermFactory.cpp b/fuzzylite/src/factory/TermFactory.cpp
new file mode 100644
index 0000000..10f3c15
--- /dev/null
+++ b/fuzzylite/src/factory/TermFactory.cpp
@@ -0,0 +1,81 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/factory/TermFactory.h"
+
+#include "fl/Exception.h"
+#include "fl/term/Term.h"
+#include "fl/term/Bell.h"
+#include "fl/term/Concave.h"
+#include "fl/term/Constant.h"
+#include "fl/term/Cosine.h"
+#include "fl/term/Discrete.h"
+#include "fl/term/Function.h"
+#include "fl/term/Gaussian.h"
+#include "fl/term/GaussianProduct.h"
+#include "fl/term/Linear.h"
+#include "fl/term/PiShape.h"
+#include "fl/term/Ramp.h"
+#include "fl/term/Rectangle.h"
+#include "fl/term/SShape.h"
+#include "fl/term/Sigmoid.h"
+#include "fl/term/SigmoidDifference.h"
+#include "fl/term/SigmoidProduct.h"
+#include "fl/term/Spike.h"
+#include "fl/term/Trapezoid.h"
+#include "fl/term/Triangle.h"
+#include "fl/term/ZShape.h"
+
+namespace fl {
+
+ TermFactory::TermFactory() : ConstructionFactory<Term*>("Term") {
+ registerConstructor("", fl::null);
+ registerConstructor(Bell().className(), &(Bell::constructor));
+ registerConstructor(Concave().className(), &(Concave::constructor));
+ registerConstructor(Constant().className(), &(Constant::constructor));
+ registerConstructor(Cosine().className(), &(Cosine::constructor));
+ registerConstructor(Discrete().className(), &(Discrete::constructor));
+ registerConstructor(Function().className(), &(Function::constructor));
+ registerConstructor(Gaussian().className(), &(Gaussian::constructor));
+ registerConstructor(GaussianProduct().className(), &(GaussianProduct::constructor));
+ registerConstructor(Linear().className(), &(Linear::constructor));
+ registerConstructor(PiShape().className(), &(PiShape::constructor));
+ registerConstructor(Ramp().className(), &(Ramp::constructor));
+ registerConstructor(Rectangle().className(), &(Rectangle::constructor));
+ registerConstructor(SShape().className(), &(SShape::constructor));
+ registerConstructor(Sigmoid().className(), &(Sigmoid::constructor));
+ registerConstructor(SigmoidDifference().className(), &(SigmoidDifference::constructor));
+ registerConstructor(SigmoidProduct().className(), &(SigmoidProduct::constructor));
+ registerConstructor(Spike().className(), &(Spike::constructor));
+ registerConstructor(Trapezoid().className(), &(Trapezoid::constructor));
+ registerConstructor(Triangle().className(), &(Triangle::constructor));
+ registerConstructor(ZShape().className(), &(ZShape::constructor));
+ }
+
+ TermFactory::~TermFactory() {
+
+ }
+
+
+}
diff --git a/fuzzylite/src/fuzzylite.cpp b/fuzzylite/src/fuzzylite.cpp
new file mode 100644
index 0000000..06b635a
--- /dev/null
+++ b/fuzzylite/src/fuzzylite.cpp
@@ -0,0 +1,128 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/fuzzylite.h"
+
+namespace fl {
+
+ int fuzzylite::_decimals = 3;
+ scalar fuzzylite::_macheps = 1e-6;
+ bool fuzzylite::_debug = false;
+ bool fuzzylite::_logging = true;
+
+ std::string fuzzylite::name() {
+ return "fuzzylite";
+ }
+
+ std::string fuzzylite::fullname() {
+ return name() + "-" + longVersion();
+ }
+
+ std::string fuzzylite::version() {
+ return FL_VERSION;
+ }
+
+ std::string fuzzylite::longVersion() {
+ return FL_VERSION "b" FL_DATE;
+ }
+
+ std::string fuzzylite::license() {
+ return "GNU Lesser General Public License v3.0";
+ }
+
+ std::string fuzzylite::author() {
+ return "Juan Rada-Vilela, Ph.D.";
+ }
+
+ std::string fuzzylite::company() {
+ return "FuzzyLite Limited";
+ }
+
+ std::string fuzzylite::website() {
+ return "http://www.fuzzylite.com/";
+ }
+
+ std::string fuzzylite::date() {
+ return FL_DATE;
+ }
+
+ std::string fuzzylite::platform() {
+#ifdef FL_UNIX
+ return "Unix";
+#elif defined FL_WINDOWS
+ return "Windows";
+#else
+ return "?";
+#endif
+ }
+
+ std::string fuzzylite::floatingPoint() {
+ scalar someScalar = 0;
+ (void) someScalar;
+ std::string type;
+
+ std::ostringstream ss;
+#ifdef FL_USE_FLOAT
+ type = "float";
+#else
+ type = "double";
+#endif
+ ss << "fl::scalar is defined as \'" << type << "\' using " <<
+ sizeof (someScalar) << " bytes";
+ return ss.str();
+ }
+
+ void fuzzylite::setDebug(bool debug) {
+ _debug = debug;
+ }
+
+ bool fuzzylite::debug() {
+ return _debug;
+ }
+
+ void fuzzylite::setDecimals(int decimals) {
+ _decimals = decimals;
+ }
+
+ int fuzzylite::decimals() {
+ return _decimals;
+ }
+
+ void fuzzylite::setMachEps(scalar macheps) {
+ _macheps = macheps;
+ }
+
+ scalar fuzzylite::macheps() {
+ return _macheps;
+ }
+
+ void fuzzylite::setLogging(bool logging) {
+ _logging = logging;
+ }
+
+ bool fuzzylite::logging() {
+ return _logging;
+ }
+
+}
diff --git a/fuzzylite/src/hedge/Any.cpp b/fuzzylite/src/hedge/Any.cpp
new file mode 100644
index 0000000..72724f1
--- /dev/null
+++ b/fuzzylite/src/hedge/Any.cpp
@@ -0,0 +1,52 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/hedge/Any.h"
+
+namespace fl {
+
+ Any::Any() {
+ }
+
+ Any::~Any() {
+ }
+
+ std::string Any::name() const {
+ return "any";
+ }
+
+ scalar Any::hedge(scalar x) const {
+ (void) x;
+ return 1.0;
+ }
+
+ Any* Any::clone() const {
+ return new Any(*this);
+ }
+
+ Hedge* Any::constructor() {
+ return new Any;
+ }
+
+}
diff --git a/fuzzylite/src/hedge/Extremely.cpp b/fuzzylite/src/hedge/Extremely.cpp
new file mode 100644
index 0000000..eabbb60
--- /dev/null
+++ b/fuzzylite/src/hedge/Extremely.cpp
@@ -0,0 +1,50 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/hedge/Extremely.h"
+
+#include "fl/Operation.h"
+
+namespace fl {
+
+ std::string Extremely::name() const {
+ return "extremely";
+ }
+
+ scalar Extremely::hedge(scalar x) const {
+ return Op::isLE(x, 0.5)
+ ? 2.0 * x * x
+ : 1.0 - 2.0 * (1.0 - x) * (1.0 - x);
+ }
+
+ Extremely* Extremely::clone() const {
+ return new Extremely(*this);
+ }
+
+ Hedge* Extremely::constructor() {
+ return new Extremely;
+ }
+
+
+}
diff --git a/fuzzylite/src/hedge/Not.cpp b/fuzzylite/src/hedge/Not.cpp
new file mode 100644
index 0000000..531213f
--- /dev/null
+++ b/fuzzylite/src/hedge/Not.cpp
@@ -0,0 +1,46 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/hedge/Not.h"
+
+namespace fl {
+
+ std::string Not::name() const {
+ return "not";
+ }
+
+ scalar Not::hedge(scalar x) const {
+ return 1.0 - x;
+ }
+
+ Not* Not::clone() const {
+ return new Not(*this);
+ }
+
+ Hedge* Not::constructor() {
+ return new Not;
+ }
+
+
+}
diff --git a/fuzzylite/src/hedge/Seldom.cpp b/fuzzylite/src/hedge/Seldom.cpp
new file mode 100644
index 0000000..d87b48a
--- /dev/null
+++ b/fuzzylite/src/hedge/Seldom.cpp
@@ -0,0 +1,50 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/hedge/Seldom.h"
+
+#include "fl/Operation.h"
+
+namespace fl {
+
+ std::string Seldom::name() const {
+ return "seldom";
+ }
+
+ scalar Seldom::hedge(scalar x) const {
+ return Op::isLE(x, 0.5)
+ ? std::sqrt(x / 2.0)
+ : 1.0 - std::sqrt((1.0 - x) / 2.0);
+ }
+
+ Seldom* Seldom::clone() const {
+ return new Seldom(*this);
+ }
+
+ Hedge* Seldom::constructor() {
+ return new Seldom;
+ }
+
+
+}
diff --git a/fuzzylite/src/hedge/Somewhat.cpp b/fuzzylite/src/hedge/Somewhat.cpp
new file mode 100644
index 0000000..16c371b
--- /dev/null
+++ b/fuzzylite/src/hedge/Somewhat.cpp
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/hedge/Somewhat.h"
+
+namespace fl {
+
+ std::string Somewhat::name() const {
+ return "somewhat";
+ }
+
+ scalar Somewhat::hedge(scalar x) const {
+ return std::sqrt(x);
+ }
+
+ Somewhat* Somewhat::clone() const {
+ return new Somewhat(*this);
+ }
+
+ Hedge* Somewhat::constructor() {
+ return new Somewhat;
+ }
+
+}
diff --git a/fuzzylite/src/hedge/Very.cpp b/fuzzylite/src/hedge/Very.cpp
new file mode 100644
index 0000000..dc1fbec
--- /dev/null
+++ b/fuzzylite/src/hedge/Very.cpp
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/hedge/Very.h"
+
+namespace fl {
+
+ std::string Very::name() const {
+ return "very";
+ }
+
+ scalar Very::hedge(scalar x) const {
+ return x * x;
+ }
+
+ Very* Very::clone() const {
+ return new Very(*this);
+ }
+
+ Hedge* Very::constructor() {
+ return new Very;
+ }
+
+}
diff --git a/fuzzylite/src/imex/CppExporter.cpp b/fuzzylite/src/imex/CppExporter.cpp
new file mode 100644
index 0000000..7b21087
--- /dev/null
+++ b/fuzzylite/src/imex/CppExporter.cpp
@@ -0,0 +1,234 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/CppExporter.h"
+
+#include "fl/Headers.h"
+
+#include <algorithm>
+
+namespace fl {
+
+ CppExporter::CppExporter(bool prefixNamespace) : Exporter(),
+ _prefixNamespace(prefixNamespace) {
+ }
+
+ CppExporter::~CppExporter() {
+ }
+
+ std::string CppExporter::name() const {
+ return "CppExporter";
+ }
+
+ std::string CppExporter::fl(const std::string& clazz) const {
+ return _prefixNamespace ? "fl::" + clazz : clazz;
+ }
+
+ void CppExporter::setPrefixNamespace(bool prefixNamespace){
+ this->_prefixNamespace = prefixNamespace;
+ }
+
+ bool CppExporter::isPrefixNamespace() const{
+ return this->_prefixNamespace;
+ }
+
+ std::string CppExporter::toString(const Engine* engine) const {
+ std::ostringstream cpp;
+ if (not _prefixNamespace) cpp << "using namespace fl;\n\n";
+ cpp << fl("Engine* ") << "engine = new " << fl("Engine;\n");
+ cpp << "engine->setName(\"" << engine->getName() << "\");\n";
+
+ cpp << "\n";
+
+ for (int i = 0; i < engine->numberOfInputVariables(); ++i) {
+ cpp << toString(engine->getInputVariable(i), engine) << "\n";
+ }
+
+ for (int i = 0; i < engine->numberOfOutputVariables(); ++i) {
+ cpp << toString(engine->getOutputVariable(i), engine) << "\n";
+ }
+
+ for (int i = 0; i < engine->numberOfRuleBlocks(); ++i) {
+ cpp << toString(engine->getRuleBlock(i), engine) << "\n";
+ }
+
+ return cpp.str();
+ }
+
+ std::string CppExporter::toString(const InputVariable* inputVariable, const Engine* engine) const {
+ std::ostringstream ss;
+ std::string name = "inputVariable";
+ if (engine->numberOfInputVariables() > 1) {
+ int index = std::distance(engine->inputVariables().begin(),
+ std::find(engine->inputVariables().begin(),
+ engine->inputVariables().end(), inputVariable));
+ name += Op::str<int>(index + 1);
+ }
+ ss << fl("InputVariable* ") << name << " = new " << fl("InputVariable;\n");
+ ss << name << "->setEnabled(" << (inputVariable->isEnabled() ? "true" : "false") << ");\n";
+ ss << name << "->setName(\"" << inputVariable->getName() << "\");\n";
+ ss << name << "->setRange(" <<
+ toString(inputVariable->getMinimum()) << ", " <<
+ toString(inputVariable->getMaximum()) << ");\n";
+ for (int t = 0; t < inputVariable->numberOfTerms(); ++t) {
+ ss << name << "->addTerm(" << toString(inputVariable->getTerm(t)) << ");\n";
+ }
+ ss << "engine->addInputVariable(" << name << ");\n";
+ return ss.str();
+ }
+
+ std::string CppExporter::toString(const OutputVariable* outputVariable, const Engine* engine) const {
+ std::ostringstream ss;
+ std::string name = "outputVariable";
+ if (engine->numberOfOutputVariables() > 1) {
+ int index = std::distance(engine->outputVariables().begin(),
+ std::find(engine->outputVariables().begin(),
+ engine->outputVariables().end(), outputVariable));
+ name += Op::str<int>(index + 1);
+ }
+ ss << fl("OutputVariable* ") << name << " = new " << fl("OutputVariable;\n");
+ ss << name << "->setEnabled(" << (outputVariable->isEnabled() ? "true" : "false") << ");\n";
+ ss << name << "->setName(\"" << outputVariable->getName() << "\");\n";
+ ss << name << "->setRange(" <<
+ toString(outputVariable->getMinimum()) << ", " <<
+ toString(outputVariable->getMaximum()) << ");\n";
+ ss << name << "->fuzzyOutput()->setAccumulation(" <<
+ toString(outputVariable->fuzzyOutput()->getAccumulation()) << ");\n";
+ ss << name << "->setDefuzzifier(" <<
+ toString(outputVariable->getDefuzzifier()) << ");\n";
+ ss << name << "->setDefaultValue(" <<
+ toString(outputVariable->getDefaultValue()) << ");\n";
+ ss << name << "->setLockPreviousOutputValue(" <<
+ (outputVariable->isLockedPreviousOutputValue() ? "true" : "false") << ");\n";
+ ss << name << "->setLockOutputValueInRange(" <<
+ (outputVariable->isLockedOutputValueInRange() ? "true" : "false") << ");\n";
+ for (int t = 0; t < outputVariable->numberOfTerms(); ++t) {
+ ss << name << "->addTerm(" << toString(outputVariable->getTerm(t)) << ");\n";
+ }
+ ss << "engine->addOutputVariable(" << name << ");\n";
+ return ss.str();
+ }
+
+ //TODO: addRules using `new Rule` instead of `Rule::parse` in version 6.0
+ std::string CppExporter::toString(const RuleBlock* ruleBlock, const Engine* engine) const {
+ std::ostringstream ss;
+ std::string name = "ruleBlock";
+ if (engine->numberOfRuleBlocks() > 1) {
+ int index = std::distance(engine->ruleBlocks().begin(),
+ std::find(engine->ruleBlocks().begin(),
+ engine->ruleBlocks().end(), ruleBlock));
+ name += Op::str<int>(index + 1);
+ }
+ ss << fl("RuleBlock* ") << name << " = new " << fl("RuleBlock;\n");
+ ss << name << "->setEnabled(" << (ruleBlock->isEnabled() ? "true" : "false") << ");\n";
+ ss << name << "->setName(\"" << ruleBlock->getName() << "\");\n";
+ ss << name << "->setConjunction(" <<
+ toString(ruleBlock->getConjunction()) << ");\n";
+ ss << name << "->setDisjunction("
+ << toString(ruleBlock->getDisjunction()) << ");\n";
+ ss << name << "->setActivation("
+ << toString(ruleBlock->getActivation()) << ");\n";
+ for (int r = 0; r < ruleBlock->numberOfRules(); ++r) {
+ ss << name << "->addRule(" << "fl::Rule::parse(\"" <<
+ ruleBlock->getRule(r)->getText() << "\", engine));\n";
+ }
+ ss << "engine->addRuleBlock(" << name << ");\n";
+ return ss.str();
+ }
+
+ std::string CppExporter::toString(scalar value) const {
+ if (fl::Op::isNaN(value))
+ return "fl::nan";
+ if (fl::Op::isInf(value)){
+ return (value > 0 ? "fl::inf" : "-fl::inf");
+ }
+ return fl::Op::str(value);
+ }
+
+ std::string CppExporter::toString(const Term* term) const {
+ if (not term) return "fl::null";
+
+ if (const Discrete * discrete = dynamic_cast<const Discrete*> (term)) {
+ std::ostringstream ss;
+ ss << fl(term->className()) << "::create(\"" << term->getName() << "\", "
+ << discrete->xy().size() * 2 << ", "
+ << fl::Op::join(Discrete::toVector(discrete->xy()), ", ") << ")";
+ return ss.str();
+ }
+
+ if (const Function * function = dynamic_cast<const Function*> (term)) {
+ std::ostringstream ss;
+ ss << fl(term->className()) << "::create(\"" << term->getName() << "\", "
+ << "\"" << function->getFormula() << "\", engine)";
+ return ss.str();
+ }
+
+ if (const Linear * linear = dynamic_cast<const Linear*> (term)) {
+ std::ostringstream ss;
+ ss << fl(term->className()) << "::create(\"" << term->getName() << "\", "
+ << "engine, " << fl::Op::join(linear->coefficients(), ", ") << ")";
+ return ss.str();
+ }
+
+ std::ostringstream ss;
+ ss << "new " << fl(term->className()) << "(\"" << term->getName() << "\", "
+ << Op::findReplace(term->parameters(), " ", ", ") << ")";
+ return ss.str();
+ }
+
+ std::string CppExporter::toString(const Hedge * hedge) const {
+ if (hedge->name() == Any().name()) return "new " + fl("Any");
+ if (hedge->name() == Extremely().name()) return "new " + fl("Extremely");
+ if (hedge->name() == Not().name()) return "new " + fl("Not");
+ if (hedge->name() == Seldom().name()) return "new " + fl("Seldom");
+ if (hedge->name() == Somewhat().name()) return "new " + fl("Somewhat");
+ if (hedge->name() == Very().name()) return "new " + fl("Very");
+ return "new " + fl(hedge->name());
+ }
+
+ std::string CppExporter::toString(const Norm* op) const {
+ if (not op) return "fl::null";
+ return "new " + fl(op->className());
+ }
+
+ std::string CppExporter::toString(const Defuzzifier* defuzzifier) const {
+ if (not defuzzifier) return "fl::null";
+ if (const IntegralDefuzzifier * integralDefuzzifier =
+ dynamic_cast<const IntegralDefuzzifier*> (defuzzifier)) {
+ return "new " + fl(integralDefuzzifier->className()) + "("
+ + fl::Op::str(integralDefuzzifier->getResolution()) + ")";
+ }
+ if (const WeightedDefuzzifier * weightedDefuzzifier =
+ dynamic_cast<const WeightedDefuzzifier*> (defuzzifier)) {
+ return "new " + weightedDefuzzifier->className() +
+ "(\"" + weightedDefuzzifier->getTypeName() + "\")";
+ }
+ return "new " + fl(defuzzifier->className());
+ }
+
+ CppExporter* CppExporter::clone() const {
+ return new CppExporter(*this);
+ }
+
+}
diff --git a/fuzzylite/src/imex/Exporter.cpp b/fuzzylite/src/imex/Exporter.cpp
new file mode 100644
index 0000000..5b0fe1b
--- /dev/null
+++ b/fuzzylite/src/imex/Exporter.cpp
@@ -0,0 +1,49 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/Exporter.h"
+#include "fl/Exception.h"
+
+#include <fstream>
+
+namespace fl {
+
+ Exporter::Exporter() {
+
+ }
+
+ Exporter::~Exporter() {
+
+ }
+
+ void Exporter::toFile(const std::string& path, const Engine* engine) const {
+ std::ofstream writer(path.c_str());
+ if (not writer.is_open()) {
+ throw fl::Exception("[file error] file <" + path + "> could not be created", FL_AT);
+ }
+ writer << toString(engine) << std::endl;
+ writer.close();
+ }
+
+}
diff --git a/fuzzylite/src/imex/FclExporter.cpp b/fuzzylite/src/imex/FclExporter.cpp
new file mode 100644
index 0000000..cf8ffb0
--- /dev/null
+++ b/fuzzylite/src/imex/FclExporter.cpp
@@ -0,0 +1,256 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+#include "fl/imex/FclExporter.h"
+
+#include "fl/Headers.h"
+
+#include <sstream>
+
+namespace fl {
+
+ FclExporter::FclExporter(const std::string& indent) : Exporter(), _indent(indent) {
+ }
+
+ FclExporter::~FclExporter() {
+ }
+
+ void FclExporter::setIndent(const std::string& indent) {
+ this->_indent = indent;
+ }
+
+ std::string FclExporter::getIndent() const {
+ return this->_indent;
+ }
+
+ std::string FclExporter::name() const {
+ return "FclExporter";
+ }
+
+ std::string FclExporter::toString(const Engine* engine) const {
+ std::ostringstream fcl;
+ fcl << "FUNCTION_BLOCK " << engine->getName() << "\n\n";
+
+ fcl << "VAR_INPUT\n";
+ for (int i = 0; i < engine->numberOfInputVariables(); ++i) {
+ fcl << _indent << Op::validName(engine->getInputVariable(i)->getName()) << ": REAL;\n";
+ }
+ fcl << "END_VAR\n\n";
+
+ fcl << "VAR_OUTPUT\n";
+ for (int i = 0; i < engine->numberOfOutputVariables(); ++i) {
+ fcl << _indent << Op::validName(engine->getOutputVariable(i)->getName()) << ": REAL;\n";
+ }
+ fcl << "END_VAR\n\n";
+
+ for (int i = 0; i < engine->numberOfInputVariables(); ++i) {
+ InputVariable* inputVariable = engine->getInputVariable(i);
+ fcl << toString(inputVariable) << "\n";
+ }
+
+ for (int i = 0; i < engine->numberOfOutputVariables(); ++i) {
+ OutputVariable* outputVariable = engine->getOutputVariable(i);
+ fcl << toString(outputVariable) << "\n";
+ }
+
+ for (int i = 0; i < engine->numberOfRuleBlocks(); ++i) {
+ RuleBlock* ruleblock = engine->getRuleBlock(i);
+ fcl << toString(ruleblock) << "\n";
+ }
+
+ fcl << "END_FUNCTION_BLOCK\n";
+ return fcl.str();
+ }
+
+ std::string FclExporter::toString(const InputVariable* inputVariable) const {
+ std::ostringstream fcl;
+ fcl << "FUZZIFY " << Op::validName(inputVariable->getName()) << "\n";
+ if (not inputVariable->isEnabled()) {
+ fcl << _indent << "ENABLED : " <<
+ (inputVariable->isEnabled() ? "TRUE" : "FALSE") << ";\n";
+ }
+ fcl << _indent << "RANGE := (" << fl::Op::join(2, " .. ",
+ inputVariable->getMinimum(), inputVariable->getMaximum())
+ << ");\n";
+
+ for (int t = 0; t < inputVariable->numberOfTerms(); ++t) {
+ Term* term = inputVariable->getTerm(t);
+ fcl << _indent << "TERM " << Op::validName(term->getName()) << " := " << toString(term)
+ << ";\n";
+ }
+ fcl << "END_FUZZIFY\n";
+ return fcl.str();
+ }
+
+ std::string FclExporter::toString(const OutputVariable* outputVariable) const {
+ std::ostringstream fcl;
+ fcl << "DEFUZZIFY " << Op::validName(outputVariable->getName()) << "\n";
+ if (not outputVariable->isEnabled()) {
+ fcl << _indent << "ENABLED : " <<
+ (outputVariable->isEnabled() ? "TRUE" : "FALSE") << ";\n";
+ }
+ fcl << _indent << "RANGE := (" << fl::Op::join(2, " .. ",
+ outputVariable->getMinimum(), outputVariable->getMaximum())
+ << ");\n";
+
+ for (int t = 0; t < outputVariable->numberOfTerms(); ++t) {
+ Term* term = outputVariable->getTerm(t);
+ fcl << _indent << "TERM " << Op::validName(term->getName()) << " := " << toString(term)
+ << ";\n";
+ }
+ if (outputVariable->getDefuzzifier()) {
+ fcl << _indent << "METHOD : " << toString(outputVariable->getDefuzzifier()) << ";\n";
+ }
+ if (outputVariable->fuzzyOutput()->getAccumulation())
+ fcl << _indent << "ACCU : " << toString(outputVariable->fuzzyOutput()->getAccumulation()) << ";\n";
+
+ fcl << _indent << "DEFAULT := " << fl::Op::str(outputVariable->getDefaultValue());
+ if (outputVariable->isLockedPreviousOutputValue()) {
+ fcl << " | NC";
+ }
+ fcl << ";\n";
+
+ if (outputVariable->isLockedOutputValueInRange()) {
+ fcl << _indent << "LOCK : RANGE;\n";
+ }
+
+ fcl << "END_DEFUZZIFY\n";
+ return fcl.str();
+ }
+
+ std::string FclExporter::toString(const RuleBlock* ruleBlock) const {
+ std::ostringstream fcl;
+ fcl << "RULEBLOCK " << ruleBlock->getName() << "\n";
+ if (not ruleBlock->isEnabled()) {
+ fcl << _indent << "ENABLED : " <<
+ (ruleBlock->isEnabled() ? "TRUE" : "FALSE") << ";\n";
+ }
+ if (ruleBlock->getConjunction())
+ fcl << _indent << "AND : " << toString(ruleBlock->getConjunction()) << ";\n";
+ if (ruleBlock->getDisjunction())
+ fcl << _indent << "OR : " << toString(ruleBlock->getDisjunction()) << ";\n";
+ if (ruleBlock->getActivation())
+ fcl << _indent << "ACT : " << toString(ruleBlock->getActivation()) << ";\n";
+
+ for (int r = 0; r < ruleBlock->numberOfRules(); ++r) {
+ fcl << _indent << "RULE " << (r + 1) << " : " <<
+ ruleBlock->getRule(r)->getText() << "\n";
+ }
+ fcl << "END_RULEBLOCK\n";
+ return fcl.str();
+ }
+
+ std::string FclExporter::toString(const Norm* norm) const{
+ if (not norm) return "NONE";
+
+ std::string name = norm->className();
+ //TNorms
+ if (name == Minimum().className()) return "MIN";
+ if (name == AlgebraicProduct().className()) return "PROD";
+ if (name == BoundedDifference().className()) return "BDIF";
+ if (name == DrasticProduct().className()) return "DPROD";
+ if (name == EinsteinProduct().className()) return "EPROD";
+ if (name == HamacherProduct().className()) return "HPROD";
+ if (name == NilpotentMinimum().className()) return "NMIN";
+
+ //SNorms
+ if (name == Maximum().className()) return "MAX";
+ if (name == AlgebraicSum().className()) return "ASUM";
+ if (name == NormalizedSum().className()) return "NSUM";
+ if (name == BoundedSum().className()) return "BSUM";
+ if (name == DrasticSum().className()) return "DSUM";
+ if (name == EinsteinSum().className()) return "ESUM";
+ if (name == HamacherSum().className()) return "HSUM";
+ if (name == NilpotentMaximum().className()) return "NMAX";
+
+ return norm->className();
+ }
+
+ //TODO: Delete in v6.0
+ std::string FclExporter::toString(const TNorm* tnorm) const {
+ if (not tnorm) return "NONE";
+ std::string name = tnorm->className();
+ if (name == Minimum().className()) return "MIN";
+ if (name == AlgebraicProduct().className()) return "PROD";
+ if (name == BoundedDifference().className()) return "BDIF";
+ if (name == DrasticProduct().className()) return "DPROD";
+ if (name == EinsteinProduct().className()) return "EPROD";
+ if (name == HamacherProduct().className()) return "HPROD";
+ if (name == NilpotentMinimum().className()) return "NMIN";
+ return tnorm->className();
+ }
+
+ //TODO: Delete in v6.0
+ std::string FclExporter::toString(const SNorm* snorm) const {
+ if (not snorm) return "NONE";
+ std::string name = snorm->className();
+ if (name == Maximum().className()) return "MAX";
+ if (name == AlgebraicSum().className()) return "ASUM";
+ if (name == NormalizedSum().className()) return "NSUM";
+ if (name == BoundedSum().className()) return "BSUM";
+ if (name == DrasticSum().className()) return "DSUM";
+ if (name == EinsteinSum().className()) return "ESUM";
+ if (name == HamacherSum().className()) return "HSUM";
+ if (name == NilpotentMaximum().className()) return "NMAX";
+ return snorm->className();
+ }
+
+ std::string FclExporter::toString(const Defuzzifier* defuzzifier) const {
+ if (not defuzzifier) return "NONE";
+ if (defuzzifier->className() == Centroid().className()) return "COG";
+ if (defuzzifier->className() == Bisector().className()) return "COA";
+ if (defuzzifier->className() == SmallestOfMaximum().className()) return "LM";
+ if (defuzzifier->className() == LargestOfMaximum().className()) return "RM";
+ if (defuzzifier->className() == MeanOfMaximum().className()) return "MM";
+ if (defuzzifier->className() == WeightedAverage().className()) return "COGS";
+ if (defuzzifier->className() == WeightedSum().className()) return "COGSS";
+ return defuzzifier->className();
+ }
+
+ std::string FclExporter::toString(const Term* term) const {
+ if (not term) return "";
+ if (const Discrete * discrete = dynamic_cast<const Discrete*> (term)) {
+ std::ostringstream ss;
+ for (std::size_t i = 0; i < discrete->xy().size(); ++i) {
+ ss << "(" << fl::Op::str(discrete->xy(i).first) << ", "
+ << fl::Op::str(discrete->xy(i).second) << ")";
+ if (i + 1 < discrete->xy().size()) ss << " ";
+ }
+ return ss.str();
+ }
+
+ if (const Constant * constant = dynamic_cast<const Constant*> (term)) {
+ return fl::Op::str(constant->getValue());
+ }
+
+ std::ostringstream ss;
+ ss << term->className() << " " << term->parameters();
+ return ss.str();
+ }
+
+ FclExporter* FclExporter::clone() const {
+ return new FclExporter(*this);
+ }
+
+
+}
diff --git a/fuzzylite/src/imex/FclImporter.cpp b/fuzzylite/src/imex/FclImporter.cpp
new file mode 100644
index 0000000..a56a9e1
--- /dev/null
+++ b/fuzzylite/src/imex/FclImporter.cpp
@@ -0,0 +1,607 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/FclImporter.h"
+
+#include "fl/Headers.h"
+
+#include <iostream>
+#include <sstream>
+
+namespace fl {
+
+ FclImporter::FclImporter() : Importer() {
+ }
+
+ FclImporter::~FclImporter() {
+ }
+
+ std::string FclImporter::name() const {
+ return "FclImporter";
+ }
+
+ Engine* FclImporter::fromString(const std::string& fcl) const {
+ FL_unique_ptr<Engine> engine(new Engine);
+
+ std::map<std::string, std::string> tags;
+ tags["VAR_INPUT"] = "END_VAR";
+ tags["VAR_OUTPUT"] = "END_VAR";
+ tags["FUZZIFY"] = "END_FUZZIFY";
+ tags["DEFUZZIFY"] = "END_DEFUZZIFY";
+ tags["RULEBLOCK"] = "END_RULEBLOCK";
+ std::map<std::string, std::string>::const_iterator tagFinder;
+
+ std::string currentTag = "", closingTag = "";
+ std::ostringstream block;
+ std::istringstream fclReader(fcl);
+ std::string line;
+
+ int lineNumber = 0;
+ while (std::getline(fclReader, line)) {
+ ++lineNumber;
+ std::vector<std::string> comments;
+ comments = Op::split(line, "//");
+ if (comments.size() > 1) {
+ line = comments.front();
+ }
+ comments = Op::split(line, "#");
+ if (comments.size() > 1) {
+ line = comments.front();
+ }
+ line = Op::trim(line);
+ if (line.empty() or line.at(0) == '%' or line.at(0) == '#'
+ or (line.substr(0, 2) == "//")) {
+ continue;
+ }
+ line = fl::Op::findReplace(line, ";", "");
+ std::istringstream tokenizer(line);
+ std::string firstToken;
+ tokenizer >> firstToken;
+
+ if (firstToken == "FUNCTION_BLOCK") {
+ if (tokenizer.rdbuf()->in_avail() > 0) {
+ std::ostringstream name;
+ std::string token;
+ tokenizer >> token;
+ name << token;
+ while (tokenizer >> token) {
+ name << " " << token;
+ }
+ engine->setName(name.str());
+ }
+ continue;
+ }
+ if (firstToken == "END_FUNCTION_BLOCK") {
+ break;
+ }
+
+ if (currentTag.empty()) {
+ tagFinder = tags.find(firstToken);
+ if (tagFinder == tags.end()) {
+ std::ostringstream ex;
+ ex << "[syntax error] unknown block definition <" << firstToken
+ << "> " << " in line " << lineNumber << ": " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ currentTag = tagFinder->first;
+ closingTag = tagFinder->second;
+ block.str("");
+ block.clear();
+ block << line << "\n";
+ continue;
+ }
+
+ if (not currentTag.empty()) {
+ if (firstToken == closingTag) {
+ processBlock(currentTag, block.str(), engine.get());
+ currentTag = "";
+ closingTag = "";
+ } else if (tags.find(firstToken) != tags.end()) {
+ //if opening new block without closing the previous one
+ std::ostringstream ex;
+ ex << "[syntax error] expected <" << closingTag << "> before <"
+ << firstToken << "> in line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ } else {
+ block << line << "\n";
+ }
+ continue;
+ }
+ }
+
+ if (not currentTag.empty()) {
+ std::ostringstream ex;
+ ex << "[syntax error] ";
+ if (block.rdbuf()->in_avail() > 0) {
+ ex << "expected <" << closingTag << "> for block:\n" << block.str();
+ } else {
+ ex << "expected <" << closingTag << ">, but not found";
+ }
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ return engine.release();
+ }
+
+ void FclImporter::processBlock(const std::string& tag, const std::string& block, Engine* engine) const {
+ if (tag == "VAR_INPUT" or tag == "VAR_OUTPUT") {
+ processVar(tag, block, engine);
+ } else if (tag == "FUZZIFY") {
+ processFuzzify(block, engine);
+ } else if (tag == "DEFUZZIFY") {
+ processDefuzzify(block, engine);
+ } else if (tag == "RULEBLOCK") {
+ processRuleBlock(block, engine);
+ } else {
+ std::ostringstream ex;
+ ex << "[syntax error] unexpected tag <" << tag << "> for block:\n" << block;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ }
+
+ void FclImporter::processVar(const std::string& tag, const std::string& block, Engine* engine)const {
+ std::istringstream blockReader(block);
+ std::string line;
+
+ std::getline(blockReader, line); //discard first line as it is VAR_INPUT
+ while (std::getline(blockReader, line)) {
+ std::vector<std::string> token = Op::split(line, ":");
+ if (token.size() != 2) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected property of type (key : value) in line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ std::string name = fl::Op::validName(token.at(0));
+ if (tag == "VAR_INPUT")
+ engine->addInputVariable(new InputVariable(name));
+ else if (tag == "VAR_OUTPUT")
+ engine->addOutputVariable(new OutputVariable(name));
+ else {
+ std::ostringstream ex;
+ ex << "[syntax error] unexpected tag <" << tag << "> in line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ }
+ }
+
+ void FclImporter::processFuzzify(const std::string& block, Engine* engine)const {
+ std::istringstream blockReader(block);
+ std::string line;
+
+ std::getline(blockReader, line);
+ std::string name;
+ std::size_t index = line.find_first_of(' ');
+ if (index != std::string::npos) {
+ name = fl::Op::validName(line.substr(index + 1));
+ } else {
+ std::ostringstream ex;
+ ex << "[syntax error] expected name of input variable in line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ if (not engine->hasInputVariable(name)) {
+ std::ostringstream ex;
+ ex << "[syntax error] engine does not contain "
+ "input variable <" << name << "> from line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ InputVariable* inputVariable = engine->getInputVariable(name);
+ while (std::getline(blockReader, line)) {
+ std::istringstream ss(line);
+ std::string firstToken;
+ ss >> firstToken;
+ try {
+ if (firstToken == "RANGE") {
+ std::pair<scalar, scalar> minmax = parseRange(line);
+ inputVariable->setMinimum(minmax.first);
+ inputVariable->setMaximum(minmax.second);
+ } else if (firstToken == "ENABLED") {
+ inputVariable->setEnabled(parseEnabled(line));
+ } else if (firstToken == "TERM") {
+ inputVariable->addTerm(parseTerm(line, engine));
+ } else throw fl::Exception("[syntax error] unexpected token "
+ "<" + firstToken + ">" + line, FL_AT);
+ } catch (fl::Exception& ex) {
+ ex.append("At line: <" + line + ">");
+ throw;
+ }
+ }
+
+ }
+
+ void FclImporter::processDefuzzify(const std::string& block, Engine* engine) const {
+ std::istringstream blockReader(block);
+ std::string line;
+
+ std::getline(blockReader, line);
+ std::string name;
+ std::size_t index = line.find_first_of(' ');
+ if (index != std::string::npos) {
+ name = fl::Op::validName(line.substr(index + 1));
+ } else {
+ std::ostringstream ex;
+ ex << "[syntax error] expected an output variable name in line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ if (not engine->hasOutputVariable(name)) {
+ std::ostringstream ex;
+ ex << "[syntax error] output variable <" << name
+ << "> not registered in engine. "
+ << "Line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ OutputVariable* outputVariable = engine->getOutputVariable(name);
+ while (std::getline(blockReader, line)) {
+ line = fl::Op::trim(line);
+ std::istringstream tokenizer(line);
+ std::string firstToken;
+ tokenizer >> firstToken;
+ if (firstToken == "TERM") {
+ outputVariable->addTerm(parseTerm(line, engine));
+ } else if (firstToken == "METHOD") {
+ outputVariable->setDefuzzifier(parseDefuzzifier(line));
+ } else if (firstToken == "ACCU") {
+ outputVariable->fuzzyOutput()->setAccumulation(parseSNorm(line));
+ } else if (firstToken == "DEFAULT") {
+ std::pair<scalar, bool> defaultAndLock = parseDefaultValue(line);
+ outputVariable->setDefaultValue(defaultAndLock.first);
+ outputVariable->setLockPreviousOutputValue(defaultAndLock.second or
+ outputVariable->isLockedPreviousOutputValue());
+ } else if (firstToken == "RANGE") {
+ std::pair<scalar, scalar> minmax = parseRange(line);
+ outputVariable->setMinimum(minmax.first);
+ outputVariable->setMaximum(minmax.second);
+ } else if (firstToken == "LOCK") {
+ std::pair<bool, bool> output_range = parseLocks(line);
+ outputVariable->setLockPreviousOutputValue(output_range.first);
+ outputVariable->setLockOutputValueInRange(output_range.second);
+ } else if (firstToken == "ENABLED") {
+ outputVariable->setEnabled(parseEnabled(line));
+ } else {
+ std::ostringstream ex;
+ ex << "[syntax error] unexpected token <" << firstToken <<
+ "> in line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ }
+
+ }
+
+ void FclImporter::processRuleBlock(const std::string& block, Engine* engine)const {
+ std::istringstream blockReader(block);
+ std::string line;
+
+ std::string name;
+ std::getline(blockReader, line);
+ std::size_t index = line.find_last_of(' ');
+ if (index != std::string::npos) name = line.substr(index);
+ RuleBlock * ruleblock = new RuleBlock(name);
+ engine->addRuleBlock(ruleblock);
+
+ while (std::getline(blockReader, line)) {
+ std::string firstToken = line.substr(0, line.find_first_of(' '));
+ if (firstToken == "AND") {
+ ruleblock->setConjunction(parseTNorm(line));
+ } else if (firstToken == "OR") {
+ ruleblock->setDisjunction(parseSNorm(line));
+ } else if (firstToken == "ACT") {
+ ruleblock->setActivation(parseTNorm(line));
+ } else if (firstToken == "ENABLED") {
+ ruleblock->setEnabled(parseEnabled(line));
+ } else if (firstToken == "RULE") {
+ std::size_t ruleStart = line.find_first_of(':');
+ if (ruleStart == std::string::npos) ruleStart = 4; // "RULE".size()
+ std::string ruleText = line.substr(ruleStart + 1);
+ ruleText = fl::Op::trim(ruleText);
+ Rule* rule = new Rule(ruleText);
+ try {
+ rule->load(engine);
+ } catch (...) {
+ //ignore
+ }
+ ruleblock->addRule(rule);
+ } else {
+ std::ostringstream ex;
+ ex << "[syntax error] keyword <" << firstToken
+ << "> not recognized in line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ }
+ }
+
+ TNorm* FclImporter::parseTNorm(const std::string& line) const {
+ std::vector<std::string> token = Op::split(line, ":");
+ if (token.size() != 2) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected property of type (key : value) in line: "
+ << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ std::string name = Op::trim(token.at(1));
+ std::string className = name;
+ if (name == "NONE") className = "";
+ else if (name == "MIN") className = Minimum().className();
+ else if (name == "PROD") className = AlgebraicProduct().className();
+ else if (name == "BDIF") className = BoundedDifference().className();
+ else if (name == "DPROD") className = DrasticProduct().className();
+ else if (name == "EPROD") className = EinsteinProduct().className();
+ else if (name == "HPROD") className = HamacherProduct().className();
+ else if (name == "NMIN") className = NilpotentMinimum().className();
+
+ return FactoryManager::instance()->tnorm()->constructObject(className);
+ }
+
+ SNorm* FclImporter::parseSNorm(const std::string& line) const {
+ std::vector<std::string> token = Op::split(line, ":");
+ if (token.size() != 2) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected property of type (key : value) in line: "
+ << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ std::string name = Op::trim(token.at(1));
+ std::string className = name;
+ if (name == "NONE") className = "";
+ else if (name == "MAX") className = Maximum().className();
+ else if (name == "ASUM") className = AlgebraicSum().className();
+ else if (name == "BSUM") className = BoundedSum().className();
+ else if (name == "NSUM") className = NormalizedSum().className();
+ else if (name == "DSUM") className = DrasticSum().className();
+ else if (name == "ESUM") className = EinsteinSum().className();
+ else if (name == "HSUM") className = HamacherSum().className();
+ else if (name == "NMAX") className = NilpotentMaximum().className();
+
+ return FactoryManager::instance()->snorm()->constructObject(className);
+ }
+
+ Term* FclImporter::parseTerm(const std::string& line, const Engine* engine) const {
+ std::ostringstream spacer;
+ for (std::size_t i = 0; i < line.size(); ++i) {
+ if (line.at(i) == '(' or line.at(i) == ')' or line.at(i) == ',') {
+ spacer << " " << line.at(i) << " ";
+ } else if (line.at(i) == ':') {
+ spacer << " :";
+ } else if (line.at(i) == '=') {
+ spacer << "= ";
+ } else
+ spacer << line.at(i);
+ }
+ std::string spacedLine = spacer.str();
+
+ enum FSM {
+ S_KWTERM, S_NAME, S_ASSIGN, S_TERMCLASS, S_PARAMETERS
+ };
+ FSM state = S_KWTERM;
+ std::istringstream tokenizer(spacedLine);
+ std::string token;
+ std::string name, termClass;
+ std::vector<std::string> parameters;
+ while (tokenizer >> token) {
+ if (state == S_KWTERM and token == "TERM") {
+ state = S_NAME;
+ continue;
+ }
+ if (state == S_NAME) {
+ name = token;
+ state = S_ASSIGN;
+ continue;
+ }
+ if (state == S_ASSIGN and token == ":=") {
+ state = S_TERMCLASS;
+ continue;
+ }
+ if (state == S_TERMCLASS) {
+ if (fl::Op::isNumeric(token)) {
+ termClass = Constant().className();
+ parameters.push_back(token);
+ } else if (token == "(") {
+ termClass = Discrete().className();
+ } else {
+ termClass = token;
+ }
+ state = S_PARAMETERS;
+ continue;
+ }
+ if (state == S_PARAMETERS) {
+ if (termClass != Function().className() and
+ (token == "(" or token == ")" or token == ",")) {
+ continue;
+ }
+ if (token == ";") break;
+ parameters.push_back(fl::Op::trim(token));
+ }
+ }
+ if (state <= S_TERMCLASS)
+ throw fl::Exception("[syntax error] malformed term in line: " + line, FL_AT);
+
+ FL_unique_ptr<Term> term;
+ term.reset(FactoryManager::instance()->term()->constructObject(termClass));
+ Term::updateReference(term.get(), engine);
+ term->setName(fl::Op::validName(name));
+ std::string separator;
+ if (not dynamic_cast<Function*> (term.get())) {
+ separator = " ";
+ }
+ term->configure(Op::join(parameters, separator)); //remove spaces for text of function
+ return term.release();
+ }
+
+ Defuzzifier* FclImporter::parseDefuzzifier(const std::string& line) const {
+ std::vector<std::string> token = Op::split(line, ":");
+ if (token.size() != 2) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected property of type (key : value) in "
+ << "line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ std::string name = fl::Op::trim(token.at(1));
+ std::string className = name;
+ if (name == "NONE") className = "";
+ else if (name == "COG") className = Centroid().className();
+ else if (name == "COA") className = Bisector().className();
+ else if (name == "LM") className = SmallestOfMaximum().className();
+ else if (name == "RM") className = LargestOfMaximum().className();
+ else if (name == "MM") className = MeanOfMaximum().className();
+ else if (name == "COGS") className = WeightedAverage().className();
+ else if (name == "COGSS") className = WeightedSum().className();
+
+ return FactoryManager::instance()->defuzzifier()->constructObject(className);
+ }
+
+ std::pair<scalar, bool> FclImporter::parseDefaultValue(const std::string& line) const {
+ std::vector<std::string> token = Op::split(line, ":=");
+ if (token.size() != 2) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected property of type (key := value) in line: "
+ << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ std::vector<std::string> values = Op::split(token.at(1), "|");
+
+ std::string defaultValue = values.front();
+ std::string nc;
+ if (values.size() == 2) nc = values.back();
+
+ defaultValue = fl::Op::trim(defaultValue);
+ nc = fl::Op::trim(nc);
+
+ scalar value;
+ try {
+ value = fl::Op::toScalar(defaultValue);
+ } catch (...) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected numeric value, "
+ << "but found <" << defaultValue << "> in line: "
+ << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ bool lockPreviousOutput = (nc == "NC");
+
+ if (not (lockPreviousOutput or nc.empty())) {
+ throw fl::Exception("[syntax error] expected keyword <NC>, "
+ "but found <" + nc + "> in line: " + line, FL_AT);
+ }
+
+ return std::pair<scalar, bool>(value, lockPreviousOutput);
+ }
+
+ std::pair<scalar, scalar> FclImporter::parseRange(const std::string& line) const {
+ std::vector<std::string> token = Op::split(line, ":=");
+ if (token.size() != 2) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected property of type (key := value) in line: "
+ << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ std::string rangeToken = token.at(1);
+
+ std::ostringstream range;
+ for (std::size_t i = 0; i < rangeToken.size(); ++i) {
+ char character = rangeToken.at(i);
+ if (character == '(' or character == ')' or character == ' ' or character == ';')
+ continue;
+ range << character;
+ }
+ token = Op::split(range.str(), "..");
+ if (token.size() != 2) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected property of type 'start .. end', "
+ << "but found <" << range.str() << "> in line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ scalar minimum, maximum;
+ int index;
+ try {
+ minimum = Op::toScalar(token.at(index = 0));
+ maximum = Op::toScalar(token.at(index = 1));
+ } catch (std::exception& ex) {
+ (void) ex;
+ std::ostringstream ss;
+ ss << "[syntax error] expected numeric value, but found <" << token.at(index) << "> in "
+ << "line: " << line;
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+ return std::pair<scalar, scalar>(minimum, maximum);
+ }
+
+ std::pair<bool, bool> FclImporter::parseLocks(const std::string& line) const {
+ std::size_t index = line.find_first_of(":");
+ if (index == std::string::npos) {
+ throw fl::Exception("[syntax error] expected property of type "
+ "'key : value' in line: " + line, FL_AT);
+ }
+ bool output, range;
+ std::string value = line.substr(index + 1);
+ std::vector<std::string> flags = fl::Op::split(value, "|");
+ if (flags.size() == 1) {
+ std::string flag = fl::Op::trim(flags.front());
+ output = (flag == "PREVIOUS");
+ range = (flag == "RANGE");
+ if (not (output or range)) {
+ throw fl::Exception("[syntax error] expected locking flags "
+ "<PREVIOUS|RANGE>, but found <" + flag + "> in line: " + line, FL_AT);
+ }
+ } else if (flags.size() == 2) {
+ std::string flagA = fl::Op::trim(flags.front());
+ std::string flagB = fl::Op::trim(flags.back());
+ output = (flagA == "PREVIOUS" or flagB == "PREVIOUS");
+ range = (flagA == "RANGE" or flagB == "RANGE");
+ if (not (output and range)) {
+ throw fl::Exception("[syntax error] expected locking flags "
+ "<PREVIOUS|RANGE>, but found "
+ "<" + flags.front() + "|" + flags.back() + "> in line: " + line, FL_AT);
+ }
+ } else {
+ throw fl::Exception("[syntax error] expected locking flags "
+ "<PREVIOUS|RANGE>, but found "
+ "<" + value + "> in line: " + line, FL_AT);
+ }
+ return std::pair<bool, bool>(output, range);
+ }
+
+ bool FclImporter::parseEnabled(const std::string& line) const {
+ std::vector<std::string> tokens = Op::split(line, ":");
+ if (tokens.size() != 2) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected property of type (key : value) in "
+ << "line: " << line;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ std::string boolean = fl::Op::trim(tokens.at(1));
+ if (boolean == "TRUE") return true;
+ if (boolean == "FALSE") return false;
+ throw fl::Exception("[syntax error] expected boolean <TRUE|FALSE>, but found <" + line + ">", FL_AT);
+ }
+
+ FclImporter* FclImporter::clone() const {
+ return new FclImporter(*this);
+ }
+
+
+}
diff --git a/fuzzylite/src/imex/FisExporter.cpp b/fuzzylite/src/imex/FisExporter.cpp
new file mode 100644
index 0000000..0934b33
--- /dev/null
+++ b/fuzzylite/src/imex/FisExporter.cpp
@@ -0,0 +1,463 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/FisExporter.h"
+
+#include "fl/Headers.h"
+
+#include <queue>
+
+namespace fl {
+
+ FisExporter::FisExporter() : Exporter() {
+ }
+
+ FisExporter::~FisExporter() {
+ }
+
+ std::string FisExporter::name() const {
+ return "FisExporter";
+ }
+
+ std::string FisExporter::toString(const Engine* engine) const {
+ std::ostringstream fis;
+ fis << exportSystem(engine) << "\n";
+
+ fis << exportInputs(engine);
+
+ fis << exportOutputs(engine);
+
+ fis << exportRules(engine);
+
+ return fis.str();
+ }
+ //TODO: deal with multiple ruleblocks, merge them into one.
+ std::string FisExporter::exportSystem(const Engine* engine) const {
+ std::ostringstream fis;
+ fis << "[System]\n";
+ fis << "Name='" << engine->getName() << "'\n";
+ std::string type;
+ if (engine->type() == Engine::Mamdani or engine->type() == Engine::Larsen) {
+ type = "mamdani";
+ } else if (engine->type() == Engine::TakagiSugeno) {
+ type = "sugeno";
+ } else if (engine->type() == Engine::Tsukamoto) {
+ type = "tsukamoto";
+ } else if (engine->type() == Engine::InverseTsukamoto) {
+ type = "inverse tsukamoto";
+ }else if (engine->type() == Engine::Hybrid){
+ type = "hybrid";
+ } else {
+ type = "unknown";
+ }
+ fis << "Type='" << type << "'\n";
+ // fis << "Version=" << FL_VERSION << "\n";
+ fis << "NumInputs=" << engine->numberOfInputVariables() << "\n";
+ fis << "NumOutputs=" << engine->numberOfOutputVariables() << "\n";
+
+ int numberOfRules = 0;
+ const TNorm* conjunction = fl::null;
+ const SNorm* disjunction = fl::null;
+ const TNorm* activation = fl::null;
+ for (int i = 0; i < engine->numberOfRuleBlocks(); ++i) {
+ RuleBlock* rb = engine->getRuleBlock(i);
+ numberOfRules += rb->numberOfRules();
+ if (not conjunction) conjunction = rb->getConjunction();
+ if (not disjunction) disjunction = rb->getDisjunction();
+ if (not activation) activation = rb->getActivation();
+ }
+ fis << "NumRules=" << numberOfRules << "\n";
+ fis << "AndMethod='" << toString(conjunction) << "'\n";
+ fis << "OrMethod='" << toString(disjunction) << "'\n";
+ fis << "ImpMethod='" << toString(activation) << "'\n";
+
+ const SNorm* accumulation = fl::null;
+ Defuzzifier* defuzzifier = fl::null;
+ for (int i = 0; i < engine->numberOfOutputVariables(); ++i) {
+ OutputVariable* outputVariable = engine->getOutputVariable(i);
+ if (not accumulation) accumulation = outputVariable->fuzzyOutput()->getAccumulation();
+ if (not defuzzifier) defuzzifier = outputVariable->getDefuzzifier();
+ }
+
+ fis << "AggMethod='" << toString(accumulation) << "'\n";
+ fis << "DefuzzMethod='" << toString(defuzzifier) << "'\n";
+ return fis.str();
+ }
+
+ std::string FisExporter::exportInputs(const Engine* engine) const {
+ std::ostringstream fis;
+ for (int ixVar = 0; ixVar < engine->numberOfInputVariables(); ++ixVar) {
+ InputVariable* var = engine->getInputVariable(ixVar);
+ fis << "[Input" << (ixVar + 1) << "]\n";
+ if (not var->isEnabled()) {
+ fis << "Enabled=" << var->isEnabled() << "\n";
+ }
+ fis << "Name='" << Op::validName(var->getName()) << "'\n";
+ fis << "Range=[" << fl::Op::join(2, " ", var->getMinimum(), var->getMaximum()) << "]\n";
+ fis << "NumMFs=" << var->numberOfTerms() << "\n";
+ for (int ixTerm = 0; ixTerm < var->numberOfTerms(); ++ixTerm) {
+ fis << "MF" << (ixTerm + 1) << "='" << Op::validName(var->getTerm(ixTerm)->getName()) << "':"
+ << toString(var->getTerm(ixTerm)) << "\n";
+ }
+ fis << "\n";
+ }
+ return fis.str();
+ }
+
+ std::string FisExporter::exportOutputs(const Engine* engine) const {
+ std::ostringstream fis;
+ for (int ixVar = 0; ixVar < engine->numberOfOutputVariables(); ++ixVar) {
+ OutputVariable* var = engine->getOutputVariable(ixVar);
+ fis << "[Output" << (ixVar + 1) << "]\n";
+ if (not var->isEnabled()) {
+ fis << "Enabled=" << var->isEnabled() << "\n";
+ }
+ fis << "Name='" << Op::validName(var->getName()) << "'\n";
+ fis << "Range=[" << fl::Op::join(2, " ", var->getMinimum(), var->getMaximum()) << "]\n";
+ if (not fl::Op::isNaN(var->getDefaultValue())) {
+ fis << "Default=" << fl::Op::str(var->getDefaultValue()) << "\n";
+ }
+ if (var->isLockedPreviousOutputValue()) {
+ fis << "LockPrevious=" << var->isLockedPreviousOutputValue() << "\n";
+ }
+ if (var->isLockedOutputValueInRange()) {
+ fis << "LockRange=" << var->isLockedOutputValueInRange() << "\n";
+ }
+ fis << "NumMFs=" << var->numberOfTerms() << "\n";
+ for (int ixTerm = 0; ixTerm < var->numberOfTerms(); ++ixTerm) {
+ fis << "MF" << (ixTerm + 1) << "='" << Op::validName(var->getTerm(ixTerm)->getName()) << "':"
+ << toString(var->getTerm(ixTerm)) << "\n";
+ }
+ fis << "\n";
+ }
+ return fis.str();
+ }
+
+ std::string FisExporter::exportRules(const Engine* engine) const {
+ std::ostringstream fis;
+ fis << "[Rules]\n";
+ for (int ixRuleBlock = 0; ixRuleBlock < engine->numberOfRuleBlocks(); ++ixRuleBlock) {
+ RuleBlock* rb = engine->getRuleBlock(ixRuleBlock);
+ if (engine->numberOfRuleBlocks() > 1) fis << "# RuleBlock " << rb->getName() << "\n";
+ for (int ixRule = 0; ixRule < rb->numberOfRules(); ++ixRule) {
+ Rule* rule = rb->getRule(ixRule);
+ if (rule->isLoaded()) {
+ fis << exportRule(rule, engine) << "\n";
+ }
+ }
+ }
+ return fis.str();
+ }
+
+ std::string FisExporter::exportRule(const Rule* rule, const Engine* engine) const {
+ if (not rule) return "";
+ std::vector<Proposition*> propositions;
+ std::vector<Operator*> operators;
+
+ std::queue<Expression*> bfsQueue;
+ bfsQueue.push(rule->getAntecedent()->getExpression());
+ while (not bfsQueue.empty()) {
+ Expression* front = bfsQueue.front();
+ bfsQueue.pop();
+ Operator* op = dynamic_cast<Operator*> (front);
+ if (op) {
+ bfsQueue.push(op->left);
+ bfsQueue.push(op->right);
+ operators.push_back(op);
+ } else {
+ propositions.push_back(dynamic_cast<Proposition*> (front));
+ }
+ }
+
+ bool equalOperators = true;
+ for (std::size_t i = 0; i + 1 < operators.size(); ++i) {
+ if (operators.at(i)->name != operators.at(i + 1)->name) {
+ equalOperators = false;
+ break;
+ }
+ }
+ if (not equalOperators) {
+ throw fl::Exception("[exporter error] "
+ "fis files do not support rules with different connectors "
+ "(i.e. ['and', 'or']). All connectors within a rule must be the same", FL_AT);
+ }
+ std::ostringstream fis;
+ std::vector<Variable*> inputVariables, outputVariables;
+ for (int i = 0; i < engine->numberOfInputVariables(); ++i)
+ inputVariables.push_back(engine->getInputVariable(i));
+ for (int i = 0; i < engine->numberOfOutputVariables(); ++i)
+ outputVariables.push_back(engine->getOutputVariable(i));
+
+ fis << translate(propositions, inputVariables) << ", ";
+ fis << translate(rule->getConsequent()->conclusions(), outputVariables);
+ fis << "(" << Op::str(rule->getWeight()) << ") : ";
+ if (operators.size() == 0) fis << "1"; //does not matter
+ else {
+ if (operators.at(0)->name == Rule::andKeyword()) fis << "1";
+ else if (operators.at(0)->name == Rule::orKeyword()) fis << "2";
+ else fis << operators.at(0)->name;
+ }
+ return fis.str();
+ }
+
+ std::string FisExporter::translate(const std::vector<Proposition*>& propositions,
+ const std::vector<Variable*> variables) const {
+ std::ostringstream ss;
+ for (std::size_t ixVariable = 0; ixVariable < variables.size(); ++ixVariable) {
+ Variable* variable = variables.at(ixVariable);
+ int termIndexPlusOne = 0;
+ scalar plusHedge = 0;
+ int negated = 1;
+ for (std::size_t ixProposition = 0; ixProposition < propositions.size(); ++ixProposition) {
+ Proposition* proposition = propositions.at(ixProposition);
+ if (proposition->variable != variable) continue;
+
+ for (int termIndex = 0; termIndex < variable->numberOfTerms(); ++termIndex) {
+ if (variable->getTerm(termIndex) == proposition->term) {
+ termIndexPlusOne = termIndex + 1;
+ break;
+ }
+ }
+
+ std::vector<Hedge*> hedges = proposition->hedges;
+ if (hedges.size() > 1) {
+ FL_DBG("[exporter warning] only a few combinations of multiple "
+ "hedges are supported in fis files");
+ }
+ for (std::size_t ixHedge = 0; ixHedge < hedges.size(); ++ixHedge) {
+ Hedge* hedge = hedges.at(ixHedge);
+ if (hedge->name() == Not().name()) negated *= -1;
+ else if (hedge->name() == Extremely().name()) plusHedge += 0.3;
+ else if (hedge->name() == Very().name()) plusHedge += 0.2;
+ else if (hedge->name() == Somewhat().name()) plusHedge += 0.05;
+ else if (hedge->name() == Seldom().name()) plusHedge += 0.01;
+ else if (hedge->name() == Any().name()) plusHedge += 0.99;
+ else plusHedge = fl::nan; //Unreconized hedge combination (e.g. Any)
+ }
+
+ break;
+ }
+ if (negated < 0) ss << "-";
+ if (not fl::Op::isNaN(plusHedge)) {
+ ss << fl::Op::str(termIndexPlusOne + plusHedge);
+ } else {
+ ss << termIndexPlusOne << ".?"; // Unreconized hedge combination
+ }
+ ss << " ";
+ }
+ return ss.str();
+ }
+
+ std::string FisExporter::toString(const Norm * norm) const {
+ if (not norm) return "";
+ //TNorm
+ if (norm->className() == Minimum().className()) return "min";
+ if (norm->className() == AlgebraicProduct().className()) return "prod";
+ if (norm->className() == BoundedDifference().className()) return "bounded_difference";
+ if (norm->className() == DrasticProduct().className()) return "drastic_product";
+ if (norm->className() == EinsteinProduct().className()) return "einstein_product";
+ if (norm->className() == HamacherProduct().className()) return "hamacher_product";
+ if (norm->className() == NilpotentMinimum().className()) return "nilpotent_minimum";
+ //SNorm
+ if (norm->className() == Maximum().className()) return "max";
+ if (norm->className() == AlgebraicSum().className()) return "sum";
+ if (norm->className() == BoundedSum().className()) return "bounded_sum";
+ if (norm->className() == NormalizedSum().className()) return "normalized_sum";
+ if (norm->className() == DrasticSum().className()) return "drastic_sum";
+ if (norm->className() == EinsteinSum().className()) return "einstein_sum";
+ if (norm->className() == HamacherSum().className()) return "hamacher_sum";
+ if (norm->className() == NilpotentMaximum().className()) return "nilpotent_maximum";
+
+ return norm->className();
+ }
+
+ std::string FisExporter::toString(const TNorm * tnorm) const {
+ if (not tnorm) return "";
+ if (tnorm->className() == Minimum().className()) return "min";
+ if (tnorm->className() == AlgebraicProduct().className()) return "prod";
+ if (tnorm->className() == BoundedDifference().className()) return "bounded_difference";
+ if (tnorm->className() == DrasticProduct().className()) return "drastic_product";
+ if (tnorm->className() == EinsteinProduct().className()) return "einstein_product";
+ if (tnorm->className() == HamacherProduct().className()) return "hamacher_product";
+ if (tnorm->className() == NilpotentMinimum().className()) return "nilpotent_minimum";
+ return tnorm->className();
+ }
+
+ std::string FisExporter::toString(const SNorm * snorm) const {
+ if (not snorm) return "";
+ if (snorm->className() == Maximum().className()) return "max";
+ if (snorm->className() == AlgebraicSum().className()) return "sum";
+ if (snorm->className() == BoundedSum().className()) return "bounded_sum";
+ if (snorm->className() == NormalizedSum().className()) return "normalized_sum";
+ if (snorm->className() == DrasticSum().className()) return "drastic_sum";
+ if (snorm->className() == EinsteinSum().className()) return "einstein_sum";
+ if (snorm->className() == HamacherSum().className()) return "hamacher_sum";
+ if (snorm->className() == NilpotentMaximum().className()) return "nilpotent_maximum";
+ return snorm->className();
+ }
+
+ std::string FisExporter::toString(const Defuzzifier * defuzzifier) const {
+ if (not defuzzifier) return "";
+ if (defuzzifier->className() == Centroid().className()) return "centroid";
+ if (defuzzifier->className() == Bisector().className()) return "bisector";
+ if (defuzzifier->className() == LargestOfMaximum().className()) return "lom";
+ if (defuzzifier->className() == MeanOfMaximum().className()) return "mom";
+ if (defuzzifier->className() == SmallestOfMaximum().className()) return "som";
+ if (defuzzifier->className() == WeightedAverage().className()) return "wtaver";
+ if (defuzzifier->className() == WeightedSum().className()) return "wtsum";
+ return defuzzifier->className();
+ }
+
+ std::string FisExporter::toString(const Term * term) const {
+ std::ostringstream ss;
+ if (const Bell * x = dynamic_cast<const Bell*> (term)) {
+ ss << "'gbellmf',[" << fl::Op::join(3, " ",
+ x->getWidth(), x->getSlope(), x->getCenter()) << "]";
+ return ss.str();
+ }
+
+ if (const Concave * x = dynamic_cast<const Concave*> (term)) {
+ ss << "'concavemf',[" << fl::Op::join(2, " ",
+ x->getInflection(), x->getEnd()) << "]";
+ return ss.str();
+ }
+
+ if (const Constant * x = dynamic_cast<const Constant*> (term)) {
+ ss << "'constant',[" << fl::Op::str(x->getValue()) << "]";
+ return ss.str();
+ }
+
+ if (const Cosine * x = dynamic_cast<const Cosine*> (term)) {
+ ss << "'cosinemf',[" << fl::Op::join(2, " ",
+ x->getCenter(), x->getWidth()) << "]";
+ return ss.str();
+ }
+
+ if (const Discrete * x = dynamic_cast<const Discrete*> (term)) {
+ ss << "'discretemf',[" << fl::Op::join(Discrete::toVector(x->xy()), " ") << "]";
+ return ss.str();
+ }
+
+ if (const Function * x = dynamic_cast<const Function*> (term)) {
+ ss << "'function',[" << x->getFormula() << "]";
+ return ss.str();
+ }
+
+ if (const Gaussian * x = dynamic_cast<const Gaussian*> (term)) {
+ ss << "'gaussmf',[" << fl::Op::join(2, " ",
+ x->getStandardDeviation(), x->getMean()) << "]";
+ return ss.str();
+ }
+
+ if (const GaussianProduct * x = dynamic_cast<const GaussianProduct*> (term)) {
+ ss << "'gauss2mf',[" << fl::Op::join(4, " ",
+ x->getStandardDeviationA(), x->getMeanA(),
+ x->getStandardDeviationB(), x->getMeanB()) << "]";
+ return ss.str();
+ }
+
+ if (const Linear * x = dynamic_cast<const Linear*> (term)) {
+ ss << "'linear',[" << fl::Op::join<scalar>(x->coefficients(), " ") << "]";
+ return ss.str();
+ }
+
+
+ if (const PiShape * x = dynamic_cast<const PiShape*> (term)) {
+ ss << "'pimf',[" << fl::Op::join(4, " ",
+ x->getBottomLeft(), x->getTopLeft(),
+ x->getTopRight(), x->getBottomRight()) << "]";
+ return ss.str();
+ }
+
+ if (const Ramp * x = dynamic_cast<const Ramp*> (term)) {
+ ss << "'rampmf',[" << fl::Op::join(2, " ",
+ x->getStart(), x->getEnd()) << "]";
+ return ss.str();
+ }
+
+ if (const Rectangle * x = dynamic_cast<const Rectangle*> (term)) {
+ ss << "'rectmf',[" << fl::Op::join(2, " ",
+ x->getStart(), x->getEnd()) << "]";
+ return ss.str();
+ }
+
+ if (const SigmoidDifference * x = dynamic_cast<const SigmoidDifference*> (term)) {
+ ss << "'dsigmf',[" << fl::Op::join(4, " ",
+ x->getRising(), x->getLeft(),
+ x->getFalling(), x->getRight()) << "]";
+ return ss.str();
+ }
+
+ if (const Sigmoid * x = dynamic_cast<const Sigmoid*> (term)) {
+ ss << "'sigmf',[" << fl::Op::join(2, " ",
+ x->getSlope(), x->getInflection()) << "]";
+ return ss.str();
+ }
+
+ if (const SigmoidProduct * x = dynamic_cast<const SigmoidProduct*> (term)) {
+ ss << "'psigmf',[" << fl::Op::join(4, " ",
+ x->getRising(), x->getLeft(),
+ x->getFalling(), x->getRight()) << "]";
+ return ss.str();
+ }
+
+ if (const SShape * x = dynamic_cast<const SShape*> (term)) {
+ ss << "'smf',[" << fl::Op::join(2, " ",
+ x->getStart(), x->getEnd()) << "]";
+ return ss.str();
+ }
+
+ if (const Spike * x = dynamic_cast<const Spike*> (term)) {
+ ss << "'spikemf',[" << fl::Op::join(2, " ",
+ x->getCenter(), x->getWidth()) << "]";
+ return ss.str();
+ }
+
+ if (const Trapezoid * x = dynamic_cast<const Trapezoid*> (term)) {
+ ss << "'trapmf',[" << fl::Op::join(4, " ",
+ x->getVertexA(), x->getVertexB(), x->getVertexC(), x->getVertexD()) << "]";
+ return ss.str();
+ }
+
+ if (const Triangle * x = dynamic_cast<const Triangle*> (term)) {
+ ss << "'trimf',[" << fl::Op::join(3, " ",
+ x->getVertexA(), x->getVertexB(), x->getVertexC()) << "]";
+ return ss.str();
+ }
+
+ if (const ZShape * x = dynamic_cast<const ZShape*> (term)) {
+ ss << "'zmf',[" << fl::Op::join(2, " ",
+ x->getStart(), x->getEnd()) << "]";
+ return ss.str();
+ }
+
+ ss << "[exporter error] term of class <" << term->className() << "> not supported";
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+
+ FisExporter* FisExporter::clone() const {
+ return new FisExporter(*this);
+ }
+
+}
diff --git a/fuzzylite/src/imex/FisImporter.cpp b/fuzzylite/src/imex/FisImporter.cpp
new file mode 100644
index 0000000..741719c
--- /dev/null
+++ b/fuzzylite/src/imex/FisImporter.cpp
@@ -0,0 +1,501 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/FisImporter.h"
+
+#include "fl/Headers.h"
+
+#include <sstream>
+#include <iostream>
+#include <cctype>
+
+namespace fl {
+
+ FisImporter::FisImporter() : Importer() {
+ }
+
+ FisImporter::~FisImporter() {
+ }
+
+ std::string FisImporter::name() const {
+ return "FisImporter";
+ }
+
+ Engine* FisImporter::fromString(const std::string& fis) const {
+ FL_unique_ptr<Engine> engine(new Engine);
+
+ std::istringstream fisReader(fis);
+ std::string line;
+ int lineNumber = 0;
+
+ std::vector<std::string> sections;
+ while (std::getline(fisReader, line)) {
+ ++lineNumber;
+ std::vector<std::string> comments;
+ comments = Op::split(line, "//");
+ if (comments.size() > 1) {
+ line = comments.front();
+ }
+ comments = Op::split(line, "#");
+ if (comments.size() > 1) {
+ line = comments.front();
+ }
+ line = Op::trim(line);
+ if (line.empty() or line.at(0) == '%' or line.at(0) == '#'
+ or (line.substr(0, 2) == "//")) {
+ continue;
+ }
+
+ line = fl::Op::findReplace(line, "'", "");
+
+ if ("[System]" == line.substr(0, std::string("[System]").size())
+ or "[Input" == line.substr(0, std::string("[Input").size())
+ or "[Output" == line.substr(0, std::string("[Output").size())
+ or "[Rules]" == line.substr(0, std::string("[Rules]").size())) {
+ sections.push_back(line);
+ } else {
+ if (not sections.empty()) {
+ sections.at(sections.size() - 1) += "\n" + line;
+ } else {
+ std::ostringstream ss;
+ ss << "[import error] line " << lineNumber << " <" << line + "> "
+ "does not belong to any section";
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+ }
+ }
+ std::string andMethod, orMethod, impMethod, aggMethod, defuzzMethod;
+ for (std::size_t i = 0; i < sections.size(); ++i) {
+ if ("[System]" == sections.at(i).substr(0, std::string("[System]").size()))
+ importSystem(sections.at(i), engine.get(),
+ andMethod, orMethod, impMethod, aggMethod, defuzzMethod);
+ else if ("[Input" == sections.at(i).substr(0, std::string("[Input").size()))
+ importInput(sections.at(i), engine.get());
+ else if ("[Output" == sections.at(i).substr(0, std::string("[Output").size()))
+ importOutput(sections.at(i), engine.get());
+ else if ("[Rules]" == sections.at(i).substr(0, std::string("[Rules]").size()))
+ importRules(sections.at(i), engine.get());
+ else throw fl::Exception("[import error] section <"
+ + sections.at(i) + "> not recognized", FL_AT);
+ }
+ engine->configure(extractTNorm(andMethod), extractSNorm(orMethod),
+ extractTNorm(impMethod), extractSNorm(aggMethod),
+ extractDefuzzifier(defuzzMethod));
+ return engine.release();
+ }
+
+ void FisImporter::importSystem(const std::string& section, Engine * engine,
+ std::string& andMethod, std::string& orMethod,
+ std::string& impMethod, std::string& aggMethod,
+ std::string& defuzzMethod) const {
+ std::istringstream reader(section);
+ std::string line;
+ std::getline(reader, line); //ignore first line [System]
+ while (std::getline(reader, line)) {
+ std::vector<std::string> keyValue = fl::Op::split(line, "=");
+
+ std::string key = fl::Op::trim(keyValue.at(0));
+ std::string value;
+ for (std::size_t i = 1; i < keyValue.size(); ++i) {
+ value += keyValue.at(i);
+ }
+ value = fl::Op::trim(value);
+ if (key == "Name") engine->setName(value);
+ else if (key == "AndMethod") andMethod = value;
+ else if (key == "OrMethod") orMethod = value;
+ else if (key == "ImpMethod") impMethod = value;
+ else if (key == "AggMethod") aggMethod = value;
+ else if (key == "DefuzzMethod") defuzzMethod = value;
+ else if (key == "Type" or key == "Version"
+ or key == "NumInputs" or key == "NumOutputs"
+ or key == "NumRules" or key == "NumMFs") {
+ //ignore because are redundant.
+ } else throw fl::Exception("[import error] token <" + key + "> not recognized", FL_AT);
+ }
+ }
+
+ void FisImporter::importInput(const std::string& section, Engine* engine) const {
+ std::istringstream reader(section);
+ std::string line;
+ std::getline(reader, line); //ignore first line [Input#]
+
+ InputVariable* input = new InputVariable;
+ engine->addInputVariable(input);
+
+ while (std::getline(reader, line)) {
+ std::vector<std::string> keyValue = fl::Op::split(line, "=");
+ if (keyValue.size() != 2)
+ throw fl::Exception("[syntax error] expected a property of type "
+ "'key=value', but found <" + line + ">", FL_AT);
+ std::string key = fl::Op::trim(keyValue.at(0));
+ std::string value = fl::Op::trim(keyValue.at(1));
+
+ if (key == "Name") input->setName(fl::Op::validName(value));
+ else if (key == "Enabled") {
+ input->setEnabled(Op::isEq(Op::toScalar(value), 1.0));
+ } else if (key == "Range") {
+ std::pair<scalar, scalar> minmax = range(value);
+ input->setMinimum(minmax.first);
+ input->setMaximum(minmax.second);
+ } else if (key.substr(0, 2) == "MF") {
+ input->addTerm(parseTerm(value, engine));
+ } else if (key == "NumMFs") {
+ //ignore
+ } else {
+ throw fl::Exception("[import error] token <" + key + "> not recognized", FL_AT);
+ }
+ }
+ }
+
+ void FisImporter::importOutput(const std::string& section, Engine* engine) const {
+ std::istringstream reader(section);
+ std::string line;
+ std::getline(reader, line); //ignore first line [Output#]
+
+ OutputVariable* output = new OutputVariable;
+ engine->addOutputVariable(output);
+
+
+ while (std::getline(reader, line)) {
+ std::vector<std::string> keyValue = fl::Op::split(line, "=");
+ if (keyValue.size() != 2)
+ throw fl::Exception("[syntax error] expected a property of type "
+ "'key=value', but found < " + line + ">", FL_AT);
+ std::string key = fl::Op::trim(keyValue.at(0));
+ std::string value = fl::Op::trim(keyValue.at(1));
+
+ if (key == "Name") output->setName(fl::Op::validName(value));
+ else if (key == "Enabled") {
+ output->setEnabled(Op::isEq(Op::toScalar(value), 1.0));
+ } else if (key == "Range") {
+ std::pair<scalar, scalar> minmax = range(value);
+ output->setMinimum(minmax.first);
+ output->setMaximum(minmax.second);
+ } else if (key.substr(0, 2) == "MF") {
+ output->addTerm(parseTerm(value, engine));
+ } else if (key == "Default") {
+ output->setDefaultValue(fl::Op::toScalar(value));
+ } else if (key == "LockPrevious") {
+ output->setLockPreviousOutputValue(fl::Op::isEq(fl::Op::toScalar(value), 1.0));
+ } else if (key == "LockRange") {
+ output->setLockOutputValueInRange(fl::Op::isEq(fl::Op::toScalar(value), 1.0));
+ } else if (key == "NumMFs") {
+ //ignore
+ } else {
+ throw fl::Exception("[import error] token <" + key + "> not recognized", FL_AT);
+ }
+ }
+ }
+
+ void FisImporter::importRules(const std::string& section, Engine* engine) const {
+ std::istringstream reader(section);
+ std::string line;
+ std::getline(reader, line); //ignore first line [Rules]
+
+ RuleBlock* ruleblock = new RuleBlock;
+ engine->addRuleBlock(ruleblock);
+
+ while (std::getline(reader, line)) {
+ std::vector<std::string> inputsAndRest = fl::Op::split(line, ",");
+ if (inputsAndRest.size() != 2)
+ throw fl::Exception("[syntax error] expected rule to match pattern "
+ "<'i '+, 'o '+ (w) : '1|2'>, but found instead <" + line + ">", FL_AT);
+
+ std::vector <std::string> outputsAndRest = fl::Op::split(inputsAndRest.at(1), ":");
+ if (outputsAndRest.size() != 2)
+ throw fl::Exception("[syntax error] expected rule to match pattern "
+ "<'i '+, 'o '+ (w) : '1|2'>, but found instead <" + line + ">", FL_AT);
+
+ std::vector<std::string> inputs = fl::Op::split(inputsAndRest.at(0), " ");
+ std::vector<std::string> outputs = fl::Op::split(outputsAndRest.at(0), " ");
+ std::string weightInParenthesis = outputs.at(outputs.size() - 1);
+ outputs.erase(outputs.begin() + outputs.size() - 1);
+ std::string connector = fl::Op::trim(outputsAndRest.at(1));
+
+ if ((int) inputs.size() != engine->numberOfInputVariables()) {
+ std::ostringstream ss;
+ ss << "[syntax error] expected <" << engine->numberOfInputVariables() << ">"
+ " input variables, but found <" << inputs.size() << ">"
+ " input variables in rule <" << line << ">";
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+ if ((int) outputs.size() != engine->numberOfOutputVariables()) {
+ std::ostringstream ss;
+ ss << "[syntax error] expected <" << engine->numberOfOutputVariables() << ">"
+ " output variables, but found <" << outputs.size() << ">"
+ " output variables in rule <" << line << ">";
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+
+ std::vector<std::string> antecedent, consequent;
+
+ for (std::size_t i = 0; i < inputs.size(); ++i) {
+ scalar inputCode = fl::Op::toScalar(inputs.at(i));
+ if (fl::Op::isEq(inputCode, 0.0)) continue;
+ std::ostringstream ss;
+ ss << engine->getInputVariable(i)->getName() << " "
+ << fl::Rule::isKeyword() << " "
+ << translateProposition(inputCode, engine->getInputVariable(i));
+ antecedent.push_back(ss.str());
+ }
+
+ for (std::size_t i = 0; i < outputs.size(); ++i) {
+ scalar outputCode = fl::Op::toScalar(outputs.at(i));
+ if (fl::Op::isEq(outputCode, 0.0)) continue;
+ std::ostringstream ss;
+ ss << engine->getOutputVariable(i)->getName() << " "
+ << fl::Rule::isKeyword() << " "
+ << translateProposition(outputCode, engine->getOutputVariable(i));
+ consequent.push_back(ss.str());
+ }
+
+ std::ostringstream ruleText;
+
+ ruleText << fl::Rule::ifKeyword() << " ";
+ for (std::size_t i = 0; i < antecedent.size(); ++i) {
+ ruleText << antecedent.at(i);
+ if (i + 1 < antecedent.size()) {
+ ruleText << " ";
+ if (connector == "1") ruleText << fl::Rule::andKeyword() << " ";
+ else if (connector == "2") ruleText << fl::Rule::orKeyword() << " ";
+ else throw fl::Exception("[syntax error] connector <"
+ + connector + "> not recognized", FL_AT);
+ }
+ }
+
+ ruleText << " " << fl::Rule::thenKeyword() << " ";
+ for (std::size_t i = 0; i < consequent.size(); ++i) {
+ ruleText << consequent.at(i);
+ if (i + 1 < consequent.size()) {
+ ruleText << " " << fl::Rule::andKeyword() << " ";
+ }
+ }
+
+ std::ostringstream ss;
+ for (std::size_t i = 0; i < weightInParenthesis.size(); ++i) {
+ if (weightInParenthesis.at(i) == '('
+ or weightInParenthesis.at(i) == ')'
+ or weightInParenthesis.at(i) == ' ') continue;
+ ss << weightInParenthesis.at(i);
+ }
+
+ scalar weight = fl::Op::toScalar(ss.str());
+ if (not fl::Op::isEq(weight, 1.0))
+ ruleText << " " << fl::Rule::withKeyword() << " " << Op::str(weight);
+ Rule* rule = new Rule(ruleText.str());
+ try {
+ rule->load(engine);
+ } catch (...) {
+ //ignore
+ }
+ ruleblock->addRule(rule);
+ }
+ }
+
+ std::string FisImporter::translateProposition(scalar code, Variable* variable) const {
+ int intPart = (int) std::floor(std::fabs(code)) - 1;
+ scalar fracPart = std::fmod(std::fabs(code), 1.0);
+ if (intPart >= variable->numberOfTerms()) {
+ std::ostringstream ex;
+ ex << "[syntax error] the code <" << code << "> refers to a term "
+ "out of range from variable <" << variable->getName() << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ bool isAny = intPart < 0;
+ std::ostringstream ss;
+ if (code < 0) ss << Not().name() << " ";
+ if (fl::Op::isEq(fracPart, 0.01)) ss << Seldom().name() << " ";
+ else if (fl::Op::isEq(fracPart, 0.05)) ss << Somewhat().name() << " ";
+ else if (fl::Op::isEq(fracPart, 0.2)) ss << Very().name() << " ";
+ else if (fl::Op::isEq(fracPart, 0.3)) ss << Extremely().name() << " ";
+ else if (fl::Op::isEq(fracPart, 0.4)) ss << Very().name() << " " << Very().name() << " ";
+ else if (fl::Op::isEq(fracPart, 0.99)) ss << Any().name() << " ";
+ else if (not fl::Op::isEq(fracPart, 0))
+ throw fl::Exception("[syntax error] no hedge defined in FIS format for <"
+ + fl::Op::str(fracPart) + ">", FL_AT);
+ if (not isAny) {
+ ss << variable->getTerm(intPart)->getName();
+ }
+ return ss.str();
+ }
+
+ std::string FisImporter::extractTNorm(const std::string & name) const {
+ if (name.empty()) return "";
+ if (name == "min") return Minimum().className();
+ if (name == "prod") return AlgebraicProduct().className();
+ if (name == "bounded_difference") return BoundedDifference().className();
+ if (name == "drastic_product") return DrasticProduct().className();
+ if (name == "einstein_product") return EinsteinProduct().className();
+ if (name == "hamacher_product") return HamacherProduct().className();
+ if (name == "nilpotent_minimum") return NilpotentMinimum().className();
+ return name;
+ }
+
+ std::string FisImporter::extractSNorm(const std::string & name) const {
+ if (name.empty()) return "";
+ if (name == "max") return Maximum().className();
+ if (name == "sum" or name == "probor") return AlgebraicSum().className();
+ if (name == "bounded_sum") return BoundedSum().className();
+ if (name == "normalized_sum") return NormalizedSum().className();
+ if (name == "drastic_sum") return DrasticSum().className();
+ if (name == "einstein_sum") return EinsteinSum().className();
+ if (name == "hamacher_sum") return HamacherSum().className();
+ if (name == "nilpotent_maximum") return NilpotentMaximum().className();
+ return name;
+ }
+
+ std::string FisImporter::extractDefuzzifier(const std::string & name) const {
+ if (name.empty()) return "";
+ if (name == "centroid") return Centroid().className();
+ if (name == "bisector") return Bisector().className();
+ if (name == "lom") return LargestOfMaximum().className();
+ if (name == "mom") return MeanOfMaximum().className();
+ if (name == "som") return SmallestOfMaximum().className();
+ if (name == "wtaver") return WeightedAverage().className();
+ if (name == "wtsum") return WeightedSum().className();
+ return name;
+ }
+
+ std::pair<scalar, scalar> FisImporter::range(const std::string& range) const {
+ std::vector<std::string> parts = fl::Op::split(range, " ");
+ if (parts.size() != 2)
+ throw fl::Exception("[syntax error] expected range in format '[begin end]',"
+ " but found <" + range + ">", FL_AT);
+ std::string begin = parts.at(0), end = parts.at(1);
+ if (begin.at(0) != '[' or end.at(end.size() - 1) != ']')
+ throw fl::Exception("[syntax error] expected range in format '[begin end]',"
+ " but found <" + range + ">", FL_AT);
+ std::pair<scalar, scalar> result;
+ result.first = fl::Op::toScalar(begin.substr(1));
+ result.second = fl::Op::toScalar(end.substr(0, end.size() - 1));
+ return result;
+ }
+
+ Term * FisImporter::parseTerm(const std::string & fis, const Engine* engine) const {
+ std::ostringstream ss;
+ for (std::size_t i = 0; i < fis.size(); ++i) {
+ if (not (fis.at(i) == '[' or fis.at(i) == ']')) {
+ ss << fis.at(i);
+ }
+ }
+ std::string line = ss.str();
+
+ std::vector<std::string> nameTerm = fl::Op::split(line, ":");
+ if (nameTerm.size() != 2) {
+ throw fl::Exception("[syntax error] expected term in format 'name':'class',[params], "
+ "but found <" + line + ">", FL_AT);
+ }
+ std::vector<std::string> termParams = fl::Op::split(nameTerm.at(1), ",");
+ if (termParams.size() != 2) {
+ throw fl::Exception("[syntax error] expected term in format 'name':'class',[params], "
+ "but found " + line, FL_AT);
+ }
+
+ std::vector<std::string> parameters = fl::Op::split(termParams.at(1), " ");
+ for (std::size_t i = 0; i < parameters.size(); ++i) {
+ parameters.at(i) = fl::Op::trim(parameters.at(i));
+ }
+ return createInstance(
+ fl::Op::trim(termParams.at(0)),
+ fl::Op::trim(nameTerm.at(0)),
+ parameters, engine);
+ }
+
+ Term * FisImporter::createInstance(const std::string& mClass,
+ const std::string& name, const std::vector<std::string>& params,
+ const Engine* engine) const {
+ std::map<std::string, std::string> mapping;
+ mapping["discretemf"] = Discrete().className();
+ mapping["concavemf"] = Concave().className();
+ mapping["constant"] = Constant().className();
+ mapping["cosinemf"] = Cosine().className();
+ mapping["function"] = Function().className();
+ mapping["gbellmf"] = Bell().className();
+ mapping["gaussmf"] = Gaussian().className();
+ mapping["gauss2mf"] = GaussianProduct().className();
+ mapping["linear"] = Linear().className();
+ mapping["pimf"] = PiShape().className();
+ mapping["rampmf"] = Ramp().className();
+ mapping["rectmf"] = Rectangle().className();
+ mapping["smf"] = SShape().className();
+ mapping["sigmf"] = Sigmoid().className();
+ mapping["dsigmf"] = SigmoidDifference().className();
+ mapping["psigmf"] = SigmoidProduct().className();
+ mapping["spikemf"] = Spike().className();
+ mapping["trapmf"] = Trapezoid().className();
+ mapping["trimf"] = Triangle().className();
+ mapping["zmf"] = ZShape().className();
+
+ std::vector<std::string> sortedParams = params;
+
+ if (mClass == "gbellmf" and params.size() >= 3) {
+ sortedParams.at(0) = params.at(2);
+ sortedParams.at(1) = params.at(0);
+ sortedParams.at(2) = params.at(1);
+ } else if (mClass == "gaussmf" and params.size() >= 2) {
+ sortedParams.at(0) = params.at(1);
+ sortedParams.at(1) = params.at(0);
+ } else if (mClass == "gauss2mf" and params.size() >= 4) {
+ sortedParams.at(0) = params.at(1);
+ sortedParams.at(1) = params.at(0);
+ sortedParams.at(2) = params.at(3);
+ sortedParams.at(3) = params.at(2);
+ } else if (mClass == "sigmf" and params.size() >= 2) {
+ sortedParams.at(0) = params.at(1);
+ sortedParams.at(1) = params.at(0);
+ } else if (mClass == "dsigmf" and params.size() >= 4) {
+ sortedParams.at(0) = params.at(1);
+ sortedParams.at(1) = params.at(0);
+ sortedParams.at(2) = params.at(2);
+ sortedParams.at(3) = params.at(3);
+ } else if (mClass == "psigmf" and params.size() >= 4) {
+ sortedParams.at(0) = params.at(1);
+ sortedParams.at(1) = params.at(0);
+ sortedParams.at(2) = params.at(2);
+ sortedParams.at(3) = params.at(3);
+ }
+
+ std::string flClass;
+ std::map<std::string, std::string>::const_iterator it = mapping.find(mClass);
+ if (it != mapping.end()) flClass = it->second;
+ else flClass = mClass;
+
+ FL_unique_ptr<Term> term;
+ term.reset(FactoryManager::instance()->term()->constructObject(flClass));
+ Term::updateReference(term.get(), engine);
+ term->setName(Op::validName(name));
+ std::string separator;
+ if (not dynamic_cast<Function*> (term.get())) {
+ separator = " ";
+ }
+ term->configure(Op::join(sortedParams, separator));
+ return term.release();
+ }
+
+ FisImporter* FisImporter::clone() const {
+ return new FisImporter(*this);
+ }
+
+}
diff --git a/fuzzylite/src/imex/FldExporter.cpp b/fuzzylite/src/imex/FldExporter.cpp
new file mode 100644
index 0000000..9064250
--- /dev/null
+++ b/fuzzylite/src/imex/FldExporter.cpp
@@ -0,0 +1,246 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/FldExporter.h"
+
+#include "fl/Engine.h"
+#include "fl/Operation.h"
+#include "fl/variable/Variable.h"
+#include "fl/variable/InputVariable.h"
+#include "fl/variable/OutputVariable.h"
+
+#include <cmath>
+#include <fstream>
+#include <vector>
+
+namespace fl {
+
+ FldExporter::FldExporter(const std::string& separator) : Exporter(),
+ _separator(separator), _exportHeaders(true),
+ _exportInputValues(true), _exportOutputValues(true) {
+
+ }
+
+ FldExporter::~FldExporter() {
+ }
+
+ std::string FldExporter::name() const {
+ return "FldExporter";
+ }
+
+ void FldExporter::setSeparator(const std::string& separator) {
+ this->_separator = separator;
+ }
+
+ std::string FldExporter::getSeparator() const {
+ return this->_separator;
+ }
+
+ void FldExporter::setExportHeader(bool exportHeaders) {
+ this->_exportHeaders = exportHeaders;
+ }
+
+ bool FldExporter::exportsHeader() const {
+ return this->_exportHeaders;
+ }
+
+ void FldExporter::setExportInputValues(bool exportInputValues) {
+ this->_exportInputValues = exportInputValues;
+ }
+
+ bool FldExporter::exportsInputValues() const {
+ return this->_exportInputValues;
+ }
+
+ void FldExporter::setExportOutputValues(bool exportOutputValues) {
+ this->_exportOutputValues = exportOutputValues;
+ }
+
+ bool FldExporter::exportsOutputValues() const {
+ return this->_exportOutputValues;
+ }
+
+ std::string FldExporter::header(const Engine* engine) const {
+ std::vector<std::string> result;
+ if (_exportInputValues) {
+ for (int i = 0; i < engine->numberOfInputVariables(); ++i) {
+ InputVariable* inputVariable = engine->getInputVariable(i);
+ result.push_back("@InputVariable: " + inputVariable->getName() + ";");
+ }
+ }
+ if (_exportOutputValues) {
+ for (int i = 0; i < engine->numberOfOutputVariables(); ++i) {
+ OutputVariable* outputVariable = engine->getOutputVariable(i);
+ result.push_back("@OutputVariable: " + outputVariable->getName() + ";");
+ }
+ }
+ return "#@Engine: " + engine->getName() + ";\n#" + Op::join(result, _separator);
+ }
+
+ std::string FldExporter::toString(const Engine* engine) const {
+ return toString(const_cast<Engine*> (engine), 1024);
+ }
+
+ std::string FldExporter::toString(Engine* engine, int maximumNumberOfResults) const {
+ std::ostringstream result;
+ write(engine, result, maximumNumberOfResults);
+ return result.str();
+ }
+
+ void FldExporter::toFile(const std::string& path, Engine* engine, int maximumNumberOfResults) const {
+ std::ofstream writer(path.c_str());
+ if (not writer.is_open()) {
+ throw fl::Exception("[file error] file <" + path + "> could not be created", FL_AT);
+ }
+ write(engine, writer, maximumNumberOfResults);
+ writer.close();
+ }
+
+ std::string FldExporter::toString(Engine* engine, const std::string& inputData) const {
+ std::ostringstream writer;
+ if (_exportHeaders) writer << header(engine) << "\n";
+ std::istringstream reader(inputData);
+ std::string line;
+ while (std::getline(reader, line)) {
+ line = Op::trim(line);
+ if (not line.empty() and line.at(0) == '#') continue; //comments are ignored, blank lines are retained
+ std::vector<scalar> inputValues = parse(line);
+ write(engine, writer, inputValues);
+ writer.flush();
+ }
+ return writer.str();
+ }
+
+ void FldExporter::toFile(const std::string& path, Engine* engine, const std::string& inputData) const {
+ std::ofstream writer(path.c_str());
+ if (not writer.is_open()) {
+ throw fl::Exception("[file error] file <" + path + "> could not be created", FL_AT);
+ }
+ if (_exportHeaders) writer << header(engine) << "\n";
+ std::istringstream reader(inputData);
+ std::string line;
+ while (std::getline(reader, line)) {
+ line = Op::trim(line);
+ if (not line.empty() and line.at(0) == '#') continue; //comments are ignored, blank lines are retained
+ std::vector<scalar> inputValues = parse(line);
+ write(engine, writer, inputValues);
+ writer.flush();
+ }
+ writer.close();
+ }
+
+ std::vector<scalar> FldExporter::parse(const std::string& x) const {
+ std::vector<scalar> inputValues;
+ if (not (x.empty() or x.at(0) == '#')) {
+ std::istringstream tokenizer(x);
+ std::string token;
+ while (tokenizer >> token)
+ inputValues.push_back(fl::Op::toScalar(token));
+ }
+ return inputValues;
+ }
+
+ void FldExporter::write(Engine* engine, std::ostream& writer, int maximum) const {
+ if (_exportHeaders) writer << header(engine) << "\n";
+
+ int resolution = -1 + (int) std::max(1.0, std::pow(
+ maximum, 1.0 / engine->numberOfInputVariables()));
+ std::vector<int> sampleValues, minSampleValues, maxSampleValues;
+ for (int i = 0; i < engine->numberOfInputVariables(); ++i) {
+ sampleValues.push_back(0);
+ minSampleValues.push_back(0);
+ maxSampleValues.push_back(resolution);
+ }
+
+ engine->restart();
+
+ bool overflow = false;
+ std::vector<scalar> inputValues(engine->numberOfInputVariables());
+ while (not overflow) {
+ for (int i = 0; i < engine->numberOfInputVariables(); ++i) {
+ InputVariable* inputVariable = engine->getInputVariable(i);
+ inputValues.at(i) = inputVariable->getMinimum()
+ + sampleValues.at(i) * inputVariable->range() / std::max(1, resolution);
+ }
+ write(engine, writer, inputValues);
+ overflow = Op::increment(sampleValues, minSampleValues, maxSampleValues);
+ }
+ }
+
+ void FldExporter::write(Engine* engine, std::ostream& writer, std::istream& reader) const {
+ if (_exportHeaders) writer << header(engine) << "\n";
+
+ engine->restart();
+
+ std::string line;
+ int lineNumber = 0;
+ while (std::getline(reader, line)) {
+ ++lineNumber;
+ std::vector<scalar> inputValues = parse(Op::trim(line));
+ try {
+ write(engine, writer, inputValues);
+ } catch (fl::Exception& ex) {
+ ex.append(" writing line <" + Op::str(lineNumber) + ">");
+ throw;
+ }
+ }
+ }
+
+ void FldExporter::write(Engine* engine, std::ostream& writer, const std::vector<scalar>& inputValues) const {
+ if (inputValues.empty()) {
+ writer << "\n";
+ return;
+ }
+ if (int(inputValues.size()) < engine->numberOfInputVariables()) {
+ std::ostringstream ex;
+ ex << "[export error] engine has <" << engine->numberOfInputVariables() << "> "
+ "input variables, but input data provides <" << inputValues.size() << "> values";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ std::vector<std::string> values;
+ for (int i = 0; i < engine->numberOfInputVariables(); ++i) {
+ InputVariable* inputVariable = engine->getInputVariable(i);
+ scalar inputValue = inputVariable->isEnabled() ? inputValues.at(i) : fl::nan;
+ inputVariable->setInputValue(inputValue);
+ if (_exportInputValues) values.push_back(Op::str(inputValue));
+ }
+
+ engine->process();
+
+ for (int i = 0; i < engine->numberOfOutputVariables(); ++i) {
+ OutputVariable* outputVariable = engine->getOutputVariable(i);
+ outputVariable->defuzzify();
+ if (_exportOutputValues)
+ values.push_back(Op::str(outputVariable->getOutputValue()));
+ }
+
+ writer << Op::join(values, _separator) << "\n";
+ }
+
+ FldExporter* FldExporter::clone() const {
+ return new FldExporter(*this);
+ }
+
+}
diff --git a/fuzzylite/src/imex/FllExporter.cpp b/fuzzylite/src/imex/FllExporter.cpp
new file mode 100644
index 0000000..0ffeb2f
--- /dev/null
+++ b/fuzzylite/src/imex/FllExporter.cpp
@@ -0,0 +1,189 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/FllExporter.h"
+
+#include "fl/Headers.h"
+
+namespace fl {
+
+ FllExporter::FllExporter(const std::string& indent, const std::string& separator)
+ : Exporter(), _indent(indent), _separator(separator) {
+ }
+
+ FllExporter::~FllExporter() {
+ }
+
+ std::string FllExporter::name() const {
+ return "FllExporter";
+ }
+
+ void FllExporter::setIndent(const std::string& indent) {
+ this->_indent = indent;
+ }
+
+ std::string FllExporter::getIndent() const {
+ return this->_indent;
+ }
+
+ void FllExporter::setSeparator(const std::string& separator) {
+ this->_separator = separator;
+ }
+
+ std::string FllExporter::getSeparator() const {
+ return this->_separator;
+ }
+
+ std::string FllExporter::toString(const Engine* engine) const {
+ std::vector<std::string> result;
+ result.push_back("Engine: " + engine->getName());
+ result.push_back(toString(engine->inputVariables()));
+ result.push_back(toString(engine->outputVariables()));
+ result.push_back(toString(engine->ruleBlocks()));
+ return Op::join(result, _separator);
+ }
+
+ std::string FllExporter::toString(const std::vector<Variable*>& variables) const {
+ std::vector<std::string> result;
+ for (std::size_t i = 0; i < variables.size(); ++i) {
+ result.push_back(toString(variables.at(i)));
+ }
+ return Op::join(result, _separator);
+ }
+
+ std::string FllExporter::toString(const std::vector<InputVariable*>& variables) const {
+ std::vector<std::string> result;
+ for (std::size_t i = 0; i < variables.size(); ++i) {
+ result.push_back(toString(variables.at(i)));
+ }
+ return Op::join(result, _separator);
+ }
+
+ std::string FllExporter::toString(const std::vector<OutputVariable*>& variables) const {
+ std::vector<std::string> result;
+ for (std::size_t i = 0; i < variables.size(); ++i) {
+ result.push_back(toString(variables.at(i)));
+ }
+ return Op::join(result, _separator);
+ }
+
+ std::string FllExporter::toString(const std::vector<RuleBlock*>& ruleBlocks) const {
+ std::vector<std::string> result;
+ for (std::size_t i = 0; i < ruleBlocks.size(); ++i) {
+ result.push_back(toString(ruleBlocks.at(i)));
+ }
+ return Op::join(result, _separator);
+ }
+
+ std::string FllExporter::toString(const Variable* variable) const {
+ std::vector<std::string> result;
+ result.push_back("Variable: " + Op::validName(variable->getName()));
+ result.push_back(_indent + "enabled: " + (variable->isEnabled() ? "true" : "false"));
+ result.push_back(_indent + "range: " + Op::join(2, " ",
+ variable->getMinimum(), variable->getMaximum()));
+ for (int i = 0; i < variable->numberOfTerms(); ++i) {
+ result.push_back(_indent + toString(variable->getTerm(i)));
+ }
+ return Op::join(result, _separator);
+ }
+
+ std::string FllExporter::toString(const InputVariable* inputVariable) const {
+ std::vector<std::string> result;
+ result.push_back("InputVariable: " + Op::validName(inputVariable->getName()));
+ result.push_back(_indent + "enabled: " + (inputVariable->isEnabled() ? "true" : "false"));
+ result.push_back(_indent + "range: " + Op::join(2, " ",
+ inputVariable->getMinimum(), inputVariable->getMaximum()));
+ for (int i = 0; i < inputVariable->numberOfTerms(); ++i) {
+ result.push_back(_indent + toString(inputVariable->getTerm(i)));
+ }
+ return Op::join(result, _separator);
+ }
+
+ std::string FllExporter::toString(const OutputVariable* outputVariable) const {
+ std::vector<std::string> result;
+ result.push_back("OutputVariable: " + Op::validName(outputVariable->getName()));
+ result.push_back(_indent + "enabled: " + (outputVariable->isEnabled() ? "true" : "false"));
+ result.push_back(_indent + "range: " + Op::join(2, " ",
+ outputVariable->getMinimum(), outputVariable->getMaximum()));
+ result.push_back(_indent + "accumulation: " +
+ toString(outputVariable->fuzzyOutput()->getAccumulation()));
+ result.push_back(_indent + "defuzzifier: " +
+ toString(outputVariable->getDefuzzifier()));
+ result.push_back(_indent + "default: " + Op::str(outputVariable->getDefaultValue()));
+ result.push_back(_indent + "lock-previous: " +
+ (outputVariable->isLockedPreviousOutputValue() ? "true" : "false"));
+ result.push_back(_indent + "lock-range: " +
+ (outputVariable->isLockedOutputValueInRange() ? "true" : "false"));
+ for (int i = 0; i < outputVariable->numberOfTerms(); ++i) {
+ result.push_back(_indent + toString(outputVariable->getTerm(i)));
+ }
+ return Op::join(result, _separator);
+ }
+
+ std::string FllExporter::toString(const RuleBlock* ruleBlock) const {
+ std::vector<std::string> result;
+ result.push_back("RuleBlock: " + ruleBlock->getName());
+ result.push_back(_indent + "enabled: " +
+ (ruleBlock->isEnabled() ? "true" : "false"));
+ result.push_back(_indent + "conjunction: " + toString(ruleBlock->getConjunction()));
+ result.push_back(_indent + "disjunction: " + toString(ruleBlock->getDisjunction()));
+ result.push_back(_indent + "activation: " + toString(ruleBlock->getActivation()));
+ for (int i = 0; i < ruleBlock->numberOfRules(); ++i) {
+ result.push_back(_indent + toString(ruleBlock->getRule(i)));
+ }
+ return Op::join(result, _separator);
+ }
+
+ std::string FllExporter::toString(const Rule* rule) const {
+ return "rule: " + rule->getText();
+ }
+
+ std::string FllExporter::toString(const Term* term) const {
+ return "term: " + Op::validName(term->getName()) + " " + term->className()
+ + " " + term->parameters();
+ }
+
+ std::string FllExporter::toString(const Norm* norm) const {
+ if (norm) return norm->className();
+ return "none";
+ }
+
+ std::string FllExporter::toString(const Defuzzifier* defuzzifier) const {
+ if (not defuzzifier) return "none";
+ if (const IntegralDefuzzifier * integralDefuzzifier =
+ dynamic_cast<const IntegralDefuzzifier*> (defuzzifier)) {
+ return defuzzifier->className() + " " + Op::str<int>(integralDefuzzifier->getResolution());
+
+ } else if (const WeightedDefuzzifier * weightedDefuzzifier =
+ dynamic_cast<const WeightedDefuzzifier*> (defuzzifier)) {
+ return weightedDefuzzifier->className() + " " + weightedDefuzzifier->getTypeName();
+ }
+ return defuzzifier->className();
+ }
+
+ FllExporter* FllExporter::clone() const {
+ return new FllExporter(*this);
+ }
+
+}
diff --git a/fuzzylite/src/imex/FllImporter.cpp b/fuzzylite/src/imex/FllImporter.cpp
new file mode 100644
index 0000000..2443d10
--- /dev/null
+++ b/fuzzylite/src/imex/FllImporter.cpp
@@ -0,0 +1,317 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/FllImporter.h"
+
+#include "fl/Headers.h"
+
+#include <queue>
+
+namespace fl {
+
+ FllImporter::FllImporter(const std::string& separator) : Importer(),
+ _separator(separator) {
+ }
+
+ FllImporter::~FllImporter() {
+
+ }
+
+ std::string FllImporter::name() const {
+ return "FllImporter";
+ }
+
+ void FllImporter::setSeparator(const std::string& separator) {
+ this->_separator = separator;
+ }
+
+ std::string FllImporter::getSeparator() const {
+ return this->_separator;
+ }
+
+ Engine* FllImporter::fromString(const std::string& fll) const {
+ FL_unique_ptr<Engine> engine(new Engine);
+
+ std::string tag;
+ std::ostringstream block;
+ std::istringstream fclReader(fll);
+ std::string line;
+ std::queue<std::string> lineQueue;
+
+ bool processPending = false;
+ int lineNumber = 0;
+ while (not lineQueue.empty() or std::getline(fclReader, line)) {
+ if (not lineQueue.empty()) {
+ line = lineQueue.front();
+ lineQueue.pop();
+ } else {
+ line = clean(line);
+ if (line.empty()) continue;
+ std::vector<std::string> split = Op::split(line, _separator);
+ line = clean(split.front());
+ for (std::size_t i = 1; i < split.size(); ++i) {
+ lineQueue.push(clean(split.at(i)));
+ }
+ ++lineNumber;
+ }
+ if (line.empty()) continue;
+ std::size_t colon = line.find_first_of(':');
+ if (colon == std::string::npos) {
+ throw fl::Exception("[import error] expected a colon at line " +
+ Op::str(lineNumber) + ": " + line, FL_AT);
+ }
+ std::string key = Op::trim(line.substr(0, colon));
+ std::string value = Op::trim(line.substr(colon + 1));
+ if ("Engine" == key) {
+ engine->setName(value);
+ continue;
+ } else {
+ processPending = (key == "InputVariable"
+ or key == "OutputVariable"
+ or key == "RuleBlock");
+ }
+ if (processPending) {
+ process(tag, block.str(), engine.get());
+ block.str(""); //clear buffer
+ block.clear(); //clear error flags
+ processPending = false;
+ tag = key;
+ }
+ block << key << ":" << value << "\n";
+ }
+ process(tag, block.str(), engine.get());
+ return engine.release();
+ }
+
+ void FllImporter::process(const std::string& tag, const std::string& block, Engine* engine) const {
+ if (tag.empty()) return;
+ if ("InputVariable" == tag) {
+ processInputVariable(block, engine);
+ } else if ("OutputVariable" == tag) {
+ processOutputVariable(block, engine);
+ } else if ("RuleBlock" == tag) {
+ processRuleBlock(block, engine);
+ } else {
+ throw fl::Exception("[import error] block tag <" + tag + "> not recognized", FL_AT);
+ }
+ }
+
+ void FllImporter::processInputVariable(const std::string& block, Engine* engine) const {
+ std::istringstream reader(block);
+ std::string line;
+ InputVariable* inputVariable = new InputVariable;
+ engine->addInputVariable(inputVariable);
+ while (std::getline(reader, line)) {
+ std::pair<std::string, std::string> keyValue = parseKeyValue(line, ':');
+ if ("InputVariable" == keyValue.first) {
+ inputVariable->setName(Op::validName(keyValue.second));
+ } else if ("enabled" == keyValue.first) {
+ inputVariable->setEnabled(parseBoolean(keyValue.second));
+ } else if ("range" == keyValue.first) {
+ std::pair<scalar, scalar> range = parseRange(keyValue.second);
+ inputVariable->setRange(range.first, range.second);
+ } else if ("term" == keyValue.first) {
+ inputVariable->addTerm(parseTerm(keyValue.second, engine));
+ } else {
+ throw fl::Exception("[import error] key <" + keyValue.first + "> not "
+ "recognized in pair <" + keyValue.first + ":" + keyValue.second + ">", FL_AT);
+ }
+ }
+ }
+
+ void FllImporter::processOutputVariable(const std::string& block, Engine* engine) const {
+ std::istringstream reader(block);
+ std::string line;
+ OutputVariable* outputVariable = new OutputVariable;
+ engine->addOutputVariable(outputVariable);
+ while (std::getline(reader, line)) {
+ std::pair<std::string, std::string> keyValue = parseKeyValue(line, ':');
+ if ("OutputVariable" == keyValue.first) {
+ outputVariable->setName(Op::validName(keyValue.second));
+ } else if ("enabled" == keyValue.first) {
+ outputVariable->setEnabled(parseBoolean(keyValue.second));
+ } else if ("range" == keyValue.first) {
+ std::pair<scalar, scalar> range = parseRange(keyValue.second);
+ outputVariable->setRange(range.first, range.second);
+ } else if ("default" == keyValue.first) {
+ outputVariable->setDefaultValue(Op::toScalar(keyValue.second));
+ } else if ("lock-previous" == keyValue.first or "lock-valid" == keyValue.first) {
+ outputVariable->setLockPreviousOutputValue(parseBoolean(keyValue.second));
+ } else if ("lock-range" == keyValue.first) {
+ outputVariable->setLockOutputValueInRange(parseBoolean(keyValue.second));
+ } else if ("defuzzifier" == keyValue.first) {
+ outputVariable->setDefuzzifier(parseDefuzzifier(keyValue.second));
+ } else if ("accumulation" == keyValue.first) {
+ outputVariable->fuzzyOutput()->setAccumulation(parseSNorm(keyValue.second));
+ } else if ("term" == keyValue.first) {
+ outputVariable->addTerm(parseTerm(keyValue.second, engine));
+ } else {
+ throw fl::Exception("[import error] key <" + keyValue.first + "> not "
+ "recognized in pair <" + keyValue.first + ":" + keyValue.second + ">", FL_AT);
+ }
+ }
+ }
+
+ void FllImporter::processRuleBlock(const std::string& block, Engine* engine) const {
+ std::istringstream reader(block);
+ std::string line;
+ RuleBlock* ruleBlock = new RuleBlock;
+ engine->addRuleBlock(ruleBlock);
+ while (std::getline(reader, line)) {
+ std::pair<std::string, std::string> keyValue = parseKeyValue(line, ':');
+ if ("RuleBlock" == keyValue.first) {
+ ruleBlock->setName(keyValue.second);
+ } else if ("enabled" == keyValue.first) {
+ ruleBlock->setEnabled(parseBoolean(keyValue.second));
+ } else if ("conjunction" == keyValue.first) {
+ ruleBlock->setConjunction(parseTNorm(keyValue.second));
+ } else if ("disjunction" == keyValue.first) {
+ ruleBlock->setDisjunction(parseSNorm(keyValue.second));
+ } else if ("activation" == keyValue.first) {
+ ruleBlock->setActivation(parseTNorm(keyValue.second));
+ } else if ("rule" == keyValue.first) {
+ Rule* rule = new Rule;
+ rule->setText(keyValue.second);
+ try {
+ rule->load(engine);
+ } catch (std::exception& ex) {
+ FL_LOG(ex.what());
+ }
+ ruleBlock->addRule(rule);
+ } else {
+ throw fl::Exception("[import error] key <" + keyValue.first + "> not "
+ "recognized in pair <" + keyValue.first + ":" + keyValue.second + ">", FL_AT);
+ }
+ }
+ }
+
+ Term* FllImporter::parseTerm(const std::string& text, Engine* engine) const {
+ std::vector<std::string> tokens = Op::split(text, " ");
+
+ //MEDIUM Triangle 0.500 1.000 1.500
+
+ if (tokens.size() < 2) {
+ throw fl::Exception("[syntax error] expected a term in format <name class parameters>, "
+ "but found <" + text + ">", FL_AT);
+ }
+ FL_unique_ptr<Term> term;
+ term.reset(FactoryManager::instance()->term()->constructObject(tokens.at(1)));
+ Term::updateReference(term.get(), engine);
+ term->setName(Op::validName(tokens.at(0)));
+ std::ostringstream parameters;
+ for (std::size_t i = 2; i < tokens.size(); ++i) {
+ parameters << tokens.at(i);
+ if (i + 1 < tokens.size()) parameters << " ";
+ }
+ term->configure(parameters.str());
+ return term.release();
+ }
+
+ TNorm* FllImporter::parseTNorm(const std::string& name) const {
+ if (name == "none") return FactoryManager::instance()->tnorm()->constructObject("");
+ return FactoryManager::instance()->tnorm()->constructObject(name);
+ }
+
+ SNorm* FllImporter::parseSNorm(const std::string& name) const {
+ if (name == "none") return FactoryManager::instance()->snorm()->constructObject("");
+ return FactoryManager::instance()->snorm()->constructObject(name);
+ }
+
+ Defuzzifier* FllImporter::parseDefuzzifier(const std::string& text) const {
+ std::vector<std::string> parameters = Op::split(text, " ");
+ std::string name = parameters.at(0);
+ if (name == "none") return FactoryManager::instance()->defuzzifier()->constructObject("");
+ Defuzzifier* defuzzifier = FactoryManager::instance()->defuzzifier()->constructObject(name);
+ if (parameters.size() > 1) {
+ std::string parameter(parameters.at(1));
+ if (IntegralDefuzzifier * integralDefuzzifier = dynamic_cast<IntegralDefuzzifier*> (defuzzifier)) {
+ integralDefuzzifier->setResolution((int) Op::toScalar(parameter));
+ } else if (WeightedDefuzzifier * weightedDefuzzifier = dynamic_cast<WeightedDefuzzifier*> (defuzzifier)) {
+ WeightedDefuzzifier::Type type = WeightedDefuzzifier::Automatic;
+ if (parameter == "Automatic") type = WeightedDefuzzifier::Automatic;
+ else if (parameter == "TakagiSugeno") type = WeightedDefuzzifier::TakagiSugeno;
+ else if (parameter == "Tsukamoto") type = WeightedDefuzzifier::Tsukamoto;
+ else throw fl::Exception("[syntax error] unknown parameter of WeightedDefuzzifier <" + parameter + ">", FL_AT);
+ weightedDefuzzifier->setType(type);
+ }
+ }
+ return defuzzifier;
+ }
+
+ std::pair<scalar, scalar> FllImporter::parseRange(const std::string& text) const {
+ std::pair<std::string, std::string> range = parseKeyValue(text, ' ');
+ return std::pair<scalar, scalar>(Op::toScalar(range.first), Op::toScalar(range.second));
+ }
+
+ bool FllImporter::parseBoolean(const std::string& boolean) const {
+ if ("true" == boolean) return true;
+ if ("false" == boolean) return false;
+ throw fl::Exception("[syntax error] expected boolean <true|false>, "
+ "but found <" + boolean + ">", FL_AT);
+ }
+
+ std::pair<std::string, std::string> FllImporter::parseKeyValue(const std::string& text,
+ char separator) const {
+ std::size_t half = text.find_first_of(separator);
+ if (half == std::string::npos) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected pair in the form "
+ "<key" << separator << "value>, but found <" << text << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ std::pair<std::string, std::string> result;
+ result.first = text.substr(0, half);
+ result.second = text.substr(half + 1);
+ return result;
+ }
+
+ std::string FllImporter::clean(const std::string& line) const {
+ if (line.empty()) return line;
+ if (line.size() == 1) return isspace(line.at(0)) ? "" : line;
+ int start = 0, end = line.size() - 1;
+ while (start <= end and isspace(line.at(start))) {
+ ++start;
+ }
+ int sharp = start;
+ while (sharp <= end) {
+ if (line.at(sharp) == '#') {
+ end = sharp - 1;
+ break;
+ }
+ ++sharp;
+ }
+ while (end >= start and (line.at(end) == '#' or isspace(line.at(end)))) {
+ --end;
+ }
+
+ int length = end - start + 1;
+ return line.substr(start, length);
+ }
+
+ FllImporter* FllImporter::clone() const {
+ return new FllImporter(*this);
+ }
+
+
+}
diff --git a/fuzzylite/src/imex/Importer.cpp b/fuzzylite/src/imex/Importer.cpp
new file mode 100644
index 0000000..faef71d
--- /dev/null
+++ b/fuzzylite/src/imex/Importer.cpp
@@ -0,0 +1,54 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/Importer.h"
+#include "fl/Exception.h"
+
+#include <fstream>
+#include <ostream>
+
+namespace fl {
+
+ Importer::Importer() {
+ }
+
+ Importer::~Importer() {
+
+ }
+
+ Engine* Importer::fromFile(const std::string& path) const {
+ std::ifstream reader(path.c_str());
+ if (not reader.is_open()) {
+ throw fl::Exception("[file error] file <" + path + "> could not be opened", FL_AT);
+ }
+ std::ostringstream textEngine;
+ std::string line;
+ while (std::getline(reader, line)) {
+ textEngine << line << std::endl;
+ }
+ reader.close();
+ return fromString(textEngine.str());
+ }
+
+}
diff --git a/fuzzylite/src/imex/JavaExporter.cpp b/fuzzylite/src/imex/JavaExporter.cpp
new file mode 100644
index 0000000..a4948f8
--- /dev/null
+++ b/fuzzylite/src/imex/JavaExporter.cpp
@@ -0,0 +1,228 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/imex/JavaExporter.h"
+
+#include "fl/Headers.h"
+
+#include <algorithm>
+namespace fl {
+
+ JavaExporter::JavaExporter() : Exporter() {
+ }
+
+ JavaExporter::~JavaExporter() {
+
+ }
+
+ std::string JavaExporter::name() const {
+ return "JavaExporter";
+ }
+
+ std::string JavaExporter::toString(const Engine* engine) const {
+ std::ostringstream ss;
+ ss << "Engine engine = new Engine();\n";
+ ss << "engine.setName(\"" << engine->getName() << "\");\n";
+ ss << "\n";
+
+ for (int i = 0; i < engine->numberOfInputVariables(); ++i) {
+ ss << toString(engine->getInputVariable(i), engine) << "\n";
+ }
+
+ for (int i = 0; i < engine->numberOfOutputVariables(); ++i) {
+ ss << toString(engine->getOutputVariable(i), engine) << "\n";
+ }
+
+ for (int i = 0; i < engine->numberOfRuleBlocks(); ++i) {
+ ss << toString(engine->getRuleBlock(i), engine) << "\n";
+ }
+
+ return ss.str();
+ }
+
+ std::string JavaExporter::toString(const InputVariable* inputVariable, const Engine* engine) const {
+ std::ostringstream ss;
+ std::string name = "inputVariable";
+ if (engine->numberOfInputVariables() > 1) {
+ int index = std::distance(engine->inputVariables().begin(),
+ std::find(engine->inputVariables().begin(),
+ engine->inputVariables().end(), inputVariable));
+ name += Op::str<int>(index + 1);
+ }
+ ss << "InputVariable " << name << " = new InputVariable();\n";
+ ss << name << ".setEnabled(" << (inputVariable->isEnabled() ? "true" : "false") << ");\n";
+ ss << name << ".setName(\"" << inputVariable->getName() << "\");\n";
+ ss << name << ".setRange("
+ << toString(inputVariable->getMinimum()) << ", "
+ << toString(inputVariable->getMaximum()) << ");\n";
+
+ for (int i = 0; i < inputVariable->numberOfTerms(); ++i) {
+ ss << name << ".addTerm(" <<
+ toString(inputVariable->getTerm(i)) << ");\n";
+ }
+ ss << "engine.addInputVariable(" << name << ");\n";
+ return ss.str();
+ }
+
+ std::string JavaExporter::toString(const OutputVariable* outputVariable, const Engine* engine) const {
+ std::ostringstream ss;
+ std::string name = "outputVariable";
+ if (engine->numberOfOutputVariables() > 1) {
+ int index = std::distance(engine->outputVariables().begin(),
+ std::find(engine->outputVariables().begin(),
+ engine->outputVariables().end(), outputVariable));
+ name += Op::str<int>(index + 1);
+ }
+ ss << "OutputVariable " << name << " = new OutputVariable();\n";
+ ss << name << ".setEnabled(" << (outputVariable->isEnabled() ? "true" : "false") << ");\n";
+ ss << name << ".setName(\"" << outputVariable->getName() << "\");\n";
+ ss << name << ".setRange("
+ << toString(outputVariable->getMinimum()) << ", "
+ << toString(outputVariable->getMaximum()) << ");\n";
+ ss << name << ".fuzzyOutput().setAccumulation(" <<
+ toString(outputVariable->fuzzyOutput()->getAccumulation()) << ");\n";
+ ss << name << ".setDefuzzifier(" <<
+ toString(outputVariable->getDefuzzifier()) << ");\n";
+ ss << name << ".setDefaultValue(" <<
+ toString(outputVariable->getDefaultValue()) << ");\n";
+ ss << name << ".setLockPreviousOutputValue(" <<
+ (outputVariable->isLockedPreviousOutputValue() ? "true" : "false") << ");\n";
+ ss << name << ".setLockOutputValueInRange(" <<
+ (outputVariable->isLockedOutputValueInRange() ? "true" : "false") << ");\n";
+ for (int i = 0; i < outputVariable->numberOfTerms(); ++i) {
+ ss << name << ".addTerm(" <<
+ toString(outputVariable->getTerm(i)) << ");\n";
+ }
+ ss << "engine.addOutputVariable(" << name << ");\n";
+ return ss.str();
+ }
+
+ std::string JavaExporter::toString(const RuleBlock* ruleBlock, const Engine* engine) const {
+ std::ostringstream ss;
+ std::string name = "ruleBlock";
+ if (engine->numberOfRuleBlocks() > 1) {
+ int index = std::distance(engine->ruleBlocks().begin(),
+ std::find(engine->ruleBlocks().begin(),
+ engine->ruleBlocks().end(), ruleBlock));
+ name += Op::str<int>(index + 1);
+ }
+ ss << "RuleBlock " << name << " = new RuleBlock();\n";
+ ss << name << ".setEnabled(" << (ruleBlock->isEnabled() ? "true" : "false") << ");\n";
+ ss << name << ".setName(\"" << ruleBlock->getName() << "\");\n";
+ ss << name << ".setConjunction("
+ << toString(ruleBlock->getConjunction()) << ");\n";
+ ss << name << ".setDisjunction("
+ << toString(ruleBlock->getDisjunction()) << ");\n";
+ ss << name << ".setActivation("
+ << toString(ruleBlock->getActivation()) << ");\n";
+ for (int i = 0; i < ruleBlock->numberOfRules(); ++i) {
+ Rule* rule = ruleBlock->getRule(i);
+ ss << name << ".addRule(Rule.parse(\"" << rule->getText() << "\", engine));\n";
+ }
+ ss << "engine.addRuleBlock(" << name << ");\n";
+ return ss.str();
+ }
+
+ std::string JavaExporter::toString(const Term* term) const {
+ if (not term) {
+ return "null";
+ }
+
+ if (const Discrete * discrete = dynamic_cast<const Discrete*> (term)) {
+ std::ostringstream ss;
+ std::vector<scalar> xy;
+ ss << term->className() << ".create(\"" << term->getName() << "\", "
+ << Op::join(Discrete::toVector(discrete->xy()), ", ") << ")";
+ return ss.str();
+ }
+
+ if (const Function * function = dynamic_cast<const Function*> (term)) {
+ std::ostringstream ss;
+ ss << term->className() << ".create(\"" << term->getName() << "\", "
+ << "\"" << function->getFormula() << "\", engine)";
+ return ss.str();
+ }
+
+ if (const Linear * linear = dynamic_cast<const Linear*> (term)) {
+ std::ostringstream ss;
+ ss << term->className() << ".create(\"" << term->getName() << "\", "
+ << "engine, " << Op::join(linear->coefficients(), ", ") << ")";
+ return ss.str();
+ }
+
+ std::ostringstream ss;
+ ss << "new " << term->className() << "(\"" << term->getName() << "\", "
+ << Op::findReplace(term->parameters(), " ", ", ") << ")";
+ return ss.str();
+ }
+
+ std::string JavaExporter::toString(const Defuzzifier* defuzzifier) const {
+ if (not defuzzifier) return "null";
+
+ if (const IntegralDefuzzifier * integralDefuzzifier =
+ dynamic_cast<const IntegralDefuzzifier*> (defuzzifier)) {
+ return "new " + integralDefuzzifier->className() + "("
+ + fl::Op::str(integralDefuzzifier->getResolution()) + ")";
+ }
+ if (const WeightedDefuzzifier * weightedDefuzzifier =
+ dynamic_cast<const WeightedDefuzzifier*> (defuzzifier)) {
+ return "new " + weightedDefuzzifier->className() +
+ "(\"" + weightedDefuzzifier->getTypeName() + "\")";
+ }
+ return "new " + defuzzifier->className() + "()";
+ }
+
+ std::string JavaExporter::toString(const Norm* norm) const{
+ if (not norm) return "null";
+ return "new " + norm->className() + "()";
+ }
+
+ std::string JavaExporter::toString(const TNorm* norm) const {
+ if (not norm) return "null";
+ return "new " + norm->className() + "()";
+ }
+
+ std::string JavaExporter::toString(const SNorm* norm) const {
+ if (not norm) return "null";
+ return "new " + norm->className() + "()";
+ }
+
+ std::string JavaExporter::toString(scalar value) const {
+ if (Op::isNaN(value)) {
+ return "Double.NaN";
+ } else if (Op::isInf(value)) {
+ return (value > 0
+ ? "Double.POSITIVE_INFINITY"
+ : "Double.NEGATIVE_INFINITY");
+ }
+ return Op::str(value);
+ }
+
+ JavaExporter* JavaExporter::clone() const {
+ return new JavaExporter(*this);
+ }
+
+
+}
+
diff --git a/fuzzylite/src/m/compare.m b/fuzzylite/src/m/compare.m
new file mode 100755
index 0000000..56da68d
--- /dev/null
+++ b/fuzzylite/src/m/compare.m
@@ -0,0 +1,60 @@
+%{/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite (R) is a registered trademark of FuzzyLite Limited.
+ */
+}%
+
+function [engine] = compare(fisFile, fldFile, delimiter, hasMetadata)
+if (nargin < 3)
+ delimiter = ' ';
+end
+if (nargin < 4)
+ hasMetadata = true;
+end
+
+engine = readfis(fisFile);
+flMatrix = dlmread(fldFile, delimiter, hasMetadata ~ = 0, 0);
+
+if (length(engine.input) + length(engine.output) ~ = size(flMatrix, 2))
+ error('fuzzylite:compare.m', 'Number of inputs and outputs in engine differ from FLD matrix');
+end
+
+if (isempty(engine.andMethod))
+ engine.andMethod = 'min';
+end
+if (isempty(engine.orMethod))
+ engine.orMethod = 'max';
+end
+
+engine.inputValues = flMatrix(1 : end, 1 : length(engine.input));
+engine.outputValues = evalfis(engine.inputValues, engine);
+engine.flOutputValues = flMatrix(1 : end, (length(engine.input) + 1) : (length(engine.input) + length(engine.output)));
+engine.outputDiff = engine.outputValues - engine.flOutputValues;
+engine.fld = [engine.inputValues engine.outputValues engine.flOutputValues engine.outputDiff];
+engine.nanfreeDiff = engine.outputDiff;
+engine.nanfreeDiff(find(isnan(engine.nanfreeDiff))) = 0;
+engine.mse = nansum(engine.outputDiff.^2) / size(engine.outputDiff, 1);
+engine.quantiles = prctile(engine.nanfreeDiff, 0 : 25 : 100);
+
+end
+
+
+
diff --git a/fuzzylite/src/m/compare_examples.m b/fuzzylite/src/m/compare_examples.m
new file mode 100755
index 0000000..1bf6818
--- /dev/null
+++ b/fuzzylite/src/m/compare_examples.m
@@ -0,0 +1,45 @@
+%{/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite (R) is a registered trademark of FuzzyLite Limited.
+ */
+}%
+
+
+function [ engines ] = compare_examples(path, delimiter, hasMetadata)
+if (nargin < 2)
+ delimiter = ' ';
+end
+if (nargin < 3)
+ hasMetadata = true;
+end
+
+examples = {'\mamdani\SimpleDimmer', '\mamdani\matlab\mam21', '\mamdani\matlab\mam22', '\mamdani\matlab\shower', '\mamdani\matlab\tank', '\mamdani\matlab\tank2', '\mamdani\matlab\tipper', '\mamdani\matlab\tipper1', '\mamdani\octave\mamdani_tip_calculator', '\takagi-sugeno\SimpleDimmer', '\takagi-sugeno\matlab\fpeaks', '\takagi-sugeno\matlab\invkine1', '\takagi-sugeno\matlab\invkine2', '\takagi-sugeno\matlab\juggler', '\takagi-sugeno\matlab\membrn1', '\takagi-sugeno\matlab\membrn2', '\takagi-sugeno\matlab\slbb', '\takagi-sugeno\matlab\slcp', '\takagi-sugeno\matlab\slcp1', '\takagi-sugeno\matlab\slcpp1', '\takagi-sugeno\matlab\sltbu_fl', '\takagi-sugeno\matlab\sugeno1', '\takagi-sugeno\matlab\tanksg', '\takagi-sugeno\matlab\tippersg', '\takagi-sugeno\octave\cubic_approximator', '\takagi-sugeno\octave\heart_disease_risk', '\takagi-sugeno\octave\linear_tip_calculator'};
+pending = {'\mamdani\octave\investment_portfolio', '\takagi-sugeno\approximation', '\takagi-sugeno\octave\sugeno_tip_calculator', '\tsukamoto\tsukamoto'};
+engines = [];
+for i = 1 : length(examples)
+ fisFile = strcat(path, examples{i}, '.fis')
+ fldFile = strcat(path, examples{i}, '.fld');
+ engines = [engines compare(fisFile, fldFile, delimiter, hasMetadata)];
+ disp(strcat('Five number summary (', num2str(i), '): ', fisFile));
+ engines(i).quantiles
+end
+end
+
diff --git a/fuzzylite/src/main.cpp b/fuzzylite/src/main.cpp
new file mode 100644
index 0000000..6d8d701
--- /dev/null
+++ b/fuzzylite/src/main.cpp
@@ -0,0 +1,71 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/Headers.h"
+
+#include <cstdlib>
+#include <fstream>
+#include <iomanip>
+#include <signal.h>
+#include <typeinfo>
+
+using namespace fl;
+
+/*
+#ifdef FL_WINDOWS
+#include <windows.h>
+BOOL WINAPI flSignalHandler(DWORD dwCtrlType)
+{
+ FL_LOG("Signal: " << dwCtrlType);
+ if (CTRL_C_EVENT == dwCtrlType){
+ }
+ //return FALSE;
+ return TRUE;
+}
+#endif
+ */
+
+int main(int argc, char** argv) {
+ (void) argc;
+ (void) argv;
+ std::set_terminate(fl::Exception::terminate);
+ std::set_unexpected(fl::Exception::terminate);
+ signal(SIGSEGV, fl::Exception::signalHandler);
+ signal(SIGABRT, fl::Exception::signalHandler);
+ signal(SIGILL, fl::Exception::signalHandler);
+ signal(SIGSEGV, fl::Exception::signalHandler);
+ signal(SIGFPE, fl::Exception::signalHandler);
+#ifdef FL_UNIX
+ signal(SIGBUS, fl::Exception::signalHandler);
+ signal(SIGPIPE, fl::Exception::signalHandler);
+#endif
+#ifdef FL_WINDOWS
+ //SetConsoleCtrlHandler(flSignalHandler, TRUE);
+#endif
+ fuzzylite::setDebug(false);
+ return Console::main(argc, argv);
+}
+
+
+
diff --git a/fuzzylite/src/norm/s/AlgebraicSum.cpp b/fuzzylite/src/norm/s/AlgebraicSum.cpp
new file mode 100644
index 0000000..e96c1a7
--- /dev/null
+++ b/fuzzylite/src/norm/s/AlgebraicSum.cpp
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/s/AlgebraicSum.h"
+
+namespace fl {
+
+ std::string AlgebraicSum::className() const {
+ return "AlgebraicSum";
+ }
+
+ scalar AlgebraicSum::compute(scalar a, scalar b) const {
+ return a + b - (a * b);
+ }
+
+ AlgebraicSum* AlgebraicSum::clone() const {
+ return new AlgebraicSum(*this);
+ }
+
+ SNorm* AlgebraicSum::constructor() {
+ return new AlgebraicSum;
+ }
+
+}
diff --git a/fuzzylite/src/norm/s/BoundedSum.cpp b/fuzzylite/src/norm/s/BoundedSum.cpp
new file mode 100644
index 0000000..9c050c8
--- /dev/null
+++ b/fuzzylite/src/norm/s/BoundedSum.cpp
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/s/BoundedSum.h"
+
+namespace fl {
+
+ std::string BoundedSum::className() const {
+ return "BoundedSum";
+ }
+
+ scalar BoundedSum::compute(scalar a, scalar b) const {
+ return Op::min(scalar(1.0), a + b);
+ }
+
+ BoundedSum* BoundedSum::clone() const {
+ return new BoundedSum(*this);
+ }
+
+ SNorm* BoundedSum::constructor() {
+ return new BoundedSum;
+ }
+
+}
diff --git a/fuzzylite/src/norm/s/DrasticSum.cpp b/fuzzylite/src/norm/s/DrasticSum.cpp
new file mode 100644
index 0000000..c0629db
--- /dev/null
+++ b/fuzzylite/src/norm/s/DrasticSum.cpp
@@ -0,0 +1,48 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/s/DrasticSum.h"
+
+namespace fl {
+
+ std::string DrasticSum::className() const {
+ return "DrasticSum";
+ }
+
+ scalar DrasticSum::compute(scalar a, scalar b) const {
+ if (Op::isEq(Op::min(a, b), 0.0)) {
+ return Op::max(a, b);
+ }
+ return 1.0;
+ }
+
+ DrasticSum* DrasticSum::clone() const {
+ return new DrasticSum(*this);
+ }
+
+ SNorm* DrasticSum::constructor() {
+ return new DrasticSum;
+ }
+
+}
diff --git a/fuzzylite/src/norm/s/EinsteinSum.cpp b/fuzzylite/src/norm/s/EinsteinSum.cpp
new file mode 100644
index 0000000..ec0fbd8
--- /dev/null
+++ b/fuzzylite/src/norm/s/EinsteinSum.cpp
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/s/EinsteinSum.h"
+
+namespace fl {
+
+ std::string EinsteinSum::className() const {
+ return "EinsteinSum";
+ }
+
+ scalar EinsteinSum::compute(scalar a, scalar b) const {
+ return (a + b) / (1.0 + a * b);
+ }
+
+ EinsteinSum* EinsteinSum::clone() const {
+ return new EinsteinSum(*this);
+ }
+
+ SNorm* EinsteinSum::constructor() {
+ return new EinsteinSum;
+ }
+
+}
diff --git a/fuzzylite/src/norm/s/HamacherSum.cpp b/fuzzylite/src/norm/s/HamacherSum.cpp
new file mode 100644
index 0000000..f9c0994
--- /dev/null
+++ b/fuzzylite/src/norm/s/HamacherSum.cpp
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/s/HamacherSum.h"
+
+namespace fl {
+
+ std::string HamacherSum::className() const {
+ return "HamacherSum";
+ }
+
+ scalar HamacherSum::compute(scalar a, scalar b) const {
+ return (a + b - 2.0 * a * b) / (1.0 - a * b);
+ }
+
+ HamacherSum* HamacherSum::clone() const {
+ return new HamacherSum(*this);
+ }
+
+ SNorm* HamacherSum::constructor() {
+ return new HamacherSum;
+ }
+
+}
diff --git a/fuzzylite/src/norm/s/Maximum.cpp b/fuzzylite/src/norm/s/Maximum.cpp
new file mode 100644
index 0000000..ed8a839
--- /dev/null
+++ b/fuzzylite/src/norm/s/Maximum.cpp
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/s/Maximum.h"
+
+namespace fl {
+
+ std::string Maximum::className() const {
+ return "Maximum";
+ }
+
+ scalar Maximum::compute(scalar a, scalar b) const {
+ return Op::max(a, b);
+ }
+
+ Maximum* Maximum::clone() const {
+ return new Maximum(*this);
+ }
+
+ SNorm* Maximum::constructor() {
+ return new Maximum;
+ }
+
+}
diff --git a/fuzzylite/src/norm/s/NilpotentMaximum.cpp b/fuzzylite/src/norm/s/NilpotentMaximum.cpp
new file mode 100644
index 0000000..0a09136
--- /dev/null
+++ b/fuzzylite/src/norm/s/NilpotentMaximum.cpp
@@ -0,0 +1,50 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/s/NilpotentMaximum.h"
+
+namespace fl {
+
+ std::string NilpotentMaximum::className() const {
+ return "NilpotentMaximum";
+ }
+
+ scalar NilpotentMaximum::compute(scalar a, scalar b) const {
+ if (Op::isLt(a + b, 1.0)) {
+ return std::max(a, b);
+ }
+ return 1.0;
+ }
+
+ NilpotentMaximum* NilpotentMaximum::clone() const {
+ return new NilpotentMaximum(*this);
+ }
+
+ SNorm* NilpotentMaximum::constructor() {
+ return new NilpotentMaximum;
+ }
+
+
+}
+
diff --git a/fuzzylite/src/norm/s/NormalizedSum.cpp b/fuzzylite/src/norm/s/NormalizedSum.cpp
new file mode 100644
index 0000000..94ad5ea
--- /dev/null
+++ b/fuzzylite/src/norm/s/NormalizedSum.cpp
@@ -0,0 +1,46 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/s/NormalizedSum.h"
+
+namespace fl {
+
+ std::string NormalizedSum::className() const {
+ return "NormalizedSum";
+ }
+
+ scalar NormalizedSum::compute(scalar a, scalar b) const {
+ return a + b / Op::max(scalar(1.0), Op::max(a, b));
+ }
+
+ NormalizedSum* NormalizedSum::clone() const {
+ return new NormalizedSum(*this);
+ }
+
+ SNorm* NormalizedSum::constructor() {
+ return new NormalizedSum;
+ }
+
+
+}
diff --git a/fuzzylite/src/norm/t/AlgebraicProduct.cpp b/fuzzylite/src/norm/t/AlgebraicProduct.cpp
new file mode 100644
index 0000000..eee1061
--- /dev/null
+++ b/fuzzylite/src/norm/t/AlgebraicProduct.cpp
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/t/AlgebraicProduct.h"
+
+namespace fl {
+
+ std::string AlgebraicProduct::className() const {
+ return "AlgebraicProduct";
+ }
+
+ scalar AlgebraicProduct::compute(scalar a, scalar b) const {
+ return a * b;
+ }
+
+ AlgebraicProduct* AlgebraicProduct::clone() const {
+ return new AlgebraicProduct(*this);
+ }
+
+ TNorm* AlgebraicProduct::constructor() {
+ return new AlgebraicProduct;
+ }
+
+}
diff --git a/fuzzylite/src/norm/t/BoundedDifference.cpp b/fuzzylite/src/norm/t/BoundedDifference.cpp
new file mode 100644
index 0000000..aa4fead
--- /dev/null
+++ b/fuzzylite/src/norm/t/BoundedDifference.cpp
@@ -0,0 +1,46 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/t/BoundedDifference.h"
+
+
+namespace fl {
+
+ std::string BoundedDifference::className() const {
+ return "BoundedDifference";
+ }
+
+ scalar BoundedDifference::compute(scalar a, scalar b) const {
+ return Op::max(scalar(0.0), a + b - scalar(1.0));
+ }
+
+ BoundedDifference* BoundedDifference::clone() const {
+ return new BoundedDifference(*this);
+ }
+
+ TNorm* BoundedDifference::constructor() {
+ return new BoundedDifference;
+ }
+
+}
diff --git a/fuzzylite/src/norm/t/DrasticProduct.cpp b/fuzzylite/src/norm/t/DrasticProduct.cpp
new file mode 100644
index 0000000..124b79d
--- /dev/null
+++ b/fuzzylite/src/norm/t/DrasticProduct.cpp
@@ -0,0 +1,48 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/t/DrasticProduct.h"
+
+namespace fl {
+
+ std::string DrasticProduct::className() const {
+ return "DrasticProduct";
+ }
+
+ scalar DrasticProduct::compute(scalar a, scalar b) const {
+ if (Op::isEq(Op::max(a, b), 1.0)) {
+ return Op::min(a, b);
+ }
+ return 0.0;
+ }
+
+ DrasticProduct* DrasticProduct::clone() const {
+ return new DrasticProduct(*this);
+ }
+
+ TNorm* DrasticProduct::constructor() {
+ return new DrasticProduct;
+ }
+
+}
diff --git a/fuzzylite/src/norm/t/EinsteinProduct.cpp b/fuzzylite/src/norm/t/EinsteinProduct.cpp
new file mode 100644
index 0000000..ea79188
--- /dev/null
+++ b/fuzzylite/src/norm/t/EinsteinProduct.cpp
@@ -0,0 +1,45 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/t/EinsteinProduct.h"
+
+namespace fl {
+
+ std::string EinsteinProduct::className() const {
+ return "EinsteinProduct";
+ }
+
+ scalar EinsteinProduct::compute(scalar a, scalar b) const {
+ return (a * b) / (2.0 - (a + b - a * b));
+ }
+
+ EinsteinProduct* EinsteinProduct::clone() const {
+ return new EinsteinProduct(*this);
+ }
+
+ TNorm* EinsteinProduct::constructor() {
+ return new EinsteinProduct;
+ }
+
+}
diff --git a/fuzzylite/src/norm/t/HamacherProduct.cpp b/fuzzylite/src/norm/t/HamacherProduct.cpp
new file mode 100644
index 0000000..e3f093e
--- /dev/null
+++ b/fuzzylite/src/norm/t/HamacherProduct.cpp
@@ -0,0 +1,46 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/t/HamacherProduct.h"
+
+
+namespace fl {
+
+ std::string HamacherProduct::className() const {
+ return "HamacherProduct";
+ }
+
+ scalar HamacherProduct::compute(scalar a, scalar b) const {
+ return (a * b) / (a + b - a * b);
+ }
+
+ HamacherProduct* HamacherProduct::clone() const {
+ return new HamacherProduct(*this);
+ }
+
+ TNorm* HamacherProduct::constructor() {
+ return new HamacherProduct;
+ }
+
+}
diff --git a/fuzzylite/src/norm/t/Minimum.cpp b/fuzzylite/src/norm/t/Minimum.cpp
new file mode 100644
index 0000000..34f348f
--- /dev/null
+++ b/fuzzylite/src/norm/t/Minimum.cpp
@@ -0,0 +1,46 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/t/Minimum.h"
+
+namespace fl {
+
+ std::string Minimum::className() const {
+ return "Minimum";
+ }
+
+ scalar Minimum::compute(scalar a, scalar b) const {
+ return Op::min(a, b);
+ }
+
+ Minimum* Minimum::clone() const {
+ return new Minimum(*this);
+ }
+
+ TNorm* Minimum::constructor() {
+ return new Minimum;
+ }
+
+
+}
diff --git a/fuzzylite/src/norm/t/NilpotentMinimum.cpp b/fuzzylite/src/norm/t/NilpotentMinimum.cpp
new file mode 100644
index 0000000..b52a2fc
--- /dev/null
+++ b/fuzzylite/src/norm/t/NilpotentMinimum.cpp
@@ -0,0 +1,50 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/norm/t/NilpotentMinimum.h"
+
+namespace fl {
+
+ std::string NilpotentMinimum::className() const {
+ return "NilpotentMinimum";
+ }
+
+ scalar NilpotentMinimum::compute(scalar a, scalar b) const {
+ if (Op::isGt(a + b, 1.0)) {
+ return Op::min(a, b);
+ }
+ return 0.0;
+ }
+
+ NilpotentMinimum* NilpotentMinimum::clone() const {
+ return new NilpotentMinimum(*this);
+ }
+
+ TNorm* NilpotentMinimum::constructor() {
+ return new NilpotentMinimum;
+ }
+
+
+}
+
diff --git a/fuzzylite/src/rule/Antecedent.cpp b/fuzzylite/src/rule/Antecedent.cpp
new file mode 100644
index 0000000..aa18a68
--- /dev/null
+++ b/fuzzylite/src/rule/Antecedent.cpp
@@ -0,0 +1,368 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/rule/Antecedent.h"
+
+#include "fl/Engine.h"
+#include "fl/factory/HedgeFactory.h"
+#include "fl/factory/FactoryManager.h"
+#include "fl/hedge/Any.h"
+#include "fl/hedge/Hedge.h"
+#include "fl/norm/SNorm.h"
+#include "fl/norm/TNorm.h"
+#include "fl/rule/Expression.h"
+#include "fl/rule/Rule.h"
+#include "fl/term/Accumulated.h"
+#include "fl/term/Function.h"
+#include "fl/term/Term.h"
+#include "fl/variable/InputVariable.h"
+#include "fl/variable/OutputVariable.h"
+
+#include <algorithm>
+#include <stack>
+
+
+namespace fl {
+
+ Antecedent::Antecedent()
+ : _text(""), _expression(fl::null) {
+ }
+
+ Antecedent::~Antecedent() {
+ unload();
+ }
+
+ void Antecedent::setText(const std::string& text) {
+ this->_text = text;
+ }
+
+ std::string Antecedent::getText() const {
+ return this->_text;
+ }
+
+ Expression* Antecedent::getExpression() const {
+ return this->_expression;
+ }
+
+ bool Antecedent::isLoaded() const {
+ return this->_expression != fl::null;
+ }
+
+ scalar Antecedent::activationDegree(const TNorm* conjunction, const SNorm* disjunction) const {
+ return this->activationDegree(conjunction, disjunction, this->_expression);
+ }
+
+ scalar Antecedent::activationDegree(const TNorm* conjunction, const SNorm* disjunction,
+ const Expression* node) const {
+ if (not isLoaded()) {
+ throw fl::Exception("[antecedent error] antecedent <" + _text + "> is not loaded", FL_AT);
+ }
+ const Proposition* proposition = dynamic_cast<const Proposition*> (node);
+ if (proposition) {
+ if (not proposition->variable->isEnabled()) {
+ return 0.0;
+ }
+
+ if (not proposition->hedges.empty()) {
+ //if last hedge is "Any", apply hedges in reverse order and return degree
+ std::vector<Hedge*>::const_reverse_iterator rit = proposition->hedges.rbegin();
+ if (dynamic_cast<Any*> (*rit)) {
+ scalar result = (*rit)->hedge(fl::nan);
+ while (++rit != proposition->hedges.rend()) {
+ result = (*rit)->hedge(result);
+ }
+ return result;
+ }
+ }
+ scalar result = fl::nan;
+ if (InputVariable * inputVariable = dynamic_cast<InputVariable*> (proposition->variable)) {
+ result = proposition->term->membership(inputVariable->getInputValue());
+ } else if (OutputVariable * outputVariable = dynamic_cast<OutputVariable*> (proposition->variable)) {
+ result = outputVariable->fuzzyOutput()->activationDegree(proposition->term);
+ }
+ for (std::vector<Hedge*>::const_reverse_iterator rit = proposition->hedges.rbegin();
+ rit != proposition->hedges.rend(); ++rit) {
+ result = (*rit)->hedge(result);
+ }
+ return result;
+ }
+ //if node is an operator
+ const Operator* fuzzyOperator = dynamic_cast<const Operator*> (node);
+ if (not (fuzzyOperator->left and fuzzyOperator->right)) {
+ std::ostringstream ex;
+ ex << "[syntax error] left and right operands must exist";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ if (fuzzyOperator->name == Rule::andKeyword()) {
+ if (not conjunction) throw fl::Exception("[conjunction error] "
+ "the following rule requires a conjunction operator:\n" + _text, FL_AT);
+ return conjunction->compute(
+ this->activationDegree(conjunction, disjunction, fuzzyOperator->left),
+ this->activationDegree(conjunction, disjunction, fuzzyOperator->right));
+ }
+
+ if (fuzzyOperator->name == Rule::orKeyword()) {
+ if (not disjunction) throw fl::Exception("[disjunction error] "
+ "the following rule requires a disjunction operator:\n" + _text, FL_AT);
+ return disjunction->compute(
+ this->activationDegree(conjunction, disjunction, fuzzyOperator->left),
+ this->activationDegree(conjunction, disjunction, fuzzyOperator->right));
+ }
+ std::ostringstream ex;
+ ex << "[syntax error] operator <" << fuzzyOperator->name << "> not recognized";
+ throw fl::Exception(ex.str(), FL_AT);
+
+ }
+
+ void Antecedent::unload() {
+ if (_expression) {
+ delete _expression;
+ _expression = fl::null;
+ }
+ }
+
+ void Antecedent::load(fl::Rule* rule, const Engine* engine) {
+ load(_text, rule, engine);
+ }
+
+ void Antecedent::load(const std::string& antecedent, fl::Rule* rule, const Engine* engine) {
+ FL_DBG("Antecedent: " << antecedent);
+ unload();
+ this->_text = antecedent;
+ if (fl::Op::trim(antecedent).empty()) {
+ throw fl::Exception("[syntax error] antecedent is empty", FL_AT);
+ }
+ /*
+ Builds an proposition tree from the antecedent of a fuzzy rule.
+ The rules are:
+ 1) After a variable comes 'is',
+ 2) After 'is' comes a hedge or a term
+ 3) After a hedge comes a hedge or a term
+ 4) After a term comes a variable or an operator
+ */
+
+ Function function;
+
+ std::string postfix = function.toPostfix(antecedent);
+ FL_DBG("Postfix: " << postfix);
+ std::stringstream tokenizer(postfix);
+ std::string token;
+
+ enum FSM {
+ S_VARIABLE = 1, S_IS = 2, S_HEDGE = 4, S_TERM = 8, S_AND_OR = 16
+ };
+ int state = S_VARIABLE;
+ std::stack<Expression*> expressionStack;
+ Proposition* proposition = fl::null;
+ try {
+ while (tokenizer >> token) {
+ if (state bitand S_VARIABLE) {
+ Variable* variable = fl::null;
+ if (engine->hasInputVariable(token)) variable = engine->getInputVariable(token);
+ else if (engine->hasOutputVariable(token)) variable = engine->getOutputVariable(token);
+ if (variable) {
+ proposition = new Proposition;
+ proposition->variable = variable;
+ expressionStack.push(proposition);
+
+ state = S_IS;
+ FL_DBG("Token <" << token << "> is variable");
+ continue;
+ }
+ }
+
+ if (state bitand S_IS) {
+ if (token == Rule::isKeyword()) {
+ state = S_HEDGE bitor S_TERM;
+ FL_DBG("Token <" << token << "> is keyword");
+ continue;
+ }
+ }
+
+ if (state bitand S_HEDGE) {
+ Hedge* hedge = rule->getHedge(token);
+ if (not hedge) {
+ HedgeFactory* factory = FactoryManager::instance()->hedge();
+ if (factory->hasConstructor(token)) {
+ hedge = factory->constructObject(token);
+ rule->addHedge(hedge);
+ }
+ }
+ if (hedge) {
+ proposition->hedges.push_back(hedge);
+ if (dynamic_cast<Any*> (hedge)) {
+ state = S_VARIABLE bitor S_AND_OR;
+ } else {
+ state = S_HEDGE bitor S_TERM;
+ }
+ FL_DBG("Token <" << token << "> is hedge");
+ continue;
+ }
+ }
+
+ if (state bitand S_TERM) {
+ if (proposition->variable->hasTerm(token)) {
+ proposition->term = proposition->variable->getTerm(token);
+ state = S_VARIABLE bitor S_AND_OR;
+ FL_DBG("Token <" << token << "> is term");
+ continue;
+ }
+ }
+
+ if (state bitand S_AND_OR) {
+ if (token == Rule::andKeyword() or token == Rule::orKeyword()) {
+ if (expressionStack.size() < 2) {
+ std::ostringstream ex;
+ ex << "[syntax error] logical operator <" << token << "> expects two operands,"
+ << "but found <" << expressionStack.size() << "> in antecedent";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ Operator* fuzzyOperator = new Operator;
+ fuzzyOperator->name = token;
+ fuzzyOperator->right = expressionStack.top();
+ expressionStack.pop();
+ fuzzyOperator->left = expressionStack.top();
+ expressionStack.pop();
+ expressionStack.push(fuzzyOperator);
+
+ state = S_VARIABLE bitor S_AND_OR;
+ FL_DBG("Subtree: " << fuzzyOperator->toString() <<
+ "(" << fuzzyOperator->left->toString() << ") " <<
+ "(" << fuzzyOperator->right->toString() << ")");
+ continue;
+ }
+ }
+
+ //If reached this point, there was an error
+ if ((state bitand S_VARIABLE) or (state bitand S_AND_OR)) {
+ std::ostringstream ex;
+ ex << "[syntax error] antecedent expected variable or logical operator, but found <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ if (state bitand S_IS) {
+ std::ostringstream ex;
+ ex << "[syntax error] antecedent expected keyword <" << Rule::isKeyword() << ">, but found <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ if ((state bitand S_HEDGE) or (state bitand S_TERM)) {
+ std::ostringstream ex;
+ ex << "[syntax error] antecedent expected hedge or term, but found <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ std::ostringstream ex;
+ ex << "[syntax error] unexpected token <" << token << "> in antecedent";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ if (not ((state bitand S_VARIABLE) or (state bitand S_AND_OR))) { //only acceptable final state
+ if (state bitand S_IS) {
+ std::ostringstream ex;
+ ex << "[syntax error] antecedent expected keyword <" << Rule::isKeyword() << "> after <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ if ((state bitand S_HEDGE) or (state bitand S_TERM)) {
+ std::ostringstream ex;
+ ex << "[syntax error] antecedent expected hedge or term after <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ }
+
+ if (expressionStack.size() != 1) {
+ std::vector<std::string> errors;
+ while (expressionStack.size() > 1) {
+ Expression* expression = expressionStack.top();
+ expressionStack.pop();
+ errors.push_back(expression->toString());
+ delete expression;
+ }
+ std::ostringstream ex;
+ ex << "[syntax error] unable to parse the following expressions in antecedent <"
+ << Op::join(errors, " ") << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ } catch (...) {
+ for (std::size_t i = 0; i < expressionStack.size(); ++i) {
+ delete expressionStack.top();
+ expressionStack.pop();
+ }
+ throw;
+ }
+ this->_expression = expressionStack.top();
+ }
+
+ std::string Antecedent::toString() const {
+ return toInfix(this->_expression);
+ }
+
+ std::string Antecedent::toPrefix(const Expression* node) const {
+ if (not isLoaded()) {
+ throw fl::Exception("[antecedent error] antecedent <" + _text + "> is not loaded", FL_AT);
+ }
+ if (not node) node = this->_expression;
+
+ if (dynamic_cast<const Proposition*> (node)) {
+ return node->toString();
+ }
+ const Operator* fuzzyOperator = dynamic_cast<const Operator*> (node);
+ std::stringstream ss;
+ ss << fuzzyOperator->toString() << " "
+ << toPrefix(fuzzyOperator->left) << " "
+ << toPrefix(fuzzyOperator->right) << " ";
+ return ss.str();
+ }
+
+ std::string Antecedent::toInfix(const Expression* node) const {
+ if (not isLoaded()) {
+ throw fl::Exception("[antecedent error] antecedent <" + _text + "> is not loaded", FL_AT);
+ }
+ if (not node) node = this->_expression;
+ if (dynamic_cast<const Proposition*> (node)) {
+ return node->toString();
+ }
+ const Operator* fuzzyOperator = dynamic_cast<const Operator*> (node);
+ std::stringstream ss;
+ ss << toInfix(fuzzyOperator->left) << " "
+ << fuzzyOperator->toString() << " "
+ << toInfix(fuzzyOperator->right) << " ";
+ return ss.str();
+ }
+
+ std::string Antecedent::toPostfix(const Expression* node) const {
+ if (not isLoaded()) {
+ throw fl::Exception("[antecedent error] antecedent <" + _text + "> is not loaded", FL_AT);
+ }
+ if (not node) node = this->_expression;
+ if (dynamic_cast<const Proposition*> (node)) {
+ return node->toString();
+ }
+ const Operator* fuzzyOperator = dynamic_cast<const Operator*> (node);
+ std::stringstream ss;
+ ss << toPostfix(fuzzyOperator->left) << " "
+ << toPostfix(fuzzyOperator->right) << " "
+ << fuzzyOperator->toString() << " ";
+ return ss.str();
+ }
+
+
+}
diff --git a/fuzzylite/src/rule/Consequent.cpp b/fuzzylite/src/rule/Consequent.cpp
new file mode 100644
index 0000000..28d3390
--- /dev/null
+++ b/fuzzylite/src/rule/Consequent.cpp
@@ -0,0 +1,243 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/rule/Consequent.h"
+
+#include "fl/Engine.h"
+#include "fl/factory/HedgeFactory.h"
+#include "fl/factory/FactoryManager.h"
+#include "fl/hedge/Hedge.h"
+#include "fl/hedge/Any.h"
+#include "fl/norm/TNorm.h"
+#include "fl/rule/Expression.h"
+#include "fl/rule/Rule.h"
+#include "fl/term/Accumulated.h"
+#include "fl/term/Activated.h"
+#include "fl/variable/OutputVariable.h"
+
+#include <algorithm>
+
+namespace fl {
+
+ Consequent::Consequent() {
+ }
+
+ Consequent::~Consequent() {
+ unload();
+ }
+
+ std::string Consequent::getText() const {
+ return this->_text;
+ }
+
+ void Consequent::setText(const std::string& text) {
+ this->_text = text;
+ }
+
+ const std::vector<Proposition*>& Consequent::conclusions() const {
+ return this->_conclusions;
+ }
+
+ void Consequent::modify(scalar activationDegree, const TNorm* activation) {
+ if (not isLoaded()) {
+ throw fl::Exception("[consequent error] consequent <" + _text + "> is not loaded", FL_AT);
+ }
+ for (std::size_t i = 0; i < _conclusions.size(); ++i) {
+ Proposition* proposition = _conclusions.at(i);
+ if (proposition->variable->isEnabled()) {
+ if (not proposition->hedges.empty()) {
+ for (std::vector<Hedge*>::const_reverse_iterator rit = proposition->hedges.rbegin();
+ rit != proposition->hedges.rend(); ++rit) {
+ activationDegree = (*rit)->hedge(activationDegree);
+ }
+ }
+ Activated* term = new Activated(_conclusions.at(i)->term, activationDegree, activation);
+ OutputVariable* outputVariable = dynamic_cast<OutputVariable*> (proposition->variable);
+ outputVariable->fuzzyOutput()->addTerm(term);
+ FL_DBG("Accumulating " << term->toString());
+ }
+ }
+ }
+
+ bool Consequent::isLoaded() {
+ return not _conclusions.empty();
+ }
+
+ void Consequent::unload() {
+ for (std::size_t i = 0; i < _conclusions.size(); ++i) {
+ delete _conclusions.at(i);
+ }
+ _conclusions.clear();
+ }
+
+ void Consequent::load(Rule* rule, const Engine* engine) {
+ load(_text, rule, engine);
+ }
+
+ void Consequent::load(const std::string& consequent, Rule* rule, const Engine* engine) {
+ unload();
+ this->_text = consequent;
+
+ if (fl::Op::trim(consequent).empty()) {
+ throw fl::Exception("[syntax error] consequent is empty", FL_AT);
+ }
+
+ /**
+ Extracts the list of propositions from the consequent
+ The rules are:
+ 1) After a variable comes 'is' or '=',
+ 2) After 'is' comes a hedge or a term
+ 3) After a hedge comes a hedge or a term
+ 4) After a term comes operators 'and' or 'with'
+ 5) After operator 'and' comes a variable
+ 6) After operator 'with' comes a float
+ */
+ enum FSM {
+ S_VARIABLE = 1, S_IS = 2, S_HEDGE = 4, S_TERM = 8,
+ S_AND = 16, S_WITH = 32
+ };
+ int state = S_VARIABLE;
+
+ Proposition* proposition = fl::null;
+
+ std::stringstream tokenizer(consequent);
+ std::string token;
+ try {
+ while (tokenizer >> token) {
+ if (state bitand S_VARIABLE) {
+ if (engine->hasOutputVariable(token)) {
+ proposition = new Proposition;
+ proposition->variable = engine->getOutputVariable(token);
+ _conclusions.push_back(proposition);
+
+ state = S_IS;
+ continue;
+ }
+ }
+
+ if (state bitand S_IS) {
+ if (token == Rule::isKeyword()) {
+ state = S_HEDGE bitor S_TERM;
+ continue;
+ }
+ }
+
+ if (state bitand S_HEDGE) {
+ Hedge* hedge = rule->getHedge(token);
+ if (not hedge) {
+ HedgeFactory* factory = FactoryManager::instance()->hedge();
+ if (factory->hasConstructor(token)){
+ hedge = factory->constructObject(token);
+ rule->addHedge(hedge);
+ }
+ }
+ if (hedge) {
+ proposition->hedges.push_back(hedge);
+ state = S_HEDGE bitor S_TERM;
+ continue;
+ }
+ }
+
+ if (state bitand S_TERM) {
+ if (proposition->variable->hasTerm(token)) {
+ proposition->term = proposition->variable->getTerm(token);
+ state = S_AND bitor S_WITH;
+ continue;
+ }
+ }
+
+ if (state bitand S_AND) {
+ if (token == Rule::andKeyword()) {
+ state = S_VARIABLE;
+ continue;
+ }
+ }
+
+ //if reached this point, there was an error:
+ if (state bitand S_VARIABLE) {
+ std::ostringstream ex;
+ ex << "[syntax error] consequent expected output variable, but found <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ if (state bitand S_IS) {
+ std::ostringstream ex;
+ ex << "[syntax error] consequent expected keyword <" << Rule::isKeyword() << ">, "
+ "but found <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ if ((state bitand S_HEDGE) or (state bitand S_TERM)) {
+ std::ostringstream ex;
+ ex << "[syntax error] consequent expected hedge or term, but found <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ if ((state bitand S_AND) or (state bitand S_WITH)) {
+ std::ostringstream ex;
+ ex << "[syntax error] consequent expected operator <" << Rule::andKeyword() << "> "
+ << "or keyword <" << Rule::withKeyword() << ">, "
+ << "but found <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ std::ostringstream ex;
+ ex << "[syntax error] unexpected token <" << token << "> in consequent";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ if (not ((state bitand S_AND) or (state bitand S_WITH))) { //only acceptable final state
+ if (state bitand S_VARIABLE) {
+ std::ostringstream ex;
+ ex << "[syntax error] consequent expected output variable after <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ if (state bitand S_IS) {
+ std::ostringstream ex;
+ ex << "[syntax error] consequent expected keyword <" << Rule::isKeyword() << "> "
+ "after <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ if ((state bitand S_HEDGE) or (state bitand S_TERM)) {
+ std::ostringstream ex;
+ ex << "[syntax error] consequent expected hedge or term after <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ }
+ } catch (...) {
+ unload();
+ throw;
+ }
+ }
+
+ std::string Consequent::toString() const {
+ std::stringstream ss;
+ for (std::size_t i = 0; i < _conclusions.size(); ++i) {
+ ss << _conclusions.at(i)->toString();
+ if (i + 1 < _conclusions.size())
+ ss << " " << Rule::andKeyword() << " ";
+ }
+ return ss.str();
+ }
+
+}
diff --git a/fuzzylite/src/rule/Expression.cpp b/fuzzylite/src/rule/Expression.cpp
new file mode 100644
index 0000000..ea7873e
--- /dev/null
+++ b/fuzzylite/src/rule/Expression.cpp
@@ -0,0 +1,83 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/rule/Expression.h"
+
+#include "fl/hedge/Hedge.h"
+#include "fl/term/Term.h"
+#include "fl/rule/Rule.h"
+#include "fl/variable/Variable.h"
+
+namespace fl {
+
+ Expression::Expression() {
+ }
+
+ Expression::~Expression() {
+ }
+
+ Proposition::Proposition()
+ : Expression(), variable(fl::null), term(fl::null) {
+ }
+
+ Proposition::~Proposition() {
+
+ }
+
+ std::string Proposition::toString() const {
+ std::ostringstream ss;
+ if (variable) {
+ ss << variable->getName();
+ } else {
+ ss << "?";
+ }
+ if (not hedges.empty()) {
+ ss << " " << Rule::isKeyword() << " ";
+ for (std::size_t i = 0; i < hedges.size(); ++i) {
+ ss << hedges.at(i)->name() << " ";
+ }
+ }
+
+ if (term) { //term is fl::null if hedge is any
+ if (hedges.empty()) {
+ ss << " " << Rule::isKeyword() << " ";
+ }
+ ss << term->getName();
+ }
+ return ss.str();
+ }
+
+ Operator::Operator() : Expression(), name(""), left(fl::null), right(fl::null) {
+ }
+
+ Operator::~Operator() {
+ if (left) delete left;
+ if (right) delete right;
+ }
+
+ std::string Operator::toString() const {
+ return name;
+ }
+
+}
diff --git a/fuzzylite/src/rule/Rule.cpp b/fuzzylite/src/rule/Rule.cpp
new file mode 100644
index 0000000..446290b
--- /dev/null
+++ b/fuzzylite/src/rule/Rule.cpp
@@ -0,0 +1,262 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/rule/Rule.h"
+
+#include "fl/Exception.h"
+#include "fl/hedge/Hedge.h"
+#include "fl/imex/FllExporter.h"
+#include "fl/norm/Norm.h"
+#include "fl/rule/Antecedent.h"
+#include "fl/rule/Consequent.h"
+
+#include <sstream>
+#include <vector>
+
+namespace fl {
+
+ Rule::Rule(const std::string& text, scalar weight)
+ : _text(text), _weight(weight), _antecedent(new Antecedent), _consequent(new Consequent) {
+ }
+
+ Rule::Rule(const Rule& other) : _text(other._text), _weight(other._weight),
+ _antecedent(new Antecedent), _consequent(new Consequent) {
+ }
+
+ Rule& Rule::operator=(const Rule& other) {
+ if (this != &other) {
+ unload();
+
+ _text = other._text;
+ _weight = other._weight;
+ _antecedent.reset(new Antecedent);
+ _consequent.reset(new Consequent);
+ }
+ return *this;
+ }
+
+ Rule::~Rule() {
+ unload();
+ }
+
+ void Rule::setText(const std::string& text) {
+ this->_text = text;
+ }
+
+ std::string Rule::getText() const {
+ return this->_text;
+ }
+
+ void Rule::setWeight(scalar weight) {
+ this->_weight = weight;
+ }
+
+ scalar Rule::getWeight() const {
+ return this->_weight;
+ }
+
+ void Rule::setAntecedent(Antecedent* antecedent) {
+ this->_antecedent.reset(antecedent);
+ }
+
+ Antecedent* Rule::getAntecedent() const {
+ return this->_antecedent.get();
+ }
+
+ void Rule::setConsequent(Consequent* consequent) {
+ this->_consequent.reset(consequent);
+ }
+
+ Consequent* Rule::getConsequent() const {
+ return this->_consequent.get();
+ }
+
+ /**
+ * Operations for std::vector _hedges
+ */
+ void Rule::addHedge(Hedge* hedge) {
+ this->_hedges[hedge->name()] = hedge;
+ }
+
+ Hedge* Rule::getHedge(const std::string& name) const {
+ std::map<std::string, Hedge*>::const_iterator it = this->_hedges.find(name);
+ if (it != this->_hedges.end()) {
+ if (it->second) return it->second;
+ }
+ return fl::null;
+ }
+
+ Hedge* Rule::removeHedge(const std::string& name) {
+ Hedge* result = fl::null;
+ std::map<std::string, Hedge*>::iterator it = this->_hedges.find(name);
+ if (it != this->_hedges.end()) {
+ result = it->second;
+ this->_hedges.erase(it);
+ }
+ return result;
+ }
+
+ bool Rule::hasHedge(const std::string& name) const {
+ std::map<std::string, Hedge*>::const_iterator it = this->_hedges.find(name);
+ return (it != this->_hedges.end());
+ }
+
+ int Rule::numberOfHedges() const {
+ return this->_hedges.size();
+ }
+
+ void Rule::setHedges(const std::map<std::string, Hedge*>& hedges) {
+ this->_hedges = hedges;
+ }
+
+ const std::map<std::string, Hedge*>& Rule::hedges() const {
+ return this->_hedges;
+ }
+
+ std::map<std::string, Hedge*>& Rule::hedges() {
+ return this->_hedges;
+ }
+
+ scalar Rule::activationDegree(const TNorm* conjunction, const SNorm* disjunction) const {
+ if (not isLoaded()) {
+ throw fl::Exception("[rule error] the following rule is not loaded: " + _text, FL_AT);
+ }
+ return _weight * getAntecedent()->activationDegree(conjunction, disjunction);
+ }
+
+ void Rule::activate(scalar degree, const TNorm* activation) const {
+ if (not isLoaded()) {
+ throw fl::Exception("[rule error] the following rule is not loaded: " + _text, FL_AT);
+ }
+ _consequent->modify(degree, activation);
+ }
+
+ bool Rule::isLoaded() const {
+ return _antecedent->isLoaded() and _consequent->isLoaded();
+ }
+
+ void Rule::unload() {
+ _antecedent->unload();
+ _consequent->unload();
+
+ for (std::map<std::string, Hedge*>::const_iterator it = _hedges.begin();
+ it != _hedges.end(); ++it) {
+ delete it->second;
+ }
+ _hedges.clear();
+ }
+
+ void Rule::load(const Engine* engine) {
+ load(_text, engine);
+ }
+
+ void Rule::load(const std::string& rule, const Engine* engine) {
+ this->_text = rule;
+ std::istringstream tokenizer(rule.substr(0, rule.find_first_of('#')));
+ std::string token;
+ std::ostringstream ossAntecedent, ossConsequent;
+ scalar weight = 1.0;
+
+ enum FSM {
+ S_NONE, S_IF, S_THEN, S_WITH, S_END
+ };
+ FSM state = S_NONE;
+ try {
+ while (tokenizer >> token) {
+
+ switch (state) {
+ case S_NONE:
+ if (token == Rule::ifKeyword()) state = S_IF;
+ else {
+ std::ostringstream ex;
+ ex << "[syntax error] expected keyword <" << Rule::ifKeyword() <<
+ ">, but found <" << token << "> in rule: " << rule;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ break;
+ case S_IF:
+ if (token == Rule::thenKeyword()) state = S_THEN;
+ else ossAntecedent << token << " ";
+ break;
+ case S_THEN:
+ if (token == Rule::withKeyword()) state = S_WITH;
+ else ossConsequent << token << " ";
+ break;
+ case S_WITH:
+ try {
+ weight = fl::Op::toScalar(token);
+ state = S_END;
+ } catch (fl::Exception& e) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected a numeric value as the weight of the rule: "
+ << rule;
+ e.append(ex.str(), FL_AT);
+ throw e;
+ }
+ break;
+ case S_END:
+ std::ostringstream ex;
+ ex << "[syntax error] unexpected token <" << token << "> at the end of rule";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ }
+ if (state == S_NONE) {
+ std::ostringstream ex;
+ ex << "[syntax error] " << (rule.empty() ? "empty rule" : "ignored rule: " + rule);
+ throw fl::Exception(ex.str(), FL_AT);
+ } else if (state == S_IF) {
+ std::ostringstream ex;
+ ex << "[syntax error] keyword <" << Rule::thenKeyword() << "> not found in rule: " << rule;
+ throw fl::Exception(ex.str(), FL_AT);
+ } else if (state == S_WITH) {
+ std::ostringstream ex;
+ ex << "[syntax error] expected a numeric value as the weight of the rule: " << rule;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ _antecedent->load(ossAntecedent.str(), this, engine);
+ _consequent->load(ossConsequent.str(), this, engine);
+ _weight = weight;
+
+ } catch (...) {
+ unload();
+ throw;
+ }
+ }
+
+ std::string Rule::toString() const {
+ return FllExporter().toString(this);
+ }
+
+ Rule* Rule::clone() const {
+ return new Rule(*this);
+ }
+
+ Rule* Rule::parse(const std::string& rule, const Engine* engine) {
+ FL_unique_ptr<Rule> result(new Rule);
+ result->load(rule, engine);
+ return result.release();
+ }
+
+}
diff --git a/fuzzylite/src/rule/RuleBlock.cpp b/fuzzylite/src/rule/RuleBlock.cpp
new file mode 100644
index 0000000..9ab813e
--- /dev/null
+++ b/fuzzylite/src/rule/RuleBlock.cpp
@@ -0,0 +1,210 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/rule/RuleBlock.h"
+
+#include "fl/imex/FllExporter.h"
+#include "fl/norm/TNorm.h"
+#include "fl/norm/SNorm.h"
+#include "fl/rule/Rule.h"
+
+#include <sstream>
+
+namespace fl {
+
+ RuleBlock::RuleBlock(const std::string& name)
+ : _name(name), _enabled(true) {
+ }
+
+ RuleBlock::RuleBlock(const RuleBlock& other) : _name(other._name),
+ _enabled(true) {
+ copyFrom(other);
+ }
+
+ RuleBlock& RuleBlock::operator=(const RuleBlock& other) {
+ if (this != &other) {
+ for (std::size_t i = 0; i < _rules.size(); ++i) {
+ delete _rules.at(i);
+ }
+ _rules.clear();
+ _conjunction.reset(fl::null);
+ _disjunction.reset(fl::null);
+ _activation.reset(fl::null);
+
+ copyFrom(other);
+ }
+ return *this;
+ }
+
+ void RuleBlock::copyFrom(const RuleBlock& source) {
+ _name = source._name;
+ _enabled = source._enabled;
+ if (source._activation.get()) _activation.reset(source._activation->clone());
+ if (source._conjunction.get()) _conjunction.reset(source._conjunction->clone());
+ if (source._disjunction.get()) _disjunction.reset(source._disjunction->clone());
+ for (std::size_t i = 0; i < source._rules.size(); ++i) {
+ _rules.push_back(source._rules.at(i)->clone());
+ }
+ }
+
+ RuleBlock::~RuleBlock() {
+ for (std::size_t i = 0; i < _rules.size(); ++i) {
+ delete _rules.at(i);
+ }
+ _rules.clear();
+ }
+
+ void RuleBlock::activate() {
+ FL_DBG("===================");
+ FL_DBG("ACTIVATING RULEBLOCK " << _name);
+ for (std::size_t i = 0; i < _rules.size(); ++i) {
+ Rule* rule = _rules.at(i);
+ if (rule->isLoaded()) {
+ scalar activationDegree = rule->activationDegree(_conjunction.get(), _disjunction.get());
+ FL_DBG("[degree=" << Op::str(activationDegree) << "] " << rule->toString());
+ if (Op::isGt(activationDegree, 0.0)) {
+ rule->activate(activationDegree, _activation.get());
+ }
+ } else {
+ FL_DBG("Rule not loaded: " << rule->toString());
+ }
+ }
+ }
+
+ void RuleBlock::unloadRules() const {
+ for (std::size_t i = 0; i < _rules.size(); ++i) {
+ _rules.at(i)->unload();
+ }
+ }
+
+ void RuleBlock::loadRules(const Engine* engine) {
+ std::ostringstream exceptions;
+ bool throwException = false;
+ for (std::size_t i = 0; i < _rules.size(); ++i) {
+ Rule* rule = _rules.at(i);
+ if (rule->isLoaded()) {
+ rule->unload();
+ }
+ try {
+ rule->load(engine);
+ } catch (std::exception& ex) {
+ throwException = true;
+ exceptions << ex.what() << "\n";
+ }
+ }
+ if (throwException) {
+ fl::Exception exception("[ruleblock error] the following "
+ "rules could not be loaded:\n" + exceptions.str(), FL_AT);
+ throw exception;
+ }
+ }
+
+ void RuleBlock::reloadRules(const Engine* engine) {
+ unloadRules();
+ loadRules(engine);
+ }
+
+ void RuleBlock::setName(std::string name) {
+ this->_name = name;
+ }
+
+ std::string RuleBlock::getName() const {
+ return this->_name;
+ }
+
+ void RuleBlock::setConjunction(TNorm* tnorm) {
+ this->_conjunction.reset(tnorm);
+ }
+
+ TNorm* RuleBlock::getConjunction() const {
+ return this->_conjunction.get();
+ }
+
+ void RuleBlock::setDisjunction(SNorm* snorm) {
+ this->_disjunction.reset(snorm);
+ }
+
+ SNorm* RuleBlock::getDisjunction() const {
+ return this->_disjunction.get();
+ }
+
+ void RuleBlock::setActivation(TNorm* activation) {
+ this->_activation.reset(activation);
+ }
+
+ TNorm* RuleBlock::getActivation() const {
+ return this->_activation.get();
+ }
+
+ void RuleBlock::setEnabled(bool enabled) {
+ this->_enabled = enabled;
+ }
+
+ bool RuleBlock::isEnabled() const {
+ return this->_enabled;
+ }
+
+ std::string RuleBlock::toString() const {
+ return FllExporter().toString(this);
+ }
+
+ /**
+ * Operations for std::vector _rules
+ */
+ void RuleBlock::addRule(Rule* rule) {
+ this->_rules.push_back(rule);
+ }
+
+ void RuleBlock::insertRule(Rule* rule, int index) {
+ this->_rules.insert(this->_rules.begin() + index, rule);
+ }
+
+ Rule* RuleBlock::getRule(int index) const {
+ return this->_rules.at(index);
+ }
+
+ Rule* RuleBlock::removeRule(int index) {
+ Rule* result = this->_rules.at(index);
+ this->_rules.erase(this->_rules.begin() + index);
+ return result;
+ }
+
+ int RuleBlock::numberOfRules() const {
+ return this->_rules.size();
+ }
+
+ const std::vector<Rule*>& RuleBlock::rules() const {
+ return this->_rules;
+ }
+
+ void RuleBlock::setRules(const std::vector<Rule*>& rules) {
+ this->_rules = rules;
+ }
+
+ std::vector<Rule*>& RuleBlock::rules() {
+ return this->_rules;
+ }
+
+
+}
diff --git a/fuzzylite/src/term/Accumulated.cpp b/fuzzylite/src/term/Accumulated.cpp
new file mode 100644
index 0000000..979af9f
--- /dev/null
+++ b/fuzzylite/src/term/Accumulated.cpp
@@ -0,0 +1,211 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Accumulated.h"
+
+#include "fl/imex/FllExporter.h"
+#include "fl/norm/SNorm.h"
+#include "fl/norm/s/Maximum.h"
+#include "fl/term/Activated.h"
+
+
+namespace fl {
+
+ Accumulated::Accumulated(const std::string& name, scalar minimum, scalar maximum,
+ SNorm* accumulation)
+ : Term(name), _minimum(minimum), _maximum(maximum), _accumulation(accumulation) {
+ }
+
+ Accumulated::Accumulated(const Accumulated& other) : Term(other) {
+ copyFrom(other);
+ }
+
+ Accumulated& Accumulated::operator=(const Accumulated& other) {
+ if (this != &other) {
+ clear();
+ _accumulation.reset(fl::null);
+
+ Term::operator=(other);
+ copyFrom(other);
+ }
+ return *this;
+ }
+
+ Accumulated::~Accumulated() {
+ clear();
+ }
+
+ void Accumulated::copyFrom(const Accumulated& source) {
+ _minimum = source._minimum;
+ _maximum = source._maximum;
+
+ if (source._accumulation.get())
+ _accumulation.reset(source._accumulation->clone());
+
+ for (std::size_t i = 0; i < source._terms.size(); ++i) {
+ _terms.push_back(source._terms.at(i)->clone());
+ }
+ }
+
+ std::string Accumulated::className() const {
+ return "Accumulated";
+ }
+
+ scalar Accumulated::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ if (not (_terms.empty() or _accumulation.get())) { //Exception for IntegralDefuzzifiers
+ throw fl::Exception("[accumulation error] "
+ "accumulation operator needed to accumulate " + toString(), FL_AT);
+ }
+ scalar mu = 0.0;
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ mu = _accumulation->compute(mu, _terms.at(i)->membership(x));
+ }
+ return mu;
+ }
+
+ scalar Accumulated::activationDegree(const Term* forTerm) const {
+ scalar result = 0.0;
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ Activated* activatedTerm = _terms.at(i);
+ if (activatedTerm->getTerm() == forTerm) {
+ if (_accumulation.get()) result = _accumulation->compute(result, activatedTerm->getDegree());
+ else result += activatedTerm->getDegree(); //Default for WeightDefuzzifier
+ }
+ }
+ return result;
+ }
+
+ std::string Accumulated::parameters() const {
+ FllExporter exporter;
+ std::ostringstream ss;
+ ss << exporter.toString(_accumulation.get());
+ ss << " " << Op::str(_minimum) << " " << Op::str(_maximum) << " ";
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ ss << " " << exporter.toString(_terms.at(i));
+ }
+ return ss.str();
+ }
+
+ void Accumulated::configure(const std::string& parameters) {
+ (void) parameters;
+ }
+
+ Accumulated* Accumulated::clone() const {
+ return new Accumulated(*this);
+ }
+
+ std::string Accumulated::toString() const {
+ std::vector<std::string> accumulate;
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ accumulate.push_back(_terms.at(i)->toString());
+ }
+ FllExporter exporter;
+ std::ostringstream ss;
+ ss << _name << ": " << className() << " "
+ << exporter.toString(_accumulation.get()) << "["
+ << fl::Op::join(accumulate, ",") << "]";
+ return ss.str();
+ }
+
+ void Accumulated::setMinimum(scalar minimum) {
+ this->_minimum = minimum;
+ }
+
+ scalar Accumulated::getMinimum() const {
+ return this->_minimum;
+ }
+
+ void Accumulated::setMaximum(scalar maximum) {
+ this->_maximum = maximum;
+ }
+
+ scalar Accumulated::getMaximum() const {
+ return this->_maximum;
+ }
+
+ void Accumulated::setRange(scalar minimum, scalar maximum) {
+ setMinimum(minimum);
+ setMaximum(maximum);
+ }
+
+ scalar Accumulated::range() const {
+ return this->_maximum - this->_minimum;
+ }
+
+ void Accumulated::setAccumulation(SNorm* accumulation) {
+ this->_accumulation.reset(accumulation);
+ }
+
+ SNorm* Accumulated::getAccumulation() const {
+ return this->_accumulation.get();
+ }
+
+ /**
+ * Operations for std::vector _terms
+ */
+
+
+ void Accumulated::addTerm(const Term* term, scalar degree, const TNorm* activation) {
+ this->_terms.push_back(new Activated(term, degree, activation));
+ }
+
+ void Accumulated::addTerm(Activated* term) {
+ this->_terms.push_back(term);
+ }
+
+ Activated* Accumulated::removeTerm(int index) {
+ Activated* term = this->_terms.at(index);
+ this->_terms.erase(this->_terms.begin() + index);
+ return term;
+ }
+
+ void Accumulated::clear() {
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ delete _terms.at(i);
+ }
+ _terms.clear();
+ }
+
+ Activated* Accumulated::getTerm(int index) const {
+ return this->_terms.at(index);
+ }
+
+ const std::vector<Activated*>& Accumulated::terms() const {
+ return this->_terms;
+ }
+
+ std::vector<Activated*>& Accumulated::terms() {
+ return this->_terms;
+ }
+
+ int Accumulated::numberOfTerms() const {
+ return _terms.size();
+ }
+
+ bool Accumulated::isEmpty() const {
+ return _terms.empty();
+ }
+
+}
diff --git a/fuzzylite/src/term/Activated.cpp b/fuzzylite/src/term/Activated.cpp
new file mode 100644
index 0000000..9a27b4b
--- /dev/null
+++ b/fuzzylite/src/term/Activated.cpp
@@ -0,0 +1,100 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Activated.h"
+
+#include "fl/imex/FllExporter.h"
+#include "fl/norm/TNorm.h"
+
+namespace fl {
+
+ Activated::Activated(const Term* term, scalar degree, const TNorm* activation)
+ : Term(""), _term(term), _degree(degree), _activation(activation) {
+ if (term) this->_name = term->getName();
+ }
+
+ Activated::~Activated() {
+ }
+
+ std::string Activated::className() const {
+ return "Activated";
+ }
+
+ scalar Activated::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ if (not _activation) throw fl::Exception("[activation error] "
+ "activation operator needed to activate " + _term->toString(), FL_AT);
+ return _activation->compute(this->_term->membership(x), _degree);
+ }
+
+ std::string Activated::parameters() const {
+ FllExporter exporter;
+ std::ostringstream ss;
+ ss << Op::str(_degree) << " " << exporter.toString(_activation) << " "
+ << exporter.toString(_term);
+ return ss.str();
+ }
+
+ void Activated::configure(const std::string& parameters) {
+ (void) parameters;
+ }
+
+ std::string Activated::toString() const {
+ FllExporter exporter;
+ std::ostringstream ss;
+ ss << exporter.toString(_activation) << "("
+ << Op::str(_degree) << ","
+ << _term->getName() << ")";
+ return ss.str();
+ }
+
+ void Activated::setTerm(const Term* term) {
+ this->_term = term;
+ }
+
+ const Term* Activated::getTerm() const {
+ return this->_term;
+ }
+
+ void Activated::setDegree(scalar degree) {
+ this->_degree = degree;
+ }
+
+ scalar Activated::getDegree() const {
+ return this->_degree;
+ }
+
+ void Activated::setActivation(const TNorm* activation) {
+ this->_activation = activation;
+ }
+
+ const TNorm* Activated::getActivation() const {
+ return this->_activation;
+ }
+
+ Activated* Activated::clone() const {
+ return new Activated(*this);
+ }
+
+}
diff --git a/fuzzylite/src/term/Bell.cpp b/fuzzylite/src/term/Bell.cpp
new file mode 100644
index 0000000..fc0b215
--- /dev/null
+++ b/fuzzylite/src/term/Bell.cpp
@@ -0,0 +1,99 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Bell.h"
+
+namespace fl {
+
+ Bell::Bell(const std::string& name, scalar center, scalar width, scalar slope, scalar height)
+ : Term(name, height), _center(center), _width(width), _slope(slope) {
+ }
+
+ Bell::~Bell() {
+ }
+
+ std::string Bell::className() const {
+ return "Bell";
+ }
+
+ scalar Bell::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ return _height * (1.0 / (1.0 + std::pow(std::abs((x - _center) / _width), 2 * _slope)));
+ }
+
+ std::string Bell::parameters() const {
+ return Op::join(3, " ", _center, _width, _slope) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void Bell::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 3;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setCenter(Op::toScalar(values.at(0)));
+ setWidth(Op::toScalar(values.at(1)));
+ setSlope(Op::toScalar(values.at(2)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void Bell::setWidth(scalar a) {
+ this->_width = a;
+ }
+
+ scalar Bell::getWidth() const {
+ return this->_width;
+ }
+
+ void Bell::setSlope(scalar b) {
+ this->_slope = b;
+ }
+
+ scalar Bell::getSlope() const {
+ return this->_slope;
+ }
+
+ void Bell::setCenter(scalar c) {
+ this->_center = c;
+ }
+
+ scalar Bell::getCenter() const {
+ return this->_center;
+ }
+
+ Bell* Bell::clone() const {
+ return new Bell(*this);
+ }
+
+ Term* Bell::constructor() {
+ return new Bell;
+ }
+
+}
diff --git a/fuzzylite/src/term/Concave.cpp b/fuzzylite/src/term/Concave.cpp
new file mode 100644
index 0000000..37679ae
--- /dev/null
+++ b/fuzzylite/src/term/Concave.cpp
@@ -0,0 +1,107 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Concave.h"
+
+namespace fl {
+
+ Concave::Concave(const std::string& name, scalar inflection, scalar end, scalar height)
+ : Term(name, height), _inflection(inflection), _end(end) {
+
+ }
+
+ Concave::~Concave() {
+
+ }
+
+ std::string Concave::className() const {
+ return "Concave";
+ }
+
+ scalar Concave::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ if (fl::Op::isLE(_inflection, _end)) { //Concave increasing
+ if (fl::Op::isLt(x, _end)) {
+ return _height * (_end - _inflection) / (2 * _end - _inflection - x);
+ }
+ } else { //Concave decreasing
+ if (fl::Op::isGt(x, _end)) {
+ return _height * (_inflection - _end) / (_inflection - 2 * _end + x);
+ }
+ }
+ return _height * 1.0;
+ }
+
+ std::string Concave::parameters() const {
+ return Op::join(2, " ", _inflection, _end) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+
+ }
+
+ void Concave::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 2;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setInflection(Op::toScalar(values.at(0)));
+ setEnd(Op::toScalar(values.at(1)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+
+ }
+
+ void Concave::setInflection(scalar start) {
+ this->_inflection = start;
+ }
+
+ scalar Concave::getInflection() const {
+ return this->_inflection;
+ }
+
+ void Concave::setEnd(scalar end) {
+ this->_end = end;
+ }
+
+ scalar Concave::getEnd() const {
+ return this->_end;
+ }
+
+ Concave* Concave::clone() const {
+ return new Concave(*this);
+ }
+
+ Term* Concave::constructor() {
+ return new Concave;
+ }
+
+
+
+
+
+}
diff --git a/fuzzylite/src/term/Constant.cpp b/fuzzylite/src/term/Constant.cpp
new file mode 100644
index 0000000..d52f8ec
--- /dev/null
+++ b/fuzzylite/src/term/Constant.cpp
@@ -0,0 +1,70 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Constant.h"
+
+namespace fl {
+
+ Constant::Constant(const std::string& name, scalar value)
+ : Term(name), _value(value) {
+ }
+
+ Constant::~Constant() {
+ }
+
+ std::string Constant::className() const {
+ return "Constant";
+ }
+
+ scalar Constant::membership(scalar x) const {
+ (void) x;
+ return this->_value;
+ }
+
+ std::string Constant::parameters() const {
+ return Op::str(_value);
+ }
+
+ void Constant::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ setValue(Op::toScalar(parameters));
+ }
+
+ void Constant::setValue(scalar value) {
+ this->_value = value;
+ }
+
+ scalar Constant::getValue() const {
+ return this->_value;
+ }
+
+ Constant* Constant::clone() const {
+ return new Constant(*this);
+ }
+
+ Term* Constant::constructor() {
+ return new Constant;
+ }
+
+}
diff --git a/fuzzylite/src/term/Cosine.cpp b/fuzzylite/src/term/Cosine.cpp
new file mode 100644
index 0000000..a1402ad
--- /dev/null
+++ b/fuzzylite/src/term/Cosine.cpp
@@ -0,0 +1,96 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Cosine.h"
+
+namespace fl {
+
+ Cosine::Cosine(const std::string& name, scalar center, scalar width, scalar height)
+ : Term(name, height), _center(center), _width(width) {
+
+ }
+
+ Cosine::~Cosine() {
+
+ }
+
+ std::string Cosine::className() const {
+ return "Cosine";
+ }
+
+ std::string Cosine::parameters() const {
+ return Op::join(2, " ", _center, _width) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void Cosine::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 2;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setCenter(Op::toScalar(values.at(0)));
+ setWidth(Op::toScalar(values.at(1)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+
+ }
+
+ scalar Cosine::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ if (fl::Op::isLt(x, _center - _width / 2.0)
+ or fl::Op::isGt(x, _center + _width / 2.0))
+ return _height * 0.0;
+ const scalar pi = 4.0 * std::atan(1.0);
+ return _height * (0.5 * (1.0 + std::cos(2.0 / _width * pi * (x - _center))));
+ }
+
+ void Cosine::setCenter(scalar center) {
+ this->_center = center;
+ }
+
+ scalar Cosine::getCenter() const {
+ return this->_center;
+ }
+
+ void Cosine::setWidth(scalar width) {
+ this->_width = width;
+ }
+
+ scalar Cosine::getWidth() const {
+ return this->_width;
+ }
+
+ Cosine* Cosine::clone() const {
+ return new Cosine(*this);
+ }
+
+ Term* Cosine::constructor() {
+ return new Cosine;
+ }
+}
diff --git a/fuzzylite/src/term/Discrete.cpp b/fuzzylite/src/term/Discrete.cpp
new file mode 100644
index 0000000..212ada2
--- /dev/null
+++ b/fuzzylite/src/term/Discrete.cpp
@@ -0,0 +1,210 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Discrete.h"
+
+#include <cstdarg>
+
+namespace fl {
+
+ Discrete::Discrete(const std::string& name, const std::vector<Pair>& xy, scalar height)
+ : Term(name, height), _xy(xy) {
+ }
+
+ Discrete::~Discrete() {
+ }
+
+ std::string Discrete::className() const {
+ return "Discrete";
+ }
+
+ scalar Discrete::membership(scalar _x_) const {
+ if (fl::Op::isNaN(_x_)) return fl::nan;
+ if (_xy.empty())
+ throw fl::Exception("[discrete error] term is empty", FL_AT);
+
+ /* ______________________
+ * / \
+ * / \
+ * ____________/ \____________
+ * x[0] x[n-1]
+ */
+
+
+ if (fl::Op::isLE(_x_, _xy.front().first)) return _height * _xy.front().second;
+ if (fl::Op::isGE(_x_, _xy.back().first)) return _height * _xy.back().second;
+
+ int lower = -1, upper = -1;
+
+ for (std::size_t i = 0; i < _xy.size(); ++i) {
+ if (Op::isEq(_xy.at(i).first, _x_)) return _height * _xy.at(i).second;
+ //approximate on the left
+ if (Op::isLt(_xy.at(i).first, _x_)) {
+ lower = i;
+ }
+ //get the immediate next one on the right
+ if (Op::isGt(_xy.at(i).first, _x_)) {
+ upper = i;
+ break;
+ }
+ }
+ if (upper < 0) upper = _xy.size() - 1;
+ if (lower < 0) lower = 0;
+
+ return _height * Op::scale(_x_, _xy.at(lower).first, _xy.at(upper).first,
+ _xy.at(lower).second, _xy.at(upper).second);
+ }
+
+ std::string Discrete::parameters() const {
+ std::ostringstream ss;
+ for (std::size_t i = 0; i < _xy.size(); ++i) {
+ ss << fl::Op::str(_xy.at(i).first) << " " << fl::Op::str(_xy.at(i).second);
+ if (i + 1 < _xy.size()) ss << " ";
+ }
+ if (not Op::isEq(_height, 1.0)) ss << " " << Op::str(_height);
+ return ss.str();
+ }
+
+ void Discrete::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> strValues = Op::split(parameters, " ");
+ std::vector<scalar> values(strValues.size());
+ for (std::size_t i = 0; i < strValues.size(); ++i) {
+ values.at(i) = Op::toScalar(strValues.at(i));
+ }
+ if (values.size() % 2 == 0) {
+ setHeight(1.0);
+ } else {
+ setHeight(values.back());
+ values.pop_back();
+ }
+ this->_xy = toPairs(values);
+ }
+
+ template <typename T>
+ Discrete* Discrete::create(const std::string& name, int argc,
+ T x1, T y1, ...) { // throw (fl::Exception) {
+ std::vector<scalar> xy(argc);
+ xy.at(0) = x1;
+ xy.at(1) = y1;
+ va_list args;
+ va_start(args, y1);
+ for (int i = 2; i < argc; ++i) {
+ xy.at(i) = (scalar) va_arg(args, T);
+ }
+ va_end(args);
+
+ FL_unique_ptr<Discrete> result(new Discrete(name));
+ if (xy.size() % 2 != 0) {
+ result->setHeight(xy.back());
+ xy.pop_back();
+ }
+ result->setXY(toPairs(xy));
+ return result.release();
+ }
+
+ template FL_API Discrete* Discrete::create(const std::string& name, int argc,
+ double x1, double y1, ...); // throw (fl::Exception);
+ //double, not scalar because variadic promotes floats to double
+ template FL_API Discrete* Discrete::create(const std::string& name, int argc,
+ int x1, int y1, ...); // throw (fl::Exception);
+
+ void Discrete::setXY(const std::vector<Pair>& pairs) {
+ this->_xy = pairs;
+ }
+
+ const std::vector<Discrete::Pair>& Discrete::xy() const {
+ return this->_xy;
+ }
+
+ std::vector<Discrete::Pair>& Discrete::xy() {
+ return this->_xy;
+ }
+
+ const Discrete::Pair& Discrete::xy(int index) const {
+ return this->_xy.at(index);
+ }
+
+ Discrete::Pair& Discrete::xy(int index) {
+ return this->_xy.at(index);
+ }
+
+ std::vector<Discrete::Pair> Discrete::toPairs(const std::vector<scalar>& xy) {
+ if (xy.size() % 2 != 0) {
+ std::ostringstream os;
+ os << "[discrete error] missing value in set of pairs (|xy|=" << xy.size() << ")";
+ throw fl::Exception(os.str(), FL_AT);
+ }
+
+ std::vector<Pair> result((xy.size() + 1) / 2);
+ for (std::size_t i = 0; i + 1 < xy.size(); i += 2) {
+ result.at(i / 2).first = xy.at(i);
+ result.at(i / 2).second = xy.at(i + 1);
+ }
+ return result;
+ }
+
+ std::vector<Discrete::Pair> Discrete::toPairs(const std::vector<scalar>& xy,
+ scalar missingValue) FL_INOEXCEPT {
+ std::vector<Pair> result((xy.size() + 1) / 2);
+ for (std::size_t i = 0; i + 1 < xy.size(); i += 2) {
+ result.at(i / 2).first = xy.at(i);
+ result.at(i / 2).second = xy.at(i + 1);
+ }
+ if (xy.size() % 2 != 0) {
+ result.back().first = xy.back();
+ result.back().second = missingValue;
+ }
+ return result;
+ }
+
+ std::vector<scalar> Discrete::toVector(const std::vector<Pair>& xy) {
+ std::vector<scalar> result(xy.size() * 2);
+ for (std::size_t i = 0; i < xy.size(); ++i) {
+ result.at(2 * i) = xy.at(i).first;
+ result.at(2 * i + 1) = xy.at(i).second;
+ }
+ return result;
+ }
+
+ std::string Discrete::formatXY(const std::vector<Pair>& xy, const std::string& prefix, const std::string& innerSeparator, const std::string& postfix, const std::string& outerSeparator) {
+ std::ostringstream os;
+ for (std::size_t i = 0; i < xy.size(); ++i) {
+ os << prefix << fl::Op::str(xy.at(i).first) << innerSeparator
+ << fl::Op::str(xy.at(i).second) << postfix;
+ if (i + 1 < xy.size()) os << outerSeparator;
+ }
+ return os.str();
+ }
+
+ Discrete* Discrete::clone() const {
+ return new Discrete(*this);
+ }
+
+ Term* Discrete::constructor() {
+ return new Discrete;
+ }
+
+
+}
diff --git a/fuzzylite/src/term/Function.cpp b/fuzzylite/src/term/Function.cpp
new file mode 100644
index 0000000..c0f54b8
--- /dev/null
+++ b/fuzzylite/src/term/Function.cpp
@@ -0,0 +1,600 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Function.h"
+
+#include "fl/Engine.h"
+#include "fl/factory/FactoryManager.h"
+#include "fl/factory/FunctionFactory.h"
+#include "fl/rule/Rule.h"
+#include "fl/variable/InputVariable.h"
+#include "fl/variable/OutputVariable.h"
+
+#include <cctype>
+#include <functional>
+#include <queue>
+#include <signal.h>
+#include <stack>
+
+
+namespace fl {
+
+ /**
+ * Parsing elements
+ */
+
+
+ Function::Element::Element(const std::string& name, const std::string& description, Type type)
+ : name(name), description(description), type(type), unary(fl::null), binary(fl::null), arity(0),
+ precedence(0), associativity(-1) {
+
+ }
+
+ Function::Element::Element(const std::string& name, const std::string& description,
+ Type type, Unary unary, int precedence, int associativity)
+ : name(name), description(description), type(type), unary(unary), binary(fl::null), arity(1),
+ precedence(precedence), associativity(associativity) {
+ }
+
+ Function::Element::Element(const std::string& name, const std::string& description,
+ Type type, Binary binary, int precedence, int associativity)
+ : name(name), description(description), type(type), unary(fl::null), binary(binary), arity(2),
+ precedence(precedence), associativity(associativity) {
+ }
+
+ Function::Element::~Element() {
+
+ }
+
+ bool Function::Element::isOperator() const {
+ return type == OPERATOR;
+ }
+
+ bool Function::Element::isFunction() const {
+ return type == FUNCTION;
+ }
+
+ Function::Element* Function::Element::clone() const {
+ return new Element(*this);
+ }
+
+ std::string Function::Element::toString() const {
+ std::ostringstream ss;
+
+ if (type == OPERATOR) {
+ ss << "Operator (name=" << name << ", "
+ << "description=" << description << ", "
+ << "precedence=" << precedence << ", "
+ << "arity=" << arity << ", "
+ << "associativity=" << associativity << ", ";
+ if (arity == 1) ss << "pointer=" << unary;
+ else if (arity == 2) ss << "pointer=" << binary;
+ else ss << "pointer=error";
+ ss << ")";
+ } else if (type == FUNCTION) {
+ ss << "Function (name=" << name << ", "
+ << "description=" << description << ", "
+ << "arity=" << arity << ", "
+ << "associativity=" << associativity << ", ";
+ if (arity == 1) ss << "pointer=" << unary;
+ else if (arity == 2) ss << "pointer=" << binary;
+ else ss << "pointer=error";
+ ss << ")";
+ }
+ return ss.str();
+ }
+
+ /******************************
+ * Tree Node Elements
+ ******************************/
+
+ Function::Node::Node(Element* element, Node* left, Node* right)
+ : element(element), left(left), right(right), variable(""), value(fl::nan) {
+ }
+
+ Function::Node::Node(const std::string& variable)
+ : element(fl::null), left(fl::null), right(fl::null), variable(variable), value(fl::nan) {
+ }
+
+ Function::Node::Node(scalar value)
+ : element(fl::null), left(fl::null), right(fl::null), variable(""), value(value) {
+ }
+
+ Function::Node::Node(const Node& other)
+ : element(fl::null), left(fl::null), right(fl::null), variable(""), value(fl::nan) {
+ copyFrom(other);
+ }
+
+ Function::Node& Function::Node::operator=(const Node& other) {
+ if (this != &other) {
+ element.reset(fl::null);
+ left.reset(fl::null);
+ right.reset(fl::null);
+
+ copyFrom(other);
+ }
+ return *this;
+ }
+
+ void Function::Node::copyFrom(const Node& other) {
+ if (other.element.get()) element.reset(other.element->clone());
+ if (other.left.get()) left.reset(other.left->clone());
+ if (other.right.get()) right.reset(other.right->clone());
+ variable = other.variable;
+ value = other.value;
+ }
+
+ Function::Node::~Node() {
+ }
+
+ scalar Function::Node::evaluate(const std::map<std::string, scalar>* variables) const {
+ scalar result = fl::nan;
+ if (element.get()) {
+ if (element->unary) {
+ result = element->unary(left->evaluate(variables));
+ } else if (element->binary) {
+ result = element->binary(right->evaluate(variables), left->evaluate(variables));
+ } else {
+ std::ostringstream ex;
+ ex << "[function error] arity <" << element->arity << "> of "
+ << (element->isOperator() ? "operator" : "function") <<
+ " <" << element->name << "> is fl::null";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ } else if (not variable.empty()) {
+ if (not variables) {
+ throw fl::Exception("[function error] "
+ "expected a map of variables, but none was provided", FL_AT);
+ }
+ std::map<std::string, scalar>::const_iterator it = variables->find(variable);
+ if (it != variables->end()) result = it->second;
+ else throw fl::Exception("[function error] "
+ "unknown variable <" + variable + ">", FL_AT);
+ } else {
+ result = value;
+ }
+ return result;
+ }
+
+ Function::Node* Function::Node::clone() const {
+ return new Node(*this);
+ }
+
+ std::string Function::Node::toString() const {
+ std::ostringstream ss;
+ if (element.get()) ss << element->name;
+ else if (not variable.empty()) ss << variable;
+ else ss << fl::Op::str(value);
+ return ss.str();
+ }
+
+ std::string Function::Node::toPrefix(const Node* node) const {
+ if (not node) node = this;
+ if (not fl::Op::isNaN(node->value)) { //is terminal
+ return fl::Op::str(node->value);
+ }
+ if (not node->variable.empty()) {
+ return node->variable;
+ }
+
+ std::ostringstream ss;
+ ss << node->toString();
+ if (node->left.get())
+ ss << " " << this->toPrefix(node->left.get());
+ if (node->right.get())
+ ss << " " << this->toPrefix(node->right.get());
+ return ss.str();
+ }
+
+ std::string Function::Node::toInfix(const Node* node) const {
+ if (not node) node = this;
+ if (not fl::Op::isNaN(node->value)) { //is proposition
+ return fl::Op::str(node->value);
+ }
+ if (not node->variable.empty()) {
+ return node->variable;
+ }
+
+ std::ostringstream ss;
+ if (node->left.get())
+ ss << this->toInfix(node->left.get()) << " ";
+ ss << node->toString();
+ if (node->right.get())
+ ss << " " << this->toInfix(node->right.get());
+ return ss.str();
+ }
+
+ std::string Function::Node::toPostfix(const Node* node) const {
+ if (not node) node = this;
+ if (not fl::Op::isNaN(node->value)) { //is proposition
+ return fl::Op::str(node->value);
+ }
+ if (not node->variable.empty()) {
+ return node->variable;
+ }
+
+ std::ostringstream ss;
+ if (node->left.get())
+ ss << this->toPostfix(node->left.get()) << " ";
+ if (node->right.get())
+ ss << this->toPostfix(node->right.get()) << " ";
+ ss << node->toString();
+ return ss.str();
+ }
+
+ /**********************************
+ * Function class.
+ **********************************/
+ Function::Function(const std::string& name,
+ const std::string& formula, const Engine* engine)
+ : Term(name), _root(fl::null), _formula(formula), _engine(engine) {
+ }
+
+ Function::Function(const Function& other) : Term(other),
+ _root(fl::null), _formula(other._formula), _engine(other._engine) {
+ if (other._root.get()) _root.reset(other._root->clone());
+ variables = other.variables;
+ }
+
+ Function& Function::operator=(const Function& other) {
+ if (this != &other) {
+ _root.reset(fl::null);
+
+ Term::operator=(other);
+ _formula = other._formula;
+ _engine = other._engine;
+ if (other._root.get()) _root.reset(other._root->clone());
+ variables = other.variables;
+ }
+ return *this;
+ }
+
+ Function::~Function() {
+ }
+
+ std::string Function::className() const {
+ return "Function";
+ }
+
+ scalar Function::membership(scalar x) const {
+ if (not this->_root.get()) {
+ throw fl::Exception("[function error] function <" + _formula + "> not loaded.", FL_AT);
+ }
+ if (this->_engine) {
+ for (int i = 0; i < this->_engine->numberOfInputVariables(); ++i) {
+ InputVariable* input = this->_engine->getInputVariable(i);
+ this->variables[input->getName()] = input->getInputValue();
+ }
+ for (int i = 0; i < this->_engine->numberOfOutputVariables(); ++i) {
+ OutputVariable* output = this->_engine->getOutputVariable(i);
+ this->variables[output->getName()] = output->getOutputValue();
+ }
+ }
+ this->variables["x"] = x;
+ return this->evaluate(&this->variables);
+ }
+
+ scalar Function::evaluate(const std::map<std::string, scalar>* localVariables) const {
+ if (not this->_root.get())
+ throw fl::Exception("[function error] evaluation failed because the function is not loaded", FL_AT);
+ if (localVariables)
+ return this->_root->evaluate(localVariables);
+ return this->_root->evaluate(&this->variables);
+ }
+
+ std::string Function::parameters() const {
+ return _formula;
+ }
+
+ void Function::configure(const std::string& parameters) {
+ load(parameters);
+ }
+
+ Function* Function::create(const std::string& name,
+ const std::string& infix, const Engine* engine) {
+ FL_unique_ptr<Function> result(new Function(name));
+ result->load(infix, engine);
+ return result.release();
+ }
+
+ bool Function::isLoaded() const {
+ return this->_root.get() != fl::null;
+ }
+
+ void Function::unload() {
+ this->_root.reset(fl::null);
+ this->variables.clear();
+ }
+
+ void Function::load() {
+ load(this->_formula);
+ }
+
+ void Function::load(const std::string& formula) {
+ load(formula, this->_engine);
+ }
+
+ void Function::load(const std::string& formula,
+ const Engine* engine) {
+ unload();
+ this->_formula = formula;
+ this->_engine = engine;
+ this->_root.reset(parse(formula));
+ membership(0.0); //make sure function evaluates without throwing exception.
+ }
+
+ void Function::setFormula(const std::string& formula) {
+ this->_formula = formula;
+ }
+
+ std::string Function::getFormula() const {
+ return this->_formula;
+ }
+
+ void Function::setEngine(const Engine* engine) {
+ this->_engine = engine;
+ }
+
+ const Engine* Function::getEngine() const {
+ return this->_engine;
+ }
+
+ Function::Node* Function::root() const {
+ return this->_root.get();
+ }
+
+ Function* Function::clone() const {
+ return new Function(*this);
+ }
+
+ Term* Function::constructor() {
+ return new Function;
+ }
+
+ std::string Function::space(const std::string& formula) const {
+ std::vector<std::string> chars;
+ chars.push_back("(");
+ chars.push_back(")");
+ chars.push_back(",");
+
+ std::vector<std::string> operators = fl::FactoryManager::instance()->function()->availableOperators();
+ for (std::size_t i = 0; i < operators.size(); ++i) {
+ if (not (operators.at(i) == fl::Rule::andKeyword() or
+ operators.at(i) == fl::Rule::orKeyword())) {
+ chars.push_back(operators.at(i));
+ }
+ }
+
+ std::string result = formula;
+ for (std::size_t i = 0; i < chars.size(); ++i) {
+ result = fl::Op::findReplace(result, chars.at(i), " " + chars.at(i) + " ");
+ }
+ return result;
+ }
+
+ /****************************************
+ * The Glorious Parser
+ * Shunting-yard algorithm
+ * TODO: Maybe change it for http://en.wikipedia.org/wiki/Operator-precedence_parser
+ ***************************************/
+
+ std::string Function::toPostfix(const std::string& formula) const {
+ std::string spacedFormula = space(formula);
+
+ std::queue<std::string> queue;
+ std::stack<std::string> stack;
+
+ std::stringstream tokenizer(spacedFormula);
+ std::string token;
+ FunctionFactory* factory = fl::FactoryManager::instance()->function();
+ while (tokenizer >> token) {
+ Element* element = factory->getObject(token);
+ bool isOperand = not element and token != "(" and token != ")" and token != ",";
+
+ if (isOperand) {
+ queue.push(token);
+
+ } else if (element and element->isFunction()) {
+ stack.push(token);
+
+ } else if (token == ",") {
+ while (not stack.empty() and stack.top() != "(") {
+ queue.push(stack.top());
+ stack.pop();
+ }
+ if (stack.empty() or stack.top() != "(") {
+ std::ostringstream ex;
+ ex << "[parsing error] mismatching parentheses in: " << formula;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+
+ } else if (element and element->isOperator()) {
+ Element* op1 = element;
+ for (;;) {
+ Element* op2 = fl::null;
+ if (not stack.empty()) op2 = factory->getObject(stack.top());
+ if (not op2) break;
+
+ if ((op1->associativity < 0 and op1->precedence == op2->precedence)
+ or op1->precedence < op2->precedence) {
+ queue.push(stack.top());
+ stack.pop();
+ } else
+ break;
+ }
+ stack.push(token);
+
+ } else if (token == "(") {
+ stack.push(token);
+
+ } else if (token == ")") {
+ while (not stack.empty() and stack.top() != "(") {
+ queue.push(stack.top());
+ stack.pop();
+ }
+ if (stack.empty() or stack.top() != "(") {
+ std::ostringstream ex;
+ ex << "[parsing error] mismatching parentheses in: " << formula;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ stack.pop(); //get rid of "("
+
+ Element* top = fl::null;
+ if (not stack.empty()) top = factory->getObject(stack.top());
+ if (top and top->isFunction()) {
+ queue.push(stack.top());
+ stack.pop();
+ }
+ } else {
+ std::ostringstream ex;
+ ex << "[parsing error] unexpected error with token <" << token << ">";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ }
+
+ while (not stack.empty()) {
+ if (stack.top() == "(" or stack.top() == ")") {
+ std::ostringstream ex;
+ ex << "[parsing error] mismatching parentheses in: " << formula;
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ queue.push(stack.top());
+ stack.pop();
+ }
+
+ std::stringstream ssPostfix;
+ while (not queue.empty()) {
+ ssPostfix << queue.front();
+ queue.pop();
+ if (not queue.empty()) ssPostfix << " ";
+ }
+ // FL_DBG("postfix=" << ssPostfix.str());
+ return ssPostfix.str();
+ }
+
+ // bool FunctionFactory::isOperand(const std::string& name) const {
+ // //An operand is not a parenthesis...
+ // if (name == "(" or name == ")" or name == ",") return false;
+ // //nor an operator...
+ // if (isOperator(name)) return false;
+ // //nor a function...
+ // if (isFunction(name)) return false;
+ // //...it is everything else :)
+ // return true;
+ // }
+
+ Function::Node* Function::parse(const std::string& formula) {
+ if (formula.empty())
+ throw fl::Exception("[function error] formula is empty", FL_AT);
+ std::string postfix = toPostfix(formula);
+
+ std::stack<Node*> stack;
+
+ std::istringstream tokenizer(postfix);
+ std::string token;
+ FunctionFactory* factory = fl::FactoryManager::instance()->function();
+ while (tokenizer >> token) {
+ Element* element = factory->getObject(token);
+ bool isOperand = not element and token != "(" and token != ")" and token != ",";
+
+ if (element) {
+ if (element->arity > (int) stack.size()) {
+ std::ostringstream ss;
+ ss << "[function error] " << (element->isOperator() ? "operator" : "function") <<
+ " <" << element->name << "> has arity <" << element->arity << ">, "
+ "but found <" << stack.size() << "> element" <<
+ (stack.size() == 1 ? "" : "s");
+ throw fl::Exception(ss.str(), FL_AT);
+ }
+
+ Node* node = new Node(element->clone());
+ node->left.reset(stack.top());
+ stack.pop();
+ if (element->arity == 2) {
+ node->right.reset(stack.top());
+ stack.pop();
+ }
+ stack.push(node);
+
+ } else if (isOperand) {
+ Node* node;
+ try {
+ scalar value = fl::Op::toScalar(token);
+ node = new Node(value);
+ } catch (std::exception& ex) {
+ (void) ex;
+ node = new Node(token);
+ }
+ stack.push(node);
+ }
+ }
+
+ if (stack.size() != 1)
+ throw fl::Exception("[function error] ill-formed formula <" + formula + ">", FL_AT);
+
+ return stack.top();
+ }
+
+ void Function::main() {
+ Function f;
+ std::string text = "3+4*2/(1-5)^2^3";
+ FL_LOG(f.toPostfix(text));
+ FL_LOG("P: " << f.parse(text)->toInfix());
+ FL_LOG(">" << f.parse(text)->evaluate());
+ //3 4 2 * 1 5 - 2 3 ^ ^ / +
+
+ f.variables["y"] = 1.0;
+ text = "sin(y*x)^2/x";
+ FL_LOG("pre: " << f.parse(text)->toPrefix());
+ FL_LOG("in: " << f.parse(text)->toInfix());
+ FL_LOG("pos: " << f.parse(text)->toPostfix());
+ f.load(text);
+ FL_LOG("Result: " << f.membership(1));
+ //y x * sin 2 ^ x /
+
+
+ text = "(Temperature is High and Oxygen is Low) or "
+ "(Temperature is Low and (Oxygen is Low or Oxygen is High))";
+ FL_LOG(f.toPostfix(text));
+
+ f.variables["pi"] = 3.14;
+ text = "-5 *4/sin(-pi/2)";
+ FL_LOG(f.toPostfix(text));
+ try {
+ FL_LOG(f.parse(text)->evaluate());
+ } catch (std::exception& e) {
+ FL_LOG(e.what());
+ }
+ f.variables["pi"] = 3.14;
+ text = "~5 *4/sin(~pi/2)";
+ FL_LOG(f.toPostfix(text));
+ try {
+ FL_LOG(f.parse(text)->evaluate(&f.variables));
+ } catch (std::exception& e) {
+ FL_LOG(e.what());
+ }
+ }
+
+}
diff --git a/fuzzylite/src/term/Gaussian.cpp b/fuzzylite/src/term/Gaussian.cpp
new file mode 100644
index 0000000..5b709f9
--- /dev/null
+++ b/fuzzylite/src/term/Gaussian.cpp
@@ -0,0 +1,92 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Gaussian.h"
+
+namespace fl {
+
+ Gaussian::Gaussian(const std::string& name,
+ scalar mean, scalar standardDeviation, scalar height)
+ : Term(name, height), _mean(mean), _standardDeviation(standardDeviation) {
+ }
+
+ Gaussian::~Gaussian() {
+ }
+
+ std::string Gaussian::className() const {
+ return "Gaussian";
+ }
+
+ scalar Gaussian::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ return _height * std::exp((-(x - _mean) * (x - _mean)) / (2 * _standardDeviation * _standardDeviation));
+ }
+
+ std::string Gaussian::parameters() const {
+ return Op::join(2, " ", _mean, _standardDeviation) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void Gaussian::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 2;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setMean(Op::toScalar(values.at(0)));
+ setStandardDeviation(Op::toScalar(values.at(1)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void Gaussian::setMean(scalar c) {
+ this->_mean = c;
+ }
+
+ scalar Gaussian::getMean() const {
+ return this->_mean;
+ }
+
+ void Gaussian::setStandardDeviation(scalar sigma) {
+ this->_standardDeviation = sigma;
+ }
+
+ scalar Gaussian::getStandardDeviation() const {
+ return this->_standardDeviation;
+ }
+
+ Gaussian* Gaussian::clone() const {
+ return new Gaussian(*this);
+ }
+
+ Term* Gaussian::constructor() {
+ return new Gaussian;
+ }
+
+
+}
diff --git a/fuzzylite/src/term/GaussianProduct.cpp b/fuzzylite/src/term/GaussianProduct.cpp
new file mode 100644
index 0000000..b9652e1
--- /dev/null
+++ b/fuzzylite/src/term/GaussianProduct.cpp
@@ -0,0 +1,120 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/GaussianProduct.h"
+
+namespace fl {
+
+ GaussianProduct::GaussianProduct(const std::string& name,
+ scalar meanA, scalar standardDeviationA, scalar meanB, scalar standardDeviationB,
+ scalar height)
+ : Term(name, height), _meanA(meanA), _standardDeviationA(standardDeviationA),
+ _meanB(meanB), _standardDeviationB(standardDeviationB) {
+ }
+
+ GaussianProduct::~GaussianProduct() {
+ }
+
+ std::string GaussianProduct::className() const {
+ return "GaussianProduct";
+ }
+
+ scalar GaussianProduct::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ bool xLEa = fl::Op::isLE(x, _meanA);
+ scalar a = (1 - xLEa) + xLEa * std::exp(
+ (-(x - _meanA) * (x - _meanA)) / (2 * _standardDeviationA * _standardDeviationA)
+ );
+ bool xGEb = fl::Op::isGE(x, _meanB);
+ scalar b = (1 - xGEb) + xGEb * std::exp(
+ (-(x - _meanB) * (x - _meanB)) / (2 * _standardDeviationB * _standardDeviationB)
+ );
+ return _height * a * b;
+ }
+
+ std::string GaussianProduct::parameters() const {
+ return Op::join(4, " ", _meanA, _standardDeviationA, _meanB, _standardDeviationB) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void GaussianProduct::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 4;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setMeanA(Op::toScalar(values.at(0)));
+ setStandardDeviationA(Op::toScalar(values.at(1)));
+ setMeanB(Op::toScalar(values.at(2)));
+ setStandardDeviationB(Op::toScalar(values.at(3)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void GaussianProduct::setMeanA(scalar meanA) {
+ this->_meanA = meanA;
+ }
+
+ scalar GaussianProduct::getMeanA() const {
+ return this->_meanA;
+ }
+
+ void GaussianProduct::setStandardDeviationA(scalar sigmaA) {
+ this->_standardDeviationA = sigmaA;
+ }
+
+ scalar GaussianProduct::getStandardDeviationA() const {
+ return this->_standardDeviationA;
+ }
+
+ void GaussianProduct::setMeanB(scalar meanB) {
+ this->_meanB = meanB;
+ }
+
+ scalar GaussianProduct::getMeanB() const {
+ return this->_meanB;
+ }
+
+ void GaussianProduct::setStandardDeviationB(scalar sigmaB) {
+ this->_standardDeviationB = sigmaB;
+ }
+
+ scalar GaussianProduct::getStandardDeviationB() const {
+ return this->_standardDeviationB;
+ }
+
+ GaussianProduct* GaussianProduct::clone() const {
+ return new GaussianProduct(*this);
+ }
+
+ Term* GaussianProduct::constructor() {
+ return new GaussianProduct;
+ }
+
+
+}
diff --git a/fuzzylite/src/term/Linear.cpp b/fuzzylite/src/term/Linear.cpp
new file mode 100644
index 0000000..4111a00
--- /dev/null
+++ b/fuzzylite/src/term/Linear.cpp
@@ -0,0 +1,135 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Linear.h"
+
+#include "fl/Engine.h"
+#include "fl/variable/InputVariable.h"
+
+#include <cstdarg>
+
+namespace fl {
+
+ Linear::Linear(const std::string& name,
+ const std::vector<scalar>& coefficients,
+ const Engine* engine)
+ : Term(name), _coefficients(coefficients), _engine(engine) {
+ }
+
+ Linear::~Linear() {
+ }
+
+ std::string Linear::className() const {
+ return "Linear";
+ }
+
+ scalar Linear::membership(scalar x) const {
+ (void) x;
+ if (not _engine) throw fl::Exception("[linear error] term <" + getName() + "> "
+ "is missing a reference to the engine", FL_AT);
+
+ scalar result = 0.0;
+ for (std::size_t i = 0; i < _engine->inputVariables().size(); ++i) {
+ if (i < _coefficients.size())
+ result += _coefficients.at(i) * _engine->inputVariables().at(i)->getInputValue();
+ }
+ if (_coefficients.size() > _engine->inputVariables().size()) {
+ result += _coefficients.back();
+ }
+ return result;
+ }
+
+ void Linear::set(const std::vector<scalar>& coeffs, const Engine* engine) {
+ setCoefficients(coeffs);
+ setEngine(engine);
+ }
+
+ void Linear::setCoefficients(const std::vector<scalar>& coeffs) {
+ this->_coefficients = coeffs;
+ }
+
+ const std::vector<scalar>& Linear::coefficients() const {
+ return this->_coefficients;
+ }
+
+ std::vector<scalar>& Linear::coefficients() {
+ return this->_coefficients;
+ }
+
+ void Linear::setEngine(const Engine* engine) {
+ this->_engine = engine;
+ }
+
+ const Engine* Linear::getEngine() const {
+ return this->_engine;
+ }
+
+ std::string Linear::parameters() const {
+ return Op::join(this->_coefficients, " ");
+ }
+
+ void Linear::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> strValues = Op::split(parameters, " ");
+ std::vector<scalar> values;
+ for (std::size_t i = 0; i < strValues.size(); ++i) {
+ values.push_back(Op::toScalar(strValues.at(i)));
+ }
+ this->_coefficients = values;
+ }
+
+ Linear* Linear::clone() const {
+ return new Linear(*this);
+ }
+
+ Term* Linear::constructor() {
+ return new Linear;
+ }
+
+ template <typename T>
+ Linear* Linear::create(const std::string& name,
+ const Engine* engine, T firstCoefficient, ...) {// throw (fl::Exception) {
+ if (not engine) throw fl::Exception("[linear error] cannot create term <" + name + "> "
+ "without a reference to the engine", FL_AT);
+ std::vector<scalar> coefficients;
+ coefficients.push_back(firstCoefficient);
+
+ va_list args;
+ va_start(args, firstCoefficient);
+ for (std::size_t i = 0; i < engine->inputVariables().size(); ++i) {
+ coefficients.push_back((scalar) va_arg(args, T));
+ }
+ va_end(args);
+
+ return new Linear(name, coefficients, engine);
+ }
+
+ template FL_API Linear* Linear::create(const std::string& name,
+ const Engine* engine,
+ double firstCoefficient, ...);
+
+ template FL_API Linear* Linear::create(const std::string& name,
+ const Engine* engine,
+ int firstCoefficient, ...);
+}
diff --git a/fuzzylite/src/term/PiShape.cpp b/fuzzylite/src/term/PiShape.cpp
new file mode 100644
index 0000000..ba3e99f
--- /dev/null
+++ b/fuzzylite/src/term/PiShape.cpp
@@ -0,0 +1,133 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/PiShape.h"
+
+namespace fl {
+
+ PiShape::PiShape(const std::string& name, scalar bottomLeft, scalar topLeft,
+ scalar topRight, scalar bottomRight, scalar height)
+ : Term(name, height), _bottomLeft(bottomLeft), _topLeft(topLeft),
+ _topRight(topRight), _bottomRight(bottomRight) {
+ }
+
+ PiShape::~PiShape() {
+ }
+
+ std::string PiShape::className() const {
+ return "PiShape";
+ }
+
+ scalar PiShape::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ //from Octave smf.m
+ scalar a_b_ave = (_bottomLeft + _topLeft) / 2.0;
+ scalar b_minus_a = _topLeft - _bottomLeft;
+ scalar c_d_ave = (_topRight + _bottomRight) / 2.0;
+ scalar d_minus_c = _bottomRight - _topRight;
+
+ if (Op::isLE(x, _bottomLeft)) return _height * 0.0;
+
+ if (Op::isLE(x, a_b_ave))
+ return _height * (2.0 * std::pow((x - _bottomLeft) / b_minus_a, 2));
+
+ if (Op::isLt(x, _topLeft))
+ return _height * (1.0 - 2.0 * std::pow((x - _topLeft) / b_minus_a, 2));
+
+ if (Op::isLE(x, _topRight))
+ return _height * 1.0;
+
+ if (Op::isLE(x, c_d_ave))
+ return _height * (1.0 - 2.0 * std::pow((x - _topRight) / d_minus_c, 2));
+
+ if (Op::isLt(x, _bottomRight))
+ return _height * (2.0 * std::pow((x - _bottomRight) / d_minus_c, 2));
+
+ return _height * 0.0;
+ }
+
+ std::string PiShape::parameters() const {
+ return Op::join(4, " ", _bottomLeft, _topLeft, _topRight, _bottomRight) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void PiShape::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 4;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setBottomLeft(Op::toScalar(values.at(0)));
+ setTopLeft(Op::toScalar(values.at(1)));
+ setTopRight(Op::toScalar(values.at(2)));
+ setBottomRight(Op::toScalar(values.at(3)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void PiShape::setBottomLeft(scalar a) {
+ this->_bottomLeft = a;
+ }
+
+ scalar PiShape::getBottomLeft() const {
+ return this->_bottomLeft;
+ }
+
+ void PiShape::setTopLeft(scalar b) {
+ this->_topLeft = b;
+ }
+
+ scalar PiShape::getTopLeft() const {
+ return this->_topLeft;
+ }
+
+ void PiShape::setTopRight(scalar d) {
+ this->_topRight = d;
+ }
+
+ scalar PiShape::getTopRight() const {
+ return this->_topRight;
+ }
+
+ void PiShape::setBottomRight(scalar c) {
+ this->_bottomRight = c;
+ }
+
+ scalar PiShape::getBottomRight() const {
+ return this->_bottomRight;
+ }
+
+ PiShape* PiShape::clone() const {
+ return new PiShape(*this);
+ }
+
+ Term* PiShape::constructor() {
+ return new PiShape;
+ }
+
+}
diff --git a/fuzzylite/src/term/Ramp.cpp b/fuzzylite/src/term/Ramp.cpp
new file mode 100644
index 0000000..f224045
--- /dev/null
+++ b/fuzzylite/src/term/Ramp.cpp
@@ -0,0 +1,110 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Ramp.h"
+
+namespace fl {
+
+ Ramp::Ramp(const std::string& name, scalar start, scalar end, scalar height)
+ : Term(name, height), _start(start), _end(end) {
+ }
+
+ Ramp::~Ramp() {
+ }
+
+ std::string Ramp::className() const {
+ return "Ramp";
+ }
+
+ scalar Ramp::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+
+ if (Op::isEq(_start, _end)) return _height * 0.0;
+
+ if (Op::isLt(_start, _end)) {
+ if (Op::isLE(x, _start)) return _height * 0.0;
+ if (Op::isGE(x, _end)) return _height * 1.0;
+ return _height * (x - _start) / (_end - _start);
+ } else {
+ if (Op::isGE(x, _start)) return _height * 0.0;
+ if (Op::isLE(x, _end)) return _height * 1.0;
+ return _height * (_start - x) / (_start - _end);
+ }
+ }
+
+ std::string Ramp::parameters() const {
+ return Op::join(2, " ", _start, _end) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void Ramp::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 2;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setStart(Op::toScalar(values.at(0)));
+ setEnd(Op::toScalar(values.at(1)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void Ramp::setStart(scalar start) {
+ this->_start = start;
+ }
+
+ scalar Ramp::getStart() const {
+ return this->_start;
+ }
+
+ void Ramp::setEnd(scalar end) {
+ this->_end = end;
+ }
+
+ scalar Ramp::getEnd() const {
+ return this->_end;
+ }
+
+ Ramp::Direction Ramp::direction() const {
+ scalar range = this->_end - this->_start;
+ if (not fl::Op::isFinite(range) or fl::Op::isEq(range, 0.0)) return ZERO;
+
+ if (fl::Op::isGt(range, 0.0)) return POSITIVE;
+
+ return NEGATIVE;
+ }
+
+ Ramp* Ramp::clone() const {
+ return new Ramp(*this);
+ }
+
+ Term* Ramp::constructor() {
+ return new Ramp;
+ }
+
+}
diff --git a/fuzzylite/src/term/Rectangle.cpp b/fuzzylite/src/term/Rectangle.cpp
new file mode 100644
index 0000000..363b15d
--- /dev/null
+++ b/fuzzylite/src/term/Rectangle.cpp
@@ -0,0 +1,93 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Rectangle.h"
+
+namespace fl {
+
+ Rectangle::Rectangle(const std::string& name, scalar start, scalar end, scalar height)
+ : Term(name, height), _start(start), _end(end) {
+ }
+
+ Rectangle::~Rectangle() {
+ }
+
+ std::string Rectangle::className() const {
+ return "Rectangle";
+ }
+
+ scalar Rectangle::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ if (fl::Op::isLt(x, _start) or fl::Op::isGt(x, _end))
+ return _height * 0.0;
+ return _height * 1.0;
+ }
+
+ std::string Rectangle::parameters() const {
+ return Op::join(2, " ", _start, _end) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void Rectangle::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 2;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setStart(Op::toScalar(values.at(0)));
+ setEnd(Op::toScalar(values.at(1)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void Rectangle::setStart(scalar minimum) {
+ this->_start = minimum;
+ }
+
+ scalar Rectangle::getStart() const {
+ return this->_start;
+ }
+
+ void Rectangle::setEnd(scalar maximum) {
+ this->_end = maximum;
+ }
+
+ scalar Rectangle::getEnd() const {
+ return this->_end;
+ }
+
+ Rectangle* Rectangle::clone() const {
+ return new Rectangle(*this);
+ }
+
+ Term* Rectangle::constructor() {
+ return new Rectangle;
+ }
+
+
+}
diff --git a/fuzzylite/src/term/SShape.cpp b/fuzzylite/src/term/SShape.cpp
new file mode 100644
index 0000000..cd02be1
--- /dev/null
+++ b/fuzzylite/src/term/SShape.cpp
@@ -0,0 +1,102 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/SShape.h"
+
+namespace fl {
+
+ SShape::SShape(const std::string& name, scalar start, scalar end, scalar height)
+ : Term(name, height), _start(start), _end(end) {
+ }
+
+ SShape::~SShape() {
+ }
+
+ std::string SShape::className() const {
+ return "SShape";
+ }
+
+ scalar SShape::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ //from Octave smf.m
+ scalar average = (_start + _end) / 2.0;
+ scalar difference = _end - _start;
+
+ if (Op::isLE(x, _start)) return _height * 0.0;
+
+ if (Op::isLE(x, average))
+ return _height * (2.0 * std::pow((x - _start) / difference, 2));
+
+ if (Op::isLt(x, _end))
+ return _height * (1.0 - 2.0 * std::pow((x - _end) / difference, 2));
+
+ return _height * 1.0;
+ }
+
+ std::string SShape::parameters() const {
+ return Op::join(2, " ", _start, _end) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void SShape::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 2;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setStart(Op::toScalar(values.at(0)));
+ setEnd(Op::toScalar(values.at(1)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void SShape::setStart(scalar start) {
+ this->_start = start;
+ }
+
+ scalar SShape::getStart() const {
+ return this->_start;
+ }
+
+ void SShape::setEnd(scalar end) {
+ this->_end = end;
+ }
+
+ scalar SShape::getEnd() const {
+ return this->_end;
+ }
+
+ SShape* SShape::clone() const {
+ return new SShape(*this);
+ }
+
+ Term* SShape::constructor() {
+ return new SShape;
+ }
+
+}
diff --git a/fuzzylite/src/term/Sigmoid.cpp b/fuzzylite/src/term/Sigmoid.cpp
new file mode 100644
index 0000000..77d7f82
--- /dev/null
+++ b/fuzzylite/src/term/Sigmoid.cpp
@@ -0,0 +1,98 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Sigmoid.h"
+
+namespace fl {
+
+ Sigmoid::Sigmoid(const std::string& name, scalar inflection, scalar slope, scalar height)
+ : Term(name, height), _inflection(inflection), _slope(slope) {
+ }
+
+ Sigmoid::~Sigmoid() {
+ }
+
+ std::string Sigmoid::className() const {
+ return "Sigmoid";
+ }
+
+ scalar Sigmoid::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ return _height * 1.0 / (1.0 + std::exp(-_slope * (x - _inflection)));
+ }
+
+ std::string Sigmoid::parameters() const {
+ return Op::join(2, " ", _inflection, _slope) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void Sigmoid::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 2;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setInflection(Op::toScalar(values.at(0)));
+ setSlope(Op::toScalar(values.at(1)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void Sigmoid::setSlope(scalar a) {
+ this->_slope = a;
+ }
+
+ scalar Sigmoid::getSlope() const {
+ return this->_slope;
+ }
+
+ void Sigmoid::setInflection(scalar c) {
+ this->_inflection = c;
+ }
+
+ scalar Sigmoid::getInflection() const {
+ return this->_inflection;
+ }
+
+ Sigmoid::Direction Sigmoid::direction() const {
+ if (not fl::Op::isFinite(_slope) or fl::Op::isEq(_slope, 0.0)) return ZERO;
+
+ if (fl::Op::isGt(_slope, 0.0)) return POSITIVE;
+
+ return NEGATIVE;
+ }
+
+ Sigmoid* Sigmoid::clone() const {
+ return new Sigmoid(*this);
+ }
+
+ Term* Sigmoid::constructor() {
+ return new Sigmoid;
+ }
+
+}
diff --git a/fuzzylite/src/term/SigmoidDifference.cpp b/fuzzylite/src/term/SigmoidDifference.cpp
new file mode 100644
index 0000000..55a586c
--- /dev/null
+++ b/fuzzylite/src/term/SigmoidDifference.cpp
@@ -0,0 +1,114 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/SigmoidDifference.h"
+
+namespace fl {
+
+ SigmoidDifference::SigmoidDifference(const std::string& name,
+ scalar left, scalar rising,
+ scalar falling, scalar right, scalar height)
+ : Term(name, height), _left(left), _rising(rising), _falling(falling), _right(right) {
+ }
+
+ SigmoidDifference::~SigmoidDifference() {
+ }
+
+ std::string SigmoidDifference::className() const {
+ return "SigmoidDifference";
+ }
+
+ scalar SigmoidDifference::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+
+ scalar a = 1.0 / (1 + std::exp(-_rising * (x - _left)));
+ scalar b = 1.0 / (1 + std::exp(-_falling * (x - _right)));
+ return _height * std::abs(a - b);
+ }
+
+ std::string SigmoidDifference::parameters() const {
+ return Op::join(4, " ", _left, _rising, _falling, _right) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void SigmoidDifference::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 4;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setLeft(Op::toScalar(values.at(0)));
+ setRising(Op::toScalar(values.at(1)));
+ setFalling(Op::toScalar(values.at(2)));
+ setRight(Op::toScalar(values.at(3)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void SigmoidDifference::setLeft(scalar leftInflection) {
+ this->_left = leftInflection;
+ }
+
+ scalar SigmoidDifference::getLeft() const {
+ return this->_left;
+ }
+
+ void SigmoidDifference::setRising(scalar risingSlope) {
+ this->_rising = risingSlope;
+ }
+
+ scalar SigmoidDifference::getRising() const {
+ return this->_rising;
+ }
+
+ void SigmoidDifference::setFalling(scalar fallingSlope) {
+ this->_falling = fallingSlope;
+ }
+
+ scalar SigmoidDifference::getFalling() const {
+ return this->_falling;
+ }
+
+ void SigmoidDifference::setRight(scalar rightInflection) {
+ this->_right = rightInflection;
+ }
+
+ scalar SigmoidDifference::getRight() const {
+ return this->_right;
+ }
+
+ SigmoidDifference* SigmoidDifference::clone() const {
+ return new SigmoidDifference(*this);
+ }
+
+ Term* SigmoidDifference::constructor() {
+ return new SigmoidDifference;
+ }
+
+
+}
diff --git a/fuzzylite/src/term/SigmoidProduct.cpp b/fuzzylite/src/term/SigmoidProduct.cpp
new file mode 100644
index 0000000..9e43ac9
--- /dev/null
+++ b/fuzzylite/src/term/SigmoidProduct.cpp
@@ -0,0 +1,112 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/SigmoidProduct.h"
+
+namespace fl {
+
+ SigmoidProduct::SigmoidProduct(const std::string& name,
+ scalar left, scalar rising,
+ scalar falling, scalar right, scalar height)
+ : Term(name, height), _left(left), _rising(rising), _falling(falling), _right(right) {
+ }
+
+ SigmoidProduct::~SigmoidProduct() {
+ }
+
+ std::string SigmoidProduct::className() const {
+ return "SigmoidProduct";
+ }
+
+ scalar SigmoidProduct::membership(scalar x) const {
+ scalar a = 1.0 / (1 + std::exp(-_rising * (x - _left)));
+ scalar b = 1.0 / (1 + std::exp(-_falling * (x - _right)));
+ return _height * a * b;
+ }
+
+ std::string SigmoidProduct::parameters() const {
+ return Op::join(4, " ", _left, _rising, _falling, _right) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void SigmoidProduct::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 4;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setLeft(Op::toScalar(values.at(0)));
+ setRising(Op::toScalar(values.at(1)));
+ setFalling(Op::toScalar(values.at(2)));
+ setRight(Op::toScalar(values.at(3)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+
+ }
+
+ void SigmoidProduct::setRising(scalar risingSlope) {
+ this->_rising = risingSlope;
+ }
+
+ scalar SigmoidProduct::getRising() const {
+ return this->_rising;
+ }
+
+ void SigmoidProduct::setLeft(scalar leftInflection) {
+ this->_left = leftInflection;
+ }
+
+ scalar SigmoidProduct::getLeft() const {
+ return this->_left;
+ }
+
+ void SigmoidProduct::setRight(scalar rightInflection) {
+ this->_right = rightInflection;
+ }
+
+ scalar SigmoidProduct::getRight() const {
+ return this->_right;
+ }
+
+ void SigmoidProduct::setFalling(scalar fallingSlope) {
+ this->_falling = fallingSlope;
+ }
+
+ scalar SigmoidProduct::getFalling() const {
+ return this->_falling;
+ }
+
+ SigmoidProduct* SigmoidProduct::clone() const {
+ return new SigmoidProduct(*this);
+ }
+
+ Term* SigmoidProduct::constructor() {
+ return new SigmoidProduct;
+ }
+
+}
diff --git a/fuzzylite/src/term/Spike.cpp b/fuzzylite/src/term/Spike.cpp
new file mode 100644
index 0000000..f4b73bf
--- /dev/null
+++ b/fuzzylite/src/term/Spike.cpp
@@ -0,0 +1,90 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Spike.h"
+
+namespace fl {
+
+ Spike::Spike(const std::string& name, scalar center, scalar width, scalar height)
+ : Term(name, height), _center(center), _width(width) {
+ }
+
+ Spike::~Spike() {
+
+ }
+
+ std::string Spike::className() const {
+ return "Spike";
+ }
+
+ scalar Spike::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ return _height * std::exp(-std::fabs(10.0 / _width * (x - _center)));
+ }
+
+ std::string Spike::parameters() const {
+ return Op::join(2, " ", _center, _width) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void Spike::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 2;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setCenter(Op::toScalar(values.at(0)));
+ setWidth(Op::toScalar(values.at(1)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void Spike::setCenter(scalar center) {
+ this->_center = center;
+ }
+
+ scalar Spike::getCenter() const {
+ return this->_center;
+ }
+
+ void Spike::setWidth(scalar width) {
+ this->_width = width;
+ }
+
+ scalar Spike::getWidth() const {
+ return this->_width;
+ }
+
+ Spike* Spike::clone() const {
+ return new Spike(*this);
+ }
+
+ Term* Spike::constructor() {
+ return new Spike;
+ }
+}
diff --git a/fuzzylite/src/term/Term.cpp b/fuzzylite/src/term/Term.cpp
new file mode 100644
index 0000000..143a98f
--- /dev/null
+++ b/fuzzylite/src/term/Term.cpp
@@ -0,0 +1,74 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Term.h"
+
+#include "fl/imex/FllExporter.h"
+#include "fl/term/Linear.h"
+#include "fl/term/Function.h"
+
+namespace fl {
+
+ Term::Term(const std::string& name, scalar height) : _name(name), _height(height) {
+
+ }
+
+ Term::~Term() {
+
+ }
+
+ void Term::setName(const std::string& name) {
+ this->_name = name;
+ }
+
+ std::string Term::getName() const {
+ return this->_name;
+ }
+
+ void Term::setHeight(scalar height) {
+ this->_height = height;
+ }
+
+ scalar Term::getHeight() const {
+ return this->_height;
+ }
+
+ std::string Term::toString() const {
+ return FllExporter().toString(this);
+ }
+
+ void Term::updateReference(Term* term, const Engine* engine) {
+ if (Linear * linear = dynamic_cast<Linear*> (term)) {
+ linear->setEngine(engine);
+ } else if (Function * function = dynamic_cast<Function*> (term)) {
+ function->setEngine(engine);
+ try {
+ function->load();
+ } catch (...) {
+ //ignore
+ }
+ }
+ }
+
+}
diff --git a/fuzzylite/src/term/Trapezoid.cpp b/fuzzylite/src/term/Trapezoid.cpp
new file mode 100644
index 0000000..60abcc4
--- /dev/null
+++ b/fuzzylite/src/term/Trapezoid.cpp
@@ -0,0 +1,130 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Trapezoid.h"
+
+namespace fl {
+
+ Trapezoid::Trapezoid(const std::string& name,
+ scalar vertexA, scalar vertexB, scalar vertexC, scalar vertexD, scalar height)
+ : Term(name, height), _vertexA(vertexA), _vertexB(vertexB), _vertexC(vertexC), _vertexD(vertexD) {
+ if (Op::isNaN(vertexC) and Op::isNaN(vertexD)) {
+ //TODO: Modify FLL to allow passing two parameters only.
+ this->_vertexD = _vertexB;
+ scalar range = _vertexD - _vertexA;
+ this->_vertexB = _vertexA + range * 1.0 / 5.0;
+ this->_vertexC = _vertexA + range * 4.0 / 5.0;
+ }
+ }
+
+ Trapezoid::~Trapezoid() {
+ }
+
+ std::string Trapezoid::className() const {
+ return "Trapezoid";
+ }
+
+ scalar Trapezoid::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+
+ if (Op::isLt(x, _vertexA) or Op::isGt(x, _vertexD))
+ return _height * 0.0;
+
+ if (Op::isLt(x, _vertexB))
+ return _height * Op::min(scalar(1.0), (x - _vertexA) / (_vertexB - _vertexA));
+
+ if (Op::isLE(x, _vertexC))
+ return _height * 1.0;
+
+ if (Op::isLt(x, _vertexD))
+ return _height * (_vertexD - x) / (_vertexD - _vertexC);
+
+ return _height * 0.0;
+ }
+
+ std::string Trapezoid::parameters() const {
+ return Op::join(4, " ", _vertexA, _vertexB, _vertexC, _vertexD)+
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void Trapezoid::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 4;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setVertexA(Op::toScalar(values.at(0)));
+ setVertexB(Op::toScalar(values.at(1)));
+ setVertexC(Op::toScalar(values.at(2)));
+ setVertexD(Op::toScalar(values.at(3)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void Trapezoid::setVertexA(scalar a) {
+ this->_vertexA = a;
+ }
+
+ scalar Trapezoid::getVertexA() const {
+ return this->_vertexA;
+ }
+
+ void Trapezoid::setVertexB(scalar b) {
+ this->_vertexB = b;
+ }
+
+ scalar Trapezoid::getVertexB() const {
+ return this->_vertexB;
+ }
+
+ void Trapezoid::setVertexC(scalar c) {
+ this->_vertexC = c;
+ }
+
+ scalar Trapezoid::getVertexC() const {
+ return this->_vertexC;
+ }
+
+ void Trapezoid::setVertexD(scalar d) {
+ this->_vertexD = d;
+ }
+
+ scalar Trapezoid::getVertexD() const {
+ return this->_vertexD;
+ }
+
+ Trapezoid* Trapezoid::clone() const {
+ return new Trapezoid(*this);
+ }
+
+ Term* Trapezoid::constructor() {
+ return new Trapezoid;
+ }
+
+
+}
diff --git a/fuzzylite/src/term/Triangle.cpp b/fuzzylite/src/term/Triangle.cpp
new file mode 100644
index 0000000..2fce1a6
--- /dev/null
+++ b/fuzzylite/src/term/Triangle.cpp
@@ -0,0 +1,115 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/Triangle.h"
+
+namespace fl {
+
+ Triangle::Triangle(const std::string& name, scalar vertexA, scalar vertexB, scalar vertexC, scalar height)
+ : Term(name, height), _vertexA(vertexA), _vertexB(vertexB), _vertexC(vertexC) {
+ if (fl::Op::isNaN(vertexC)) {
+ //TODO: Modify FLL to allow passing two parameters only.
+ this->_vertexC = vertexB;
+ this->_vertexB = (vertexA + vertexB) / 2.0;
+ }
+ }
+
+ Triangle::~Triangle() {
+ }
+
+ std::string Triangle::className() const {
+ return "Triangle";
+ }
+
+ scalar Triangle::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+
+ if (Op::isLt(x, _vertexA) or Op::isGt(x, _vertexC))
+ return _height * 0.0;
+
+ if (Op::isEq(x, _vertexB))
+ return _height * 1.0;
+
+ if (Op::isLt(x, _vertexB))
+ return _height * (x - _vertexA) / (_vertexB - _vertexA);
+
+ return _height * (_vertexC - x) / (_vertexC - _vertexB);
+ }
+
+ std::string Triangle::parameters() const {
+ return Op::join(3, " ", _vertexA, _vertexB, _vertexC) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void Triangle::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 3;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setVertexA(Op::toScalar(values.at(0)));
+ setVertexB(Op::toScalar(values.at(1)));
+ setVertexC(Op::toScalar(values.at(2)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void Triangle::setVertexA(scalar a) {
+ this->_vertexA = a;
+ }
+
+ scalar Triangle::getVertexA() const {
+ return this->_vertexA;
+ }
+
+ void Triangle::setVertexB(scalar b) {
+ this->_vertexB = b;
+ }
+
+ scalar Triangle::getVertexB() const {
+ return this->_vertexB;
+ }
+
+ void Triangle::setVertexC(scalar c) {
+ this->_vertexC = c;
+ }
+
+ scalar Triangle::getVertexC() const {
+ return this->_vertexC;
+ }
+
+ Triangle* Triangle::clone() const {
+ return new Triangle(*this);
+ }
+
+ Term* Triangle::constructor() {
+ return new Triangle;
+ }
+
+
+}
diff --git a/fuzzylite/src/term/ZShape.cpp b/fuzzylite/src/term/ZShape.cpp
new file mode 100644
index 0000000..86668b6
--- /dev/null
+++ b/fuzzylite/src/term/ZShape.cpp
@@ -0,0 +1,102 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/term/ZShape.h"
+
+namespace fl {
+
+ ZShape::ZShape(const std::string& name, scalar start, scalar end, scalar height)
+ : Term(name, height), _start(start), _end(end) {
+ }
+
+ ZShape::~ZShape() {
+ }
+
+ std::string ZShape::className() const {
+ return "ZShape";
+ }
+
+ scalar ZShape::membership(scalar x) const {
+ if (fl::Op::isNaN(x)) return fl::nan;
+ //from Octave zmf.m
+ scalar average = (_start + _end) / 2;
+ scalar difference = _end - _start;
+
+ if (Op::isLE(x, _start)) return _height * 1.0;
+
+ if (Op::isLE(x, average))
+ return _height * (1.0 - 2.0 * std::pow((x - _start) / difference, 2));
+
+ if (Op::isLt(x, _end))
+ return _height * (2.0 * std::pow((x - _end) / difference, 2));
+
+ return _height * 0.0;
+ }
+
+ std::string ZShape::parameters() const {
+ return Op::join(2, " ", _start, _end) +
+ (not Op::isEq(_height, 1.0) ? " " + Op::str(_height) : "");
+ }
+
+ void ZShape::configure(const std::string& parameters) {
+ if (parameters.empty()) return;
+ std::vector<std::string> values = Op::split(parameters, " ");
+ std::size_t required = 2;
+ if (values.size() < required) {
+ std::ostringstream ex;
+ ex << "[configuration error] term <" << className() << ">"
+ << " requires <" << required << "> parameters";
+ throw fl::Exception(ex.str(), FL_AT);
+ }
+ setStart(Op::toScalar(values.at(0)));
+ setEnd(Op::toScalar(values.at(1)));
+ if (values.size() > required)
+ setHeight(Op::toScalar(values.at(required)));
+ }
+
+ void ZShape::setStart(scalar start) {
+ this->_start = start;
+ }
+
+ scalar ZShape::getStart() const {
+ return this->_start;
+ }
+
+ void ZShape::setEnd(scalar end) {
+ this->_end = end;
+ }
+
+ scalar ZShape::getEnd() const {
+ return this->_end;
+ }
+
+ ZShape* ZShape::clone() const {
+ return new ZShape(*this);
+ }
+
+ Term* ZShape::constructor() {
+ return new ZShape;
+ }
+
+}
diff --git a/fuzzylite/src/variable/InputVariable.cpp b/fuzzylite/src/variable/InputVariable.cpp
new file mode 100644
index 0000000..9fa2932
--- /dev/null
+++ b/fuzzylite/src/variable/InputVariable.cpp
@@ -0,0 +1,54 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/variable/InputVariable.h"
+
+#include "fl/imex/FllExporter.h"
+
+namespace fl {
+
+ InputVariable::InputVariable(const std::string& name, scalar minimum, scalar maximum)
+ : Variable(name, minimum, maximum), _inputValue(fl::nan) {
+ }
+
+ InputVariable::~InputVariable() {
+ }
+
+ void InputVariable::setInputValue(scalar inputValue) {
+ this->_inputValue = inputValue;
+ }
+
+ scalar InputVariable::getInputValue() const {
+ return this->_inputValue;
+ }
+
+ std::string InputVariable::fuzzyInputValue() const {
+ return fuzzify(_inputValue);
+ }
+
+ std::string InputVariable::toString() const {
+ return FllExporter().toString(this);
+ }
+
+}
diff --git a/fuzzylite/src/variable/OutputVariable.cpp b/fuzzylite/src/variable/OutputVariable.cpp
new file mode 100644
index 0000000..6e1d906
--- /dev/null
+++ b/fuzzylite/src/variable/OutputVariable.cpp
@@ -0,0 +1,195 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/variable/OutputVariable.h"
+
+#include "fl/defuzzifier/Defuzzifier.h"
+#include "fl/imex/FllExporter.h"
+#include "fl/norm/SNorm.h"
+#include "fl/term/Accumulated.h"
+#include "fl/term/Activated.h"
+
+namespace fl {
+
+ OutputVariable::OutputVariable(const std::string& name,
+ scalar minimum, scalar maximum)
+ : Variable(name, minimum, maximum),
+ _fuzzyOutput(new Accumulated(name, minimum, maximum)), _outputValue(fl::nan),
+ _previousOutputValue(fl::nan), _defaultValue(fl::nan),
+ _lockOutputValueInRange(false), _lockPreviousOutputValue(false) {
+ }
+
+ OutputVariable::OutputVariable(const OutputVariable& other) : Variable(other) {
+ copyFrom(other);
+ }
+
+ OutputVariable& OutputVariable::operator=(const OutputVariable& other) {
+ if (this != &other) {
+ _fuzzyOutput.reset(fl::null);
+ _defuzzifier.reset(fl::null);
+
+ Variable::operator=(other);
+ copyFrom(other);
+ }
+ return *this;
+ }
+
+ OutputVariable::~OutputVariable() {
+ }
+
+ void OutputVariable::copyFrom(const OutputVariable& other) {
+ _fuzzyOutput.reset(other._fuzzyOutput->clone());
+ if (other._defuzzifier.get()) _defuzzifier.reset(other._defuzzifier->clone());
+ _outputValue = other._outputValue;
+ _previousOutputValue = other._previousOutputValue;
+ _defaultValue = other._defaultValue;
+ _lockOutputValueInRange = other._lockOutputValueInRange;
+ _lockPreviousOutputValue = other._lockPreviousOutputValue;
+ }
+
+ void OutputVariable::setName(const std::string& name) {
+ Variable::setName(name);
+ this->_fuzzyOutput->setName(name);
+ }
+
+ Accumulated* OutputVariable::fuzzyOutput() const {
+ return this->_fuzzyOutput.get();
+ }
+
+ void OutputVariable::setMinimum(scalar minimum) {
+ Variable::setMinimum(minimum);
+ this->_fuzzyOutput->setMinimum(minimum);
+ }
+
+ void OutputVariable::setMaximum(scalar maximum) {
+ Variable::setMaximum(maximum);
+ this->_fuzzyOutput->setMaximum(maximum);
+ }
+
+ void OutputVariable::setDefuzzifier(Defuzzifier* defuzzifier) {
+ this->_defuzzifier.reset(defuzzifier);
+ }
+
+ Defuzzifier* OutputVariable::getDefuzzifier() const {
+ return this->_defuzzifier.get();
+ }
+
+ void OutputVariable::setOutputValue(scalar outputValue) {
+ this->_outputValue = outputValue;
+ }
+
+ scalar OutputVariable::getOutputValue() const {
+ return this->_outputValue;
+ }
+
+ void OutputVariable::setPreviousOutputValue(scalar previousOutputValue) {
+ this->_previousOutputValue = previousOutputValue;
+ }
+
+ scalar OutputVariable::getPreviousOutputValue() const {
+ return this->_previousOutputValue;
+ }
+
+ void OutputVariable::setDefaultValue(scalar defaultValue) {
+ this->_defaultValue = defaultValue;
+ }
+
+ scalar OutputVariable::getDefaultValue() const {
+ return this->_defaultValue;
+ }
+
+ void OutputVariable::setLockOutputValueInRange(bool lockOutputValueInRange) {
+ this->_lockOutputValueInRange = lockOutputValueInRange;
+ }
+
+ bool OutputVariable::isLockedOutputValueInRange() const {
+ return this->_lockOutputValueInRange;
+ }
+
+ void OutputVariable::setLockPreviousOutputValue(bool lockPreviousOutputValue) {
+ this->_lockPreviousOutputValue = lockPreviousOutputValue;
+ }
+
+ bool OutputVariable::isLockedPreviousOutputValue() const {
+ return this->_lockPreviousOutputValue;
+ }
+
+ void OutputVariable::defuzzify() {
+ if (fl::Op::isFinite(this->_outputValue)) {
+ this->_previousOutputValue = this->_outputValue;
+ }
+
+ scalar result = fl::nan;
+ bool isValid = this->_enabled and not this->_fuzzyOutput->isEmpty();
+ if (isValid) {
+ if (not _defuzzifier.get()) {
+ throw fl::Exception("[defuzzifier error] "
+ "defuzzifier needed to defuzzify output variable <" + _name + ">", FL_AT);
+ }
+ result = this->_defuzzifier->defuzzify(this->_fuzzyOutput.get(), _minimum, _maximum);
+ } else {
+ //if a previous defuzzification was successfully performed and
+ //and the output value is supposed not to change when the output is empty
+ if (_lockPreviousOutputValue and not Op::isNaN(_previousOutputValue)) {
+ result = _previousOutputValue;
+ } else {
+ result = _defaultValue;
+ }
+ }
+
+ if (_lockOutputValueInRange) {
+ result = fl::Op::bound(result, _minimum, _maximum);
+ }
+
+ this->_outputValue = result;
+ }
+
+ std::string OutputVariable::fuzzyOutputValue() const {
+ std::ostringstream ss;
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ scalar degree = _fuzzyOutput->activationDegree(_terms.at(i));
+ if (i == 0) {
+ ss << fl::Op::str(degree);
+ } else {
+ if (fl::Op::isNaN(degree) or fl::Op::isGE(degree, 0.0))
+ ss << " + " << fl::Op::str(degree);
+ else
+ ss << " - " << fl::Op::str(std::fabs(degree));
+ }
+ ss << "/" << _terms.at(i)->getName();
+ }
+ return ss.str();
+ }
+
+ void OutputVariable::clear() {
+ _fuzzyOutput->clear();
+ setPreviousOutputValue(fl::nan);
+ setOutputValue(fl::nan);
+ }
+
+ std::string OutputVariable::toString() const {
+ return FllExporter().toString(this);
+ }
+
+}
diff --git a/fuzzylite/src/variable/Variable.cpp b/fuzzylite/src/variable/Variable.cpp
new file mode 100644
index 0000000..37cf25c
--- /dev/null
+++ b/fuzzylite/src/variable/Variable.cpp
@@ -0,0 +1,244 @@
+/*
+ Author: Juan Rada-Vilela, Ph.D.
+ Copyright (C) 2010-2014 FuzzyLite Limited
+ All rights reserved
+
+ This file is part of fuzzylite.
+
+ fuzzylite is free software: you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your option)
+ any later version.
+
+ fuzzylite is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+ for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
+
+ fuzzylite™ is a trademark of FuzzyLite Limited.
+
+ */
+
+#include "fl/variable/Variable.h"
+
+#include "fl/defuzzifier/Centroid.h"
+#include "fl/imex/FllExporter.h"
+#include "fl/norm/Norm.h"
+#include "fl/term/Constant.h"
+#include "fl/term/Linear.h"
+#include "fl/term/Term.h"
+
+#include <algorithm>
+#include <map>
+#include <sstream>
+
+namespace fl {
+
+ Variable::Variable(const std::string& name, scalar minimum, scalar maximum)
+ : _name(name), _minimum(minimum), _maximum(maximum), _enabled(true) {
+ }
+
+ Variable::Variable(const Variable& other) {
+ copyFrom(other);
+ }
+
+ Variable& Variable::operator=(const Variable& other) {
+ if (this != &other) {
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ delete _terms.at(i);
+ }
+ _terms.clear();
+ copyFrom(other);
+ }
+ return *this;
+ }
+
+ void Variable::copyFrom(const Variable& other) {
+ _name = other._name;
+ _enabled = other._enabled;
+ _minimum = other._minimum;
+ _maximum = other._maximum;
+ for (std::size_t i = 0; i < other._terms.size(); ++i) {
+ _terms.push_back(other._terms.at(i)->clone());
+ }
+ }
+
+ Variable::~Variable() {
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ delete _terms.at(i);
+ }
+ }
+
+ void Variable::setName(const std::string& name) {
+ this->_name = name;
+ }
+
+ std::string Variable::getName() const {
+ return this->_name;
+ }
+
+ void Variable::setRange(scalar minimum, scalar maximum) {
+ setMinimum(minimum);
+ setMaximum(maximum);
+ }
+
+ scalar Variable::range() const {
+ return this->_maximum - this->_minimum;
+ }
+
+ void Variable::setMinimum(scalar minimum) {
+ this->_minimum = minimum;
+ }
+
+ scalar Variable::getMinimum() const {
+ return this->_minimum;
+ }
+
+ void Variable::setMaximum(scalar maximum) {
+ this->_maximum = maximum;
+ }
+
+ scalar Variable::getMaximum() const {
+ return this->_maximum;
+ }
+
+ void Variable::setEnabled(bool enabled) {
+ this->_enabled = enabled;
+ }
+
+ bool Variable::isEnabled() const {
+ return this->_enabled;
+ }
+
+ std::string Variable::fuzzify(scalar x) const {
+ std::ostringstream ss;
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ scalar fx = fl::nan;
+ try {
+ fx = _terms.at(i)->membership(x);
+ } catch (...) {
+ //ignore
+ }
+ if (i == 0) {
+ ss << fl::Op::str(fx);
+ } else {
+ if (fl::Op::isNaN(fx) or fl::Op::isGE(fx, 0.0))
+ ss << " + " << fl::Op::str(fx);
+ else
+ ss << " - " << fl::Op::str(std::fabs(fx));
+ }
+ ss << "/" << _terms.at(i)->getName();
+ }
+ return ss.str();
+ }
+
+ Term* Variable::highestMembership(scalar x, scalar* yhighest) const {
+ Term* result = fl::null;
+ scalar ymax = 0.0;
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ scalar y = fl::nan;
+ try {
+ y = _terms.at(i)->membership(x);
+ } catch (...) {
+ //ignore
+ }
+ if (fl::Op::isGt(y, ymax)) {
+ ymax = y;
+ result = _terms.at(i);
+ }
+ }
+ if (yhighest) *yhighest = ymax;
+ return result;
+ }
+
+ std::string Variable::toString() const {
+ return FllExporter().toString(this);
+ }
+
+ /**
+ * Operations for datatype _terms
+ */
+
+ struct SortByCoG {
+ std::map<const Term*, scalar> centroids;
+
+ bool operator()(const Term* a, const Term * b) {
+ return fl::Op::isLt(
+ centroids.find(a)->second,
+ centroids.find(b)->second);
+ }
+ };
+
+ void Variable::sort() {
+ Centroid defuzzifier;
+ std::map<const Term*, scalar> centroids;
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ Term* term = _terms.at(i);
+ try {
+ if (dynamic_cast<const Constant*> (term) or dynamic_cast<const Linear*> (term)) {
+ centroids[term] = term->membership(0);
+ } else {
+ centroids[term] = defuzzifier.defuzzify(term, _minimum, _maximum);
+ }
+ } catch (...) { //ignore error possibly due to Function not loaded
+ centroids[term] = fl::inf;
+ }
+ }
+ SortByCoG criterion;
+ criterion.centroids = centroids;
+ std::sort(_terms.begin(), _terms.end(), criterion);
+ }
+
+ void Variable::addTerm(Term* term) {
+ this->_terms.push_back(term);
+ }
+
+ void Variable::insertTerm(Term* term, int index) {
+ this->_terms.insert(this->_terms.begin() + index, term);
+ }
+
+ Term* Variable::getTerm(int index) const {
+ return this->_terms.at(index);
+ }
+
+ Term* Variable::getTerm(const std::string& name) const {
+ for (std::size_t i = 0; i < _terms.size(); ++i) {
+ if (_terms.at(i)->getName() == name) {
+ return _terms.at(i);
+ }
+ }
+ throw fl::Exception("[variable error] term <" + name + "> "
+ "not found in variable <" + this->_name + ">", FL_AT);
+ }
+
+ bool Variable::hasTerm(const std::string& name) const {
+ return getTerm(name) != fl::null;
+ }
+
+ Term* Variable::removeTerm(int index) {
+ Term* result = this->_terms.at(index);
+ this->_terms.erase(this->_terms.begin() + index);
+ return result;
+ }
+
+ int Variable::numberOfTerms() const {
+ return this->_terms.size();
+ }
+
+ const std::vector<Term*>& Variable::terms() const {
+ return this->_terms;
+ }
+
+ void Variable::setTerms(const std::vector<Term*>& terms) {
+ this->_terms = terms;
+ }
+
+ std::vector<Term*>& Variable::terms() {
+ return this->_terms;
+ }
+
+}
+