Class PlanningFailureException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.tnsai.exceptions.TnsAIException
com.tnsai.planning.PlanningFailureException
All Implemented Interfaces:
Serializable

public final class PlanningFailureException extends com.tnsai.exceptions.TnsAIException
Typed failure raised when planning cannot produce a plan for an unsatisfied goal, or when a produced plan stops holding while it executes.

An empty plan from Planner.plan(java.util.Map) means every goal was already satisfied. Anything else is a failure and arrives here, so a caller cannot mistake "nothing to do" for "the planner gave up".

reason() separates the four ways planning ends without a plan: the goal is simply PlanningFailureException.Reason.UNREACHABLE, the precondition graph is cyclic, the depth budget ran out, or the bounded search budget did. goalName() and maxDepth() are always populated on the exception that escapes the planner; actionName() and precondition() carry the action-level detail when the failure happened inside precondition search.

Two reasons are raised after planning rather than during it, because a plan that no longer holds is a planning failure and travels on this same channel. PlanningFailureException.Reason.PRECONDITION_STALE reports a step whose precondition had stopped holding by the time execution reached it, with actionName() and precondition() naming the refused step. PlanningFailureException.Reason.GOAL_UNSATISFIED_AFTER_EXECUTION reports a goal the plan set out to establish and the executed bodies did not, with goalName() naming it — the first such goal the planner's own ordering yields, which for BackwardChainingPlanner is the highest-priority one.

See Also: