AI-FuzzyEngine

 view release on metacpan or  search on metacpan

lib/AI/FuzzyEngine.pm  view on Meta::CPAN

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
=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

510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
    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 )