Sample Consultation Using Fuzzy Logic: Rules

%:::  SHOE-SIZE KNOWLEDGE BASE
%:::  Adapted from "Animated Fuzzy Logic"
%:::  by Gary Meehan and Mike Joy,
%:::  J. Functional Programming 1, January 1993.


if height be short then shoe_size := small.

if height be medium then shoe_size := average.

if height be tall then shoe_size := big.

if height be very_tall then shoe_size := very_big.


low( shoe_size, 4 ).
high( shoe_size, 13 ).
scale( shoe_size, 'British shoe sizes' ).
fuzzy_set( shoe_size, small,    down( 4, 6 ) ).
fuzzy_set( shoe_size, average,  tri( 5, 7, 9 ) ).
fuzzy_set( shoe_size, big,      tri( 8, 10, 12 ) ).
fuzzy_set( shoe_size, very_big, up( 11, 13 ) ).


low( height, 1.5 ).
high( height, 1.95 ).
scale( height, metres ).
fuzzy_set( height, short,     down( 1.5, 1.62 ) ).
fuzzy_set( height, medium,    tri( 1.53, 1.65, 1.77 ) ).
fuzzy_set( height, tall,      tri( 1.68, 1.8, 1.92 ) ).
fuzzy_set( height, very_tall, up( 1.83, 1.95 ) ).


/*
low( height, 4.92 ).
high( height, 6.4 ).
scale( height, feet ).
fuzzy_set( height, short,     down( 4.92, 5.31 ) ).
fuzzy_set( height, medium,    tri( 5.02, 5.41, 5.81 ) ).
fuzzy_set( height, tall,      tri( 5.51, 5.9, 6.23 ) ).
fuzzy_set( height, very_tall, up( 6, 6.4 ) ).
*/