Class AbstractSTNPlanner

All Implemented Interfaces:
HTNPlanner, STNPlanner, Planner, Serializable, Callable<Integer>
Direct Known Subclasses:
PFD, TFD

public abstract class AbstractSTNPlanner extends AbstractHTNPlanner implements STNPlanner
This abstract class implements the common methods of all Simple Task Network planners.
Since:
4.0
See Also:
Serialized Form
  • Constructor Details

    • AbstractSTNPlanner

      public AbstractSTNPlanner()
      Creates a new planner with a default configuration.
    • AbstractSTNPlanner

      public AbstractSTNPlanner(PlannerConfiguration configuration)
      Creates a new planner with a specific configuration.
      Parameters:
      configuration - the configuration of the planner.
  • Method Details

    • isInteractive

      public final boolean isInteractive()
      Returns if the planner is in interactive mode.
      Returns:
      true if the planner is in interactive mode; false otherwise.
    • setInteractive

      public final void setInteractive(boolean interactive)
      Sets the planner in the interactive mode.
      Parameters:
      interactive - the flag to indicate if the planner is in interactive mode or not.
    • getDefaultConfiguration

      public static PlannerConfiguration getDefaultConfiguration()
      This method return the default arguments of the planner.
      Returns:
      the default arguments of the planner.
      See Also:
      PlannerConfiguration
    • getConfiguration

      public PlannerConfiguration getConfiguration()
      Returns the configuration of the planner.
      Specified by:
      getConfiguration in interface Planner
      Overrides:
      getConfiguration in class AbstractPlanner
      Returns:
      the configuration of the planner.
    • setConfiguration

      public void setConfiguration(PlannerConfiguration configuration)
      Sets the configuration of the planner. If a planner setting is not defined in the specified configuration, the setting is initialized with its default value.
      Specified by:
      setConfiguration in interface Planner
      Overrides:
      setConfiguration in class AbstractPlanner
      Parameters:
      configuration - the configuration to set.
    • extractPlan

      protected Plan extractPlan(AbstractSTNNode node, Problem problem)
      Extract a plan from a solution node for the specified planning problem.
      Parameters:
      node - the solution node.
      problem - the problem to be solved.
      Returns:
      the solution plan or null is no solution was found.
    • extractHierarchy

      protected Hierarchy extractHierarchy(AbstractSTNNode node, Problem problem)
      Extract a hierarchy from a solution node for the specified planning problem.
      Parameters:
      node - the solution node.
      problem - the problem to be solved.
      Returns:
      the hierarchy of the solution plan.
    • solve

      public Plan solve() throws InvalidConfigurationException
      Search a plan for the current planner configuration.
      Specified by:
      solve in interface Planner
      Overrides:
      solve in class AbstractPlanner
      Returns:
      the solution plan or null is no solution was found.
      Throws:
      InvalidConfigurationException - if the planner has an invalid configuration.
    • hasValidConfiguration

      public boolean hasValidConfiguration()
      Checks the planner configuration and returns if the configuration is valid. A configuration is valid if the timeout allocated to the search is greter than 0.
      Specified by:
      hasValidConfiguration in interface Planner
      Overrides:
      hasValidConfiguration in class AbstractPlanner
      Returns:
      true if the configuration is valide false otherwise.
    • isSupported

      public boolean isSupported(Problem problem)
      Returns if a specified problem is supported by the planner.
      Specified by:
      isSupported in interface Planner
      Parameters:
      problem - the problem to test.
      Returns:
      true if the problem is supported false otherwise.
    • instantiate

      public Problem instantiate(DefaultParsedProblem problem)
      Instantiates the planning problem from a parsed problem.
      Specified by:
      instantiate in interface Planner
      Parameters:
      problem - the problem to instantiate.
      Returns:
      the instantiated planning problem or null if the problem cannot be instantiated.
    • waitPressAnyKey

      protected static void waitPressAnyKey()
      Wait until a key on keyboard is pressed.