Class: Lernen::System::TransitionSystemSimulator

Inherits:
SUL
  • Object
show all
Defined in:
lib/lernen/system/transition_system_simulator.rb

Overview

TransitionSystemSimulator is a system under learning (SUL) using a transition system simulation.

Instance Method Summary collapse

Methods inherited from SUL

#query, #query_last, #stats

Constructor Details

#initialize(automaton, cache: true) ⇒ TransitionSystemSimulator

: (Automaton::TransitionSystem[Conf, In, Out] automaton, ?cache: bool) -> void



16
17
18
19
20
21
# File 'lib/lernen/system/transition_system_simulator.rb', line 16

def initialize(automaton, cache: true)
  super(cache:)

  @automaton = automaton
  @current_conf = nil
end

Instance Method Details

#setupObject



24
25
26
# File 'lib/lernen/system/transition_system_simulator.rb', line 24

def setup
  @current_conf = @automaton.initial_conf
end

#shutdownObject



29
30
31
# File 'lib/lernen/system/transition_system_simulator.rb', line 29

def shutdown
  @current_conf = nil
end

#step(input) ⇒ Object



34
35
36
37
# File 'lib/lernen/system/transition_system_simulator.rb', line 34

def step(input)
  output, @current_conf = @automaton.step(@current_conf, input) # steep:ignore
  output
end