-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogic.py
More file actions
29 lines (25 loc) · 766 Bytes
/
Copy pathlogic.py
File metadata and controls
29 lines (25 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from reinas import Reinas
from ag_reinas import AG_Reinas
import time
def resolver_n_reinas(n):
problema = Reinas(n)
problema.resolver()
return problema.obtener_soluciones()
def resolver_AG_reinas(n):
problema = AG_Reinas(n)
problema.evolucionar()
return problema.obtener_soluciones()
def resolver_n_reinas_time(n):
inicio = time.time()
problema = Reinas(n)
problema.resolver()
fin = time.time()
tiempo_ejecucion = fin - inicio
return problema.obtener_soluciones(), tiempo_ejecucion
def resolver_AG_reinas_time(n):
inicio = time.time()
problema = AG_Reinas(n)
problema.evolucionar()
fin = time.time()
tiempo_ejecucion = fin - inicio
return problema.obtener_soluciones(), tiempo_ejecucion