Class: Longjing::PDDL::Formula
- Defined in:
- lib/longjing/pddl/literal.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
-
#pred ⇒ Object
readonly
Returns the value of attribute pred.
-
#vars ⇒ Object
readonly
Returns the value of attribute vars.
Attributes inherited from Literal
#ff_goal, #ff_layer, #ff_neg_goal
Instance Method Summary collapse
-
#initialize(pred, vars) ⇒ Formula
constructor
A new instance of Formula.
- #inspect ⇒ Object
- #substitute(variables) ⇒ Object
- #to_s ⇒ Object
Methods inherited from Literal
Constructor Details
#initialize(pred, vars) ⇒ Formula
Returns a new instance of Formula.
82 83 84 85 86 |
# File 'lib/longjing/pddl/literal.rb', line 82 def initialize(pred, vars) @pred = pred @vars = vars @hash = [pred, vars].hash end |
Instance Attribute Details
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
81 82 83 |
# File 'lib/longjing/pddl/literal.rb', line 81 def hash @hash end |
#pred ⇒ Object (readonly)
Returns the value of attribute pred.
81 82 83 |
# File 'lib/longjing/pddl/literal.rb', line 81 def pred @pred end |
#vars ⇒ Object (readonly)
Returns the value of attribute vars.
81 82 83 |
# File 'lib/longjing/pddl/literal.rb', line 81 def vars @vars end |
Instance Method Details
#inspect ⇒ Object
96 97 98 |
# File 'lib/longjing/pddl/literal.rb', line 96 def inspect "(formula #{to_s})" end |
#substitute(variables) ⇒ Object
88 89 90 |
# File 'lib/longjing/pddl/literal.rb', line 88 def substitute(variables) Fact[@pred, @vars.map{|v| variables[v]}] end |
#to_s ⇒ Object
92 93 94 |
# File 'lib/longjing/pddl/literal.rb', line 92 def to_s "(#{[@pred.name, *@vars].join(' ')})" end |