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,111 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Scheduling function types.
|
|
3
|
+
|
|
4
|
+
This module provides:
|
|
5
|
+
- CumulFunction: Cumulative function for resource consumption
|
|
6
|
+
- pulse, step_at, step_at_start, step_at_end: Elementary cumul functions
|
|
7
|
+
- cumul_range, always_in: Cumulative constraints
|
|
8
|
+
- height_at_start, height_at_end: Cumulative accessors
|
|
9
|
+
- StateFunction: State function for resource states
|
|
10
|
+
- TransitionMatrix: Transition costs/times between states
|
|
11
|
+
- always_equal, always_constant, always_no_state: State constraints
|
|
12
|
+
- StepFunction: Piecewise step function for forbidden regions (future)
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from pycsp3_scheduling.functions.cumul_functions import (
|
|
18
|
+
CumulExpr,
|
|
19
|
+
CumulExprType,
|
|
20
|
+
CumulFunction,
|
|
21
|
+
CumulConstraint,
|
|
22
|
+
CumulConstraintType,
|
|
23
|
+
CumulHeightExpr,
|
|
24
|
+
CumulHeightType,
|
|
25
|
+
always_in as cumul_always_in,
|
|
26
|
+
cumul_range,
|
|
27
|
+
height_at_end,
|
|
28
|
+
height_at_start,
|
|
29
|
+
pulse,
|
|
30
|
+
step_at,
|
|
31
|
+
step_at_end,
|
|
32
|
+
step_at_start,
|
|
33
|
+
clear_cumul_registry,
|
|
34
|
+
get_registered_cumuls,
|
|
35
|
+
register_cumul,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
from pycsp3_scheduling.functions.state_functions import (
|
|
39
|
+
StateFunction,
|
|
40
|
+
StateConstraint,
|
|
41
|
+
StateConstraintType,
|
|
42
|
+
TransitionMatrix,
|
|
43
|
+
always_constant,
|
|
44
|
+
always_equal,
|
|
45
|
+
always_in as state_always_in,
|
|
46
|
+
always_no_state,
|
|
47
|
+
clear_state_function_registry,
|
|
48
|
+
get_registered_state_functions,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
# Re-export always_in with smart dispatch
|
|
52
|
+
def always_in(resource, interval_or_range, min_val, max_val=None, **kwargs):
|
|
53
|
+
"""
|
|
54
|
+
Constrain a cumulative or state function within bounds.
|
|
55
|
+
|
|
56
|
+
For CumulFunction: always_in(cumul, interval_or_range, min, max)
|
|
57
|
+
For StateFunction: always_in(state_func, interval, min, max)
|
|
58
|
+
"""
|
|
59
|
+
if isinstance(resource, CumulFunction):
|
|
60
|
+
return cumul_always_in(resource, interval_or_range, min_val, max_val)
|
|
61
|
+
elif isinstance(resource, StateFunction):
|
|
62
|
+
return state_always_in(resource, interval_or_range, min_val, max_val, **kwargs)
|
|
63
|
+
else:
|
|
64
|
+
raise TypeError(
|
|
65
|
+
f"always_in expects CumulFunction or StateFunction, got {type(resource).__name__}"
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# To be implemented:
|
|
70
|
+
# from pycsp3_scheduling.functions.step_function import StepFunction
|
|
71
|
+
|
|
72
|
+
__all__ = [
|
|
73
|
+
# Cumulative function types
|
|
74
|
+
"CumulExpr",
|
|
75
|
+
"CumulExprType",
|
|
76
|
+
"CumulFunction",
|
|
77
|
+
"CumulConstraint",
|
|
78
|
+
"CumulConstraintType",
|
|
79
|
+
"CumulHeightExpr",
|
|
80
|
+
"CumulHeightType",
|
|
81
|
+
# Elementary cumul functions
|
|
82
|
+
"pulse",
|
|
83
|
+
"step_at",
|
|
84
|
+
"step_at_start",
|
|
85
|
+
"step_at_end",
|
|
86
|
+
# Cumul constraints
|
|
87
|
+
"cumul_range",
|
|
88
|
+
# Cumul accessors
|
|
89
|
+
"height_at_start",
|
|
90
|
+
"height_at_end",
|
|
91
|
+
# Cumul registry
|
|
92
|
+
"register_cumul",
|
|
93
|
+
"get_registered_cumuls",
|
|
94
|
+
"clear_cumul_registry",
|
|
95
|
+
# State function types
|
|
96
|
+
"StateFunction",
|
|
97
|
+
"StateConstraint",
|
|
98
|
+
"StateConstraintType",
|
|
99
|
+
"TransitionMatrix",
|
|
100
|
+
# State constraints
|
|
101
|
+
"always_equal",
|
|
102
|
+
"always_constant",
|
|
103
|
+
"always_no_state",
|
|
104
|
+
# State registry
|
|
105
|
+
"get_registered_state_functions",
|
|
106
|
+
"clear_state_function_registry",
|
|
107
|
+
# Shared
|
|
108
|
+
"always_in",
|
|
109
|
+
# Future
|
|
110
|
+
# "StepFunction",
|
|
111
|
+
]
|