Class: Saulabs::TrueSkill::Layers::IteratedTeamPerformances

Inherits:
Base
  • Object
show all
Defined in:
lib/saulabs/trueskill/layers/iterated_team_performances.rb

Instance Attribute Summary

Attributes inherited from Base

#graph, #input, #output

Instance Method Summary collapse

Methods inherited from Base

#posterior_schedule

Constructor Details

#initialize(graph, team_perf_diff, team_diff_comp) ⇒ IteratedTeamPerformances

Returns a new instance of IteratedTeamPerformances.



9
10
11
12
13
# File 'lib/saulabs/trueskill/layers/iterated_team_performances.rb', line 9

def initialize(graph, team_perf_diff, team_diff_comp)
  super(graph)
  @tpd = team_perf_diff
  @tdc = team_diff_comp
end

Instance Method Details

#buildObject



15
16
17
18
19
20
# File 'lib/saulabs/trueskill/layers/iterated_team_performances.rb', line 15

def build
  @tpd.input = @input
  @tpd.build
  @tdc.input = @tpd.output
  @tdc.build
end

#factorsObject



22
23
24
# File 'lib/saulabs/trueskill/layers/iterated_team_performances.rb', line 22

def factors
  @tpd.factors + @tdc.factors
end

#prior_scheduleObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/saulabs/trueskill/layers/iterated_team_performances.rb', line 26

def prior_schedule
  loop_schedule = if @input.size == 2
    two_team_loop_schedule
  elsif @input.size > 2
    multiple_team_loop_schedule
  else
    raise 'Illegal input'
  end
  team_diffs = @tpd.factors.size;
  Schedules::Sequence.new([loop_schedule, 
                           Schedules::Step.new(@tpd.factors[0], 1),
                           Schedules::Step.new(@tpd.factors[team_diffs-1], 2)])
end