79127934

Date: 2024-10-26 06:28:53
Score: 1
Natty:
Report link

So to check accuracy of the code,i tried with less permutaions and it took 30 sec around.Then I ran above code.This was the testing code---

from constraint import Problem, AllDifferentConstraint

# Basic setup with fewer constraints to check if it finds solutions quickly
problem = Problem()
customers = ["Freda", "Opal", "Penny", "Sarah", "Vicky"]


for i in range(1, 6):
    problem.addVariable(f"Customer_{i}", customers)


problem.addConstraint(AllDifferentConstraint(), [f"Customer_{i}" for i in range(1, 6)])


solutions = problem.getSolutions()


for solution in solutions:
    print(solution)

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Aqshat