Class LearningState

java.lang.Object
edu.tufts.hrilab.action.learning.LearningState

public class LearningState extends Object
LearningState is used to store relevant information during learning of a new action (task or skill), including the roles (argument and local variables), action steps, effects (success and failure), conditions (pre and operational), also contains additional information about skills and instructions This class is modified by the ActionLearning class
  • Constructor Details

    • LearningState

      public LearningState(Predicate predicate)
    • LearningState

      public LearningState(Predicate signature, LearningState previousLearningState)
    • LearningState

      public LearningState(ActionDBEntry adbe, Predicate action)
      Generates a new LearningState which is a copy of adbe but with the name from action
      Parameters:
      adbe - ActionDBEntry to clone
      action - signature predicate representing new action
  • Method Details

    • getName

      public String getName()
    • getDescription

      public String getDescription()
    • getPreviousLearningState

      public LearningState getPreviousLearningState()
    • getConditions

      public Set<Condition> getConditions()
    • addCondition

      public void addCondition(Condition toAdd)
    • removeCondition

      public void removeCondition(Condition toRemove)
    • addEffect

      public void addEffect(Effect toAdd)
    • removeEffect

      public void removeEffect(Effect toRemove)
    • getEffects

      public Set<Effect> getEffects()
    • getRoles

      public List<ActionBinding> getRoles()
    • getEventSpecs

      public List<EventSpec> getEventSpecs()
    • addEventSpec

      public String addEventSpec(int index, Predicate p)
      Add EventSpec described by p at index
      Parameters:
      index - index in learning state at which to insert new EventSpec
      p - Predicate description of new Event spec
    • removeEventSpec

      public void removeEventSpec(int index)
    • removeEventSpec

      public void removeEventSpec(int index, String lvToUpdate)
    • removeEventSpecsForLocalVariable

      public void removeEventSpecsForLocalVariable(Symbol lvRef)
    • getEventStepLocation

      public int getEventStepLocation(Predicate reference)
      Helper method to find the action step matching the reference step.
      Parameters:
      reference - predicate defining reference event spec
      Returns:
    • createEventSpec

      public void createEventSpec(Goal g)
      Main entry point method for adding new event specs ot learning state
      Parameters:
      g - goal to generate event spec for
    • getIndexOfConstraint

      public int getIndexOfConstraint(Predicate locationConstraint)
      Parameters:
      locationConstraint - constraint predicate of the form before(X), after(X), and(X,Y)
      Returns:
      index of first step/before or after constraint
    • getIndexGivenConstraints

      public int getIndexGivenConstraints(Predicate location, Predicate modification)
      Parameters:
      location -
      modification -
      Returns:
      index of @modification, constrained by @location
    • generateActionDBEntry

      public void generateActionDBEntry()
      Generates a new ActionDBEntry and adds it to the Database. Iterates through the learning queue and creates events and roles for new action