diff --git a/lib/rubella/weighting/expotential.rb b/lib/rubella/weighting/expotential.rb index 65dd44d..5ed3c01 100644 --- a/lib/rubella/weighting/expotential.rb +++ b/lib/rubella/weighting/expotential.rb @@ -20,16 +20,14 @@ module Rubella # prepare data data_list = Array.new() bucket_no = 0 - total_amount = nil input.each do |cores| - total_amount = cores.length if total_amount.nil? # every 10 load percent one heatpoint i = 0 data_list << Array.new(buckets) do amount = cores.select { |core| core >= i and core < (i+@steps)}.length i = i + @steps - core = (amount.to_f*bucket_no**0.8)/total_amount + core = (amount.to_f*bucket_no**0.8)/cores.length bucket_no = bucket_no + 1 core diff --git a/lib/rubella/weighting/per_value.rb b/lib/rubella/weighting/per_value.rb index 2d5a8d6..09b33ae 100644 --- a/lib/rubella/weighting/per_value.rb +++ b/lib/rubella/weighting/per_value.rb @@ -19,16 +19,14 @@ module Rubella def parse input # prepare data data_list = Array.new() - total_amount = nil input.each do |cores| - total_amount = cores.length if total_amount.nil? # every 10 load percent one heatpoint i = 0 data_list << Array.new(buckets) do amount = cores.select { |core| core >= i and core < (i+@steps)}.length i = i + @steps - amount.to_f/total_amount + amount.to_f/cores.length end end