Está en la página 1de 93

LOGICA FUZZY

PASOS
● Etapa estática:
● Definir variables (rangos y gráfico)
– Entrada
– Salida
● Definir reglas si ... entonces ... (cuadro)
● Etapa dinámica:
● Captar valores de entrada
● Ubicar valores de entrada en sus respectivos gráficos.
● Seleccionar reglas
● Aplicar and para cada regla y graficar en la salida (encontrar área de
soluciones)
● Calcular centroides parciales
● Calcular centroide solución
● Presentar la solución.
Ejemplo: Cruzar una calle
● Variables de entrada generadas sobre un auto
que se aproxima:
● Velocidad del auto.
● Distancia del auto.
● Variable de salida (acción del peatón):
● Velocidad del peatón.
Velocidad del auto
LENTO

1,0

0,8

0,6

0,4

0,2

10 20 30 40 50 60
Velocidad del auto
NORMAL

1,0

0,8

0,6

0,4

0,2

10 20 30 40 50 60
Velocidad del auto
RAPIDO

1,0

0,8

0,6

0,4

0,2

10 20 30 40 50 60
Velocidad del auto
LENTO NORMAL RAPIDO

1,0

0,8

0,6

0,4

0,2

10 20 30 40 50 60
Distancia del auto
CERCA

1,0

0,8

0,6

0,4

0,2

20 30 40 50 60 70 80 100
Distancia del auto
LEJOS

1,0

0,8

0,6

0,4

0,2

20 30 40 50 60 70 80 100
Distancia del auto
MUY LEJOS

1,0

0,8

0,6

0,4

0,2

20 30 40 50 60 70 80 100
Distancia del auto
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4

0,2

20 30 40 50 60 70 80 100
Velocidad del peatón
MUY LENTO

1,0

0,8

0,6

0,4

0,2

1 2 3 4 5 6
Velocidad del peatón
LENTO

1,0

0,8

0,6

0,4

0,2

1 2 3 4 5 6
Velocidad del peatón
CAMINAR

1,0

0,8

0,6

0,4

0,2

1 2 3 4 5 6
Velocidad del peatón
TROTAR

1,0

0,8

0,6

0,4

0,2

1 2 3 4 5 6
Velocidad del peatón
CORRER

1,0

0,8

0,6

0,4

0,2

1 2 3 4 5 6
Velocidad del peatón
CORRER
MUCHO

1,0

0,8

0,6

0,4

0,2

1 2 3 4 5 6
Velocidad del peatón
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,2

1 2 3 4 5 6
REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON
REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)


REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)

LENTO (0-30) LEJOS (20-80) LENTO (1-3)


REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)

LENTO (0-30) LEJOS (20-80) LENTO (1-3)

LENTO (0-30) MUY LEJOS (70-mas) MUY LENTO (0-2)


REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)

LENTO (0-30) LEJOS (20-80) LENTO (1-3)

LENTO (0-30) MUY LEJOS (70-mas) MUY LENTO (0-2)

NORMAL (10-60) CERCA (0-30) CORRER (4-6)


REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)

LENTO (0-30) LEJOS (20-80) LENTO (1-3)

LENTO (0-30) MUY LEJOS (70-mas) MUY LENTO (0-2)

NORMAL (10-60) CERCA (0-30) CORRER (4-6)

NORMAL (10-60) LEJOS (20-80) TROTAR (3-5)


REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)

LENTO (0-30) LEJOS (20-80) LENTO (1-3)

LENTO (0-30) MUY LEJOS (70-mas) MUY LENTO (0-2)

NORMAL (10-60) CERCA (0-30) CORRER (4-6)

NORMAL (10-60) LEJOS (20-80) TROTAR (3-5)

NORMAL (10-60) MUY LEJOS (70-mas) CAMINAR (2-4)


REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)

LENTO (0-30) LEJOS (20-80) LENTO (1-3)

LENTO (0-30) MUY LEJOS (70-mas) MUY LENTO (0-2)

NORMAL (10-60) CERCA (0-30) CORRER (4-6)

