Class ExploreUtils

java.lang.Object
edu.tufts.hrilab.polycraft.recovery.util.ExploreUtils

public class ExploreUtils extends Object
  • Constructor Details

    • ExploreUtils

      public ExploreUtils()
  • Method Details

    • checkObjectStatus

      public static Map<String,Boolean> checkObjectStatus(String object)
      Helper method to get the properties of an object.

      not_present [T/F]: if all other properties are false, this will be true inventory [T/F]: if object is in agent's inventory block [T/F]: if object is in the world (i.e., fluent_equals(world(object), >0)) floating [T/F]: if object type is floating recipe [T/F]: if a craft action to craft the object exists

      Parameters:
      object -
      Returns:
    • doGoal

      public static Justification doGoal(Predicate goalPredicate)
      Helper method to submit a goal, and wait for it to terminate. Note that if a goal with a matching goal predicate is already active, a new goal will not be submitted, and false will be returned.
      Parameters:
      goalPredicate -
      Returns:
      if the goal was successfully executed
    • getActionCost

      public static Double getActionCost(Predicate actionCostQuery, boolean observe)
      Convenience method to retrieve the action cost from Belief (observe==false) or by making a game state observation (observation==true). Returns null if the cost couldn't be found.
    • getDetectedNovelties

      public static Set<Predicate> getDetectedNovelties(Symbol level)
      Convenience method to get novelties that have been detected (and reported).
      Parameters:
      level -
      Returns:
    • getExistingCondition

      public static Condition getExistingCondition(ParameterizedAction parameterizedAction, Predicate conditionPredicate)
    • getExistingEffect

      public static Effect getExistingEffect(ParameterizedAction parameterizedAction, Predicate effectPredicate)
    • areActionsEffectivelyEqual

      public static boolean areActionsEffectivelyEqual(ActionDBEntry action1, ActionDBEntry action2)
    • generateNewPostCondition

      public static Effect generateNewPostCondition(ParameterizedAction parameterizedAction, Term discrepancy)
      Generate a new Effect based on a discrepancy novelty, when there is no existing Effect that has been violated. TODO: generalize arguments in generated Effect (e.g., self -> ?actor, etc)
      Parameters:
      discrepancy -
      Returns:
    • generateUpdatedPostCondition

      public static Effect generateUpdatedPostCondition(Effect effect, Term discrepancy)
      Generate a new Effect, based on an existing incorrect Effect, and a discrepancy novelty. For example, if there's an existing fluent_increase effect, but a different amount has been observed.
      Parameters:
      effect -
      discrepancy -
      Returns:
    • getObjectsOfType

      public static List<Symbol> getObjectsOfType(Symbol semanticType)
      Convenience method to query belief for all concrete objects of a particular semantic type.
      Parameters:
      semanticType -
      Returns: