python-constraint2 2.7.0__cp313-cp313-win_arm64.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,267 @@
1
+ Metadata-Version: 2.4
2
+ Name: python-constraint2
3
+ Version: 2.7.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.11
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.11
24
+ Classifier: Programming Language :: Python :: 3.12
25
+ Classifier: Programming Language :: Python :: 3.13
26
+ Classifier: Programming Language :: Python :: 3.14
27
+ Project-URL: Changelog, https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md
28
+ Project-URL: Documentation, http://python-constraint.github.io/python-constraint/
29
+ Project-URL: Homepage, http://python-constraint.github.io/python-constraint/
30
+ Project-URL: Issues, https://github.com/python-constraint/python-constraint/issues
31
+ Project-URL: Repository, https://github.com/python-constraint/python-constraint
32
+ Description-Content-Type: text/x-rst
33
+
34
+ |CondaDownloads| |Downloads|
35
+ |Python Versions|
36
+ |License| |Build Status| |Status| |Docs| |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
+ | ⚠️ IMPORTANT: this software must be installed with ``pip install python-constraint2``, as the original pip release will not be updated.
46
+ | A `Conda Forge <https://anaconda.org/channels/conda-forge/packages/python-constraint2/overview>`_ / `Mamba <https://github.com/conda-forge/python-constraint2-feedstock>`_ version is also available: ``conda install python-constraint2``.
47
+ |
48
+
49
+ | For an overview of recent changes, visit the `Changelog <https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md>`_.
50
+ | The complete documentation can be found `here <http://python-constraint.github.io/python-constraint/>`_.
51
+ |
52
+
53
+ | New: writing constraints in the new string format is preferable over functions and lambdas.
54
+ | 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.
55
+ | For example, :code:`problem.addConstraint(["50 <= x * y < 100"])` is parsed to :code:`[MinProdConstraint(50, ["x", "y"]), MaxProdConstraint(100, ["x", "y"])]`.
56
+ | Similarly, :code:`problem.addConstraint(["x / y == z"])` is parsed to :code:`[ExactProdConstraint("x", ["z", "y"])]`.
57
+ | This feature is in beta and subject to possible change, please provide feedback.
58
+
59
+ .. contents::
60
+ :local:
61
+ :depth: 1
62
+
63
+ Introduction
64
+ ------------
65
+ 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.
66
+ 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, ...).
67
+
68
+ Examples
69
+ --------
70
+
71
+ Basics
72
+ ~~~~~~
73
+
74
+ This interactive Python session demonstrates basic operations:
75
+
76
+ .. code-block:: python
77
+
78
+ >>> from constraint import *
79
+ >>> problem = Problem()
80
+ >>> problem.addVariable("a", [1,2,3])
81
+ >>> problem.addVariable("b", [4,5,6])
82
+ >>> problem.getSolutions() # doctest: +NORMALIZE_WHITESPACE
83
+ [{'a': 3, 'b': 6}, {'a': 3, 'b': 5}, {'a': 3, 'b': 4},
84
+ {'a': 2, 'b': 6}, {'a': 2, 'b': 5}, {'a': 2, 'b': 4},
85
+ {'a': 1, 'b': 6}, {'a': 1, 'b': 5}, {'a': 1, 'b': 4}]
86
+
87
+ >>> problem.addConstraint("a*2 == b") # string constraints are preferable over the black-box problem.addConstraint(lambda a, b: a*2 == b, ("a", "b"))
88
+ >>> problem.getSolutions()
89
+ [{'a': 3, 'b': 6}, {'a': 2, 'b': 4}]
90
+
91
+ >>> problem = Problem()
92
+ >>> problem.addVariables(["a", "b"], [1, 2, 3])
93
+ >>> problem.addConstraint(AllDifferentConstraint())
94
+ >>> problem.getSolutions() # doctest: +NORMALIZE_WHITESPACE
95
+ [{'a': 3, 'b': 2}, {'a': 3, 'b': 1}, {'a': 2, 'b': 3},
96
+ {'a': 2, 'b': 1}, {'a': 1, 'b': 2}, {'a': 1, 'b': 3}]
97
+
98
+ Rooks problem
99
+ ~~~~~~~~~~~~~
100
+
101
+ The following example solves the classical Eight Rooks problem:
102
+
103
+ .. code-block:: python
104
+
105
+ >>> problem = Problem()
106
+ >>> numpieces = 8
107
+ >>> cols = range(numpieces)
108
+ >>> rows = range(numpieces)
109
+ >>> problem.addVariables(cols, rows)
110
+ >>> for col1 in cols:
111
+ ... for col2 in cols:
112
+ ... if col1 < col2:
113
+ ... problem.addConstraint(lambda row1, row2: row1 != row2, (col1, col2))
114
+ >>> solutions = problem.getSolutions()
115
+ >>> solutions # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
116
+ [{0: 7, 1: 6, 2: 5, 3: 4, 4: 3, 5: 2, 6: 1, 7: 0},
117
+ {0: 7, 1: 6, 2: 5, 3: 4, 4: 3, 5: 2, 6: 0, 7: 1},
118
+ {0: 7, 1: 6, 2: 5, 3: 4, 4: 3, 5: 1, 6: 2, 7: 0},
119
+ {0: 7, 1: 6, 2: 5, 3: 4, 4: 3, 5: 1, 6: 0, 7: 2},
120
+ ...
121
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 2, 5: 1, 6: 4, 7: 0},
122
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 1, 5: 2, 6: 0, 7: 4},
123
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 1, 5: 2, 6: 4, 7: 0},
124
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 1, 5: 4, 6: 2, 7: 0},
125
+ {0: 7, 1: 5, 2: 3, 3: 6, 4: 1, 5: 4, 6: 0, 7: 2},
126
+ ...]
127
+
128
+
129
+ Magic squares
130
+ ~~~~~~~~~~~~~
131
+
132
+ This example solves a 4x4 magic square:
133
+
134
+ .. code-block:: python
135
+
136
+ >>> problem = Problem()
137
+ >>> problem.addVariables(range(0, 16), range(1, 16 + 1))
138
+ >>> problem.addConstraint(AllDifferentConstraint(), range(0, 16))
139
+ >>> problem.addConstraint(ExactSumConstraint(34), [0, 5, 10, 15])
140
+ >>> problem.addConstraint(ExactSumConstraint(34), [3, 6, 9, 12])
141
+ >>> for row in range(4):
142
+ ... problem.addConstraint(ExactSumConstraint(34), [row * 4 + i for i in range(4)])
143
+ >>> for col in range(4):
144
+ ... problem.addConstraint(ExactSumConstraint(34), [col + 4 * i for i in range(4)])
145
+ >>> solutions = problem.getSolutions() # doctest: +SKIP
146
+
147
+ Features
148
+ --------
149
+
150
+ The following solvers are available:
151
+
152
+ - :code:`OptimizedBacktrackingSolver` (default)
153
+ - :code:`BacktrackingSolver`
154
+ - :code:`RecursiveBacktrackingSolver`
155
+ - :code:`MinConflictsSolver`
156
+ - :code:`ParallelSolver`
157
+
158
+ .. role:: python(code)
159
+ :language: python
160
+
161
+ Predefined constraint types currently available (use the parsing for automatic conversion to these types):
162
+
163
+ - :code:`FunctionConstraint`
164
+ - :code:`AllDifferentConstraint`
165
+ - :code:`AllEqualConstraint`
166
+ - :code:`ExactSumConstraint`
167
+ - :code:`MinSumConstraint`
168
+ - :code:`MaxSumConstraint`
169
+ - :code:`MinProdConstraint`
170
+ - :code:`ExactProdConstraint`
171
+ - :code:`MaxProdConstraint`
172
+ - :code:`VariableExactSumConstraint`
173
+ - :code:`VariableMinSumConstraint`
174
+ - :code:`VariableMaxSumConstraint`
175
+ - :code:`VariableMinProdConstraint`
176
+ - :code:`VariableExactProdConstraint`
177
+ - :code:`VariableMaxProdConstraint`
178
+ - :code:`InSetConstraint`
179
+ - :code:`NotInSetConstraint`
180
+ - :code:`SomeInSetConstraint`
181
+ - :code:`SomeNotInSetConstraint`
182
+
183
+ API documentation
184
+ -----------------
185
+ Documentation for the module is available at: http://python-constraint.github.io/python-constraint/.
186
+ It can be built locally by running :code:`make clean html` from the `docs` folder.
187
+ For viewing RST files locally, `restview <https://pypi.org/project/restview/>`_ is recommended.
188
+
189
+ Download and install
190
+ --------------------
191
+
192
+ .. code-block:: shell
193
+
194
+ $ pip install python-constraint2
195
+
196
+ Conda / Mamba:
197
+
198
+ .. code-block:: shell
199
+
200
+ $ conda config --add channels conda-forge
201
+ $ conda config --set channel_priority strict
202
+ $ conda install python-constraint2
203
+ $ mamba install python-constraint2
204
+
205
+ Testing
206
+ -------
207
+
208
+ Run :code:`nox` (tests for all supported Python versions in own virtual environment).
209
+
210
+ To test against your local Python version: make sure you have the development dependencies installed.
211
+ Run :code:`pytest` (optionally add :code:`--no-cov` if you have the C-extensions enabled).
212
+
213
+ Contributing
214
+ ------------
215
+
216
+ 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>`_.
217
+ Please refer to the `contribution guidelines <https://github.com/python-constraint/python-constraint/contribute>`_ before doing so.
218
+
219
+ Roadmap
220
+ -------
221
+
222
+ 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.
223
+ For an overview of recent changes, visit the `Changelog <https://github.com/python-constraint/python-constraint/blob/main/CHANGELOG.md>`_.
224
+
225
+ Planned development:
226
+
227
+ - 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")`
228
+ - Parse using Abstract Syntax Trees (AST) instead of the current parser to be more robust and support decomposing lambdas
229
+ - Rewrite hotspots in C / Pyx instead of pure python mode
230
+ - Improvements to make the ParallelSolver competitive (experiments reveal the freethreading mode to be promising)
231
+ - Versioned documentation
232
+
233
+ Contact
234
+ -------
235
+ - `Floris-Jan Willemsen <https://github.com/fjwillemsen>`_ <fjwillemsen97@gmail.com> (current maintainer)
236
+ - `Sébastien Celles <https://github.com/s-celles/>`_ <s.celles@gmail.com> (former maintainer)
237
+ - `Gustavo Niemeyer <https://github.com/niemeyer/>`_ <gustavo@niemeyer.net> (initial developer)
238
+
239
+ But it's probably better to `open an issue <https://github.com/python-constraint/python-constraint/issues>`_.
240
+
241
+ .. |License| image:: https://img.shields.io/pypi/l/python-constraint2
242
+ :alt: PyPI - License
243
+
244
+ .. |Build Status| image:: https://github.com/python-constraint/python-constraint/actions/workflows/build-test-python-package.yml/badge.svg
245
+ :target: https://github.com/python-constraint/python-constraint/actions/workflows/build-test-python-package.yml
246
+ :alt: Build Status
247
+
248
+ .. |Docs| image:: https://img.shields.io/github/actions/workflow/status/python-constraint/python-constraint/publish-documentation.yml?label=Docs
249
+ :target: http://python-constraint.github.io/python-constraint/
250
+ :alt: Documentation Status
251
+
252
+ .. |Python Versions| image:: https://img.shields.io/pypi/pyversions/python-constraint2
253
+ :alt: PyPI - Python Versions
254
+
255
+ .. |Downloads| image:: https://img.shields.io/pypi/dm/python-constraint2
256
+ :alt: PyPI - Downloads
257
+
258
+ .. |CondaDownloads| image:: https://img.shields.io/conda/d/conda-forge/python-constraint2.svg
259
+ :alt: Conda - Downloads
260
+
261
+ .. |Status| image:: https://img.shields.io/pypi/status/python-constraint2
262
+ :alt: PyPI - Status
263
+
264
+ .. |Code Coverage| image:: https://coveralls.io/repos/github/python-constraint/python-constraint/badge.svg
265
+ :target: https://coveralls.io/github/python-constraint/python-constraint
266
+ :alt: Code Coverage
267
+
@@ -0,0 +1,15 @@
1
+ constraint/__init__.py,sha256=uNFtPbuCvaG6nPmBeoNioPaBJq-pqWHJrVfYTvfdxOM,1891
2
+ constraint/constraints.c,sha256=wiN4ayejXZwh8wI5q6QvQI7zr7IWCwPDM9wviencA0w,2743058
3
+ constraint/constraints.py,sha256=LULAm9ar0T4Zjga9Oi2FiRXCc8FMi_j3-Xl6MywH5r4,69104
4
+ constraint/domain.c,sha256=J3TnlnMNUjsLPYiQYBBZGoxexOkJcgpVSqTmrtz4fa8,413397
5
+ constraint/domain.py,sha256=XLzl619prCdB8vxSLAVQWQiFwEV2qRzyLqUJLqxmWrk,3031
6
+ constraint/parser.c,sha256=0_3XmKAKg3ZMStLQduSTCZNZw68DpppEagjjePTxThg,1140771
7
+ constraint/parser.py,sha256=PMi5bBtYRXJNSHNBILUsP0afkNQmkSUdYHom8dQzY3Q,23196
8
+ constraint/problem.c,sha256=-DkPl8M7MMB5H-lsNL0Tl0m_Bib04UCbjrjzn53lEFU,832640
9
+ constraint/problem.py,sha256=kOdms-5A71EAqlyn0u1_KMvd-8tM3rbZ4UE5arkVGZM,13040
10
+ constraint/solvers.c,sha256=M6Wu_6rsnbsiyYnGGoXLCu5zrsCnWzMU6mYqDrY8Phc,1415514
11
+ constraint/solvers.py,sha256=RhLDf7HGnoeIfk9VdPAdw3urTr1q0ydhwhj-oDyE9BY,32611
12
+ python_constraint2-2.7.0.dist-info/licenses/LICENSE,sha256=-29wB_JJKS4anSogQEG0yZqx5lPZc2m8iPJhKL-p45A,1358
13
+ python_constraint2-2.7.0.dist-info/METADATA,sha256=Njgjb1XbFzxIvjC8t3UKSswJRZUaiURScpimuO9xoIM,11334
14
+ python_constraint2-2.7.0.dist-info/WHEEL,sha256=YpTLT_oG6otzoFFmONuOBhqV43QuuCkVcFMH_7yndT8,98
15
+ python_constraint2-2.7.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 2.4.1
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-win_arm64
@@ -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.