Package fr.uga.pddl4j.planners
Class AbstractPlanner
java.lang.Object
fr.uga.pddl4j.planners.AbstractPlanner
- All Implemented Interfaces:
Planner,Serializable,Callable<Integer>
- Direct Known Subclasses:
AbstractHTNPlanner,AbstractStateSpacePlanner,ASP
This abstract class defines the main methods to access a planner.
- Since:
- 3.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 -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new planner.AbstractPlanner(PlannerConfiguration configuration)Creates a new planner with a specific configuration. -
Method Summary
Modifier and TypeMethodDescriptioncall()This method contains the code called by the main method of the planner when planner are launched from command line.Returns the configuration of the planner.Returns the path to the PDDL domain file.Returns the domain file containing the PDDL domain description.Returns the log of the planner.protected ParserReturns the parser used by the planner to parse PDDL domain and problem files.Returns the parser error manager to get the messages generated while parsing.Returns the path to the PDDL problem description.Returns the problem file containing the PDDL problem description.Returns the statistics of the planner.intReturns the timeout of the planner.booleanChecks the planner configuration and returns if the configuration is valid.parse()Parses the domain and the problem description using the configuration of the planner.Parses the domain and the problem description from the specified parameters.voidsetConfiguration(PlannerConfiguration configuration)Sets the configuration of the planner.voidSets the domain of the planner.voidsetLogLevel(LogLevel log)Sets the log level of the planner.voidsetProblem(String problem)Sets the path to the PDDL problem description.voidsetTimeout(int timeout)Sets the timeout of the planner.solve()Solves the problem as defined by the planner configuration.protected voidThrows aInvalidPlannerConfigurationExceptionwith the appropriated message or do nothing if the planner has a valid configuration.Methods 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
instantiate, isSupported, solve
-
Constructor Details
-
AbstractPlanner
public AbstractPlanner()Creates a new planner. -
AbstractPlanner
Creates a new planner with a specific configuration.- Parameters:
configuration- the configuration of the planner.
-
-
Method Details
-
setDomain
Sets the domain of the planner. -
getDomain
Returns the path to the PDDL domain file. -
getDomainFile
Returns the domain file containing the PDDL domain description.- Specified by:
getDomainFilein interfacePlanner- Returns:
- the domain file containing the PDDL domain description or null if the domain is not initialized.
-
setProblem
Sets the path to the PDDL problem description.- Specified by:
setProblemin interfacePlanner- Parameters:
problem- the path to the PDDL problem description.
-
getProblem
Returns the path to the PDDL problem description.- Specified by:
getProblemin interfacePlanner- Returns:
- the path to the PDDL problem description or null if the problem is not initialized.
-
getProblemFile
Returns the problem file containing the PDDL problem description.- Specified by:
getProblemFilein interfacePlanner- Returns:
- the problem file containing the PDDL problem description or null if the problem is not initialized.
-
setLogLevel
Sets the log level of the planner.- Specified by:
setLogLevelin interfacePlanner- Parameters:
log- the log of the planner.- See Also:
Level
-
getLogLevel
Returns the log of the planner.- Specified by:
getLogLevelin interfacePlanner- Returns:
- the trace level declared of the planner.
- See Also:
Level
-
setTimeout
public final void setTimeout(int timeout)Sets the timeout of the planner.- Specified by:
setTimeoutin interfacePlanner- Parameters:
timeout- to use by the planner in second. The timeout must greater than 0.- Throws:
IllegalArgumentException- if the timeout is strictly less than 0.
-
getTimeout
public final int getTimeout()Returns the timeout of the planner.- Specified by:
getTimeoutin interfacePlanner- Returns:
- the timeout of the planner
-
parse
Parses the domain and the problem description from the specified parameters.- Specified by:
parsein interfacePlanner- Parameters:
domain- the path to the PDDL domain file.problem- the path to the PDDL problem file.- Returns:
- the problem parsed.
- Throws:
FileNotFoundException- if the domain or the problem file was not found.IOException- if an error occur during parsing.
-
parse
Parses the domain and the problem description using the configuration of the planner.- Specified by:
parsein interfacePlanner- Returns:
- the problem parsed.
- Throws:
FileNotFoundException- if the domain or the problem file was not found.IOException- if an error occur during parsing.
-
getParserErrorManager
Description copied from interface:PlannerReturns the parser error manager to get the messages generated while parsing.- Specified by:
getParserErrorManagerin interfacePlanner- Returns:
- the parser error manger.
-
hasValidConfiguration
public boolean hasValidConfiguration()Checks the planner configuration and returns if the configuration is valid. A configuration is valid if (1) the domain and the problem files exist and can be read and (2) the timeout is greater than 0.- Specified by:
hasValidConfigurationin interfacePlanner- Returns:
trueif the configuration is validfalseotherwise.
-
throwInvalidConfigurationException
Throws aInvalidPlannerConfigurationExceptionwith the appropriated message or do nothing if the planner has a valid configuration.- Throws:
InvalidConfigurationException- if the configuration of the planner is not valid.
-
getConfiguration
Returns the configuration of the planner.- Specified by:
getConfigurationin interfacePlanner- 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- Parameters:
configuration- the configuration to set.
-
getParser
Returns the parser used by the planner to parse PDDL domain and problem files.- Returns:
- the parser used by the planner.
-
getStatistics
Returns the statistics of the planner.- Specified by:
getStatisticsin interfacePlanner- Returns:
- the statistics of the planner or null if no problem was solved.
- See Also:
Statistics
-
solve
Solves the problem as defined by the planner configuration.- Specified by:
solvein interfacePlanner- Returns:
- the solution plan found or null is no solution was found.
- Throws:
InvalidConfigurationException- if the planner configuration is invalid.
-
call
This method contains the code called by the main method of the planner when planner are launched from command line.
-