NORMAL (10-60) LEJOS (20-80) TROTAR (3-5)

NORMAL (10-60) MUY LEJOS (70-mas) CAMINAR (2-4)

RAPIDO (40-mas) CERCA (0-30) CORRER MUCHO (5-mas)


REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)

LENTO (0-30) LEJOS (20-80) LENTO (1-3)

LENTO (0-30) MUY LEJOS (70-mas) MUY LENTO (0-2)

NORMAL (10-60) CERCA (0-30) CORRER (4-6)

NORMAL (10-60) LEJOS (20-80) TROTAR (3-5)

NORMAL (10-60) MUY LEJOS (70-mas) CAMINAR (2-4)

RAPIDO (40-mas) CERCA (0-30) CORRER MUCHO (5-mas)

RAPIDO (40-mas) LEJOS (20-80) CORRER (4-6)


REGLAS
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)

LENTO (0-30) LEJOS (20-80) LENTO (1-3)

LENTO (0-30) MUY LEJOS (70-mas) MUY LENTO (0-2)

NORMAL (10-60) CERCA (0-30) CORRER (4-6)

NORMAL (10-60) LEJOS (20-80) TROTAR (3-5)

NORMAL (10-60) MUY LEJOS (70-mas) CAMINAR (2-4)

RAPIDO (40-mas) CERCA (0-30) CORRER MUCHO (5-mas)

RAPIDO (40-mas) LEJOS (20-80) CORRER (4-6)

RAPIDO (40-mas) MUY LEJOS (70-mas) TROTAR (3-5)


EJEMPLO

Un auto se aproxima
a una velocidad de
25 kph y a una
distancia de 22 mts
Velocidad del auto (25 kph)
LENTO NORMAL RAPIDO

1,0

0,8

0,6

0,4

0,2

10 20 30 40 50 60
25
Velocidad del auto (25 kph)
LENTO NORMAL RAPIDO

1,0

0,8

0,6

0,4

0,2

10 20 30 40 50 60
25
Velocidad del auto (25 kph)
LENTO NORMAL RAPIDO

1,0

0,8

0,6

0,4

0,2

10 20 30 40 50 60
25
Velocidad del auto (25 kph)
LENTO NORMAL RAPIDO

1,0

0,8

0,6

0,4

0,25
0,2

10 20 30 40 50 60
25
Velocidad del auto (25 kph)
LENTO NORMAL RAPIDO

1,0

0,8

0,6

0,4

0,2

10 20 30 40 50 60
25
Velocidad del auto (25 kph)
LENTO NORMAL RAPIDO

1,0

0,8
0,75

0,6

0,4

0,2

10 20 30 40 50 60
25
Velocidad del auto (25 kph)
LENTO NORMAL RAPIDO

1,0

0,8
0,75

0,6

0,4

0,25
0,2

10 20 30 40 50 60
25
Distancia del auto (22 mts)
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4

0,2

20 30 40 50 60 70 80 100
22
Distancia del auto (22 mts)
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4

0,2

20 30 40 50 60 70 80 100
22
Distancia del auto (22 mts)
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4

0,2

20 30 40 50 60 70 80 100
22
Distancia del auto (22 mts)
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4

0,2
0,0666

20 30 40 50 60 70 80 100
22
Distancia del auto (22 mts)
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4

0,2

20 30 40 50 60 70 80 100
22
Distancia del auto (22 mts)
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4
0,2666

0,2

20 30 40 50 60 70 80 100
22
Distancia del auto (22 mts)
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4
0,2666

0,2
0,0666

20 30 40 50 60 70 80 100
22
ACTIVACION
DE
REGLAS
Velocidad del auto
LENTO NORMAL RAPIDO

1,0

0,8
0,75

0,6

0,4
LENTO
0,25
0,2

10 20 30 40 50 60
25
Velocidad del auto
LENTO NORMAL RAPIDO

1,0

0,8 NORMAL
0,75

0,6

0,4

0,25
0,2

10 20 30 40 50 60
25
Distancia del auto
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4
0,2666

