AI-FuzzyEngine
view release on metacpan or search on metacpan
lib/AI/FuzzyEngine.pm view on Meta::CPAN
116117118119120121122123124125126127128129130131132133134135136=head1 NAME
AI::FuzzyEngine - A Fuzzy Engine, PDL aware
=head1 SYNOPSIS
=head2 Regular Perl - without PDL
use AI::FuzzyEngine;
# Engine (or factory) provides fuzzy logical arithmetic
my $fe = AI::FuzzyEngine->new();
# Disjunction:
my $a = $fe->or ( 0.2, 0.5, 0.8, 0.7 ); # 0.8
# Conjunction:
my $b = $fe->and( 0.2, 0.5, 0.8, 0.7 ); # 0.2
# Negation:
my $c = $fe->not( 0.4 ); # 0.6
# Always true:
my $t = $fe->true(); # 1.0
t/01-fuzzyEngine.t view on Meta::CPAN
510511512513514515516517518519520521522523524525526527528529530
my
$fe_resetted
=
$fe
->
reset
();
isa_ok(
$fe_resetted
,
$class
,
'What fuzzyEngine->reset returns'
,
);
is(
$w
->low, 0.0,
'FuzzyEngine resets all variables'
);
};
subtest
'synopsis'
=>
sub
{
# Engine (or factory) provides fuzzy logical arithmetic
my
$fe
=
$class
->new();
# Disjunction:
my
$a
=
$fe
->or ( 0.2, 0.5, 0.8, 0.7 );
# 0.8
# Conjunction:
my
$b
=
$fe
->and( 0.2, 0.5, 0.8, 0.7 );
# 0.2
# Negation:
my
$c
=
$fe
->not( 0.4 );
# 0.6
# Always true:
my
$t
=
$fe
->true();
# 1.0
( run in 1.091 second using v1.01-cache-2.11-cpan-49f99fa48dc )