python-constraint2 2.5.0__cp314-cp314-win_amd64.whl

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.
@@ -0,0 +1,252 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-constraint2
3
+ Version: 2.5.0
4
+ Summary: python-constraint is a module for efficiently solving CSPs (Constraint Solving Problems) over finite domains.
5
+ License-Expression: BSD-2-Clause
6
+ License-File: LICENSE
7
+ Keywords: CSP,constraint solving problems,problem solver,SMT,satisfiability modulo theory,SAT
8
+ Author: Floris-Jan Willemsen
9
+ Author-email: fjwillemsen97@gmail.com
10
+ Maintainer: Floris-Jan Willemsen
11
+ Maintainer-email: fjwillemsen97@gmail.com
12
+ Requires-Python: >= 3.9
13
+ Classifier: Environment :: Console
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Intended Audience :: Education
18
+ Classifier: Natural Language :: English
19
+ Classifier: Programming Language :: C
20
+ Classifier: Programming Language :: Cython
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Topic :: Software Development
23
+ Classifier: Programming Language :: Python :: 3.9
24
+ Classifier: Programming Language :: Python :: 3.10
25
+ Classifier: Programming Language :: Python :: 3.11
26
+ Classifier: Programming Language :: Python :: 3.12
27
+ Classifier: Programming Language :: Python :: 3.13
28
+ Classifier: Programming Language :: Python :: 3.14
29
+ Project-URL: Changelog, https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md
30
+ Project-URL: Documentation, http://python-constraint.github.io/python-constraint/
31
+ Project-URL: Homepage, http://python-constraint.github.io/python-constraint/
32
+ Project-URL: Issues, https://github.com/python-constraint/python-constraint/issues
33
+ Project-URL: Repository, https://github.com/python-constraint/python-constraint
34
+ Description-Content-Type: text/x-rst
35
+
36
+ |License| |Build Status| |Docs| |Python Versions| |Downloads| |Status| |Code Coverage|
37
+
38
+ .. image:: https://github.com/python-constraint/python-constraint/raw/main/docs/assets/logo/N-Queens_problem_Python.svg
39
+ :align: center
40
+ :width: 50%
41
+
42
+ python-constraint
43
+ =================
44
+
45
+ | This software is now back to active development / maintainance status.
46
+ | IMPORTANT: the new version can be installed with `pip install python-constraint2`, as the original pip release will not be updated.
47
+ | For an overview of recent changes, visit the `Changelog <https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md>`_.
48
+ | The complete documentation can be found `here <http://python-constraint.github.io/python-constraint/>`_.
49
+
50
+ | New: writing constraints in the new string format is preferable over functions and lambdas.
51
+ | 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.
52
+ | For example, :code:`problem.addConstraint(["50 <= x * y < 100"])` is parsed to :code:`[MinProdConstraint(50, ["x", "y"]), MaxProdConstraint(100, ["x", "y"])]`.
53
+ | Similarly, :code:`problem.addConstraint(["x / y == z"])` is parsed to :code:`[ExactProdConstraint("x", ["z", "y"])]`.
54
+ | This feature is in beta and subject to possible change, please provide feedback.
55
+
56
+ .. contents::
57
+ :local:
58
+ :depth: 1
59
+
60
+ Introduction
61
+ ------------
62
+ The :code:`python-constraint` module offers efficient solvers for `Constraint Satisfaction Problems (CSPs) <https://en.wikipedia.org/wiki/Constraint_satisfaction_problem>`_ over finite domains in an accessible Python package.
63
+ CSP is class of problems which may be represented in terms of variables (a, b, ...), domains (a in [1, 2, 3], ...), and constraints (a < b, ...).
64
+
65
+ Examples
66
+ --------
67
+
68
+ Basics
69
+ ~~~~~~
70
+
71
+ This interactive Python session demonstrates basic operations:
72
+
73
+ .. code-block:: python
74
+
75
+ >>> from constraint import *
76
+ >>> problem = Problem()
77
+ >>> problem.addVariable("a", [1,2,3])
78
+ >>> problem.addVariable("b", [4,5,6])
79
+ >>> problem.getSolutions() # doctest: +NORMALIZE_WHITESPACE
80
+ [{'a': 3, 'b': 6}, {'a': 3, 'b': 5}, {'a': 3, 'b': 4},
81
+ {'a': 2, 'b': 6}, {'a': 2, 'b': 5}, {'a': 2, 'b': 4},
82
+ {'a': 1, 'b': 6}, {'a': 1, 'b': 5}, {'a': 1, 'b': 4}]
83
+
84
+ >>> problem.addConstraint("a*2 == b") # string constraints are preferable over the black-box problem.addConstraint(lambda a, b: a*2 == b, ("a", "b"))
85
+ >>> problem.getSolutions()
86
+ [{'a': 3, 'b': 6}, {'a': 2, 'b': 4}]
87
+
88
+ >>> problem = Problem()
89
+ >>> problem.addVariables(["a", "b"], [1, 2, 3])
90
+ >>> problem.addConstraint(AllDifferentConstraint())
91
+ >>> problem.getSolutions() # doctest: +NORMALIZE_WHITESPACE
92
+ [{'a': 3, 'b': 2}, {'a': 3, 'b': 1}, {'a': 2, 'b': 3},
93
+ {'a': 2, 'b': 1}, {'a': 1, 'b': 2}, {'a': 1, 'b': 3}]
94
+
95
+ Rooks problem
96
+ ~~~~~~~~~~~~~
97
+
98
+ The following example solves the classical Eight Rooks problem:
99
+
100
+ .. code-block:: python
101
+
102
+ >>> problem = Problem()
103
+ >>> numpieces = 8
104
+ >>> cols = range(numpieces)
105
+ >>> rows = range(numpieces)
106
+ >>> problem.addVariables(cols, rows)
107
+ >>> for col1 in cols:
108
+ ... for col2 in cols:
109
+ ... if col1 < col2:
110
+ ... problem.addConstraint(lambda row1, row2: row1 != row2, (col1, col2))
111
+ >>> solutions = problem.getSolutions()
112
+ >>> solutions # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
113
+ [{0: 7, 1: 6, 2: 5, 3: 4, 4: 3, 5: 2, 6: 1, 7: 0},
114
+ {0: 7, 1: 6, 2: 5, 3: 4, 4: 3, 5: 2, 6: 0, 7: 1},
115
+ {0: 7, 1: 6, 2: 5, 3: 4, 4: 3, 5: 1, 6: 2, 7: 0},
116
+ {0: 7, 1: 6, 2: 5, 3: 4, 4: 3, 5: 1, 6: 0, 7: 2},
117
+ ...
118
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 2, 5: 1, 6: 4, 7: 0},
119
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 1, 5: 2, 6: 0, 7: 4},
120
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 1, 5: 2, 6: 4, 7: 0},
121
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 1, 5: 4, 6: 2, 7: 0},
122
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 1, 5: 4, 6: 0, 7: 2},
123
+ ...]
124
+
125
+
126
+ Magic squares
127
+ ~~~~~~~~~~~~~
128
+
129
+ This example solves a 4x4 magic square:
130
+
131
+ .. code-block:: python
132
+
133
+ >>> problem = Problem()
134
+ >>> problem.addVariables(range(0, 16), range(1, 16 + 1))
135
+ >>> problem.addConstraint(AllDifferentConstraint(), range(0, 16))
136
+ >>> problem.addConstraint(ExactSumConstraint(34), [0, 5, 10, 15])
137
+ >>> problem.addConstraint(ExactSumConstraint(34), [3, 6, 9, 12])
138
+ >>> for row in range(4):
139
+ ... problem.addConstraint(ExactSumConstraint(34), [row * 4 + i for i in range(4)])
140
+ >>> for col in range(4):
141
+ ... problem.addConstraint(ExactSumConstraint(34), [col + 4 * i for i in range(4)])
142
+ >>> solutions = problem.getSolutions() # doctest: +SKIP
143
+
144
+ Features
145
+ --------
146
+
147
+ The following solvers are available:
148
+
149
+ - :code:`OptimizedBacktrackingSolver` (default)
150
+ - :code:`BacktrackingSolver`
151
+ - :code:`RecursiveBacktrackingSolver`
152
+ - :code:`MinConflictsSolver`
153
+ - :code:`ParallelSolver`
154
+
155
+ .. role:: python(code)
156
+ :language: python
157
+
158
+ Predefined constraint types currently available (use the parsing for automatic conversion to these types):
159
+
160
+ - :code:`FunctionConstraint`
161
+ - :code:`AllDifferentConstraint`
162
+ - :code:`AllEqualConstraint`
163
+ - :code:`ExactSumConstraint`
164
+ - :code:`MinSumConstraint`
165
+ - :code:`MaxSumConstraint`
166
+ - :code:`MinProdConstraint`
167
+ - :code:`ExactProdConstraint`
168
+ - :code:`MaxProdConstraint`
169
+ - :code:`VariableExactSumConstraint`
170
+ - :code:`VariableMinSumConstraint`
171
+ - :code:`VariableMaxSumConstraint`
172
+ - :code:`VariableMinProdConstraint`
173
+ - :code:`VariableExactProdConstraint`
174
+ - :code:`VariableMaxProdConstraint`
175
+ - :code:`InSetConstraint`
176
+ - :code:`NotInSetConstraint`
177
+ - :code:`SomeInSetConstraint`
178
+ - :code:`SomeNotInSetConstraint`
179
+
180
+ API documentation
181
+ -----------------
182
+ Documentation for the module is available at: http://python-constraint.github.io/python-constraint/.
183
+ It can be built locally by running :code:`make clean html` from the `docs` folder.
184
+ For viewing RST files locally, `restview <https://pypi.org/project/restview/>`_ is recommended.
185
+
186
+ Download and install
187
+ --------------------
188
+
189
+ .. code-block:: shell
190
+
191
+ $ pip install python-constraint2
192
+
193
+ Testing
194
+ -------
195
+
196
+ Run :code:`nox` (tests for all supported Python versions in own virtual environment).
197
+
198
+ To test against your local Python version: make sure you have the development dependencies installed.
199
+ Run :code:`pytest` (optionally add :code:`--no-cov` if you have the C-extensions enabled).
200
+
201
+ Contributing
202
+ ------------
203
+
204
+ Feel free to contribute by `submitting pull requests <https://github.com/python-constraint/python-constraint/pulls>`_ or `opening issues <https://github.com/python-constraint/python-constraint/issues>`_.
205
+ Please refer to the `contribution guidelines <https://github.com/python-constraint/python-constraint/contribute>`_ before doing so.
206
+
207
+ Roadmap
208
+ -------
209
+
210
+ This GitHub organization and repository is a global effort to help to maintain :code:`python-constraint`, which was written by Gustavo Niemeyer and originaly located at https://labix.org/python-constraint.
211
+ For an overview of recent changes, visit the `Changelog <https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md>`_.
212
+
213
+ Planned development:
214
+
215
+ - Support constant modifiers on parsed (variable) constraints instead defaulting to `FunctionConstraint`, e.g. :code:`problem.addConstraint("a+2 == b")` or :code:`problem.addConstraint("x / y == 100")`
216
+ - Parse using Abstract Syntax Trees (AST) instead of the current parser to be more robust and support decomposing lambdas
217
+ - Rewrite hotspots in C / Pyx instead of pure python mode
218
+ - Improvements to make the ParallelSolver competitive (experiments reveal the freethreading mode to be promising)
219
+ - Versioned documentation
220
+
221
+ Contact
222
+ -------
223
+ - `Floris-Jan Willemsen <https://github.com/fjwillemsen>`_ <fjwillemsen97@gmail.com> (current maintainer)
224
+ - `Sébastien Celles <https://github.com/s-celles/>`_ <s.celles@gmail.com> (former maintainer)
225
+ - `Gustavo Niemeyer <https://github.com/niemeyer/>`_ <gustavo@niemeyer.net> (initial developer)
226
+
227
+ But it's probably better to `open an issue <https://github.com/python-constraint/python-constraint/issues>`_.
228
+
229
+ .. |License| image:: https://img.shields.io/pypi/l/python-constraint2
230
+ :alt: PyPI - License
231
+
232
+ .. |Build Status| image:: https://github.com/python-constraint/python-constraint/actions/workflows/build-test-python-package.yml/badge.svg
233
+ :target: https://github.com/python-constraint/python-constraint/actions/workflows/build-test-python-package.yml
234
+ :alt: Build Status
235
+
236
+ .. |Docs| image:: https://img.shields.io/github/actions/workflow/status/python-constraint/python-constraint/publish-documentation.yml?label=Docs
237
+ :target: http://python-constraint.github.io/python-constraint/
238
+ :alt: Documentation Status
239
+
240
+ .. |Python Versions| image:: https://img.shields.io/pypi/pyversions/python-constraint2
241
+ :alt: PyPI - Python Versions
242
+
243
+ .. |Downloads| image:: https://img.shields.io/pypi/dm/python-constraint2
244
+ :alt: PyPI - Downloads
245
+
246
+ .. |Status| image:: https://img.shields.io/pypi/status/python-constraint2
247
+ :alt: PyPI - Status
248
+
249
+ .. |Code Coverage| image:: https://coveralls.io/repos/github/python-constraint/python-constraint/badge.svg
250
+ :target: https://coveralls.io/github/python-constraint/python-constraint
251
+ :alt: Code Coverage
252
+
@@ -0,0 +1,15 @@
1
+ constraint/__init__.py,sha256=uNFtPbuCvaG6nPmBeoNioPaBJq-pqWHJrVfYTvfdxOM,1891
2
+ constraint/constraints.c,sha256=jdZxj2aU8RsV_r85QWlDi0JF1eQ9NJEtfNJuaifkFuQ,2750861
3
+ constraint/constraints.py,sha256=3HWvd9Y9okKssqIQzdH1NmcttQtMf0tXDN_KwM6tFkI,69126
4
+ constraint/domain.c,sha256=aBrDsI7J_KgGdGF22cUfBgy6llm7KvO45eHHhJDyp4o,409666
5
+ constraint/domain.py,sha256=XLzl619prCdB8vxSLAVQWQiFwEV2qRzyLqUJLqxmWrk,3031
6
+ constraint/parser.c,sha256=qMEXyGJchXMaY08QFlBV407OYn7bW3OKYrGHtr2HxVY,1142466
7
+ constraint/parser.py,sha256=V4_3E1Lf1bPsM_MPVWz3Xh1p8gC9Cyhb74_bkQurm9Q,23449
8
+ constraint/problem.c,sha256=7UlU33afTdT76KUcd7S5xi_El_oSPX7qxPL1A1DKRr8,836612
9
+ constraint/problem.py,sha256=1sssjbHMxQIp3W50ugrHPF-PsORftT5iRZVoLol2P4E,13084
10
+ constraint/solvers.c,sha256=imymYyqqO9bBNSl5rYO2DNV0uLuaxME7Dkz8MEOdgT8,1418730
11
+ constraint/solvers.py,sha256=RhLDf7HGnoeIfk9VdPAdw3urTr1q0ydhwhj-oDyE9BY,32611
12
+ python_constraint2-2.5.0.dist-info/licenses/LICENSE,sha256=-29wB_JJKS4anSogQEG0yZqx5lPZc2m8iPJhKL-p45A,1358
13
+ python_constraint2-2.5.0.dist-info/METADATA,sha256=fHHH0JuWxAn7kEKHJm4r4Tc8g8_s607pyYZkbBwNjkQ,10899
14
+ python_constraint2-2.5.0.dist-info/WHEEL,sha256=KtiXZIbDpchqCg5EjaAIOYch_G9byZ9QKGs_z0sh46A,98
15
+ python_constraint2-2.5.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.2.1
3
+ Root-Is-Purelib: false
4
+ Tag: cp314-cp314-win_amd64
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2005-2014 - Gustavo Niemeyer <gustavo@niemeyer.net>
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation
12
+ and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.