AI-FuzzyInference
view release on metacpan or search on metacpan
FuzzyInference.pm view on Meta::CPAN
discourse, and its term sets. The arguments are identical to those for
the C<inVar()> method.
=item 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 C<&> or C<|> indicating the fuzzy
I<AND> and I<OR> operations respectively. Each consequent must be a
single string. Each string has the form: C<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 I<If the height is short, and the weight is
big, then diet is necessary>.
=item 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 C<value()> method below.
Example:
$obj->compute(x => 5,
y => 24);
Note that any subsequent call to C<compute()> will implicitly clear out
the old computed values before recomputing the new ones. This is done
through a call to the C<reset()> method below.
=item value()
This method returns the value of the supplied output variable. It only
works for output variables (defined using the C<outVar()> method),
and only returns useful results after a call to C<compute()> has been
made.
=item reset()
This method resets all the data structures used to compute crisp values
of the output variables. It is implicitly called by the C<compute()>
method above.
=back
=head1 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
=head1 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: aqumsieh@cpan.org
( run in 1.771 second using v1.01-cache-2.11-cpan-f0fbb3f571b )