Class: Polyrun::Partition::PlanLptBuckets
- Inherits:
-
Object
- Object
- Polyrun::Partition::PlanLptBuckets
- 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
- #build ⇒ Object
-
#initialize(plan) ⇒ PlanLptBuckets
constructor
A new instance of PlanLptBuckets.
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
#build ⇒ Object
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 |