0,2
0,0666
LEJOS
20 30 40 50 60 70 80 100
22
Distancia del auto
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4
0,2666 CERCA

0,2
0,0666

20 30 40 50 60 70 80 100
22
BUSCAMOS LAS REGLAS DE
ACUERDO AL EJEMPLO
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO (0-30) CERCA (0-30) CAMINAR (2-4)

LENTO (0-30) LEJOS (20-80) LENTO (1-3)

LENTO (0-30) MUY LEJOS (70-mas) MUY LENTO (0-2)

NORMAL (10-60) CERCA (0-30) CORRER (4-6)

NORMAL (10-60) LEJOS (20-80) TROTAR (3-5)

NORMAL (10-60) MUY LEJOS (70-mas) CAMINAR (2-4)

RAPIDO (40-mas) CERCA (0-30) CORRER MUCHO (5-mas)

RAPIDO (40-mas) LEJOS (20-80) CORRER (4-6)

RAPIDO (40-mas) MUY LEJOS (70-mas) TROTAR (3-5)


Activación de reglas
● Velocidad del auto: lento, normal
● Distancia del auto: cerca, lejos
● Seleccionamos las reglas combinando las
variables del ejemplo
VELOCIDAD DISTANCIA VELOCIDAD
AUTO AUTO PEATON

LENTO CERCA CAMINAR

LENTO LEJOS LENTO

NORMAL CERCA CORRER

NORMAL LEJOS TROTAR


Velocidad del auto (recordar los
valores a la izquierda)
LENTO NORMAL RAPIDO

1,0

NORMAL
0,8
0,75

0,6

0,4
LENTO
0,25
0,2

10 20 30 40 50 60
25
Distancia del auto (recordar los
valores a la izquierda)
CERCA LEJOS MUY LEJOS

1,0

0,8

0,6

0,4
0,2666 CERCA

0,2
0,0666
LEJOS
20 30 40 50 60 70 80 100
22
Aplicando operador and a las
variables de entrada

(velocidad auto) and (distancia auto) = mínimo


RS VELOCIDAD DISTANCIA AND VELOCIDAD
AUTO AUTO (mínimo) PEATON

1 LENTO CERCA 0,2500 CAMINAR


0,2500 0,2666
Aplicando operador and a las
variables de entrada

(velocidad auto) and (distancia auto) = mínimo


RS VELOCIDAD DISTANCIA AND VELOCIDAD
AUTO AUTO (mínimo) PEATON

1 LENTO CERCA 0,2500 CAMINAR


0,2500 0,2666
2 LENTO LEJOS 0,0666 LENTO
0,2500 0,0666
Aplicando operador and a las
variables de entrada

(velocidad auto) and (distancia auto) = mínimo


RS VELOCIDAD DISTANCIA AND VELOCIDAD
AUTO AUTO (mínimo) PEATON

1 LENTO CERCA 0,2500 CAMINAR


0,2500 0,2666
2 LENTO LEJOS 0,0666 LENTO
0,2500 0,0666
3 NORMAL CERCA 0,2666 CORRER
0,7500 0,2666
Aplicando operador and a las
variables de entrada

(velocidad auto) and (distancia auto) = mínimo


RS VELOCIDAD DISTANCIA AND VELOCIDAD
AUTO AUTO (mínimo) PEATON

1 LENTO CERCA 0,2500 CAMINAR


0,2500 0,2666
2 LENTO LEJOS 0,0666 LENTO
0,2500 0,0666
3 NORMAL CERCA 0,2666 CORRER
0,7500 0,2666
4 NORMAL LEJOS TROTAR
0,7500 0,0666 0,0666
APLICANDO LOS
MINIMOS
ENCONTRADOS
A LA VARIABLE DE
SALIDA
RS1 sobre CAMINAR
Velocidad del peatón 0,2500
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,25
0,2

1 2 3 4 5 6
RS1 sobre CAMINAR
Velocidad del peatón 0,2500
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,25
0,2

1 2 3 4 5 6
RS1 sobre CAMINAR
Velocidad del peatón 0,2500
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,25
0,2

