spyrrow 0.5.0__cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl → 0.7.0__cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.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.
Potentially problematic release.
This version of spyrrow might be problematic. Click here for more details.
- spyrrow/__init__.pyi +68 -15
- spyrrow/spyrrow.cpython-313-s390x-linux-gnu.so +0 -0
- spyrrow-0.7.0.dist-info/METADATA +11 -0
- spyrrow-0.7.0.dist-info/RECORD +8 -0
- {spyrrow-0.5.0.dist-info → spyrrow-0.7.0.dist-info}/WHEEL +1 -1
- spyrrow-0.5.0.dist-info/METADATA +0 -68
- spyrrow-0.5.0.dist-info/RECORD +0 -8
- {spyrrow-0.5.0.dist-info → spyrrow-0.7.0.dist-info}/licenses/LICENSE.txt +0 -0
spyrrow/__init__.pyi
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
from typing import TypeAlias
|
|
1
|
+
from typing import TypeAlias, Optional
|
|
2
|
+
from datetime import timedelta
|
|
2
3
|
|
|
3
4
|
Point: TypeAlias = tuple[float, float]
|
|
4
5
|
|
|
@@ -13,29 +14,28 @@ class Item:
|
|
|
13
14
|
id: str,
|
|
14
15
|
shape: list[Point],
|
|
15
16
|
demand: int,
|
|
16
|
-
allowed_orientations: list[float],
|
|
17
|
+
allowed_orientations: list[float] | None,
|
|
17
18
|
):
|
|
18
19
|
"""
|
|
19
20
|
An Item represents any closed 2D shape by its outer boundary.
|
|
20
21
|
|
|
21
22
|
Spyrrow doesn't support hole(s) inside the shape as of yet. Therefore no Item can be nested inside another.
|
|
22
23
|
|
|
23
|
-
Continous rotation is not supported as of yet. A workaround is to specify any integer degrees between 0 and 360
|
|
24
|
-
to the allowed_orientations list.
|
|
25
|
-
|
|
26
24
|
Args:
|
|
27
25
|
id (str): The Item identifier
|
|
28
26
|
Needs to be unique accross all Items of a StripPackingInstance
|
|
29
27
|
shape: An ordered list of (x,y) defining the shape boundary. The shape is represented as a polygon formed by this list of points.
|
|
30
28
|
The origin point can be included twice as the finishing point. If not, [last point, first point] is infered to be the last straight line of the shape.
|
|
31
29
|
demand: The quantity of identical Items to be placed inside the strip. Should be positive.
|
|
32
|
-
allowed_orientations: List of angles in degrees allowed.
|
|
30
|
+
allowed_orientations (list[float]|None): List of angles in degrees allowed.
|
|
31
|
+
An empty list is equivalent to [0.].
|
|
32
|
+
A None value means that the item is free to rotate
|
|
33
33
|
The algorithmn is only very weakly sensible to the length of the list given.
|
|
34
34
|
|
|
35
35
|
"""
|
|
36
|
-
|
|
37
|
-
def to_json_str(self)->str:
|
|
38
|
-
"""
|
|
36
|
+
|
|
37
|
+
def to_json_str(self) -> str:
|
|
38
|
+
"""Return a string of the JSON representation of the object"""
|
|
39
39
|
|
|
40
40
|
class PlacedItem:
|
|
41
41
|
"""
|
|
@@ -68,6 +68,61 @@ class StripPackingSolution:
|
|
|
68
68
|
density: float
|
|
69
69
|
placed_items: list[PlacedItem]
|
|
70
70
|
|
|
71
|
+
class StripPackingConfig:
|
|
72
|
+
early_termination: bool
|
|
73
|
+
seed: int
|
|
74
|
+
exploration_time: timedelta
|
|
75
|
+
compression_time: timedelta
|
|
76
|
+
quadtree_depth: int
|
|
77
|
+
num_wokers:Optional[int]
|
|
78
|
+
min_items_separation: Optional[float]
|
|
79
|
+
|
|
80
|
+
def __init__(
|
|
81
|
+
self,
|
|
82
|
+
early_termination: bool = True,
|
|
83
|
+
quadtree_depth: int = 4,
|
|
84
|
+
min_items_separation: Optional[float] = None,
|
|
85
|
+
total_computation_time: Optional[int] = 600,
|
|
86
|
+
exploration_time: Optional[int] = None,
|
|
87
|
+
compression_time: Optional[int] = None,
|
|
88
|
+
num_wokers:Optional[int]= None,
|
|
89
|
+
seed: Optional[int] = None,
|
|
90
|
+
) -> None:
|
|
91
|
+
"""Initializes a configuration object for the strip packing algorithm.
|
|
92
|
+
|
|
93
|
+
Either `total_computation_time`, or both `exploration_time` and
|
|
94
|
+
`compression_time`, must be provided. Providing all three or only
|
|
95
|
+
one of the latter two raises an error.
|
|
96
|
+
|
|
97
|
+
If `total_computation_time` is provided, 80% of it is allocated to
|
|
98
|
+
exploration and 20% to compression.
|
|
99
|
+
|
|
100
|
+
If `seed` is not provided, a random seed will be generated.
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
early_termination (bool, optional): Whether to allow early termination of the algorithm. Defaults to True.
|
|
104
|
+
quadtree_depth (int, optional): Maximum depth of the quadtree used by the collision detection engine jagua-rs.
|
|
105
|
+
Must be positive, common values are 3,4,5. Defaults to 4.
|
|
106
|
+
min_items_separation (Optional[float], optional): Minimum required distance between packed items. Defaults to None.
|
|
107
|
+
total_computation_time (Optional[int], optional): Total time budget in seconds.
|
|
108
|
+
Used if `exploration_time` and `compression_time` are not provided. Defaults to 600.
|
|
109
|
+
exploration_time (Optional[int], optional): Time in seconds allocated to exploration. Defaults to None.
|
|
110
|
+
compression_time (Optional[int], optional): Time in seconds allocated to compression. Defaults to None.
|
|
111
|
+
num_workers (Optional[int], optional): Number of threads used by the collision detection engine during exploration.
|
|
112
|
+
When set to None, detect the number of logical CPU cores on the execution plateform. Defaults to None.
|
|
113
|
+
seed (Optional[int], optional): Optional random seed to give reproductibility. If None, a random seed is generated. Defaults to None.
|
|
114
|
+
|
|
115
|
+
Raises:
|
|
116
|
+
ValueError: If the combination of time arguments is invalid.
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
def to_json_str(self)->str:
|
|
120
|
+
"""Return a string of the JSON representation of the object
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
str
|
|
124
|
+
"""
|
|
125
|
+
|
|
71
126
|
class StripPackingInstance:
|
|
72
127
|
name: str
|
|
73
128
|
strip_height: float
|
|
@@ -85,17 +140,15 @@ class StripPackingInstance:
|
|
|
85
140
|
Raises:
|
|
86
141
|
ValueError
|
|
87
142
|
"""
|
|
88
|
-
def to_json_str(self)->str:
|
|
89
|
-
"""
|
|
90
|
-
|
|
143
|
+
def to_json_str(self) -> str:
|
|
144
|
+
"""Return a string of the JSON representation of the object"""
|
|
91
145
|
|
|
92
|
-
def solve(self,
|
|
146
|
+
def solve(self, config: StripPackingConfig) -> StripPackingSolution:
|
|
93
147
|
"""
|
|
94
148
|
The method to solve the instance.
|
|
95
149
|
|
|
96
150
|
Args:
|
|
97
|
-
|
|
98
|
-
The algorithm won't exit early.Waht you input is what you get. Default is 600 s = 10 minutes.
|
|
151
|
+
config (StripPackingConfig): the config object to precise behavior of how to solve the strip packing instance.
|
|
99
152
|
|
|
100
153
|
Returns:
|
|
101
154
|
a StripPackingSolution
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spyrrow
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
+
License-File: LICENSE.txt
|
|
8
|
+
Author-email: Paul Durand-Lupinski <paul.durand-lupinski@reeverse-systems.com>
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Project-URL: documentation, https://spyrrow.readthedocs.io/
|
|
11
|
+
Project-URL: source, https://github.com/PaulDL-RS/spyrrow
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
spyrrow-0.7.0.dist-info/METADATA,sha256=_HbJhdU3i7M7iN6o3jQYkVSYRJCi2aohSvGBA5ogvOk,480
|
|
2
|
+
spyrrow-0.7.0.dist-info/WHEEL,sha256=V0FBh3dwaux9oaNr7OgYh3LLOvcmk8wTUeHBb1_p5Io,127
|
|
3
|
+
spyrrow-0.7.0.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
|
|
4
|
+
spyrrow/__init__.py,sha256=MajlSBAliv8o8SqAqLgJARyi3egmvNIaXKTDXxvIAFY,111
|
|
5
|
+
spyrrow/__init__.pyi,sha256=9op4JPXX9L4-MAGMGDGIfQsc93Ch2p5CUsuT6xDUmeo,6453
|
|
6
|
+
spyrrow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
spyrrow/spyrrow.cpython-313-s390x-linux-gnu.so,sha256=Aton60OSO7ZWymVG6xaXgX3aQvGyvq0WfucJDPFLmvQ,2090336
|
|
8
|
+
spyrrow-0.7.0.dist-info/RECORD,,
|
spyrrow-0.5.0.dist-info/METADATA
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: spyrrow
|
|
3
|
-
Version: 0.5.0
|
|
4
|
-
Classifier: Programming Language :: Rust
|
|
5
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
-
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
|
-
License-File: LICENSE.txt
|
|
8
|
-
Author-email: Paul Durand-Lupinski <paul.durand-lupinski@reeverse-systems.com>
|
|
9
|
-
License: MIT
|
|
10
|
-
Requires-Python: >=3.10
|
|
11
|
-
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
12
|
-
Project-URL: documentation, https://spyrrow.readthedocs.io/
|
|
13
|
-
Project-URL: source, https://github.com/PaulDL-RS/spyrrow
|
|
14
|
-
|
|
15
|
-
# Spyrrow
|
|
16
|
-
|
|
17
|
-
`spyrrow` is a Python wrapper on the Rust project [`sparrow`](https://github.com/JeroenGar/sparrow).
|
|
18
|
-
It enables to solve 2D [Strip packing problems](https://en.wikipedia.org/wiki/Strip_packing_problem).
|
|
19
|
-
|
|
20
|
-
The documentation is hosted [here](https://spyrrow.readthedocs.io/).
|
|
21
|
-
|
|
22
|
-
## Installation
|
|
23
|
-
|
|
24
|
-
Spyrrow is hosted on [PyPI](https://pypi.org/project/spyrrow/).
|
|
25
|
-
|
|
26
|
-
You can install with the package manager of your choice, using the PyPI package index.
|
|
27
|
-
|
|
28
|
-
For example, with `pip`, the default Python package:
|
|
29
|
-
```bash
|
|
30
|
-
pip install spyrrow
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Examples
|
|
34
|
-
```python
|
|
35
|
-
import spyrrow
|
|
36
|
-
|
|
37
|
-
rectangle1 = spyrrow.Item(
|
|
38
|
-
"rectangle", [(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)], demand=4, allowed_orientations=[0]
|
|
39
|
-
)
|
|
40
|
-
triangle1 = spyrrow.Item(
|
|
41
|
-
"triangle",
|
|
42
|
-
[(0, 0), (1, 0), (1, 1), (0, 0)],
|
|
43
|
-
demand=6,
|
|
44
|
-
allowed_orientations=[0, 90, 180, -90],
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
instance = spyrrow.StripPackingInstance("test", strip_height=2.001, items=[rectangle1,triangle1])
|
|
48
|
-
sol:spyrrow.StripPackingSolution = instance.solve(30)
|
|
49
|
-
print(sol.width)
|
|
50
|
-
print(sol.density)
|
|
51
|
-
print("\n")
|
|
52
|
-
for pi in sol.placed_items:
|
|
53
|
-
print(pi.id)
|
|
54
|
-
print(pi.rotation)
|
|
55
|
-
print(pi.translation)
|
|
56
|
-
print("\n")
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Contributing
|
|
60
|
-
|
|
61
|
-
Spyrrow is open to contributions.
|
|
62
|
-
The first target should be to reach Python open sources packages standards and practices.
|
|
63
|
-
Second, a easier integration with the package `shapely` is envsionned.
|
|
64
|
-
|
|
65
|
-
Please use GitHub issues to request features.
|
|
66
|
-
They will be considered relative to what is already implemented in the parent library `sparrow`.
|
|
67
|
-
If necessary, they can be forwarded to it.
|
|
68
|
-
|
spyrrow-0.5.0.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
spyrrow-0.5.0.dist-info/METADATA,sha256=EZ7iHM1m1vZwrtCdysrc_Z8jl-TFPOlZS8y7vUSWqeQ,2156
|
|
2
|
-
spyrrow-0.5.0.dist-info/WHEEL,sha256=ud7XSgj8fv197QryPyT8U5yTHUm5OmAkZfDrXQJAONg,127
|
|
3
|
-
spyrrow-0.5.0.dist-info/licenses/LICENSE.txt,sha256=JOcOnGFqH2ZNyuMV3DBGh5kNL_3IqaS5832hwXhZ-Js,1076
|
|
4
|
-
spyrrow/__init__.py,sha256=MajlSBAliv8o8SqAqLgJARyi3egmvNIaXKTDXxvIAFY,111
|
|
5
|
-
spyrrow/__init__.pyi,sha256=2r0Dy-uJY0lE4Q_-eT7E2aOx9965J4JQ9G9xwZv4zXY,3947
|
|
6
|
-
spyrrow/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
spyrrow/spyrrow.cpython-313-s390x-linux-gnu.so,sha256=X3iXG43S0ZcccU5P_proPniPO9aw7KbFUDL6Yo3IP2Q,2034112
|
|
8
|
-
spyrrow-0.5.0.dist-info/RECORD,,
|
|
File without changes
|