Class: Lernen::Algorithm::LStar::LStarLearner

Inherits:
Lernen::Algorithm::Learner show all
Defined in:
lib/lernen/algorithm/lstar/lstar_learner.rb

Overview

LStarLearner is an implementation of Angluin’s L* algorithm.

Angluin’s L* is introduced by [Angluin (1987) “Learning Regular Sets from Queries and Counterexamples”](dl.acm.org/doi/10.1016/0890-5401%2887%2990052-6).

Instance Method Summary collapse

Methods inherited from Lernen::Algorithm::Learner

#learn

Constructor Details

#initialize(alphabet, sul, automaton_type:, cex_processing: :binary) ⇒ LStarLearner

: (

  Array[In] alphabet, System::SUL[In, Out] sul,
  automaton_type: :dfa | :moore | :mealy,
  ?cex_processing: cex_processing_method | nil
) -> void


24
25
26
27
28
29
30
# File 'lib/lernen/algorithm/lstar/lstar_learner.rb', line 24

def initialize(alphabet, sul, automaton_type:, cex_processing: :binary)
  super()

  @alphabet = alphabet.dup

  @table = ObservationTable.new(@alphabet, sul, automaton_type:, cex_processing:)
end

Instance Method Details

#add_alphabet(input) ⇒ Object



43
44
45
# File 'lib/lernen/algorithm/lstar/lstar_learner.rb', line 43

def add_alphabet(input)
  @alphabet << input
end

#build_hypothesisObject



33
34
35
# File 'lib/lernen/algorithm/lstar/lstar_learner.rb', line 33

def build_hypothesis
  @table.build_hypothesis
end

#refine_hypothesis(cex, hypothesis, state_to_prefix) ⇒ Object



38
39
40
# File 'lib/lernen/algorithm/lstar/lstar_learner.rb', line 38

def refine_hypothesis(cex, hypothesis, state_to_prefix)
  @table.refine_hypothesis(cex, hypothesis, state_to_prefix)
end