Class PlanningFailureException
- All Implemented Interfaces:
Serializable
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhy planning ended without a plan. -
Method Summary
Modifier and TypeMethodDescriptionReturns the action the failure concerns: the one whose precondition search failed, or — forPlanningFailureException.Reason.PRECONDITION_STALE— the planned step that was refused.goalName()Returns the unsatisfied goal planning was working on.intmaxDepth()Returns the depth budget in force when planning failed.Returns the precondition the failure concerns: the one being searched when the failure occurred, or — forPlanningFailureException.Reason.PRECONDITION_STALE— the clause that no longer held.reason()Returns why planning ended without a plan.Methods inherited from class com.tnsai.exceptions.TnsAIException
getContext, getErrorCode, getMaxRetryAttempts, getMessage, getSuggestedRetryDelayMs, getThrownAt, isRetryable, wrapMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
reason
Returns why planning ended without a plan.- Returns:
- failure category
-
goalName
Returns the unsatisfied goal planning was working on.- Returns:
- goal name; empty on a failure that never escaped the planner, and
on
PlanningFailureException.Reason.PRECONDITION_STALE, which is raised after planning has already produced a plan and names a step rather than a goal.PlanningFailureException.Reason.GOAL_UNSATISFIED_AFTER_EXECUTIONpopulates it with the goal the plan promised
-
actionName
Returns the action the failure concerns: the one whose precondition search failed, or — forPlanningFailureException.Reason.PRECONDITION_STALE— the planned step that was refused.- Returns:
- action name, empty for a goal-level failure
-
precondition
Returns the precondition the failure concerns: the one being searched when the failure occurred, or — forPlanningFailureException.Reason.PRECONDITION_STALE— the clause that no longer held.- Returns:
- precondition expression, possibly empty
-
maxDepth
public int maxDepth()Returns the depth budget in force when planning failed.- Returns:
- configured max depth;
0for the two execution-time reasons,PlanningFailureException.Reason.PRECONDITION_STALEandPlanningFailureException.Reason.GOAL_UNSATISFIED_AFTER_EXECUTION, which are not raised during search and so have no budget to report
-