class RoadForest::SourceRigor::CredenceAnnealer

Attributes

attempts[RW]

Public Class Methods

new(graph) click to toggle source
# File lib/roadforest/source-rigor/credence-annealer.rb, line 5
def initialize(graph)
  @graph = graph
  @attempts = 5
end

Public Instance Methods

resolve(&block) click to toggle source
# File lib/roadforest/source-rigor/credence-annealer.rb, line 12
def resolve(&block)
  attempts = @attempts

  @graph.force_impulse

  begin
    raise "Annealing failed after #@attempts attempts" if (attempts -= 1) < 0
    @graph.next_impulse
    block.call
  end until @graph.quiet_impulse?
end