| Title: | Procedures Related to the Zadeh's Extension Principle for Fuzzy Data |
|---|---|
| Description: | Procedures for calculation, plotting, animation, and approximation of the outputs for fuzzy numbers (see A.I. Ban, L. Coroianu, P. Grzegorzewski "Fuzzy Numbers: Approximations, Ranking and Applications" (2015)) based on the Zadeh's Extension Principle (see de Barros, L.C., Bassanezi, R.C., Lodwick, W.A. (2017) <doi:10.1007/978-3-662-53324-6_2>). |
| Authors: | Maciej Romaniuk [cre, aut] (ORCID: <https://orcid.org/0000-0001-9649-396X>, (Systems Research Institute Polish Academy of Sciences, Newelska 6, 01-447 Warszawa, Poland)), Abbas Parchami [aut] (ORCID: <https://orcid.org/0000-0002-0593-7324>, (Mahani Math Center, Afzalipour Research Institute, Shahid Bahonar University of Kerman, Kerman, Iran, Department of Statistics, Faculty of Mathematics and Computer, Shahid Bahonar University of Kerman, Iran)), Przemyslaw Grzegorzewski [aut] (ORCID: <https://orcid.org/0000-0002-5191-4123>, (Faculty of Mathematics and Information Science, Warsaw University of Technology, Koszykowa 75, 00-662 Warsaw, Poland)) |
| Maintainer: | Maciej Romaniuk <[email protected]> |
| License: | GPL-3 |
| Version: | 0.3.1 |
| Built: | 2026-06-01 10:38:56 UTC |
| Source: | https://github.com/mroman-ibs/zep |
AnimateListZEP animates the whole list consisting of fuzzy numbers.
AnimateListZEP( listOfValues, FUN, knots = 10, grid = TRUE, approximation = FALSE, method = "NearestEuclidean", sleep = 1, ... )AnimateListZEP( listOfValues, FUN, knots = 10, grid = TRUE, approximation = FALSE, method = "NearestEuclidean", sleep = 1, ... )
listOfValues |
List of the input fuzzy numbers. |
FUN |
Function used for the input fuzzy number with the help of the Zadeh's principle. |
knots |
Number of the alpha-cuts used during calculation of the output. |
grid |
If |
approximation |
If |
method |
The selected approximation method. |
sleep |
Interval between frames in the animation. |
... |
Additional parameters passed to other functions. |
The function takes the list of input fuzzy numbers listOfValues (which should be described by one of the
classes from FuzzyNumbers package) and applies the function FUN using
the Zadeh's principle. The output is given as animation of consecutive fuzzy numbers or their approximations (when
approximation is set to TRUE and the respective method is selected).
To properly find the output, value of FUN is calculated for many alpha-cuts of listOfValues.
The number of these alpha-cuts is equal to knots (plus 2 for the support and the core).
If the approximation is used, then the approximated fuzzy number is shown with green line.
The input fuzzy number from a list listOfValues should be given by fuzzy number described by classes from FuzzyNumbers package.
The figures are animated: the series of the input and output fuzzy numbers (for the Zadeh's principle and the applied function) or their approximation (if selected).
library(FuzzyNumbers) # prepare list of fuzzy numbers a <- seq(0,5,by=1) fuzzyList <- list() for (i in 1:length(a)) { fuzzyList[[i]] <- TrapezoidalFuzzyNumber(i,i+1,2*i+1,3*i+1) } # check the list fuzzyList # now some animations for various functions and then with approximation AnimateListZEP(fuzzyList,FUN=function(x) x^2) AnimateListZEP(fuzzyList,FUN=function(x) sin(x)) AnimateListZEP(fuzzyList,FUN=function(x) x^3+1,approximation = TRUE)library(FuzzyNumbers) # prepare list of fuzzy numbers a <- seq(0,5,by=1) fuzzyList <- list() for (i in 1:length(a)) { fuzzyList[[i]] <- TrapezoidalFuzzyNumber(i,i+1,2*i+1,3*i+1) } # check the list fuzzyList # now some animations for various functions and then with approximation AnimateListZEP(fuzzyList,FUN=function(x) x^2) AnimateListZEP(fuzzyList,FUN=function(x) sin(x)) AnimateListZEP(fuzzyList,FUN=function(x) x^3+1,approximation = TRUE)
AnimateZEP applies the selected function to a fuzzy number using the Zadeh's principle, and then animates
the output.
AnimateZEP( value, FUN, knots = 10, approximation = FALSE, method = "NearestEuclidean", sleep = 0.05, ... )AnimateZEP( value, FUN, knots = 10, approximation = FALSE, method = "NearestEuclidean", sleep = 0.05, ... )
value |
Input fuzzy number. |
FUN |
Function used for the input fuzzy number with the help of the Zadeh's principle. |
knots |
Number of the alpha-cuts used during calculation of the output. |
approximation |
If |
method |
The selected approximation method. |
sleep |
Interval between frames in the animation. |
... |
Additional parameters passed to other functions. |
The function takes the input fuzzy number value (which should be described by one of the
classes from FuzzyNumbers package) and applies the function FUN using
the Zadeh's principle. The output is given by a fuzzy number or its approximation (when
approximation is set to TRUE and the respective method is selected).
To properly find the output, value of FUN is calculated for many alpha-cuts of value.
The number of these alpha-cuts is equal to knots (plus 2 for the support and the core).
The output fuzzy number and its approximation are animated for the decreasing value of alpha (i.e., the consecutive alpha-cuts).
If the approximation is used, then the approximated fuzzy number is shown with green line.
The input fuzzy number value should be given by fuzzy number described by classes from FuzzyNumbers package.
One (or two) figures are animated: the output fuzzy number (for the Zadeh's principle and the applied function), and its approximation (if selected).
library(FuzzyNumbers) # prepare complex fuzzy number A <- FuzzyNumber(-5, 3, 6, 20, left=function(x) pbeta(x,0.4,3), right=function(x) 1-x^(1/4), lower=function(alpha) qbeta(alpha,0.4,3), upper=function(alpha) (1-alpha)^4) # animate the output fuzzy number AnimateZEP(A,FUN=function(x)x^3+2*x^2-1) # find and animate the approximated output via the Zadeh's principle AnimateZEP(A,FUN=function(x)x^3+2*x^2-1,approximation=TRUE)library(FuzzyNumbers) # prepare complex fuzzy number A <- FuzzyNumber(-5, 3, 6, 20, left=function(x) pbeta(x,0.4,3), right=function(x) 1-x^(1/4), lower=function(alpha) qbeta(alpha,0.4,3), upper=function(alpha) (1-alpha)^4) # animate the output fuzzy number AnimateZEP(A,FUN=function(x)x^3+2*x^2-1) # find and animate the approximated output via the Zadeh's principle AnimateZEP(A,FUN=function(x)x^3+2*x^2-1,approximation=TRUE)
ApplyZEP applies the selected function to a fuzzy number using the Zadeh's principle.
ApplyZEP( value, FUN, knots = 10, approximation = FALSE, method = "NearestEuclidean", ... )ApplyZEP( value, FUN, knots = 10, approximation = FALSE, method = "NearestEuclidean", ... )
value |
Input fuzzy number. |
FUN |
Function used for the input fuzzy number with the help of the Zadeh's principle. |
knots |
Number of the alpha-cuts used during calculation of the output. |
approximation |
If |
method |
The selected approximation method. |
... |
Additional parameters passed to other functions. |
The function takes the input fuzzy number value (which should be described by one of the
classes from FuzzyNumbers package) and applies the function FUN using
the Zadeh's principle. The output is given by a fuzzy number or its approximation (when
approximation is set to TRUE and the respective method is selected).
To properly find the output, value of FUN is calculated for many alpha-cuts of value.
The number of these alpha-cuts is equal to knots (plus 2 for the support and the core).
The input fuzzy number value should be given by fuzzy number described by classes from FuzzyNumbers package.
The output is a fuzzy number described by
classes from FuzzyNumbers package (piecewise linear fuzzy number without approximation,
various types with the approximation applied).
library(FuzzyNumbers) # prepare complex fuzzy number A <- FuzzyNumber(-5, 3, 6, 20, left=function(x) pbeta(x,0.4,3), right=function(x) 1-x^(1/4), lower=function(alpha) qbeta(alpha,0.4,3), upper=function(alpha) (1-alpha)^4) # find the output via the Zadeh's principle ApplyZEP(A,FUN=function(x)x^3+2*x^2-1) # find the approximated output via the Zadeh's principle ApplyZEP(A,FUN=function(x)x^3+2*x^2-1,approximation=TRUE)library(FuzzyNumbers) # prepare complex fuzzy number A <- FuzzyNumber(-5, 3, 6, 20, left=function(x) pbeta(x,0.4,3), right=function(x) 1-x^(1/4), lower=function(alpha) qbeta(alpha,0.4,3), upper=function(alpha) (1-alpha)^4) # find the output via the Zadeh's principle ApplyZEP(A,FUN=function(x)x^3+2*x^2-1) # find the approximated output via the Zadeh's principle ApplyZEP(A,FUN=function(x)x^3+2*x^2-1,approximation=TRUE)
'approximationMehodsInside' is a vector containing names of the built-in approximation methods.
approximationMehodsInsideapproximationMehodsInside
An object of class character of length 3.
This function returns a vector of strings.
# check the names approximationMehodsInside# check the names approximationMehodsInside
DpqDistance calculates the generalized D(p,q) distance between two fuzzy numbers.
DpqDistance(value1, value2, p = 2, q = 1/2)DpqDistance(value1, value2, p = 2, q = 1/2)
value1 |
First fuzzy number. |
value2 |
Second fuzzy number. |
p |
Value of the power (and the the root) applied in the distance calculation. |
q |
Value of the weight for the second fuzzy number (for the first one this weight is calculated as |
The function calculates the generalized D(p,q) distance between two fuzzy numbers value1 and value2,
where p is the value of the applied power, and q is the weight between these two fuzzy numbers.
All of the input values should be given by fuzzy numbers described by classes from FuzzyNumbers package.
The output is a numerical value (the calculated distance).
library(FuzzyNumbers) # prepare two fuzzy numbers A <- TrapezoidalFuzzyNumber(0,1,2,3) B <- TrapezoidalFuzzyNumber(1,3,4,6) # calculate the distance DpqDistance (A,B)library(FuzzyNumbers) # prepare two fuzzy numbers A <- TrapezoidalFuzzyNumber(0,1,2,3) B <- TrapezoidalFuzzyNumber(1,3,4,6) # calculate the distance DpqDistance (A,B)
FuzzyApproximation approximates the given fuzzy number.
FuzzyApproximation(value, method = "ExpectedValueCore", piecewise = FALSE, ...)FuzzyApproximation(value, method = "ExpectedValueCore", piecewise = FALSE, ...)
value |
Fuzzy number to approximate. |
method |
The selected approximation method. |
piecewise |
If |
... |
Additional parameters passed to other functions (like approximation method from the FuzzyNumbers package). |
The function approximates the fuzzy number given by value with the method selected by
method. The following approximations are possible: ExpectedValueCore–preserving the
expected value and the core of value, TriangSuppPreserving–constructs the
triangular fuzzy number based on minimization of DpqDistance, preserving the support of value,
AmbiguityValuePreserving–minimizing the Euclidean distance, while preserving the ambiguity and value,
and the approximation methods from the FuzzyNumbers package (namely: Naive, NearestEuclidean, ExpectedIntervalPreserving,
SupportCoreRestricted,SupportCorePreserving).
The input value should be given by a fuzzy number described by classes from FuzzyNumbers package.
The output is a fuzzy number (triangular or trapezoidal one) described by
classes from FuzzyNumbers package.
library(FuzzyNumbers) # prepare complex fuzzy number A <- FuzzyNumber(-5, 3, 6, 20, left=function(x) pbeta(x,0.4,3), right=function(x) 1-x^(1/4), lower=function(alpha) qbeta(alpha,0.4,3), upper=function(alpha) (1-alpha)^4) # find approximation FuzzyApproximation (A)library(FuzzyNumbers) # prepare complex fuzzy number A <- FuzzyNumber(-5, 3, 6, 20, left=function(x) pbeta(x,0.4,3), right=function(x) 1-x^(1/4), lower=function(alpha) qbeta(alpha,0.4,3), upper=function(alpha) (1-alpha)^4) # find approximation FuzzyApproximation (A)
PlotZEP applies the selected function to a fuzzy number using the Zadeh's principle, and plots
the input and output.
PlotZEP( value, FUN, knots = 10, grid = TRUE, alternate = FALSE, approximation = FALSE, xRange = NA, yRange = NA, method = "NearestEuclidean", ... )PlotZEP( value, FUN, knots = 10, grid = TRUE, alternate = FALSE, approximation = FALSE, xRange = NA, yRange = NA, method = "NearestEuclidean", ... )
value |
Input fuzzy number. |
FUN |
Function used for the input fuzzy number with the help of the Zadeh's principle. |
knots |
Number of the alpha-cuts used during calculation of the output. |
grid |
If |
alternate |
If |
approximation |
If |
xRange |
If |
yRange |
If |
method |
The selected approximation method. |
... |
Additional parameters passed to other functions. |
The function takes the input fuzzy number value (which should be described by one of the
classes from FuzzyNumbers package) and applies the function FUN using
the Zadeh's principle. The output is given by a fuzzy number or its approximation (when
approximation is set to TRUE and the respective method is selected).
To properly find the output, value of FUN is calculated for many alpha-cuts of value.
The number of these alpha-cuts is equal to knots (plus 2 for the support and the core).
The input and output fuzzy numbers are plotted together with the applied function.
If the approximation is used, then also the approximated fuzzy number is shown (green line).
The input fuzzy number value should be given by fuzzy number described by classes from FuzzyNumbers package.
Three (or four) figures are plotted: the input fuzzy number, the respective output (for the Zadeh's principle and the applied function), and the function. The output fuzzy number can be approximated with the selected method and also plotted.
library(FuzzyNumbers) # prepare complex fuzzy number A <- FuzzyNumber(-5, 3, 6, 20, left=function(x) pbeta(x,0.4,3), right=function(x) 1-x^(1/4), lower=function(alpha) qbeta(alpha,0.4,3), upper=function(alpha) (1-alpha)^4) # plot the figures PlotZEP(A,FUN=function(x)x^3+2*x^2-1) # find and plot the approximated output via the Zadeh's principle PlotZEP(A,FUN=function(x)x^3+2*x^2-1,approximation=TRUE)library(FuzzyNumbers) # prepare complex fuzzy number A <- FuzzyNumber(-5, 3, 6, 20, left=function(x) pbeta(x,0.4,3), right=function(x) 1-x^(1/4), lower=function(alpha) qbeta(alpha,0.4,3), upper=function(alpha) (1-alpha)^4) # plot the figures PlotZEP(A,FUN=function(x)x^3+2*x^2-1) # find and plot the approximated output via the Zadeh's principle PlotZEP(A,FUN=function(x)x^3+2*x^2-1,approximation=TRUE)