Class: Montecasting::Forecasting

Inherits:
Object
  • Object
show all
Defined in:
lib/montecasting.rb

Overview

Here will place all those method to generate forecasting charts

Class Method Summary collapse

Class Method Details

.montecarlo(takt_times = [], backlog_items = 1, days_iteration = 1) ⇒ Object



55
56
57
58
# File 'lib/montecasting.rb', line 55

def self.montecarlo(takt_times = [], backlog_items = 1, days_iteration = 1)
  return nil unless takt_times.all? Numeric
  takt_times.map {|tt| ((tt * backlog_items) / days_iteration).round(0)}.sort
end

.takt_times(cycle_time = [], rand_generator = 1000) ⇒ Object



49
50
51
52
53
# File 'lib/montecasting.rb', line 49

def self.takt_times(cycle_time = [], rand_generator = 1000)
  return nil unless cycle_time.all? Numeric
  result = Matrix.build(rand_generator, cycle_time.count) {cycle_time.at(rand(0...cycle_time.count))}
  result.row_vectors.map {|r| (r.inject(:+).to_f / cycle_time.count).round(2)}
end