bin_packing 0.1.0 → 0.2.0
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.
- checksums.yaml +4 -4
- data/lib/bin_packing/bin.rb +12 -8
- data/lib/bin_packing/version.rb +1 -1
- metadata +9 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ef470e8441cd54ea57580c007c72a5d4df20bdbc5758588493ee6b0e0ae2ee1
|
4
|
+
data.tar.gz: 8a5d22af4f91506e1e4f5cd4736aa53109e1434dccbe03bfee5d687ccd2715fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8a49b93d728bf9ea24071c56bfdd383b2ff7e2a2851615df407a6aee406f64c4d895c99f907d7feee3a8521185edc4a04a8d7054acd7dbbcbe8e85f50b4d1b3
|
7
|
+
data.tar.gz: 3b9ae8c3854a945120de8cee9ba86d728576fd095a93960dffa6e5629577afb1cea77fe63542cf0f7ff9b548fc19599042cd4492dddb29bf042f6f7576de0ad4
|
data/lib/bin_packing/bin.rb
CHANGED
@@ -25,6 +25,18 @@ module BinPacking
|
|
25
25
|
@heuristic.find_position_for_new_node!(box, @free_rectangles)
|
26
26
|
return false unless box.packed?
|
27
27
|
|
28
|
+
insert_in_known_position(box)
|
29
|
+
end
|
30
|
+
|
31
|
+
def insert!(box)
|
32
|
+
unless insert(box)
|
33
|
+
raise ArgumentError, "Could not insert box #{box.inspect} "\
|
34
|
+
"into bin #{inspect}."
|
35
|
+
end
|
36
|
+
self
|
37
|
+
end
|
38
|
+
|
39
|
+
def insert_in_known_position(box)
|
28
40
|
num_rectangles_to_process = @free_rectangles.size
|
29
41
|
i = 0
|
30
42
|
while i < num_rectangles_to_process
|
@@ -42,14 +54,6 @@ module BinPacking
|
|
42
54
|
true
|
43
55
|
end
|
44
56
|
|
45
|
-
def insert!(box)
|
46
|
-
unless insert(box)
|
47
|
-
raise ArgumentError, "Could not insert box #{box.inspect} "\
|
48
|
-
"into bin #{inspect}."
|
49
|
-
end
|
50
|
-
self
|
51
|
-
end
|
52
|
-
|
53
57
|
def score_for(box)
|
54
58
|
@heuristic.find_position_for_new_node!(box.clone, @free_rectangles)
|
55
59
|
end
|
data/lib/bin_packing/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bin_packing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MAK IT
|
@@ -14,26 +14,26 @@ dependencies:
|
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.0'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 3.0.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '3.0'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 3.0.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
33
33
|
description: 'Provides algorithm for placing rectangles (box-es) in one or multiple
|
34
34
|
rectangular areas (bins) with reasonable allocation efficiency.
|
35
35
|
|
36
|
-
'
|
36
|
+
'
|
37
37
|
email: info@makit.lv
|
38
38
|
executables: []
|
39
39
|
extensions: []
|
@@ -76,8 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
|
80
|
-
rubygems_version: 2.7.6
|
79
|
+
rubygems_version: 3.0.6
|
81
80
|
signing_key:
|
82
81
|
specification_version: 4
|
83
82
|
summary: 2D bin packing algorithm
|