summaryrefslogtreecommitdiff
path: root/fuzzylite/fl
diff options
context:
space:
mode:
Diffstat (limited to 'fuzzylite/fl')
-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
92 files changed, 6064 insertions, 0 deletions
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 */