You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/csp/python-constraint/testconstraint.py

16 lines
323 B
Python

10 years ago
#!/usr/bin/python
from constraint import *
#p = Problem()
#p.addVariable("ab", [1, 2])
#p.addVariable("c", [3])
#print p.getSolutions()
problem = Problem()
10 years ago
problem.addVariables(["a", "b"], range(500))
def func(a, b):
10 years ago
return a > 0 and b == 211 * a
problem.addConstraint(func, ["a", "b"])
10 years ago
print problem.getSolutions()