activecube 0.1.24 → 0.1.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e08b7128492c4b84b982715355728b6506c0eb4dc155875ef1323bc88e9c9777
4
- data.tar.gz: 856d25b480a319b11476c9d388f20aa656325f812299018c67df6b44bed322e8
3
+ metadata.gz: 94f1e4575a041108004194789f85b9c030c6f7f94083677dee253de3cc878966
4
+ data.tar.gz: b182640a584166cefc17b7b26e7add652600b0c937f08b83689a02f819bb2bb9
5
5
  SHA512:
6
- metadata.gz: 76d9c60cfba31ac7f65f819dc1e5b8b0d6689aebbb162f8677f45e7388442dfc7d581e2bec945478d058891f61fc2b7b34de5b7e79f40c510bb88c1f21647547
7
- data.tar.gz: 880550994778371e8dbd416691bc252a51de37123557ee73ad4c4ac5dcdb273a2a29084787c311b7219629cf42ac782302e664a495e5870deb69e4a6a8323730
6
+ metadata.gz: ab68fd59fdbffe5e0b3d4b8f0523d351b5a6c2840090328af0e78ed10c7fc23e402335f99f05d114da175c57d0b12f0d4fa02195a89ab52108af451b2dae0445
7
+ data.tar.gz: ace9d8f215cb59e930cf66249211405408c2bce905166fbe59370708dea17502d40d2416611297a1d6c06d0f6930ee3e73460775cfe1ad32895030db22a49c65
@@ -9,7 +9,7 @@ GIT
9
9
  PATH
10
10
  remote: .
11
11
  specs:
12
- activecube (0.1.23)
12
+ activecube (0.1.24)
13
13
  activerecord (>= 5.2)
14
14
 
15
15
  GEM
@@ -41,7 +41,7 @@ module Activecube::Processor
41
41
  end
42
42
  after = total_cost measure_tables
43
43
 
44
- raise "Optimizer made it worth #{before} -> #{after} for #{cost_matrix}" unless after <= before
44
+ raise "Optimizer made it worse #{before} -> #{after} for #{cost_matrix}" unless after <= before
45
45
  measure_tables
46
46
 
47
47
  end
@@ -27,8 +27,8 @@ module Activecube::Processor
27
27
 
28
28
  private
29
29
 
30
-
31
30
  def do_optimize
31
+
32
32
  @tables_by_metrics = []
33
33
 
34
34
  # sort metrics from low min cost to higher min costs ( by all applicable tables )
@@ -91,13 +91,13 @@ module Activecube::Processor
91
91
  else
92
92
  # table to unused table if
93
93
  # cost now > new cost + max other cost in table now
94
- old_cost > new_cost + ( prev_step.select.with_index{|c,i| c==c_i && i!=m_i }.max || UNLIM_COST )
94
+ old_cost > new_cost + ( prev_step.select.with_index{|c,i| c==c_i && i!=m_i }.map{|c| cost_matrix[m_i][c]}.max || UNLIM_COST )
95
95
  end
96
96
  else
97
97
  if new_table_included_times>0
98
98
  # unused table to table if
99
99
  # new cost < cost now + max other cost in new table
100
- old_cost > new_cost - ( prev_step.select{|c| c==c_n }.max || UNLIM_COST )
100
+ old_cost > new_cost - ( prev_step.select{|c| c==c_n }.map{|c| cost_matrix[m_i][c]}.max || UNLIM_COST )
101
101
  else
102
102
  # unused to unused
103
103
  # cost now > new cost
@@ -107,7 +107,7 @@ module Activecube::Processor
107
107
 
108
108
  }
109
109
 
110
- step << c_i || new_c_i
110
+ step << (new_c_i || c_i)
111
111
 
112
112
  }
113
113
 
@@ -1,3 +1,3 @@
1
1
  module Activecube
2
- VERSION = "0.1.24"
2
+ VERSION = "0.1.25"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activecube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksey Studnev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-10 00:00:00.000000000 Z
11
+ date: 2020-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord