Class: Longjing::FF::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/longjing/ff/action.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action) ⇒ Action

Returns a new instance of Action.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/longjing/ff/action.rb', line 8

def initialize(action)
  @action = action
  @pre = []
  @add = []
  @del = []
  @action.precond.to_a.each do |lit|
    if lit.ff_neg_goal || !lit.is_a?(PDDL::Not)
      @pre << lit
    end
  end

  @action.effect.to_a.each do |lit|
    if lit.ff_neg_goal || !lit.is_a?(PDDL::Not)
      @add << lit
    else
      @del << lit.literal
    end
  end
  @count_target = @pre.size
  @hash = self.object_id
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



5
6
7
# File 'lib/longjing/ff/action.rb', line 5

def action
  @action
end

#addObject (readonly)

Returns the value of attribute add.



6
7
8
# File 'lib/longjing/ff/action.rb', line 6

def add
  @add
end

#count_targetObject (readonly)

Returns the value of attribute count_target.



5
6
7
# File 'lib/longjing/ff/action.rb', line 5

def count_target
  @count_target
end

#counterObject

Returns the value of attribute counter.



4
5
6
# File 'lib/longjing/ff/action.rb', line 4

def counter
  @counter
end

#delObject (readonly)

Returns the value of attribute del.



6
7
8
# File 'lib/longjing/ff/action.rb', line 6

def del
  @del
end

#difficultyObject

Returns the value of attribute difficulty.



4
5
6
# File 'lib/longjing/ff/action.rb', line 4

def difficulty
  @difficulty
end

#hashObject (readonly)

Returns the value of attribute hash.



5
6
7
# File 'lib/longjing/ff/action.rb', line 5

def hash
  @hash
end

#layerObject

Returns the value of attribute layer.



4
5
6
# File 'lib/longjing/ff/action.rb', line 4

def layer
  @layer
end

#preObject (readonly)

Returns the value of attribute pre.



6
7
8
# File 'lib/longjing/ff/action.rb', line 6

def pre
  @pre
end

Instance Method Details

#signatureObject



30
31
32
# File 'lib/longjing/ff/action.rb', line 30

def signature
  @action.signature
end

#to_sObject



34
35
36
# File 'lib/longjing/ff/action.rb', line 34

def to_s
  "Action[#{signature}]"
end