Package fr.uga.pddl4j.planners.htn.stn
Class AbstractSTNPlanner
java.lang.Object
fr.uga.pddl4j.planners.AbstractPlanner
fr.uga.pddl4j.planners.htn.AbstractHTNPlanner
fr.uga.pddl4j.planners.htn.stn.AbstractSTNPlanner
- All Implemented Interfaces:
HTNPlanner,STNPlanner,Planner,Serializable,Callable<Integer>
This abstract class implements the common methods of all Simple Task Network planners.
- Since:
- 4.0
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface fr.uga.pddl4j.planners.Planner
Planner.Name -
Field Summary
Fields inherited from interface fr.uga.pddl4j.planners.Planner
DEFAULT_DOMAIN, DEFAULT_LOG_LEVEL, DEFAULT_PROBLEM, DEFAULT_TIME_OUT, DOMAIN_SETTING, LOG_LEVEL_SETTING, PROBLEM_SETTING, TIME_OUT_SETTINGFields inherited from interface fr.uga.pddl4j.planners.htn.stn.STNPlanner
DEFAULT_INTERACTIVE_MODE, INTERACTIVE_MODE_SETTING -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new planner with a default configuration.AbstractSTNPlanner(PlannerConfiguration configuration)Creates a new planner with a specific configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected HierarchyextractHierarchy(AbstractSTNNode node, Problem problem)Extract a hierarchy from a solution node for the specified planning problem.protected PlanextractPlan(AbstractSTNNode node, Problem problem)Extract a plan from a solution node for the specified planning problem.Returns the configuration of the planner.static PlannerConfigurationThis method return the default arguments of the planner.booleanChecks the planner configuration and returns if the configuration is valid.instantiate(DefaultParsedProblem problem)Instantiates the planning problem from a parsed problem.booleanReturns if the planner is in interactive mode.booleanisSupported(Problem problem)Returns if a specified problem is supported by the planner.voidsetConfiguration(PlannerConfiguration configuration)Sets the configuration of the planner.voidsetInteractive(boolean interactive)Sets the planner in the interactive mode.solve()Search a plan for the current planner configuration.protected static voidWait until a key on keyboard is pressed.Methods inherited from class fr.uga.pddl4j.planners.AbstractPlanner
call, getDomain, getDomainFile, getLogLevel, getParser, getParserErrorManager, getProblem, getProblemFile, getStatistics, getTimeout, parse, parse, setDomain, setLogLevel, setProblem, setTimeout, throwInvalidConfigurationExceptionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.uga.pddl4j.planners.Planner
getDomain, getDomainFile, getLogLevel, getParserErrorManager, getProblem, getProblemFile, getStatistics, getTimeout, parse, parse, setDomain, setLogLevel, setProblem, setTimeout, solve
-
Constructor Details
-
AbstractSTNPlanner
public AbstractSTNPlanner()Creates a new planner with a default configuration. -
AbstractSTNPlanner
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:
trueif the planner is in interactive mode;falseotherwise.
-
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
This method return the default arguments of the planner.- Returns:
- the default arguments of the planner.
- See Also:
PlannerConfiguration
-
getConfiguration
Returns the configuration of the planner.- Specified by:
getConfigurationin interfacePlanner- Overrides:
getConfigurationin classAbstractPlanner- Returns:
- the configuration of the planner.
-
setConfiguration
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:
setConfigurationin interfacePlanner- Overrides:
setConfigurationin classAbstractPlanner- Parameters:
configuration- the configuration to set.
-
extractPlan
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
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
Search a plan for the current planner configuration.- Specified by:
solvein interfacePlanner- Overrides:
solvein classAbstractPlanner- 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:
hasValidConfigurationin interfacePlanner- Overrides:
hasValidConfigurationin classAbstractPlanner- Returns:
trueif the configuration is validefalseotherwise.
-
isSupported
Returns if a specified problem is supported by the planner.- Specified by:
isSupportedin interfacePlanner- Parameters:
problem- the problem to test.- Returns:
trueif the problem is supportedfalseotherwise.
-
instantiate
Instantiates the planning problem from a parsed problem.- Specified by:
instantiatein interfacePlanner- 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.
-