AI-FuzzyInference
view release on metacpan or search on metacpan
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,
5.5, 1,
6, 0],
'medium' => [5.5, 0,
6.5, 1,
7, 0],
'short' => [6.5, 0,
7, 1]
);
This example defines an input variable called *height*. The minimum
possible value for height is 5, and the maximum is 8. It also
defines 3 term sets associated with height: *tall*, *medium* and
*short*. The shape of each of these triangular term sets is
completely specified by the supplied anonymous array of indices.
outVar()
This method defines an output variable, along with its universe of
discourse, and its term sets. The arguments are identical to those
for the "inVar()" method.
addRule()
This method is used to add the fuzzy rules. Its arguments are
hash-value pairs; the keys are the precedents and the values are the
consequents. Each antecedent has to be a combination of 1 or more
strings. The strings have to be separated by "&" or "|" indicating
the fuzzy *AND* and *OR* operations respectively. Each consequent
must be a single string. Each string has the form: "var = term_set".
Spaces are completely optional. Example:
$obj->addRule('height=short & weight=big' => 'diet = necessary',
'height=tall & weight=tiny' => 'diet = are_you_kidding_me');
The first rule basically says *If the height is short, and the
weight is big, then diet is necessary*.
compute()
This method takes as input a set of hash-value pairs; the keys are
names of input variables, and the values are the values of the
variables. It runs those values through the FIS, generating
corresponding values for the output variables. It always returns a
true value. To get the actual values of the output variables, look
at the "value()" method below. Example:
$obj->compute(x => 5,
y => 24);
Note that any subsequent call to "compute()" will implicitly clear
out the old computed values before recomputing the new ones. This is
done through a call to the "reset()" method below.
value()
This method returns the value of the supplied output variable. It
only works for output variables (defined using the "outVar()"
method), and only returns useful results after a call to "compute()"
has been made.
reset()
This method resets all the data structures used to compute crisp
values of the output variables. It is implicitly called by the
"compute()" method above.
INSTALLATION
It's all in pure Perl. Just place it somewhere and point your @INC to
it.
But, if you insist, here's the traditional way:
To install this module type the following:
perl Makefile.PL
make
make test
make install
AUTHOR
Copyright 2002, Ala Qumsieh. All rights reserved. This library is free
software; you can redistribute it and/or modify it under the same terms
as Perl itself.
Address bug reports and comments to: ala_qumsieh@yahoo.com.
( run in 0.549 second using v1.01-cache-2.11-cpan-13bb782fe5a )