def test_triangular(self, x, low, high, c, c_m, no_m): assume(low < c < high) assume(no_m < c_m) f = fun.triangular(low, high, c=c, c_m=c_m, no_m=no_m) assert 0 <= f(x) <= 1
def test_triangular_sigmoid(self, x, low, high, c): assume(low < c < high) f = fun.triangular(low, high, c=c) assert 0 <= f(x) <= 1
import helper import copy import fuzzylogic as fuzzy from fuzzylogic.classes import Domain import fuzzylogic.functions as ff DEGTORAD = math.pi/180.0 RADTODEG = 180.0/math.pi # Defining the main fuzzy domains Ang = Domain("diff_theta", -180, 180, res=1) Ang.zero = ff.triangular(-3,3) Ang.p_small = ff.trapezoid(0, 3, 5, 10) Ang.n_small = ff.trapezoid(-10,-5,-3,0) Ang.small = Ang.p_small | Ang.n_small Ang.p_med = ff.trapezoid(5, 10, 40, 50) Ang.n_med = ff.trapezoid(-50,-40,-10,-5) Ang.med = Ang.p_med | Ang.n_med Ang.p_big = ff.trapezoid(40, 50, 80, 100) Ang.n_big = ff.trapezoid(-100, -80, -50, -40) Ang.big = Ang.p_big | Ang.n_big