Class ExploreUtils
java.lang.Object
edu.tufts.hrilab.polycraft.recovery.util.ExploreUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
areActionsEffectivelyEqual
(ActionDBEntry action1, ActionDBEntry action2) checkObjectStatus
(String object) Helper method to get the properties of an object.static Justification
Helper method to submit a goal, and wait for it to terminate.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.static Effect
generateUpdatedPostCondition
(Effect effect, Term discrepancy) Generate a new Effect, based on an existing incorrect Effect, and a discrepancy novelty.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).getDetectedNovelties
(Symbol level) Convenience method to get novelties that have been detected (and reported).static Condition
getExistingCondition
(ParameterizedAction parameterizedAction, Predicate conditionPredicate) static Effect
getExistingEffect
(ParameterizedAction parameterizedAction, Predicate effectPredicate) getObjectsOfType
(Symbol semanticType) Convenience method to query belief for all concrete objects of a particular semantic type.
-
Constructor Details
-
ExploreUtils
public ExploreUtils()
-
-
Method Details
-
checkObjectStatus
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
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
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
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
-
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
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
Convenience method to query belief for all concrete objects of a particular semantic type.- Parameters:
semanticType
-- Returns:
-