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_SETTING
Fields inherited from interface fr.uga.pddl4j.planners.htn.stn.STNPlanner
DEFAULT_INTERACTIVE_MODE, INTERACTIVE_MODE_SETTING
-
Constructor Summary
ConstructorDescriptionCreates a new planner with a default configuration.AbstractSTNPlanner(PlannerConfiguration configuration)
Creates a new planner with a specific configuration. -
Method Summary
Modifier and TypeMethodDescriptionprotected Hierarchy
extractHierarchy(AbstractSTNNode node, Problem problem)
Extract a hierarchy from a solution node for the specified planning problem.protected Plan
extractPlan(AbstractSTNNode node, Problem problem)
Extract a plan from a solution node for the specified planning problem.Returns the configuration of the planner.static PlannerConfiguration
This method return the default arguments of the planner.boolean
Checks the planner configuration and returns if the configuration is valid.instantiate(DefaultParsedProblem problem)
Instantiates the planning problem from a parsed problem.boolean
Returns if the planner is in interactive mode.boolean
isSupported(Problem problem)
Returns if a specified problem is supported by the planner.void
setConfiguration(PlannerConfiguration configuration)
Sets the configuration of the planner.void
setInteractive(boolean interactive)
Sets the planner in the interactive mode.solve()
Search a plan for the current planner configuration.protected static void
Wait 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, throwInvalidConfigurationException
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
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
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:
getConfiguration
in interfacePlanner
- Overrides:
getConfiguration
in 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:
setConfiguration
in interfacePlanner
- Overrides:
setConfiguration
in 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:
solve
in interfacePlanner
- Overrides:
solve
in 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:
hasValidConfiguration
in interfacePlanner
- Overrides:
hasValidConfiguration
in classAbstractPlanner
- Returns:
true
if the configuration is validefalse
otherwise.
-
isSupported
Returns if a specified problem is supported by the planner.- Specified by:
isSupported
in interfacePlanner
- Parameters:
problem
- the problem to test.- Returns:
true
if the problem is supportedfalse
otherwise.
-
instantiate
Instantiates the planning problem from a parsed problem.- Specified by:
instantiate
in 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.
-