python-constraint2 2.0.2__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/PKG-INFO +10 -6
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/README.rst +8 -4
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/constraint/__init__.py +1 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/constraint/constraints.c +3374 -2748
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/constraint/constraints.py +10 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/constraint/domain.c +5 -5
- python_constraint2-2.1.0/constraint/parser.c +19108 -0
- python_constraint2-2.1.0/constraint/parser.py +269 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/constraint/problem.c +3260 -1603
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/constraint/problem.py +54 -20
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/constraint/solvers.c +10495 -3580
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/constraint/solvers.py +195 -4
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/cythonize_build.py +1 -1
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/pyproject.toml +2 -2
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/tests/test_compilation.py +4 -4
- python_constraint2-2.1.0/tests/test_parser.py +85 -0
- python_constraint2-2.1.0/tests/test_problem.py +65 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/tests/test_solvers.py +63 -1
- python_constraint2-2.0.2/tests/test_problem.py +0 -27
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/LICENSE +0 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/constraint/domain.py +0 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/tests/__init__.py +0 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/tests/setup_teardown.py +0 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/tests/test_constraint.py +0 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/tests/test_doctests.py +0 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/tests/test_some_not_in_set.py +0 -0
- {python_constraint2-2.0.2 → python_constraint2-2.1.0}/tests/test_toml_file.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: python-constraint2
|
|
3
|
-
Version: 2.0
|
|
3
|
+
Version: 2.1.0
|
|
4
4
|
Summary: python-constraint is a module for efficiently solving CSPs (Constraint Solving Problems) over finite domains.
|
|
5
5
|
License: BSD-2-Clause
|
|
6
6
|
Keywords: CSP,constraint solving problems,problem solver,SMT,satisfiability modulo theory,SAT
|
|
@@ -8,7 +8,7 @@ Author: Gustavo Niemeyer
|
|
|
8
8
|
Author-email: gustavo@niemeyer.net
|
|
9
9
|
Maintainer: Floris-Jan Willemsen
|
|
10
10
|
Maintainer-email: fjwillemsen97@gmail.com
|
|
11
|
-
Requires-Python: >=3.9,<3.
|
|
11
|
+
Requires-Python: >=3.9,<3.15
|
|
12
12
|
Classifier: Development Status :: 4 - Beta
|
|
13
13
|
Classifier: Environment :: Console
|
|
14
14
|
Classifier: Intended Audience :: Developers
|
|
@@ -44,6 +44,11 @@ python-constraint
|
|
|
44
44
|
| For an overview of recent changes, visit the `Changelog <https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md>`_.
|
|
45
45
|
| The complete documentation can be found `here <http://python-constraint.github.io/python-constraint/>`_.
|
|
46
46
|
|
|
47
|
+
| New: writing constraints in the new string format is preferable over functions and lambdas.
|
|
48
|
+
| These strings, even as compound statements, are automatically parsed to faster built-in constraints, are more concise, and do not require constraint solving familiarity by the user to be efficient.
|
|
49
|
+
| For example, :code:`problem.addConstraint(["50 <= x * y < 100"])` is parsed to :code:`[MinProdConstraint(50, ["x", "y"]), MaxProdConstraint(100, ["x", "y"])]`.
|
|
50
|
+
| This feature is in beta and subject to possible change, please provide feedback.
|
|
51
|
+
|
|
47
52
|
.. contents::
|
|
48
53
|
:local:
|
|
49
54
|
:depth: 1
|
|
@@ -72,8 +77,7 @@ This interactive Python session demonstrates basic operations:
|
|
|
72
77
|
{'a': 2, 'b': 6}, {'a': 2, 'b': 5}, {'a': 2, 'b': 4},
|
|
73
78
|
{'a': 1, 'b': 6}, {'a': 1, 'b': 5}, {'a': 1, 'b': 4}]
|
|
74
79
|
|
|
75
|
-
>>> problem.addConstraint(lambda a, b: a*2 == b,
|
|
76
|
-
("a", "b"))
|
|
80
|
+
>>> problem.addConstraint("a*2 == b") # string constraints are preferable over the black-box problem.addConstraint(lambda a, b: a*2 == b, ("a", "b"))
|
|
77
81
|
>>> problem.getSolutions()
|
|
78
82
|
[{'a': 3, 'b': 6}, {'a': 2, 'b': 4}]
|
|
79
83
|
|
|
@@ -146,6 +150,7 @@ The following solvers are available:
|
|
|
146
150
|
- Optimized backtracking solver
|
|
147
151
|
- Recursive backtracking solver
|
|
148
152
|
- Minimum conflicts solver
|
|
153
|
+
- Parallel solver
|
|
149
154
|
|
|
150
155
|
.. role:: python(code)
|
|
151
156
|
:language: python
|
|
@@ -200,8 +205,7 @@ For an overview of recent changes, visit the `Changelog <https://github.com/pyth
|
|
|
200
205
|
|
|
201
206
|
Planned development:
|
|
202
207
|
|
|
203
|
-
- Add
|
|
204
|
-
- Add a string parser for constraints
|
|
208
|
+
- Add `benchmarking tests <https://pypi.org/project/pytest-benchmark/>`_ automated with `GH actions <https://github.com/benchmark-action/github-action-benchmark>`_
|
|
205
209
|
- Versioned documentation
|
|
206
210
|
|
|
207
211
|
Contact
|
|
@@ -12,6 +12,11 @@ python-constraint
|
|
|
12
12
|
| For an overview of recent changes, visit the `Changelog <https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md>`_.
|
|
13
13
|
| The complete documentation can be found `here <http://python-constraint.github.io/python-constraint/>`_.
|
|
14
14
|
|
|
15
|
+
| New: writing constraints in the new string format is preferable over functions and lambdas.
|
|
16
|
+
| These strings, even as compound statements, are automatically parsed to faster built-in constraints, are more concise, and do not require constraint solving familiarity by the user to be efficient.
|
|
17
|
+
| For example, :code:`problem.addConstraint(["50 <= x * y < 100"])` is parsed to :code:`[MinProdConstraint(50, ["x", "y"]), MaxProdConstraint(100, ["x", "y"])]`.
|
|
18
|
+
| This feature is in beta and subject to possible change, please provide feedback.
|
|
19
|
+
|
|
15
20
|
.. contents::
|
|
16
21
|
:local:
|
|
17
22
|
:depth: 1
|
|
@@ -40,8 +45,7 @@ This interactive Python session demonstrates basic operations:
|
|
|
40
45
|
{'a': 2, 'b': 6}, {'a': 2, 'b': 5}, {'a': 2, 'b': 4},
|
|
41
46
|
{'a': 1, 'b': 6}, {'a': 1, 'b': 5}, {'a': 1, 'b': 4}]
|
|
42
47
|
|
|
43
|
-
>>> problem.addConstraint(lambda a, b: a*2 == b,
|
|
44
|
-
("a", "b"))
|
|
48
|
+
>>> problem.addConstraint("a*2 == b") # string constraints are preferable over the black-box problem.addConstraint(lambda a, b: a*2 == b, ("a", "b"))
|
|
45
49
|
>>> problem.getSolutions()
|
|
46
50
|
[{'a': 3, 'b': 6}, {'a': 2, 'b': 4}]
|
|
47
51
|
|
|
@@ -114,6 +118,7 @@ The following solvers are available:
|
|
|
114
118
|
- Optimized backtracking solver
|
|
115
119
|
- Recursive backtracking solver
|
|
116
120
|
- Minimum conflicts solver
|
|
121
|
+
- Parallel solver
|
|
117
122
|
|
|
118
123
|
.. role:: python(code)
|
|
119
124
|
:language: python
|
|
@@ -168,8 +173,7 @@ For an overview of recent changes, visit the `Changelog <https://github.com/pyth
|
|
|
168
173
|
|
|
169
174
|
Planned development:
|
|
170
175
|
|
|
171
|
-
- Add
|
|
172
|
-
- Add a string parser for constraints
|
|
176
|
+
- Add `benchmarking tests <https://pypi.org/project/pytest-benchmark/>`_ automated with `GH actions <https://github.com/benchmark-action/github-action-benchmark>`_
|
|
173
177
|
- Versioned documentation
|
|
174
178
|
|
|
175
179
|
Contact
|
|
@@ -31,6 +31,7 @@ from constraint.problem import * # noqa: F403
|
|
|
31
31
|
from constraint.domain import * # noqa: F403
|
|
32
32
|
from constraint.constraints import * # noqa: F403
|
|
33
33
|
from constraint.solvers import * # noqa: F403
|
|
34
|
+
from constraint.parser import * # noqa: F403
|
|
34
35
|
|
|
35
36
|
if __name__ == "__main__":
|
|
36
37
|
from tests import test_doctests
|