Esempio n. 1
0
# import modułów
import numpy as np
import matplotlib.pyplot as plt

from fuzzython.fsets.triangular import Triangular
from fuzzython.adjective import Adjective
from fuzzython.variable import Variable

from fuzzython.fsets.triangular import Triangular
from fuzzython.adjective import Adjective
from fuzzython.variable import Variable

#Definicja zmiennych lingwistycznych
#Dla każdej ze zmiennych definiujemy wartości lingwistyczne, trójkątne zbiory rozmyte

q_poor = Triangular((0, 0), (3, 1), (5, 0))
q_average = Triangular((0, 0), (5, 1), (10, 0))
q_good = Triangular((5, 0), (10, 1), (10.1, 0))
q_poor = Adjective('q_poor', q_poor)
q_average = Adjective('q_average', q_average)
q_good = Adjective('q_good', q_good)
quality = Variable('quality', 'star', q_poor, q_average,
                   q_good)  #jakość jedzenia w skali od 0 do 10

t_low = Triangular((-0.1, 0), (0, 1), (100, 0))
t_medium = Triangular((0, 0), (100, 1), (250, 0))
t_high = Triangular((100, 0), (250, 1), (250.1, 0))
t_low = Adjective('t_low', t_low)
t_medium = Adjective('t_medium', t_medium)
t_high = Adjective('t_high', t_high)
tip = Variable('tip',
# =========================================================================
#					MAMDANI

# import modułów
import numpy as np
import matplotlib.pyplot as plt

from fuzzython.fsets.triangular import Triangular
from fuzzython.adjective import Adjective
from fuzzython.variable import Variable

#Definicja zmiennych lingwistycznych
#Dla każdej ze zmiennych definiujemy wartości lingwistyczne, trójkątne zbiory rozmyte

# wartosci dla temperatury
t_low = Triangular((19.9, 0), (20, 1), (30, 0))
t_medium = Triangular((20, 0), (30, 1), (40, 0))
t_high = Triangular((30, 0), (40, 1), (40.1, 0))
t_low = Adjective('t_low', t_low)
t_medium = Adjective('t_medium', t_medium)
t_high = Adjective('t_high', t_high)
Temperature = Variable(
    'Temperature', 'degree', t_low, t_medium,
    t_high)  # Temperatura powietrza (20 stopni do 40 stopni)

#wartosci dla wilgotnosci
h_low = Triangular((-0.1, 0), (0, 1), (40, 0))
h_lower_medium = Triangular((0, 0), (40, 1), (60, 0))
h_higher_medium = Triangular((40, 0), (60, 1), (100, 0))
h_high = Triangular((60, 0), (100, 1), (100.1, 0))
Esempio n. 3
0
s_very_high = Trapezoid((120, 0), (130, 1), (199, 1), (200, 1))

a_s_low = Adjective('s_low', s_low)
a_s_medium = Adjective('s_medium', s_medium)
a_s_high = Adjective('s_high', s_high)
a_s_very_high = Adjective('s_very_high', s_very_high)
speed = Variable('speed', 'kmph', a_s_low, a_s_medium, a_s_high, a_s_very_high)

# zmienna lingwistyczna `visibility` opisująca widoczność w km  (0.05 − 4km
# trzy wartości lingwistyczne,  zbiory rozmyte: `v_low`, `v_medium`, `v_high`

#                                           widoczność

v_low = Gaussian(0, 1, 1)
v_medium = Gaussian(2, 1, 1)
v_high = Triangular((2.5, 0), (3, 1), (4, 1))
a_v_low = Adjective('v_low', v_low)
a_v_medium = Adjective('v_medium', v_medium)
a_v_high = Adjective('v_high', v_high)
visibility = Variable('visibility', 'km', a_v_low, a_v_medium, a_v_high)

# zmienna lingwistyczna `accident` opisująca jwysokość napiwku w skali od 0 do 25 procent (%)
# trzy wartości lingwistyczne,  zbiory rozmyte: `t_low`, `t_medium`, `t_high`

#                                           wypadek

a_very_low = Gaussian(0, 0.15, 1)
a_low = Gaussian(0.33, 0.2, 1)
a_medium = Gaussian(0.66, 0.2, 1)
a_high = Gaussian(1, 0.15, 1)
Esempio n. 4
0
from fuzzython.ruleblock import RuleBlock
import numpy as np
import matplotlib.pyplot as plt
from fuzzython.systems.mamdani import MamdaniSystem
from mpl_toolkits.mplot3d import Axes3D


# pomocnicza funkcja do rysowania zbiorów rozmytych
def plot_fuzzyset(ax, fuzzy_set, x, *args, **kwargs):
    y = np.array([fuzzy_set(e) for e in x])
    ax.plot(x, y, *args, **kwargs)
    ax.set_ylim(-0.1, 1.1)
    ax.legend()


s_slow = Triangular((9.99, 0), (10, 1), (73.33, 0))
s_medium = Triangular((10, 0), (73.33, 1), (136.66, 0))
s_fast = Triangular((73.34, 0), (136.66, 1), (200, 0))
s_very_fast = Triangular((136.66, 0), (200, 1), (200.1, 0))

a_s_slow = Adjective("s_slow", s_slow)
a_s_medium = Adjective("s_medium", s_medium)
a_s_fast = Adjective("s_fast", s_fast)
a_s_very_fast = Adjective("s_very_fast", s_very_fast)

speed = Variable("speed", "km/h", a_s_slow, a_s_medium, a_s_fast,
                 a_s_very_fast)

v_poor = Triangular((0.04, 0), (0.05, 1), (1.975, 0))
v_medium = Triangular((0.05, 0), (1.975, 1), (4, 0))
v_good = Triangular((1.975, 0), (4, 1), (4.1, 0))
Esempio n. 5
0
import numpy as np
import matplotlib.pyplot as plt

from fuzzython.fsets.triangular import Triangular
from fuzzython.adjective import Adjective
from fuzzython.variable import Variable

from fuzzython.fsets.triangular import Triangular
from fuzzython.adjective import Adjective
from fuzzython.variable import Variable

#Definicja zmiennych lingwistycznych
#Dla każdej ze zmiennych definiujemy wartości lingwistyczne, trójkątne zbiory rozmyte

#procesor
p_poor = Triangular((-1, 0), (500, 1), (900, 0))
p_average = Triangular((500, 0), (900, 1), (1500, 0))
p_good = Triangular((900, 0), (1500, 1), (2500, 0))
p_poor = Adjective('p_poor', p_poor)
p_average = Adjective('p_average', p_average)
p_good = Adjective('p_good', p_good)
procesor = Variable('procesor', 'star', p_poor, p_average, p_good)

#karta graficzna
k_poor = Triangular((-1, 0), (350, 1), (700, 0))
k_average = Triangular((350, 0), (700, 1), (1200, 0))
k_good = Triangular((700, 0), (1200, 1), (1900, 0))
k_poor = Adjective('k_poor', k_poor)
k_average = Adjective('k_average', k_average)
k_good = Adjective('k_good', k_good)
karta = Variable('karta', 'star', k_poor, k_average, k_good)
Esempio n. 6
0
# import modułów
import numpy as np
import matplotlib.pyplot as plt

from fuzzython.fsets.triangular import Triangular
from fuzzython.adjective import Adjective
from fuzzython.variable import Variable

from fuzzython.fsets.triangular import Triangular
from fuzzython.adjective import Adjective
from fuzzython.variable import Variable

#Definicja zmiennych lingwistycznych
#Dla każdej ze zmiennych definiujemy wartości lingwistyczne, trójkątne zbiory rozmyte

q_poor = Triangular((-0.1, 0), (2, 1), (3, 0))
q_average = Triangular((0, 0), (7, 1), (10, 0))
q_good = Triangular((8, 0), (10, 1), (11, 0))
q_poor = Adjective('q_poor', q_poor)
q_average = Adjective('q_average', q_average)
q_good = Adjective('q_good', q_good)
quality = Variable('quality', 'star', q_poor, q_average,
                   q_good)  #jakość jedzenia w skali od 0 do 10

s_poor = Triangular((-0.1, 0), (4, 1), (5, 0))
s_average = Triangular((0, 0), (8, 1), (10, 0))
s_good = Triangular((5, 0), (1, 1), (10.1, 0))
s_poor = Adjective('s_poor', s_poor)
s_average = Adjective('s_average', s_average)
s_good = Adjective('s_good', s_good)
service = Variable('service', 'star', s_poor, s_average,
Esempio n. 7
0
import numpy as np
import matplotlib.pyplot as plt

from fuzzython.fsets.triangular import Triangular
from fuzzython.adjective import Adjective
from fuzzython.variable import Variable

# =========================================================================
# =========================================================================
# =========================================================================

#Definicja zmiennych lingwistycznych
#Dla każdej ze zmiennych definiujemy wartości lingwistyczne, trójkątne zbiory rozmyte

# wartosci dla natężenia światła
l_low = Triangular((19.9, 0), (20, 1), (60, 0))
l_medium = Triangular((20, 0), (60, 1), (100, 0))
l_high = Triangular((60, 0), (100, 1), (100.1, 0))
l_low = Adjective('l_low', l_low)
l_medium = Adjective('l_medium', l_medium)
l_high = Adjective('l_high', l_high)
LightIntensity = Variable(
    'LightIntensity', 'klx', l_low, l_medium,
    l_high)  #natężenie światła w kilo luxach (20[klx] - 60[klx]- 100[klx])

#wartości dla pory dnia
t_dawn = Triangular((5.9, 0), (6, 1), (6.5, 0))
t_morning = Triangular((6.0, 0), (6.5, 1), (11.1, 0))
t_afternoon = Triangular((6.5, 0), (11, 1), (17, 0))
t_evening = Triangular((11, 0), (17, 1), (21, 0))
t_dawn = Adjective('t_dawn', t_dawn)