Class: Transition
- Inherits:
-
Struct
- Object
- Struct
- Transition
- Defined in:
- lib/repositories/transition_graph.rb,
lib/repositories/transition_graph.rb
Overview
This is a unified concept of a transition. The TransitionGraph has a few utilities to search and infer a transition from other data types ( arrays and hashes for now).
Instance Attribute Summary collapse
-
#from_state ⇒ Object
Returns the value of attribute from_state.
-
#name ⇒ Object
Returns the value of attribute name.
-
#probability ⇒ Object
Returns the value of attribute probability.
-
#reward ⇒ Object
Returns the value of attribute reward.
-
#to_state ⇒ Object
Returns the value of attribute to_state.
Instance Method Summary collapse
Instance Attribute Details
#from_state ⇒ Object
Returns the value of attribute from_state
4 5 6 |
# File 'lib/repositories/transition_graph.rb', line 4 def from_state @from_state end |
#name ⇒ Object
Returns the value of attribute name
4 5 6 |
# File 'lib/repositories/transition_graph.rb', line 4 def name @name end |
#probability ⇒ Object
Returns the value of attribute probability
4 5 6 |
# File 'lib/repositories/transition_graph.rb', line 4 def probability @probability end |
#reward ⇒ Object
Returns the value of attribute reward
4 5 6 |
# File 'lib/repositories/transition_graph.rb', line 4 def reward @reward end |
#to_state ⇒ Object
Returns the value of attribute to_state
4 5 6 |
# File 'lib/repositories/transition_graph.rb', line 4 def to_state @to_state end |
Instance Method Details
#update(obj) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/repositories/transition_graph.rb', line 6 def update(obj) case obj when Numeric if obj >= 0 and obj <= 1 self.probability = obj else self.reward = obj end when Hash self.probability = obj[:probability] if obj[:probability] self.reward = obj[:reward] if obj[:reward] else self.reward = obj end end |