AI-FuzzyInference
view release on metacpan or search on metacpan
);
$s->compute(service => 2,
food => 7);
DESCRIPTION
This module implements a fuzzy inference system. Very briefly, an FIS is
a system defined by a set of input and output variables, and a set of
fuzzy rules relating the input variables to the output variables. Given
crisp values for the input variables, the FIS uses the fuzzy rules to
compute a crisp value for each of the output variables.
The operation of an FIS is split into 4 distinct parts: *fuzzification*,
*inference*, *aggregation* and *defuzzification*.
Fuzzification
In this step, the crisp values of the input variables are used to
compute a degree of membership of each of the input variables in each of
its term sets. This produces a set of fuzzy sets.
Inference
In this step, all the defined rules are examined. Each rule has two
parts: the *precedent* and the *consequent*. The degree of support for
each rule is computed by applying fuzzy operators (*and*, *or*) to
combine all parts of its precendent, and generate a single crisp value.
This value indicates the "strength of firing" of the rule, and is used
to reshape (*implicate*) the consequent part of the rule, generating
modified fuzzy sets.
Aggregation
Here, all implicated fuzzy sets of the fired rules are combined using
fuzzy operators to generate a single fuzzy set for each of the output
variables.
Defuzzification
Finally, a defuzzification operator is applied to the aggregated fuzzy
set to generate a single crisp value for each of the output variables.
For a more detailed explanation of fuzzy inference, you can check out
the tutorial by Jerry Mendel at
http://sipi.usc.edu/~mendel/publications/FLS_Engr_Tutorial_Errata.pdf.
Note: The terminology used in this module might differ from that used in
the above tutorial.
PUBLIC METHODS
The module has the following public methods:
new()
This is the constructor. It takes no arguments, and returns an
initialized AI::FuzzyInference object.
operation()
This method is used to set/query the fuzzy operations. It takes at
least one argument, and at most 2. The first argument specifies the
logic operation in question, and can be either "&" for logical
*AND*, "|" for logical *OR*, or "!" for logical *NOT*. The second
argument is used to set what method to use for the given operator.
The following values are possible:
&
min The result of "A and B" is "min(A, B)". This is the default.
product The result of "A and B" is "A * B".
|
max The result of "A or B" is "max(A, B)". This is the default.
sum The result of "A or B" is "min(A + B, 1)".
!
complement
The result of "not A" is "1 - A". This is the default.
The method returns the name of the method to be used for the given
operation.
implication()
This method is used to set/query the implication method used to
alter the shape of the implicated output fuzzy sets. It takes one
optional argument which specifies the name of the implication method
used. This can be one of the following:
clip This causes the output fuzzy set to be clipped at its
support value. This is the default.
scale This scales the output fuzzy set by multiplying it by its
support value.
aggregation()
This method is used to set/query the aggregation method used to
combine the output fuzzy sets. It takes one optional argument which
specifies the name of the aggregation method used. This can be one
of the following:
max The fuzzy sets are combined by taking at each point the
maximum value of all the fuzzy sets at that point. This is
the default.
defuzzification()
This method is used to set/query the defuzzification method used to
extract a single crisp value from the aggregated fuzzy set. It takes
one optional argument which specifies the name of the
defuzzification method used. This can be one of the following:
centroid
The centroid (aka *center of mass* and *center of gravity*)
of the aggregated fuzzy set is computed and returned. This
is the default.
inVar()
This method defines an input variable, along with its universe of
discourse, and its term sets. Here's an example:
$obj->inVar('height',
5, 8, # xmin, xmax (in feet, say)
'tall' => [5, 0,
( run in 0.967 second using v1.01-cache-2.11-cpan-39bf76dae61 )