Class: Polyrun::Partition::PlanLptBuckets

Inherits:
Object
  • Object
show all
Defined in:
lib/polyrun/partition/plan_lpt.rb

Overview

LPT greedy binpack for cost strategies (extracted from Plan for size limits).

Instance Method Summary collapse

Constructor Details

#initialize(plan) ⇒ PlanLptBuckets

Returns a new instance of PlanLptBuckets.



7
8
9
# File 'lib/polyrun/partition/plan_lpt.rb', line 7

def initialize(plan)
  @plan = plan
end

Instance Method Details

#buildObject



11
12
13
14
15
16
17
# File 'lib/polyrun/partition/plan_lpt.rb', line 11

def build
  buckets = Array.new(@plan.total_shards) { [] }
  totals = Array.new(@plan.total_shards, 0.0)
  lpt_fill_forced!(buckets, totals)
  lpt_balance_free!(buckets, totals)
  buckets
end