1 /* simple operators for fuzzy sets:
2 * complement (not), intersection (and) and union (and)
5 function not_zadeh(x) { return 1-x; }
6 function not_sugeno(x, l) { return (1-x)/(1+l*x); }
7 function not_yager(x, l) { return Math.pow(1-Math.pow(x, l), 1/l); }
11 //return not_sugeno(x, -0.5);
12 //return not_yager(x, 2);
15 function and_zadeh(a, b) { return Math.min(a, b); }
16 function and_zadeh2(a, b) { return a*b; }
17 function and_tnorm(a, b, l) {
18 return 1 - Math.min(1, Math.pow(Math.pow(1-a, l) + Math.pow(1-b, l), 1/l));
22 return and_zadeh(a, b);
23 //return and_zadeh2(a, b);
24 //return and_tnorm(a, b, 2);
27 function or_zadeh(a, b) { return Math.max(a, b); }
28 function or_zadeh2(a, b) { return a+b - a*b; }
29 function or_snorm(a, b, l) {
30 return Math.min(1, Math.pow(Math.pow(a, l) + Math.pow(b, l), 1/l));
34 return or_zadeh(a, b);
35 //return or_zadeh(a, b);
36 //return or_snorm(a, b, 2);