diff options
Diffstat (limited to 'fuzzylite/fl/norm')
-rw-r--r-- | fuzzylite/fl/norm/Norm.h | 56 | ||||
-rw-r--r-- | fuzzylite/fl/norm/SNorm.h | 36 | ||||
-rw-r--r-- | fuzzylite/fl/norm/TNorm.h | 35 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/AlgebraicSum.h | 49 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/BoundedSum.h | 45 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/DrasticSum.h | 50 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/EinsteinSum.h | 46 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/HamacherSum.h | 46 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/Maximum.h | 46 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/NilpotentMaximum.h | 47 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/NormalizedSum.h | 44 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/SNormFunction.h | 81 | ||||
-rw-r--r-- | fuzzylite/fl/norm/s/UnboundedSum.h | 52 | ||||
-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 |
21 files changed, 708 insertions, 335 deletions
diff --git a/fuzzylite/fl/norm/Norm.h b/fuzzylite/fl/norm/Norm.h index 5f1b578..682d2ad 100644 --- a/fuzzylite/fl/norm/Norm.h +++ b/fuzzylite/fl/norm/Norm.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_NORM_H @@ -27,12 +19,22 @@ #include "fl/fuzzylite.h" -#include "fl/Operation.h" +#include "fl/Complexity.h" #include <string> namespace fl { + /** + The Norm class is the abstract class for norms. + + @author Juan Rada-Vilela, Ph.D. + @see TNorm + @see SNorm + @see TNormFactory + @see SNormFactory + @since 4.0 + */ class FL_API Norm { public: @@ -43,13 +45,31 @@ namespace fl { } FL_DEFAULT_COPY_AND_MOVE(Norm) - + /** + Returns the name of the class of the norm + @return the name of the class of the norm + */ virtual std::string className() const = 0; + + /** + Computes the estimated complexity of computing the hedge + @return the complexity of computing the hedge + */ + virtual Complexity complexity() const = 0; + /** + Computes the norm for @f$a@f$ and @f$b@f$ + @param a is a membership function value + @param b is a membership function value + @return the norm between @f$a@f$ and @f$b@f$ + */ virtual scalar compute(scalar a, scalar b) const = 0; + /** + Creates a clone of the norm + @return a clone of the norm + */ virtual Norm* clone() const = 0; }; } #endif /* FL_NORM_H */ - diff --git a/fuzzylite/fl/norm/SNorm.h b/fuzzylite/fl/norm/SNorm.h index a281f52..a68081c 100644 --- a/fuzzylite/fl/norm/SNorm.h +++ b/fuzzylite/fl/norm/SNorm.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_SNORM_H @@ -29,6 +21,19 @@ namespace fl { + /** + The SNorm class is the base class for all S-Norms, and it is utilized as + the disjunction fuzzy logic operator and as the aggregation (or + `accumulation` in versions 5.0 and earlier) fuzzy logic operator. + + @author Juan Rada-Vilela, Ph.D. + @see RuleBlock::getDisjunction() + @see OutputVariable::fuzzyOutput() + @see Aggregated::getAggregation() + @see SNormFactory + @see Norm + @since 4.0 + */ class FL_API SNorm : public Norm { public: @@ -44,4 +49,3 @@ namespace fl { }; } #endif /* FL_SNORM_H */ - diff --git a/fuzzylite/fl/norm/TNorm.h b/fuzzylite/fl/norm/TNorm.h index 8ba8538..b1f7cb7 100644 --- a/fuzzylite/fl/norm/TNorm.h +++ b/fuzzylite/fl/norm/TNorm.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_TNORM_H @@ -29,6 +21,18 @@ namespace fl { + /** + The TNorm class is the base class for T-Norms, and it is utilized as the + conjunction fuzzy logic operator and as the implication (or `activation` + in versions 5.0 and earlier) fuzzy logic operator. + + @author Juan Rada-Vilela, Ph.D. + @see RuleBlock::getConjunction() + @see RuleBlock::getImplication() + @see TNormFactory + @see Norm + @since 4.0 + */ class FL_API TNorm : public Norm { public: @@ -44,4 +48,3 @@ namespace fl { }; } #endif /* TNORM_H */ - diff --git a/fuzzylite/fl/norm/s/AlgebraicSum.h b/fuzzylite/fl/norm/s/AlgebraicSum.h index 786bcbd..2fbf4c1 100644 --- a/fuzzylite/fl/norm/s/AlgebraicSum.h +++ b/fuzzylite/fl/norm/s/AlgebraicSum.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_ALGEBRAICSUM_H @@ -27,20 +19,35 @@ #include "fl/norm/SNorm.h" - namespace fl { - class FL_API AlgebraicSum : public SNorm { + /** + The AlgebraicSum class is an SNorm that computes the algebraic sum of + values any two values. + + @author Juan Rada-Vilela, Ph.D. + @see AlgebraicProduct + @see SNorm + @see SNormFactory + @see Norm + @since 4.0 + */ + class FL_API AlgebraicSum FL_IFINAL : public SNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + + /** + Computes the algebraic sum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$a+b-(a \times b)@f$ + */ 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 index 5231856..cd9438e 100644 --- a/fuzzylite/fl/norm/s/BoundedSum.h +++ b/fuzzylite/fl/norm/s/BoundedSum.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_BOUNDEDSUM_H @@ -29,15 +21,34 @@ namespace fl { - class FL_API BoundedSum : public SNorm { + /** + The BoundedSum class is an SNorm that computes the bounded sum of any two + values. + + @author Juan Rada-Vilela, Ph.D. + @see BoundedDifference + @see SNorm + @see SNormFactory + @see Norm + @since 4.0 + */ + class FL_API BoundedSum FL_IFINAL : public SNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the bounded sum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$\min(1, a+b)@f$ + */ 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 index 65d4d4c..a1e33fe 100644 --- a/fuzzylite/fl/norm/s/DrasticSum.h +++ b/fuzzylite/fl/norm/s/DrasticSum.h @@ -1,43 +1,55 @@ /* - 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_DRASTICSUM_H #define FL_DRASTICSUM_H #include "fl/norm/SNorm.h" + namespace fl { - class FL_API DrasticSum : public SNorm { + /** + The DrasticSum class is an SNorm that computes the drastic sum of any two + values. + + @author Juan Rada-Vilela, Ph.D. + @see DrasticProduct + @see SNorm + @see SNormFactory + @see Norm + @since 4.0 + */ + class FL_API DrasticSum FL_IFINAL : public SNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the drastic sum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$\begin{cases} + \max(a,b) & \mbox{if $\min(a,b)=0$} \cr + 1 & \mbox{otherwise} + \end{cases}@f$ + */ 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 index 8114c68..7450330 100644 --- a/fuzzylite/fl/norm/s/EinsteinSum.h +++ b/fuzzylite/fl/norm/s/EinsteinSum.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_EINSTEINSUM_H @@ -29,16 +21,32 @@ namespace fl { - class FL_API EinsteinSum : public SNorm { + /** + The EinsteinSum class is an SNorm that computes the einstein sum of any + two values. + + @author Juan Rada-Vilela, Ph.D. + @see EinsteinProduct + @see SNorm + @see SNormFactory + @see Norm + @since 4.0 + */ + class FL_API EinsteinSum FL_IFINAL : public SNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the Einstein sum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$a+b/(1+a \times b)@f$ + */ 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 index 3daf852..0242512 100644 --- a/fuzzylite/fl/norm/s/HamacherSum.h +++ b/fuzzylite/fl/norm/s/HamacherSum.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_HAMACHERSUM_H @@ -29,16 +21,32 @@ namespace fl { - class FL_API HamacherSum : public SNorm { + /** + The HamacherSum class is an SNorm that computes the Hamacher sum of any + two values. + + @author Juan Rada-Vilela, Ph.D. + @see HamacherProduct + @see SNorm + @see SNormFactory + @see Norm + @since 4.0 + */ + class FL_API HamacherSum FL_IFINAL : public SNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the Hamacher sum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$a+b-(2\times a \times b)/(1-a\times b)@f$ + */ 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 index 28a3b6d..c8ce488 100644 --- a/fuzzylite/fl/norm/s/Maximum.h +++ b/fuzzylite/fl/norm/s/Maximum.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_MAXIMUM_H @@ -29,17 +21,31 @@ namespace fl { - class FL_API Maximum : public SNorm { + /** + The Maximum class is an SNorm that computes the maximum of any two values. + + @author Juan Rada-Vilela, Ph.D. + @see Minimum + @see SNorm + @see SNormFactory + @see Norm + @since 4.0 + */ + class FL_API Maximum FL_IFINAL : public SNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the maximum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$\max(a,b)@f$ + */ 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 index 151d92d..13e9793 100644 --- a/fuzzylite/fl/norm/s/NilpotentMaximum.h +++ b/fuzzylite/fl/norm/s/NilpotentMaximum.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_NILPOTENTMAXIMUM_H @@ -29,9 +21,31 @@ namespace fl { - class FL_API NilpotentMaximum : public SNorm { + /** + The NilpotentMaximum class is an SNorm that computes the nilpotent + maximum of any two values. + + @author Juan Rada-Vilela, Ph.D. + @see NilpotentMinimum + @see SNorm + @see SNormFactory + @see Norm + @since 5.0 + */ + class FL_API NilpotentMaximum FL_IFINAL : public SNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the nilpotent maximum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$\begin{cases} + \max(a,b) & \mbox{if $a+b<0$} \cr + 1 & \mbox{otherwise} + \end{cases}@f$ + */ scalar compute(scalar a, scalar b) const FL_IOVERRIDE; NilpotentMaximum* clone() const FL_IOVERRIDE; @@ -40,4 +54,3 @@ namespace fl { } #endif /* FL_NILPOTENTMAXIMUM_H */ - diff --git a/fuzzylite/fl/norm/s/NormalizedSum.h b/fuzzylite/fl/norm/s/NormalizedSum.h index 59063a6..e2e757b 100644 --- a/fuzzylite/fl/norm/s/NormalizedSum.h +++ b/fuzzylite/fl/norm/s/NormalizedSum.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_NORMALIZEDSUM_H @@ -29,16 +21,32 @@ namespace fl { - class FL_API NormalizedSum : public SNorm { + /** + The NormalizedSum class is an SNorm that computes the normalized sum of + any two values. + + @author Juan Rada-Vilela, Ph.D. + @see SNorm + @see SNormFactory + @see Norm + @since 4.0 + */ + class FL_API NormalizedSum FL_IFINAL : public SNorm { public: std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the normalized sum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$(a+b)/\max(1, a + b)@f$ + */ 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/s/SNormFunction.h b/fuzzylite/fl/norm/s/SNormFunction.h new file mode 100644 index 0000000..a78b1aa --- /dev/null +++ b/fuzzylite/fl/norm/s/SNormFunction.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_SNORMFUNCTION_H +#define FL_SNORMFUNCTION_H + +#include "fl/norm/SNorm.h" + +#include "fl/term/Function.h" + +namespace fl { + + /** + The SNormFunction class is a customizable SNorm via Function, which + computes any function based on the @f$a@f$ and @f$b@f$ values. + This SNorm is not registered with the SNormFactory. + + @author Juan Rada-Vilela, Ph.D. + @see Function + @see SNorm + @see Norm + @see SNormFactory + @since 6.0 + */ + + class FL_API SNormFunction FL_IFINAL : public SNorm { + private: + Function _function; + public: + explicit SNormFunction(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; + SNormFunction* clone() const FL_IOVERRIDE; + + static SNorm* constructor(); + }; +} +#endif /* FL_SNORMFUNCTION_H */ + diff --git a/fuzzylite/fl/norm/s/UnboundedSum.h b/fuzzylite/fl/norm/s/UnboundedSum.h new file mode 100644 index 0000000..695fdfd --- /dev/null +++ b/fuzzylite/fl/norm/s/UnboundedSum.h @@ -0,0 +1,52 @@ +/* + 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_UNBOUNDEDSUM_H +#define FL_UNBOUNDEDSUM_H + +#include "fl/norm/SNorm.h" + +namespace fl { + + /** + The UnboundedSum class is an SNorm that computes the sum of any two values. + + @author Juan Rada-Vilela, Ph.D. + @see BoundedSum + @see SNorm + @see SNormFactory + @see Norm + @since 4.0 + */ + class FL_API UnboundedSum FL_IFINAL : public SNorm { + public: + std::string className() const FL_IOVERRIDE; + + Complexity complexity() const FL_IOVERRIDE; + /** + Computes the bounded sum of two membership function values + @param a is a membership function value + @param b is a membership function value + @return @f$\min(1, a+b)@f$ + */ + scalar compute(scalar a, scalar b) const FL_IOVERRIDE; + UnboundedSum* clone() const FL_IOVERRIDE; + + static SNorm* constructor(); + }; +} + +#endif /* FL_BOUNDEDSUM_H */ 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 */ + |