easy-box-packer 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/easy-box-packer.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d62d68c7bf71b3125bac31ee0c01faa0b7d1adbb
|
4
|
+
data.tar.gz: 2c231b4132f149c6b3b5eabf222b2bfa222a254b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fcd648f100ea6c72eac790cf9a9dfb9e1a4cd059c245f32313dfe262227ee86d9a1599fae1bfabb2f5db7b8308534af85bd695a984d61a4d418c0ee3e10b2d2
|
7
|
+
data.tar.gz: 174e2d04868c83e2b855c70e2b5ea10ad102dd8027290e297ffb13c1e027c877d4420e61e288bf3e6c95476732272481dee5fc46416ac3a001b98eb3d6037cb3
|
data/easy-box-packer.rb
CHANGED
@@ -92,12 +92,13 @@ module EasyBoxPacker
|
|
92
92
|
item_index: 1,
|
93
93
|
min_vol: min_vol)
|
94
94
|
|
95
|
-
possible_containers.map { |a| a.sort }.sort_by { |a| [a.inject(&:*), a.inject(&:+)] }.each do |c|
|
95
|
+
select_container = possible_containers.map { |a| a.sort }.sort_by { |a| [a.inject(&:*), a.inject(&:+)] }.each do |c|
|
96
96
|
packing = pack(
|
97
97
|
container: { dimensions: c },
|
98
98
|
items: items)
|
99
|
-
|
99
|
+
break c if packing[:packings].size == 1
|
100
100
|
end
|
101
|
+
check_container_is_bigger_than_greedy_box({dimensions: select_container}, items) ? item_greedy_box(items) : select_container
|
101
102
|
end
|
102
103
|
|
103
104
|
private
|
@@ -107,7 +108,7 @@ module EasyBoxPacker
|
|
107
108
|
contents.map!(&:to_f)
|
108
109
|
mean = contents.reduce(&:+)/n
|
109
110
|
sum_sqr = contents.map {|x| x * x}.reduce(&:+)
|
110
|
-
Math.sqrt((sum_sqr - n * mean * mean)/(n-1))
|
111
|
+
Math.sqrt(((sum_sqr - n * mean * mean)/(n-1)).abs)
|
111
112
|
end
|
112
113
|
|
113
114
|
def find_possible_container(possible_containers:,invalid_containers:,container:, items:, item_index:, min_vol:)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy-box-packer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aloha Chen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|