1 2 3 4 5 6
RS2 sobre LENTO
Velocidad del peatón 0,0666
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,2
0,0666

1 2 3 4 5 6
RS2 sobre LENTO
Velocidad del peatón 0,0666
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,2
0,0666

1 2 3 4 5 6
RS2 sobre LENTO
Velocidad del peatón 0,0666
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,2
0,0666

1 2 3 4 5 6
RS3 sobre CORRER
Velocidad del peatón 0,2666
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666

0,2

1 2 3 4 5 6
RS3 sobre CORRER
Velocidad del peatón 0,2666
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666

0,2

1 2 3 4 5 6
RS3 sobre CORRER
Velocidad del peatón 0,2666
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666

0,2

1 2 3 4 5 6
RS4 sobre TROTAR
Velocidad del peatón 0,0666
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,2
0,0666

1 2 3 4 5 6
RS4 sobre TROTAR
Velocidad del peatón 0,0666
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,2
0,0666

1 2 3 4 5 6
RS4 sobre TROTAR
Velocidad del peatón 0,0666
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,2
0,0666

1 2 3 4 5 6
Unimos los resultados
Velocidad del peatón anteriores
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,2
0,0666

1 2 3 4 5 6
Unimos los resultados
Velocidad del peatón anteriores
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,25
0,2
0,0666

1 2 3 4 5 6
Unimos los resultados
Velocidad del peatón anteriores
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4

0,25
0,2
0,0666

1 2 3 4 5 6
Unimos los resultados
Velocidad del peatón anteriores
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666

1 2 3 4 5 6
Unimos los resultados
Velocidad del peatón anteriores
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666

1 2 3 4 5 6
CALCULAMOS EL CENTROIDE
DE LA FIGURA RESULTANTE

SEPARAMOS TRIANGULOS Y
RECTANGULOS PARA
FACILITAR EL CÁLCULO
Creamos triángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666
1
Creamos triángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666
1 2
Creamos triángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666
1 2 3
Creamos triángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666
1 2 3 4
Creamos triángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
5
0,0666
1 2 3 4
Creamos triángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
5
0,0666
1 2 3 4 6
Creamos triángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
5
0,0666
1 2 3 4 6 7
Creamos rectángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666
8
Creamos rectángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666
8 9
Creamos rectángulos y
Velocidad del peatón calculamos el
centroide de c/u de ellos
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666
8 9 10
Centroides
Triángulo 1: 1,0444444
Triángulo 2: 2,0444434
Triángulo3: 2,16666567
Triángulo 4: 3,89666567
Triángulo 5: 4,00222117
Triángulo 6: 4,15777523
Triángulo 7: 5,90444123
Rectángulo 8: 1,53333265
Rectángulo 9: 2,989999
Rectángulo 10: 4,9866635

CENTROIDE DE TODA LA FIGURA:


3,8598
Centroide de toda
Velocidad del peatón la figura
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666

1 2 3 4 5 6
3,8598
Centroide de toda
Velocidad del peatón la figura
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666

1 2 3 4 5 6
3,8598
Centroide de toda
Velocidad del peatón la figura
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6

0,4
0,2666
0,25
0,2
0,0666

1 2 3 4 5 6
3,8598
Centroide de toda
Velocidad del peatón la figura
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6
0,5
0,4
0,2666
0,25
0,2
0,0666

1 2 3 4 5 6
3,8598
Centroide de toda
Velocidad del peatón la figura toca la recta
de “Caminar”
MUY LENTO CAMINAR CORRER CORRER
LENTO TROTAR MUCHO

1,0

0,8

0,6
0,5
SOLUCION
0,4 INTERSECCION
0,2666 DEL CENTROIDE
0,25 CON LA RECTA
DE “CAMINAR”
0,2
0,0666

1 2 3 4 5 6
3,8598
RESULTADO

Cuando un auto se
aproxima a una
“velocidad” de 25 kph y a
una “distancia” de
22 mts, el peatón debe
“caminar”
Muchas gracias

También podría gustarte