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))
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)
def test_find_conflicts(self): assignment = {'A': 1, 'B': 1, 'C': 3} conflicts = _find_conflicts(self.problem, assignment) self.assertEqual(conflicts, self.constraints)