示例#1
0
def resolver(cajas):
    problema = generar_problema_csp_para_amagon(cajas)

    inicio = datetime.datetime.now()
    asignacion = min_conflicts(problema, iterations_limit=100)
    tiempo = (datetime.datetime.now() - inicio).total_seconds()

    conflictos = _find_conflicts(problema, asignacion)
    print("Numero de conflictos en la solucion: {}".format(len(conflictos)))
    print("Tiempo transcurrido: {} segundos".format(tiempo))
示例#2
0
 def test_find_conflicts_with_added_variable(self):
     assignment = {'A': 1, 'B': 1}
     conflicts = _find_conflicts(self.problem, assignment, 'C', 3)
     self.assertEqual(conflicts, self.constraints)
示例#3
0
 def test_find_conflicts(self):
     assignment = {'A': 1, 'B': 1, 'C': 3}
     conflicts = _find_conflicts(self.problem, assignment)
     self.assertEqual(conflicts, self.constraints)
示例#4
0
 def test_find_conflicts_with_added_variable(self):
     assignment = {'A': 1, 'B': 1}
     conflicts = _find_conflicts(self.problem, assignment, 'C', 3)
     self.assertEqual(conflicts, self.constraints)
示例#5
0
 def test_find_conflicts(self):
     assignment = {'A': 1, 'B': 1, 'C': 3}
     conflicts = _find_conflicts(self.problem, assignment)
     self.assertEqual(conflicts, self.constraints)