Learn R Programming

lfl (version 2.0)

compose: Composition of Fuzzy Relations

Description

Composition of Fuzzy Relations

Usage

compose(
  x,
  y,
  e = NULL,
  alg = c("goedel", "goguen", "lukasiewicz"),
  type = c("basic", "sub", "super", "square"),
  quantifier = NULL,
  sorting = sort
)

Arguments

x

A first fuzzy relation to be composed. It must be a numeric matrix with values within the \([0,1]\) interval. The number of columns must match with the number of rows of the y matrix.

y

A second fuzzy relation to be composed. It must be a numeric matrix with values within the \([0,1]\) interval. The number of columns must match with the number of rows of the x matrix.

e

An excluding fuzzy relation. If not NULL, it must be a numeric matrix with dimensions equal to the y matrix.

alg

An algebra to be used for composition. It must be one of 'goedel' (default), 'goguen', or 'lukasiewicz', or an instance of class algebra (see algebra()).

type

A type of a composition to be performed. It must be one of 'basic' (default), 'sub', 'super', or 'square'.

quantifier

If not NULL, it must be a function taking a single argument, a vector of relative cardinalities, that would be translated into membership degrees. A result of the lingexpr() function is a good candidate for that.

sorting

Sorting function used within quantifier application. The given function must sort the membership degrees and allow the decreasing argument as in base::sort(). This function have to be explicitly specified typically if performing compositions that handle NA values.

Value

A matrix with \(v\) rows and \(w\) columns, where \(v\) is the number of rows of x and \(w\) is the number of columns of y.

Details

Function composes a fuzzy relation x (i.e. a numeric matrix of size \((u,v)\)) with a fuzzy relation y (i.e. a numeric matrix of size \((v,w)\)) and possibly with the use of an exclusion fuzzy relation e (i.e. a numeric matrix of size \((v,w)\)).

The style of composition is determined by the algebra alg, the composition type type, and possibly also by a quantifier.

See Also

[algebra(), mult(), lingexpr()

Examples

Run this code
# NOT RUN {
    R <- matrix(c(0.1, 0.6, 1, 0, 0, 0,
                  0, 0.3, 0.7, 0.9, 1, 1,
                  0, 0, 0.6, 0.8, 1, 0,
                  0, 1, 0.5, 0, 0, 0,
                  0, 0, 1, 1, 0, 0), byrow=TRUE, nrow=5)

    S <- matrix(c(0.9, 1, 0.9, 1,
                  1, 1, 1, 1,
                  0.1, 0.2, 0, 0.2,
                  0, 0, 0, 0,
                  0.7, 0.6, 0.5, 0.4,
                  1, 0.9, 0.7, 0.6), byrow=TRUE, nrow=6)

    RS <- matrix(c(0.6, 0.6, 0.6, 0.6,
                   1, 0.9, 0.7, 0.6,
                   0.7, 0.6, 0.5, 0.4,
                   1, 1, 1, 1,
                   0.1, 0.2, 0, 0.2), byrow=TRUE, nrow=5)

    compose(R, S, alg='goedel', type='basic') # should be equal to RS

# }

Run the code above in your browser using DataLab