/cspy-lib

Constraint programming library for python

Primary LanguagePythonOtherNOASSERTION

cspy is library that provides a solver for constraint satisfaction problems.

------
Simple use:
>>> from cspy import Solver
>>> from cspy import SolverVariable
>>> s = Solver()
# Create Variable with id and domain
>>> v1 = SolverVariable('1', [1, 2, 3])
>>> v2 = SolverVariable('2', [4, 5, 6])
>>> s.reg_variable(v1)
>>> s.reg_variable(v2)
>>> s.solve()
[{'1': 1, '2': 3}, {'1': 1, '2': 4}, {'1': 1, '2': 5}, {'1': 2, '2': 3}, {'1': 2, 
'2': 4}, {'1': 2, '2': 5}, {'1': 3, '2': 3}, {'1': 3, '2': 4}, {'1': 3, '2': 5}]

------
Install:

# python setup.py install