pycsp3-scheduling 0.2.1__py3-none-any.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,234 @@
1
+ Metadata-Version: 2.4
2
+ Name: pycsp3-scheduling
3
+ Version: 0.2.1
4
+ Summary: Scheduling extension for PyCSP3 with interval variables, sequence variables, and scheduling constraints
5
+ Project-URL: Homepage, https://github.com/sohaibafifi/pycsp3-scheduling
6
+ Project-URL: Repository, https://github.com/sohaibafifi/pycsp3-scheduling
7
+ Project-URL: Issues, https://github.com/sohaibafifi/pycsp3-scheduling/issues
8
+ Author-email: Sohaib AFIFI <sohaib.lafifi@univ-artois.fr>
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: constraint-programming,interval-variables,job-shop,optimization,pycsp3,rcpsp,scheduling,xcsp3
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: lxml>=4.9
25
+ Requires-Dist: matplotlib>=3.7
26
+ Requires-Dist: pycsp3>=2.5
27
+ Provides-Extra: dev
28
+ Requires-Dist: mypy>=1.0; extra == 'dev'
29
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
30
+ Requires-Dist: pytest>=7.0; extra == 'dev'
31
+ Requires-Dist: ruff>=0.1; extra == 'dev'
32
+ Provides-Extra: docs
33
+ Requires-Dist: sphinx-rtd-theme>=1.0; extra == 'docs'
34
+ Requires-Dist: sphinx>=6.0; extra == 'docs'
35
+ Description-Content-Type: text/markdown
36
+
37
+ # pycsp3-scheduling
38
+
39
+ Scheduling extension for [pycsp3](https://pycsp.org) with interval variables, sequence variables, and scheduling constraints.
40
+
41
+ ## Features
42
+
43
+ - **Interval Variables**: Represent tasks/activities with start, end, size, length, and optional presence
44
+ - **Intensity Functions**: Stepwise intensity metadata with granularity scaling for size/length
45
+ - **Sequence Variables**: Ordered sequences of intervals on disjunctive resources
46
+ - **Precedence Constraints**: `end_before_start`, `start_at_start`, etc.
47
+ - **Grouping Constraints**: `span`, `alternative`, `synchronize`
48
+ - **Cumulative Functions**: `pulse`, `step_at_start`, `step_at_end` for resource modeling
49
+ - **State Functions**: Model resource states with transitions
50
+ - **XCSP3 Extension**: Output scheduling models in extended XCSP3 format
51
+ - **Visualization**: Gantt charts and resource profiles
52
+
53
+ ## Installation
54
+
55
+ ```bash
56
+ pip install pycsp3-scheduling
57
+ ```
58
+
59
+ For development:
60
+
61
+ ```bash
62
+ git clone https://github.com/sohaibafifi/pycsp3-scheduling.git
63
+ cd pycsp3-scheduling
64
+ pip install -e ".[dev]"
65
+ ```
66
+
67
+ ## Quick Start
68
+
69
+ ```python
70
+ from pycsp3 import *
71
+ from pycsp3_scheduling import *
72
+
73
+ # Create interval variables for tasks
74
+ task1 = IntervalVar(size=10, name="task1")
75
+ task2 = IntervalVar(size=15, name="task2")
76
+ task3 = IntervalVar(size=8, name="task3")
77
+
78
+ # Precedence: task1 must finish before task2 starts
79
+ satisfy(end_before_start(task1, task2))
80
+
81
+ # No overlap: task2 and task3 cannot overlap
82
+ satisfy(SeqNoOverlap([task2, task3]))
83
+
84
+ # Minimize makespan
85
+ minimize(max(end_time(task1), end_time(task2), end_time(task3)))
86
+ ```
87
+
88
+ ## Example: Job Shop Scheduling
89
+
90
+ ```python
91
+ from pycsp3 import *
92
+ from pycsp3_scheduling import *
93
+
94
+ # Data
95
+ n_jobs, n_machines = 3, 3
96
+ durations = [[3, 2, 2], [2, 1, 4], [4, 3, 3]]
97
+ machines = [[0, 1, 2], [0, 2, 1], [1, 0, 2]]
98
+
99
+ # Create interval variables for each operation
100
+ ops = [[IntervalVar(size=durations[j][o], name=f"op_{j}_{o}")
101
+ for o in range(n_machines)] for j in range(n_jobs)]
102
+
103
+ # Sequences for each machine
104
+ sequences = [SequenceVar(
105
+ intervals=[ops[j][o] for j in range(n_jobs)
106
+ for o in range(n_machines) if machines[j][o] == m],
107
+ name=f"machine_{m}"
108
+ ) for m in range(n_machines)]
109
+
110
+ # Precedence within jobs
111
+ satisfy(
112
+ end_before_start(ops[j][o], ops[j][o+1])
113
+ for j in range(n_jobs) for o in range(n_machines-1)
114
+ )
115
+
116
+ # No overlap on machines
117
+ satisfy(SeqNoOverlap(seq) for seq in sequences)
118
+
119
+ # Minimize makespan
120
+ minimize(Maximum(end_time(ops[j][-1]) for j in range(n_jobs)))
121
+ ```
122
+
123
+ ## Example: RCPSP (Resource-Constrained Project Scheduling)
124
+
125
+ ```python
126
+ from pycsp3 import *
127
+ from pycsp3_scheduling import *
128
+
129
+ # Data
130
+ durations = [3, 2, 5, 4, 2]
131
+ demands = [[2, 1], [1, 2], [3, 0], [2, 1], [1, 3]]
132
+ capacities = [4, 3]
133
+ precedences = [(0, 2), (1, 3), (2, 4)]
134
+
135
+ # Interval variables
136
+ tasks = [IntervalVar(size=durations[i], name=f"task_{i}")
137
+ for i in range(len(durations))]
138
+
139
+ # Precedence constraints
140
+ satisfy(end_before_start(tasks[p], tasks[s]) for p, s in precedences)
141
+
142
+ # Cumulative resource constraints
143
+ for r in range(len(capacities)):
144
+ resource = sum(pulse(tasks[i], demands[i][r])
145
+ for i in range(len(tasks)) if demands[i][r] > 0)
146
+ satisfy(resource <= capacities[r])
147
+
148
+ # Minimize makespan
149
+ minimize(Maximum(end_time(t) for t in tasks))
150
+ ```
151
+
152
+ ## API Reference
153
+
154
+ ### Variables
155
+
156
+ | Function | Description |
157
+ |----------|-------------|
158
+ | `IntervalVar(size, start, end, length, intensity, granularity, optional, name)` | Create an interval variable |
159
+ | `IntervalVarArray(size, ...)` | Create array of interval variables |
160
+ | `SequenceVar(intervals, types, name)` | Create a sequence variable |
161
+
162
+ ### Expressions
163
+
164
+ | Function | Description |
165
+ |----------|-------------|
166
+ | `start_of(interval, absent_value=0)` | Start time of interval |
167
+ | `end_of(interval, absent_value=0)` | End time of interval |
168
+ | `size_of(interval, absent_value=0)` | Size/duration of interval |
169
+ | `length_of(interval, absent_value=0)` | Length of interval |
170
+ | `presence_of(interval)` | Boolean presence status |
171
+
172
+ ### Interop Helpers
173
+
174
+ | Function | Description |
175
+ |----------|-------------|
176
+ | `start_time(interval)` | pycsp3 variable for start time |
177
+ | `end_time(interval)` | pycsp3 expression for end time |
178
+
179
+ ### Precedence Constraints
180
+
181
+ | Constraint | Semantics (when both present) |
182
+ |------------|------------------------------|
183
+ | `start_before_start(a, b, delay)` | `start(b) >= start(a) + delay` |
184
+ | `start_before_end(a, b, delay)` | `end(b) >= start(a) + delay` |
185
+ | `end_before_start(a, b, delay)` | `start(b) >= end(a) + delay` |
186
+ | `end_before_end(a, b, delay)` | `end(b) >= end(a) + delay` |
187
+ | `start_at_start(a, b, delay)` | `start(b) == start(a) + delay` |
188
+ | `start_at_end(a, b, delay)` | `start(b) == end(a) + delay` |
189
+ | `end_at_start(a, b, delay)` | `end(a) == start(b) + delay` |
190
+ | `end_at_end(a, b, delay)` | `end(b) == end(a) + delay` |
191
+
192
+ ### Grouping Constraints
193
+
194
+ | Constraint | Description |
195
+ |------------|-------------|
196
+ | `span(main, subtasks)` | Main interval spans all present subtasks |
197
+ | `alternative(main, alts, card=1)` | Select `card` alternatives matching main |
198
+ | `synchronize(main, intervals)` | All present intervals sync with main |
199
+
200
+ ### Cumulative Functions
201
+
202
+ | Function | Description |
203
+ |----------|-------------|
204
+ | `pulse(interval, height)` | Constant consumption during interval |
205
+ | `step_at(time, height)` | Step at fixed time point |
206
+ | `step_at_start(interval, height)` | Step at interval start |
207
+ | `step_at_end(interval, height)` | Step at interval end |
208
+ | `cumul_range(cumul, min, max)` | Constrain cumul to [min, max] |
209
+
210
+ ### State Functions
211
+
212
+ | Function | Description |
213
+ |----------|-------------|
214
+ | `StateFunction(transition_matrix)` | Create state function |
215
+ | `always_in(func, interval, min, max)` | State in range during interval |
216
+ | `always_equal(func, interval, value)` | State equals value during interval |
217
+ | `always_constant(func, interval)` | State constant during interval |
218
+
219
+ ## Requirements
220
+
221
+ - Python >= 3.10
222
+ - pycsp3 >= 2.5
223
+ - lxml >= 4.9
224
+ - matplotlib >= 3.7 (optional, for visualization)
225
+ - java >= 8 (optional, for solving with ACE/Choco)
226
+
227
+ ## License
228
+
229
+ MIT License - see [LICENSE](LICENSE) file.
230
+
231
+ ## References
232
+
233
+ - [PyCSP3 Documentation](https://pycsp.org)
234
+ - [XCSP3 Specification](https://xcsp.org/specifications/)
@@ -0,0 +1,26 @@
1
+ pycsp3_scheduling/__init__.py,sha256=pY6d0BYJ5Xvw7f3MEgg1GLnN51POPZHe_van6Q_lU2M,4645
2
+ pycsp3_scheduling/interop.py,sha256=q8G7olLg692Z9XSFp6C9IbeCwv5pdlUo-DTP97ONAFw,11840
3
+ pycsp3_scheduling/visu.py,sha256=m2IxL-A9jcDxhYT0uYWrBe3HWiZkL4S7ZdjUQb1_auM,39170
4
+ pycsp3_scheduling/constraints/__init__.py,sha256=BYn3OJDygxx1YwrxwLCcICNPdbpUCyFyQJc7RuDvQDA,2106
5
+ pycsp3_scheduling/constraints/_pycsp3.py,sha256=ZvQ7cTljzhuVGnTTTCWbFmdZQVH_S88GYWrVRWsRY4I,23584
6
+ pycsp3_scheduling/constraints/cumulative.py,sha256=dJ9ORKa8mKXpoGQN_lo8eAqJ_7pCYLAQFfbCpEoMYrc,7523
7
+ pycsp3_scheduling/constraints/grouping.py,sha256=Wbh_cKTlHcJN2aCuSp5zgwR-xO2TEbS_5dqFnr1brE8,14645
8
+ pycsp3_scheduling/constraints/precedence.py,sha256=Nd5XbEjYuEN8O-1wI1G5-sYE5CcBLuK6cNOl9kTkEwI,12167
9
+ pycsp3_scheduling/constraints/sequence.py,sha256=IS893C4nknYXrjScRzgcFcX1kGNBuDIBiO-7SbEbnSA,31883
10
+ pycsp3_scheduling/expressions/__init__.py,sha256=HBwOkiyx3huPrbbor3bBZE88wcFV1FUlkJEQD6M2DuA,1691
11
+ pycsp3_scheduling/expressions/element.py,sha256=5SC1VAWJZq3BpaOW-I63gv0JkqdhrZWqOSq4ngrS5U0,10873
12
+ pycsp3_scheduling/expressions/interval_expr.py,sha256=SVRoct3-i9DBizx5LdFDPbVKQEatz901_iDkp7_SFFg,15982
13
+ pycsp3_scheduling/expressions/sequence_expr.py,sha256=8K4aKwd0LmB6zvudlRjnSjJBifFKR5MIJEzSXgl5lhc,28172
14
+ pycsp3_scheduling/functions/__init__.py,sha256=E4SKqRh4PKZqkbn6KoLzxwALBE5azgEXII0GgWkS34Y,3029
15
+ pycsp3_scheduling/functions/cumul_functions.py,sha256=7qgkR65eXOAOQxrIjgVWjFHQtPqCieugD0jNVl8K2G8,32100
16
+ pycsp3_scheduling/functions/state_functions.py,sha256=1lDELvuF-FH6MlL5A-q71__RXj7CFevM0AXjLnEqJcY,17086
17
+ pycsp3_scheduling/output/__init__.py,sha256=F7JbwGeEEhSvSCACVUgYaLxhf8uRaP4YpUD6g_5v4Ww,283
18
+ pycsp3_scheduling/solvers/__init__.py,sha256=pVe3yy05OurQnfOD9KrdFWQEBp6mpfJFTW2fuBUScPk,325
19
+ pycsp3_scheduling/solvers/adapters/__init__.py,sha256=AZ6vFqq6acQ0zOGuyS5cyoXpKoKuHDepkdxs0BjoTqM,95
20
+ pycsp3_scheduling/variables/__init__.py,sha256=A6lCnArwiY9r8n2setrwFKUan-NkWM6wXQSvMzVG8fc,1046
21
+ pycsp3_scheduling/variables/interval.py,sha256=2V1spB2VXUUscxYnzYffY0-FDoME2YxpVqDZ6C0EFcQ,16454
22
+ pycsp3_scheduling/variables/sequence.py,sha256=0vgptgt1QFBa1BiQEaYvKTEcj2UIm0A7pNRVGHyY-a8,8352
23
+ pycsp3_scheduling-0.2.1.dist-info/METADATA,sha256=Wr4C98rGdEGv_PvZIUEVtTXoFAThR7SEaQp6CZWy-Q0,7856
24
+ pycsp3_scheduling-0.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
25
+ pycsp3_scheduling-0.2.1.dist-info/licenses/LICENSE,sha256=k49NebQVmSdOr9Ot0_VWG8MZ0ruM19qhV2rHFBGUYbk,1069
26
+ pycsp3_scheduling-0.2.1.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Univ. Artois
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.