Class StepNode

java.lang.Object
edu.uky.ai.planning.pg.Node
edu.uky.ai.planning.pg.StepNode
All Implemented Interfaces:
Comparable<Node>

public class StepNode extends Node
Represents a unique step, or action, in a plan graph. Step nodes have preconditions (literal nodes which must be ture before this step can happen) and effects (literal nodes which become true after this step happens).
Author:
Stephen G. Ware
  • Field Details

    • step

      public final Step step
      The step represented by this node
    • persistence

      public final boolean persistence
      Whether or not this is a dummy persistence step
    • preconditions

      protected final ArrayList<LiteralNode> preconditions
      All literal nodes which must be true before this step can happen
    • effects

      protected final ArrayList<LiteralNode> effects
      All literal nodes which become true after this step happens
  • Constructor Details

    • StepNode

      protected StepNode(PlanGraph graph, Step step)
      Constructs a new step node for the given literal in the given plan graph.
      Parameters:
      graph - the graph in which this node will exist
      step - the step this node represents
    • StepNode

      protected StepNode(PlanGraph graph, Literal literal)
      Constructs a dummy persistence step for a given literal (i.e. a step which has only this literal as a precondition and only this literal as an effect).
      Parameters:
      graph - the graph in which this node will exist
      literal - the literal which is this step's only precondition and effect
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • incrementLiteralCount

      protected void incrementLiteralCount()
      Notifies this step that one of its preconditions has been met.
    • setLevel

      protected boolean setLevel(int level)
      Description copied from class: Node
      Marks this node as having first appeared at the given level.
      Overrides:
      setLevel in class Node
      Parameters:
      level - the index of the level at which this node first appears
      Returns:
      true if this node's level was not previously set, false otherwise
    • reset

      protected void reset()
      Description copied from class: Node
      Resets this node (called when the plan graph is being reset).
      Overrides:
      reset in class Node
    • getPreconditions

      public Iterable<LiteralNode> getPreconditions(int level)
      Returns all literals at the previous level of the plan graph which are preconditions of this step. Note that when this method is called for level n, it returns steps which exist at level n - 1.
      Parameters:
      level - the index of a level in the plan graph at which this node exists
      Returns:
      all literals which exist at the previous level and which are preconditions of this step
      Throws:
      IllegalArgumentException - if this step does not exist at the given level
    • getEffects

      public Iterable<LiteralNode> getEffects(int level)
      Returns all literals at a given level of the plan graph which are effects of this step.
      Parameters:
      level - the index of a level in the plan graph
      Returns:
      all literals which exist at that level and which are effects of this step
      Throws:
      IllegalArgumentException - if this step does not exist at the given level