diff options
Diffstat (limited to 'fuzzylite/fl/norm/t')
-rw-r--r-- | fuzzylite/fl/norm/t/AlgebraicProduct.h | 47 | ||||
-rw-r--r-- | fuzzylite/fl/norm/t/BoundedDifference.h | 46 | ||||
-rw-r--r-- | fuzzylite/fl/norm/t/DrasticProduct.h | 50 | ||||
-rw-r--r-- | fuzzylite/fl/norm/t/EinsteinProduct.h | 47 | ||||
-rw-r--r-- | fuzzylite/fl/norm/t/HamacherProduct.h | 46 | ||||
-rw-r--r-- | fuzzylite/fl/norm/t/Minimum.h | 45 | ||||
-rw-r--r-- | fuzzylite/fl/norm/t/NilpotentMinimum.h | 48 | ||||
-rw-r--r-- | fuzzylite/fl/norm/t/TNormFunction.h | 81 |
8 files changed, 275 insertions, 135 deletions
diff --git a/fuzzylite/fl/norm/t/AlgebraicProduct.h b/fuzzylite/fl/norm/t/AlgebraicProduct.h index e4b0865..d19cb64 100644 --- a/fuzzylite/fl/norm/t/AlgebraicProduct.h +++ b/fuzzylite/fl/norm/t/AlgebraicProduct.h @@ -1,25 +1,17 @@ /* - Author: Juan Rada-Vilela, Ph.D. - Copyright (C) 2010-2014 FuzzyLite Limited - All rights reserved + fuzzylite (R), a fuzzy logic control library in C++. + Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved. + Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com> This file is part of fuzzylite. fuzzylite is free software: you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. + the terms of the FuzzyLite License included with the software. - fuzzylite is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - for more details. - - You should have received a copy of the GNU Lesser General Public License - along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. - - fuzzylite™ is a trademark of FuzzyLite Limited. + You should have received a copy of the FuzzyLite License along with + fuzzylite. If not, see <http://www.fuzzylite.com/license/>. + fuzzylite is a registered trademark of FuzzyLite Limited. */ #ifndef FL_ALGEBRAICPRODUCT_H @@ -29,17 +21,32 @@ namespace fl { - class FL_API AlgebraicProduct : public TNorm { + /** + The AlgebraicProduct class is a TNorm that computes the algebraic product + of any two values. + + @author Juan Rada-Vilela, Ph.D. + @see AlgebraicSum + @see TNorm + @see TNormFactory + @see Norm + @since 4.0 + */ + class FL_API AlgebraicProduct FL_IFINAL : public TNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the algebraic product of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$a\times b@f$ + */ 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 index 3dc9d3a..250512b 100644 --- a/fuzzylite/fl/norm/t/BoundedDifference.h +++ b/fuzzylite/fl/norm/t/BoundedDifference.h @@ -1,25 +1,17 @@ /* - Author: Juan Rada-Vilela, Ph.D. - Copyright (C) 2010-2014 FuzzyLite Limited - All rights reserved + fuzzylite (R), a fuzzy logic control library in C++. + Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved. + Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com> This file is part of fuzzylite. fuzzylite is free software: you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. + the terms of the FuzzyLite License included with the software. - fuzzylite is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - for more details. - - You should have received a copy of the GNU Lesser General Public License - along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. - - fuzzylite™ is a trademark of FuzzyLite Limited. + You should have received a copy of the FuzzyLite License along with + fuzzylite. If not, see <http://www.fuzzylite.com/license/>. + fuzzylite is a registered trademark of FuzzyLite Limited. */ #ifndef FL_BOUNDEDDIFFERENCE_H @@ -29,16 +21,32 @@ namespace fl { - class FL_API BoundedDifference : public TNorm { + /** + The BoundedDifference class is a TNorm that computes the bounded + difference between any two values. + + @author Juan Rada-Vilela, Ph.D. + @see BoundedSum + @see TNorm + @see TNormFactory + @see Norm + @since 4.0 + */ + class FL_API BoundedDifference FL_IFINAL : public TNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the bounded difference between two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$\max(0, a+b - 1)@f$ + */ 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 index efd589d..d0d490e 100644 --- a/fuzzylite/fl/norm/t/DrasticProduct.h +++ b/fuzzylite/fl/norm/t/DrasticProduct.h @@ -1,25 +1,17 @@ /* - Author: Juan Rada-Vilela, Ph.D. - Copyright (C) 2010-2014 FuzzyLite Limited - All rights reserved + fuzzylite (R), a fuzzy logic control library in C++. + Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved. + Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com> This file is part of fuzzylite. fuzzylite is free software: you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. + the terms of the FuzzyLite License included with the software. - fuzzylite is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - for more details. - - You should have received a copy of the GNU Lesser General Public License - along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. - - fuzzylite™ is a trademark of FuzzyLite Limited. + You should have received a copy of the FuzzyLite License along with + fuzzylite. If not, see <http://www.fuzzylite.com/license/>. + fuzzylite is a registered trademark of FuzzyLite Limited. */ #ifndef FL_DRASTICPRODUCT_H @@ -29,17 +21,35 @@ namespace fl { - class FL_API DrasticProduct : public TNorm { + /** + The DrasticProduct class is a TNorm that computes the drastic product of + any two values. + + @author Juan Rada-Vilela, Ph.D. + @see DrasticSum + @see TNorm + @see TNormFactory + @see Norm + @since 4.0 + */ + class FL_API DrasticProduct FL_IFINAL : public TNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the drastic product of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$\begin{cases} + \min(a,b) & \mbox{if $\max(a,b)=1$} \cr + 0 & \mbox{otherwise} + \end{cases}@f$ + */ 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 index a4c1141..9d3a71b 100644 --- a/fuzzylite/fl/norm/t/EinsteinProduct.h +++ b/fuzzylite/fl/norm/t/EinsteinProduct.h @@ -1,25 +1,17 @@ /* - Author: Juan Rada-Vilela, Ph.D. - Copyright (C) 2010-2014 FuzzyLite Limited - All rights reserved + fuzzylite (R), a fuzzy logic control library in C++. + Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved. + Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com> This file is part of fuzzylite. fuzzylite is free software: you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. + the terms of the FuzzyLite License included with the software. - fuzzylite is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - for more details. - - You should have received a copy of the GNU Lesser General Public License - along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. - - fuzzylite™ is a trademark of FuzzyLite Limited. + You should have received a copy of the FuzzyLite License along with + fuzzylite. If not, see <http://www.fuzzylite.com/license/>. + fuzzylite is a registered trademark of FuzzyLite Limited. */ #ifndef FL_EINSTEINPRODUCT_H @@ -29,17 +21,32 @@ namespace fl { - class FL_API EinsteinProduct : public TNorm { + /** + The EinsteinProduct class is a TNorm that computes the Einstein product + of any two values. + + @author Juan Rada-Vilela, Ph.D. + @see EinsteinSum + @see TNorm + @see TNormFactory + @see Norm + @since 4.0 + */ + class FL_API EinsteinProduct FL_IFINAL : public TNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the Einstein product of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$(a\times b)/(2-(a+b-a\times b))@f$ + */ 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 index 9bc6b40..79c56ee 100644 --- a/fuzzylite/fl/norm/t/HamacherProduct.h +++ b/fuzzylite/fl/norm/t/HamacherProduct.h @@ -1,25 +1,17 @@ /* - Author: Juan Rada-Vilela, Ph.D. - Copyright (C) 2010-2014 FuzzyLite Limited - All rights reserved + fuzzylite (R), a fuzzy logic control library in C++. + Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved. + Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com> This file is part of fuzzylite. fuzzylite is free software: you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. + the terms of the FuzzyLite License included with the software. - fuzzylite is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - for more details. - - You should have received a copy of the GNU Lesser General Public License - along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. - - fuzzylite™ is a trademark of FuzzyLite Limited. + You should have received a copy of the FuzzyLite License along with + fuzzylite. If not, see <http://www.fuzzylite.com/license/>. + fuzzylite is a registered trademark of FuzzyLite Limited. */ #ifndef FL_HAMACHERPRODUCT_H @@ -29,16 +21,32 @@ namespace fl { - class FL_API HamacherProduct : public TNorm { + /** + The HamacherProduct class is a TNorm that computes the Hamacher product + of any two values. + + @author Juan Rada-Vilela, Ph.D. + @see HamacherSum + @see TNorm + @see TNormFactory + @see Norm + @since 4.0 + */ + class FL_API HamacherProduct FL_IFINAL : public TNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the Hamacher product of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$(a \times b) / (a+b- a \times b)@f$ + */ 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 index 3590e42..5df1ae2 100644 --- a/fuzzylite/fl/norm/t/Minimum.h +++ b/fuzzylite/fl/norm/t/Minimum.h @@ -1,25 +1,17 @@ /* - Author: Juan Rada-Vilela, Ph.D. - Copyright (C) 2010-2014 FuzzyLite Limited - All rights reserved + fuzzylite (R), a fuzzy logic control library in C++. + Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved. + Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com> This file is part of fuzzylite. fuzzylite is free software: you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. + the terms of the FuzzyLite License included with the software. - fuzzylite is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - for more details. - - You should have received a copy of the GNU Lesser General Public License - along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. - - fuzzylite™ is a trademark of FuzzyLite Limited. + You should have received a copy of the FuzzyLite License along with + fuzzylite. If not, see <http://www.fuzzylite.com/license/>. + fuzzylite is a registered trademark of FuzzyLite Limited. */ #ifndef FL_MINIMUM_H @@ -29,16 +21,31 @@ namespace fl { - class FL_API Minimum : public TNorm { + /** + The Minimum class is a TNorm that computes the minimum of any two values. + + @author Juan Rada-Vilela, Ph.D. + @see Maximum + @see TNorm + @see TNormFactory + @see Norm + @since 4.0 + */ + class FL_API Minimum FL_IFINAL : public TNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the minimum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$\min(a,b)@f$ + */ 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 index b3c11e0..2ea7f3c 100644 --- a/fuzzylite/fl/norm/t/NilpotentMinimum.h +++ b/fuzzylite/fl/norm/t/NilpotentMinimum.h @@ -1,25 +1,17 @@ /* - Author: Juan Rada-Vilela, Ph.D. - Copyright (C) 2010-2014 FuzzyLite Limited - All rights reserved + fuzzylite (R), a fuzzy logic control library in C++. + Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved. + Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com> This file is part of fuzzylite. fuzzylite is free software: you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by the Free - Software Foundation, either version 3 of the License, or (at your option) - any later version. + the terms of the FuzzyLite License included with the software. - fuzzylite is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License - for more details. - - You should have received a copy of the GNU Lesser General Public License - along with fuzzylite. If not, see <http://www.gnu.org/licenses/>. - - fuzzylite™ is a trademark of FuzzyLite Limited. + You should have received a copy of the FuzzyLite License along with + fuzzylite. If not, see <http://www.fuzzylite.com/license/>. + fuzzylite is a registered trademark of FuzzyLite Limited. */ #ifndef FL_NILPOTENTMINIMUM_H @@ -29,15 +21,35 @@ namespace fl { - class FL_API NilpotentMinimum : public TNorm { + /** + The NilpotentMinimum class is a TNorm that computes the nilpotent minimum + of any two values. + + @author Juan Rada-Vilela, Ph.D. + @see NilpotentMaximum + @see TNorm + @see TNormFactory + @see Norm + @since 5.0 + */ + class FL_API NilpotentMinimum FL_IFINAL : public TNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the nilpotent minimum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$\begin{cases} + \min(a,b) & \mbox{if $a+b>1$} \cr + 0 & \mbox{otherwise} + \end{cases}@f$ + */ 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/norm/t/TNormFunction.h b/fuzzylite/fl/norm/t/TNormFunction.h new file mode 100644 index 0000000..1193a40 --- /dev/null +++ b/fuzzylite/fl/norm/t/TNormFunction.h @@ -0,0 +1,81 @@ +/* + fuzzylite (R), a fuzzy logic control library in C++. + Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved. + Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com> + + This file is part of fuzzylite. + + fuzzylite is free software: you can redistribute it and/or modify it under + the terms of the FuzzyLite License included with the software. + + You should have received a copy of the FuzzyLite License along with + fuzzylite. If not, see <http://www.fuzzylite.com/license/>. + + fuzzylite is a registered trademark of FuzzyLite Limited. + */ + +#ifndef FL_TNORMFUNCTION_H +#define FL_TNORMFUNCTION_H + +#include "fl/norm/TNorm.h" + +#include "fl/term/Function.h" + +namespace fl { + + /** + The TNormFunction class is a customizable TNorm via Function, which + computes any function based on the @f$a@f$ and @f$b@f$ values. + This TNorm is not registered with the TNormFactory. + + @author Juan Rada-Vilela, Ph.D. + @see Function + @see TNorm + @see Norm + @see TNormFactory + @since 6.0 + */ + + class FL_API TNormFunction FL_IFINAL : public TNorm { + private: + Function _function; + public: + explicit TNormFunction(const std::string& formula = ""); + + /** + Returns the reference to the Function + @return the reference to the Function + */ + Function& function(); + + /** + Loads the function with the given formula + @param formula is a valid formula in infix notation + */ + void setFormula(const std::string& formula); + /** + Returns the formula loaded into the function + @return the formula loaded into the function + */ + std::string getFormula() const; + + std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the S-Norm utilizing the given function via + SNormFunction::setFormula(), which automatically assigns the values + of @f$a@f$ and @f$b@f$. + + @param a is a membership function value + @param b is a membership function value + @return the evaluation of the function + */ + scalar compute(scalar a, scalar b) const FL_IOVERRIDE; + TNormFunction* clone() const FL_IOVERRIDE; + + static TNorm* constructor(); + }; +} +#endif /* FL_TNORMFUNCTION_H */ + |