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.
- pycsp3_scheduling/__init__.py +220 -0
- pycsp3_scheduling/constraints/__init__.py +87 -0
- pycsp3_scheduling/constraints/_pycsp3.py +701 -0
- pycsp3_scheduling/constraints/cumulative.py +227 -0
- pycsp3_scheduling/constraints/grouping.py +382 -0
- pycsp3_scheduling/constraints/precedence.py +376 -0
- pycsp3_scheduling/constraints/sequence.py +814 -0
- pycsp3_scheduling/expressions/__init__.py +80 -0
- pycsp3_scheduling/expressions/element.py +313 -0
- pycsp3_scheduling/expressions/interval_expr.py +495 -0
- pycsp3_scheduling/expressions/sequence_expr.py +865 -0
- pycsp3_scheduling/functions/__init__.py +111 -0
- pycsp3_scheduling/functions/cumul_functions.py +891 -0
- pycsp3_scheduling/functions/state_functions.py +494 -0
- pycsp3_scheduling/interop.py +356 -0
- pycsp3_scheduling/output/__init__.py +13 -0
- pycsp3_scheduling/solvers/__init__.py +14 -0
- pycsp3_scheduling/solvers/adapters/__init__.py +7 -0
- pycsp3_scheduling/variables/__init__.py +45 -0
- pycsp3_scheduling/variables/interval.py +450 -0
- pycsp3_scheduling/variables/sequence.py +244 -0
- pycsp3_scheduling/visu.py +1315 -0
- pycsp3_scheduling-0.2.1.dist-info/METADATA +234 -0
- pycsp3_scheduling-0.2.1.dist-info/RECORD +26 -0
- pycsp3_scheduling-0.2.1.dist-info/WHEEL +4 -0
- pycsp3_scheduling-0.2.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"""
|
|
2
|
+
pycsp3-scheduling: Scheduling extension for pycsp3.
|
|
3
|
+
|
|
4
|
+
This package extends pycsp3 with comprehensive scheduling support including:
|
|
5
|
+
- Interval variables (IntervalVar)
|
|
6
|
+
- Sequence variables (SequenceVar)
|
|
7
|
+
- Precedence constraints (end_before_start, start_at_start, etc.)
|
|
8
|
+
- Grouping constraints (span, alternative, synchronize)
|
|
9
|
+
- Sequence constraints (SeqNoOverlap, first, last, before, previous)
|
|
10
|
+
- Sequence consistency constraints (same_sequence, same_common_subsequence)
|
|
11
|
+
- Sequence accessor expressions (start_of_next, start_of_prev, etc.)
|
|
12
|
+
- Cumulative functions (pulse, step_at_start, step_at_end, Cumulative)
|
|
13
|
+
- State functions (StateFunction, TransitionMatrix, always_equal, etc.)
|
|
14
|
+
- XCSP3 scheduling extension output [future]
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
__version__ = "0.2.0"
|
|
21
|
+
__author__ = "Sohaib AFIFI"
|
|
22
|
+
|
|
23
|
+
# Variables
|
|
24
|
+
from pycsp3_scheduling.variables import (
|
|
25
|
+
INTERVAL_MAX,
|
|
26
|
+
INTERVAL_MIN,
|
|
27
|
+
IntervalVar,
|
|
28
|
+
IntervalVarArray,
|
|
29
|
+
IntervalVarDict,
|
|
30
|
+
SequenceVar,
|
|
31
|
+
SequenceVarArray,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
# Expressions
|
|
35
|
+
from pycsp3_scheduling.expressions import (
|
|
36
|
+
ElementMatrix,
|
|
37
|
+
IntervalExpr,
|
|
38
|
+
clear_sequence_expr_cache,
|
|
39
|
+
element,
|
|
40
|
+
element2d,
|
|
41
|
+
end_of,
|
|
42
|
+
end_of_next,
|
|
43
|
+
end_of_prev,
|
|
44
|
+
expr_max,
|
|
45
|
+
expr_min,
|
|
46
|
+
length_of,
|
|
47
|
+
length_of_next,
|
|
48
|
+
length_of_prev,
|
|
49
|
+
overlap_length,
|
|
50
|
+
presence_of,
|
|
51
|
+
size_of,
|
|
52
|
+
size_of_next,
|
|
53
|
+
size_of_prev,
|
|
54
|
+
start_of,
|
|
55
|
+
start_of_next,
|
|
56
|
+
start_of_prev,
|
|
57
|
+
type_of_next,
|
|
58
|
+
type_of_prev,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
# Interop
|
|
62
|
+
from pycsp3_scheduling.interop import (
|
|
63
|
+
IntervalValue,
|
|
64
|
+
ModelStatistics,
|
|
65
|
+
SolutionStatistics,
|
|
66
|
+
end_time,
|
|
67
|
+
interval_value,
|
|
68
|
+
model_statistics,
|
|
69
|
+
presence_time,
|
|
70
|
+
solution_statistics,
|
|
71
|
+
start_time,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Constraints
|
|
75
|
+
from pycsp3_scheduling.constraints import (
|
|
76
|
+
SeqCumulative,
|
|
77
|
+
SeqNoOverlap,
|
|
78
|
+
alternative,
|
|
79
|
+
before,
|
|
80
|
+
end_at_end,
|
|
81
|
+
end_at_start,
|
|
82
|
+
end_before_end,
|
|
83
|
+
end_before_start,
|
|
84
|
+
first,
|
|
85
|
+
last,
|
|
86
|
+
previous,
|
|
87
|
+
same_common_subsequence,
|
|
88
|
+
same_sequence,
|
|
89
|
+
span,
|
|
90
|
+
start_at_end,
|
|
91
|
+
start_at_start,
|
|
92
|
+
start_before_end,
|
|
93
|
+
start_before_start,
|
|
94
|
+
synchronize,
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Cumulative Functions
|
|
98
|
+
from pycsp3_scheduling.functions import (
|
|
99
|
+
CumulExpr,
|
|
100
|
+
CumulFunction,
|
|
101
|
+
CumulConstraint,
|
|
102
|
+
CumulHeightExpr,
|
|
103
|
+
always_in,
|
|
104
|
+
cumul_range,
|
|
105
|
+
height_at_end,
|
|
106
|
+
height_at_start,
|
|
107
|
+
pulse,
|
|
108
|
+
step_at,
|
|
109
|
+
step_at_end,
|
|
110
|
+
step_at_start,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# State Functions
|
|
114
|
+
from pycsp3_scheduling.functions import (
|
|
115
|
+
StateFunction,
|
|
116
|
+
StateConstraint,
|
|
117
|
+
TransitionMatrix,
|
|
118
|
+
always_constant,
|
|
119
|
+
always_equal,
|
|
120
|
+
always_no_state,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
# Visualization (imported as submodule)
|
|
124
|
+
from pycsp3_scheduling import visu
|
|
125
|
+
|
|
126
|
+
__all__ = [
|
|
127
|
+
"__version__",
|
|
128
|
+
# Variables
|
|
129
|
+
"IntervalVar",
|
|
130
|
+
"IntervalVarArray",
|
|
131
|
+
"IntervalVarDict",
|
|
132
|
+
"SequenceVar",
|
|
133
|
+
"SequenceVarArray",
|
|
134
|
+
"INTERVAL_MIN",
|
|
135
|
+
"INTERVAL_MAX",
|
|
136
|
+
# Expressions - Basic
|
|
137
|
+
"IntervalExpr",
|
|
138
|
+
"start_of",
|
|
139
|
+
"end_of",
|
|
140
|
+
"size_of",
|
|
141
|
+
"length_of",
|
|
142
|
+
"presence_of",
|
|
143
|
+
"overlap_length",
|
|
144
|
+
"expr_min",
|
|
145
|
+
"expr_max",
|
|
146
|
+
# Expressions - Sequence Next
|
|
147
|
+
"start_of_next",
|
|
148
|
+
"end_of_next",
|
|
149
|
+
"size_of_next",
|
|
150
|
+
"length_of_next",
|
|
151
|
+
"type_of_next",
|
|
152
|
+
# Expressions - Sequence Prev
|
|
153
|
+
"start_of_prev",
|
|
154
|
+
"end_of_prev",
|
|
155
|
+
"size_of_prev",
|
|
156
|
+
"length_of_prev",
|
|
157
|
+
"type_of_prev",
|
|
158
|
+
# Expressions - Element (array indexing)
|
|
159
|
+
"ElementMatrix",
|
|
160
|
+
"element",
|
|
161
|
+
"element2d",
|
|
162
|
+
"clear_sequence_expr_cache",
|
|
163
|
+
# Interop
|
|
164
|
+
"start_time",
|
|
165
|
+
"end_time",
|
|
166
|
+
"presence_time",
|
|
167
|
+
"interval_value",
|
|
168
|
+
"IntervalValue",
|
|
169
|
+
"model_statistics",
|
|
170
|
+
"solution_statistics",
|
|
171
|
+
"ModelStatistics",
|
|
172
|
+
"SolutionStatistics",
|
|
173
|
+
# Constraints - Exact timing
|
|
174
|
+
"start_at_start",
|
|
175
|
+
"start_at_end",
|
|
176
|
+
"end_at_start",
|
|
177
|
+
"end_at_end",
|
|
178
|
+
# Constraints - Before
|
|
179
|
+
"start_before_start",
|
|
180
|
+
"start_before_end",
|
|
181
|
+
"end_before_start",
|
|
182
|
+
"end_before_end",
|
|
183
|
+
# Constraints - Grouping
|
|
184
|
+
"span",
|
|
185
|
+
"alternative",
|
|
186
|
+
"synchronize",
|
|
187
|
+
# Constraints - Sequence
|
|
188
|
+
"SeqNoOverlap",
|
|
189
|
+
"first",
|
|
190
|
+
"last",
|
|
191
|
+
"before",
|
|
192
|
+
"previous",
|
|
193
|
+
# Constraints - Sequence Consistency
|
|
194
|
+
"same_sequence",
|
|
195
|
+
"same_common_subsequence",
|
|
196
|
+
# Constraints - Cumulative
|
|
197
|
+
"SeqCumulative",
|
|
198
|
+
# Cumulative Functions
|
|
199
|
+
"CumulExpr",
|
|
200
|
+
"CumulFunction",
|
|
201
|
+
"CumulConstraint",
|
|
202
|
+
"CumulHeightExpr",
|
|
203
|
+
"pulse",
|
|
204
|
+
"step_at",
|
|
205
|
+
"step_at_start",
|
|
206
|
+
"step_at_end",
|
|
207
|
+
"cumul_range",
|
|
208
|
+
"always_in",
|
|
209
|
+
"height_at_start",
|
|
210
|
+
"height_at_end",
|
|
211
|
+
# State Functions
|
|
212
|
+
"StateFunction",
|
|
213
|
+
"StateConstraint",
|
|
214
|
+
"TransitionMatrix",
|
|
215
|
+
"always_equal",
|
|
216
|
+
"always_constant",
|
|
217
|
+
"always_no_state",
|
|
218
|
+
# Visualization
|
|
219
|
+
"visu",
|
|
220
|
+
]
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Scheduling constraints.
|
|
3
|
+
|
|
4
|
+
This module provides:
|
|
5
|
+
- Precedence constraints: end_before_start, start_at_start, etc.
|
|
6
|
+
- Grouping constraints: span, alternative, synchronize
|
|
7
|
+
- Sequence constraints: SeqNoOverlap, first, last, before, previous
|
|
8
|
+
- Sequence consistency: same_sequence, same_common_subsequence
|
|
9
|
+
- Cumulative constraints: Cumulative (capacity constraint)
|
|
10
|
+
- State constraints: always_equal, always_constant, always_no_state (future)
|
|
11
|
+
- Forbidden region constraints: forbid_start, forbid_end, forbid_extent (future)
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
# Precedence constraints (exact timing + before)
|
|
17
|
+
from pycsp3_scheduling.constraints.precedence import (
|
|
18
|
+
end_at_end,
|
|
19
|
+
end_at_start,
|
|
20
|
+
end_before_end,
|
|
21
|
+
end_before_start,
|
|
22
|
+
start_at_end,
|
|
23
|
+
start_at_start,
|
|
24
|
+
start_before_end,
|
|
25
|
+
start_before_start,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
# Grouping constraints
|
|
29
|
+
from pycsp3_scheduling.constraints.grouping import (
|
|
30
|
+
alternative,
|
|
31
|
+
span,
|
|
32
|
+
synchronize,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
# Sequence constraints
|
|
36
|
+
from pycsp3_scheduling.constraints.sequence import (
|
|
37
|
+
SeqNoOverlap,
|
|
38
|
+
before,
|
|
39
|
+
first,
|
|
40
|
+
last,
|
|
41
|
+
previous,
|
|
42
|
+
same_common_subsequence,
|
|
43
|
+
same_sequence,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
# Cumulative constraints
|
|
47
|
+
from pycsp3_scheduling.constraints.cumulative import (
|
|
48
|
+
SeqCumulative,
|
|
49
|
+
build_cumul_constraint,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# To be implemented:
|
|
53
|
+
# from pycsp3_scheduling.constraints.state import (
|
|
54
|
+
# always_in, always_equal, always_constant, always_no_state,
|
|
55
|
+
# )
|
|
56
|
+
# from pycsp3_scheduling.constraints.forbidden import (
|
|
57
|
+
# forbid_start, forbid_end, forbid_extent,
|
|
58
|
+
# )
|
|
59
|
+
|
|
60
|
+
__all__ = [
|
|
61
|
+
# Exact timing constraints
|
|
62
|
+
"start_at_start",
|
|
63
|
+
"start_at_end",
|
|
64
|
+
"end_at_start",
|
|
65
|
+
"end_at_end",
|
|
66
|
+
# Before constraints
|
|
67
|
+
"start_before_start",
|
|
68
|
+
"start_before_end",
|
|
69
|
+
"end_before_start",
|
|
70
|
+
"end_before_end",
|
|
71
|
+
# Grouping constraints
|
|
72
|
+
"span",
|
|
73
|
+
"alternative",
|
|
74
|
+
"synchronize",
|
|
75
|
+
# Sequence constraints
|
|
76
|
+
"SeqNoOverlap",
|
|
77
|
+
"first",
|
|
78
|
+
"last",
|
|
79
|
+
"before",
|
|
80
|
+
"previous",
|
|
81
|
+
# Sequence consistency
|
|
82
|
+
"same_sequence",
|
|
83
|
+
"same_common_subsequence",
|
|
84
|
+
# Cumulative constraints
|
|
85
|
+
"SeqCumulative",
|
|
86
|
+
"build_cumul_constraint",
|
|
87
|
+
]
|