Package fr.uga.pddl4j.parser
Class DefaultParsedProblem
java.lang.Object
fr.uga.pddl4j.parser.DefaultParsedProblem
- All Implemented Interfaces:
ParsedDomain
,ParsedProblem
,Serializable
This class implements a parsed problem. This object is returned by the parser after parsing.
- See Also:
- Serialized Form
-
Constructor Summary
ConstructorDescriptionDefaultParsedProblem(ParsedDomain domain, ParsedProblem problem)
Creates a new parsed problem from a specific domain and problem.DefaultParsedProblem(Symbol<String> domain)
Creates a new parsed problem with a specific problemName of domain.DefaultParsedProblem(Symbol<String> problem, Symbol<String> domain)
Creates a new problem with a specific problem and domain. -
Method Summary
Modifier and TypeMethodDescriptionboolean
addAction(ParsedAction action)
Adds an action to the domain.boolean
addConstant(TypedSymbol<String> constant)
Adds a constant to the domain.boolean
addDerivedPredicate(ParsedDerivedPredicate predicate)
Adds a derived predicate to the domain.boolean
addFunction(NamedTypedList function)
Adds a function to the domain.boolean
addInitialFact(Expression<String> fact)
Adds an initial fact to the problem.boolean
addMethod(ParsedMethod method)
Adds a method to the domain.boolean
addObject(TypedSymbol<String> object)
Adds an object to the problem.boolean
addPredicate(NamedTypedList predicate)
Adds a predicate to the domain.boolean
addRequirement(RequireKey requirement)
Adds a requirements to the domain.boolean
addTask(NamedTypedList task)
Adds a task to the domain.boolean
addType(TypedSymbol<String> type)
Adds a type to the domain.boolean
Return if this parsed problem is equal to another specified object.Returns the list of parsed actions.getConstant(Symbol<String> symbol)
Returns the constant from a specified symbol.Returns the parsed constants in the domain file.Returns the constraints loaded in the domain file.Returns the list of parsed derived predicates.Returns the problemName of the domain.Returns the parsed functions in the domain file.getGoal()
Returns the list of goal defined in the problem file.getInit()
Returns the list of initial facts defined in the problem file.Returns the task network of the problem.Returns the list of parsed methods.Returns the metric of the problem ornull
if the problem has no metric specification.Returns the object from a specified symbol.Returns the list of objects declared in the problem file.Returns the parsed predicates in the domain file.Return the problemName of the problem.Returns the set of requirements.getTasks()
Returns the parsed tasks un the domain file.Returns the type from a specified symbol.getTypes()
Returns the parsed types in the domain file.int
hashCode()
Returns the hash code value of this parsed problem.boolean
isDeclaredConstant(Symbol<String> constant)
Returns if a specified constant symbol was declared.boolean
isDeclaredType(Symbol<String> type)
Returns if a specified type symbol was declared.boolean
isSubType(TypedSymbol<String> s1, TypedSymbol<String> s2)
Returns if the types of two typed symbol matched, i.e., if the types of the first typed symbol can be viewed as a subtype of the second.void
Normalize the domain.void
renameTaskIDs(Expression<String> exp)
Renames the tag of the tasks contained in the expression.void
setConstraints(Expression<String> constraints)
Sets the constraints to the domain.void
setDomainName(Symbol<String> name)
Sets a problemName to the domain.void
setGoal(Expression<String> goal)
Set the goal of this problem.void
setInitialTaskNetwork(ParsedTaskNetwork network)
Set the initial task network of the problem.void
setMetric(Expression<String> metric)
Sets the metric of the problem.void
setProblemName(Symbol<String> problemName)
Sets the problemName of the problem.toString()
Returns a string representation of this domain.
-
Constructor Details
-
DefaultParsedProblem
Creates a new parsed problem with a specific problemName of domain.- Parameters:
domain
- the problemName of the domain.
-
DefaultParsedProblem
Creates a new problem with a specific problem and domain.- Parameters:
problem
- the name of the problem.domain
- the name of the domain.
-
DefaultParsedProblem
Creates a new parsed problem from a specific domain and problem.- Parameters:
domain
- the domain.problem
- the problem.
-
-
Method Details
-
getDomainName
Returns the problemName of the domain.- Specified by:
getDomainName
in interfaceParsedDomain
- Specified by:
getDomainName
in interfaceParsedProblem
- Returns:
- the problemName of the domain.
-
setDomainName
Sets a problemName to the domain.- Specified by:
setDomainName
in interfaceParsedDomain
- Specified by:
setDomainName
in interfaceParsedProblem
- Parameters:
name
- the problemName to set.
-
getRequirements
Returns the set of requirements.- Specified by:
getRequirements
in interfaceParsedDomain
- Specified by:
getRequirements
in interfaceParsedProblem
- Returns:
- the set of requirements.
-
addRequirement
Adds a requirements to the domain.- Specified by:
addRequirement
in interfaceParsedDomain
- Specified by:
addRequirement
in interfaceParsedProblem
- Parameters:
requirement
- the requirement to add.- Returns:
true
if the requirement was added;false
otherwise.
-
getTypes
Returns the parsed types in the domain file.- Specified by:
getTypes
in interfaceParsedDomain
- Returns:
- the parsed types in the domain file.
-
addType
Adds a type to the domain.- Specified by:
addType
in interfaceParsedDomain
- Parameters:
type
- the type to add.- Returns:
true
if the type was added;false
otherwise.
-
getConstants
Returns the parsed constants in the domain file.- Specified by:
getConstants
in interfaceParsedDomain
- Returns:
- the parsed constants in the domain file.
-
addConstant
Adds a constant to the domain.- Specified by:
addConstant
in interfaceParsedDomain
- Parameters:
constant
- the constant to add.- Returns:
true
if the constant was added;false
otherwise.
-
getPredicates
Returns the parsed predicates in the domain file.- Specified by:
getPredicates
in interfaceParsedDomain
- Returns:
- the parsed predicates in the domain file.
-
addPredicate
Adds a predicate to the domain.- Specified by:
addPredicate
in interfaceParsedDomain
- Parameters:
predicate
- the predicate to add.- Returns:
true
if the predicate was added;false
otherwise.- Throws:
NullPointerException
- if the specified predicate is null.
-
getFunctions
Returns the parsed functions in the domain file.- Specified by:
getFunctions
in interfaceParsedDomain
- Returns:
- the parsed functions in the domain file.
-
addFunction
Adds a function to the domain.- Specified by:
addFunction
in interfaceParsedDomain
- Parameters:
function
- the function to add.- Returns:
true
if the function was added;false
otherwise.
-
getTasks
Returns the parsed tasks un the domain file.- Specified by:
getTasks
in interfaceParsedDomain
- Returns:
- the parsed tasks in the domain file.
-
addTask
Adds a task to the domain.- Specified by:
addTask
in interfaceParsedDomain
- Parameters:
task
- the task to add.- Returns:
true
if the task was added;false
otherwise.
-
getConstraints
Returns the constraints loaded in the domain file.- Specified by:
getConstraints
in interfaceParsedDomain
- Specified by:
getConstraints
in interfaceParsedProblem
- Returns:
- the constraints loaded in the domain file or null if the domain has no constraints.
-
setConstraints
Sets the constraints to the domain.- Specified by:
setConstraints
in interfaceParsedDomain
- Specified by:
setConstraints
in interfaceParsedProblem
- Parameters:
constraints
- the constraint of the domain.
-
getActions
Returns the list of parsed actions.- Specified by:
getActions
in interfaceParsedDomain
- Returns:
- the list of parsed actions.
-
addAction
Adds an action to the domain.- Specified by:
addAction
in interfaceParsedDomain
- Parameters:
action
- the action to add.- Returns:
true
if the action was added;false
otherwise.
-
getMethods
Returns the list of parsed methods.- Specified by:
getMethods
in interfaceParsedDomain
- Returns:
- the list of parsed methods.
-
addMethod
Adds a method to the domain.- Specified by:
addMethod
in interfaceParsedDomain
- Parameters:
method
- the method to add.- Returns:
true
if the method was added;false
otherwise.
-
getDerivesPredicates
Returns the list of parsed derived predicates.- Specified by:
getDerivesPredicates
in interfaceParsedDomain
- Returns:
- the list of parsed derived predicates.
-
addDerivedPredicate
Adds a derived predicate to the domain.- Specified by:
addDerivedPredicate
in interfaceParsedDomain
- Parameters:
predicate
- the derived predicate to add.- Returns:
true
if the derived predicate was added;false
otherwise.- Throws:
NullPointerException
- if the specified predicate is null.
-
isDeclaredType
Returns if a specified type symbol was declared.- Specified by:
isDeclaredType
in interfaceParsedDomain
- Parameters:
type
- the type symbol.- Returns:
true
if the specified symbol is a declared type;false
otherwise.
-
getType
Returns the type from a specified symbol.- Specified by:
getType
in interfaceParsedDomain
- Parameters:
symbol
- The symbol.- Returns:
- the type from a specified symbol or
null
if no type with this symbol was declared.
-
isDeclaredConstant
Returns if a specified constant symbol was declared.- Specified by:
isDeclaredConstant
in interfaceParsedDomain
- Parameters:
constant
- the constant symbol.- Returns:
true
if the specified symbol is a declared constant;false
otherwise.
-
getConstant
Returns the constant from a specified symbol.- Specified by:
getConstant
in interfaceParsedDomain
- Parameters:
symbol
- The symbol.- Returns:
- the constant from a specified symbol or
null
if no constant with this symbol was declared.
-
getProblemName
Return the problemName of the problem.- Specified by:
getProblemName
in interfaceParsedProblem
- Returns:
- the problemName of the problem.
-
setProblemName
Sets the problemName of the problem.- Specified by:
setProblemName
in interfaceParsedProblem
- Parameters:
problemName
- the problemName to set.
-
getObjects
Returns the list of objects declared in the problem file.- Specified by:
getObjects
in interfaceParsedProblem
- Returns:
- the list of objects declared in the problem file.
-
addObject
Adds an object to the problem.- Specified by:
addObject
in interfaceParsedProblem
- Parameters:
object
- the object to add.- Returns:
true
if the object was added;false
otherwise.
-
setInitialTaskNetwork
Set the initial task network of the problem.- Specified by:
setInitialTaskNetwork
in interfaceParsedProblem
- Parameters:
network
- The task network to set.
-
getInitialTaskNetwork
Returns the task network of the problem.- Specified by:
getInitialTaskNetwork
in interfaceParsedProblem
- Returns:
- the task network of the problem. The task network may null if it is not defined.
-
getInit
Returns the list of initial facts defined in the problem file.- Specified by:
getInit
in interfaceParsedProblem
- Returns:
- the list of initial facts defined in the problem file.
-
addInitialFact
Adds an initial fact to the problem.- Specified by:
addInitialFact
in interfaceParsedProblem
- Parameters:
fact
- the fact to add.- Returns:
true
if the fact was added;false
otherwise.
-
getGoal
Returns the list of goal defined in the problem file.- Specified by:
getGoal
in interfaceParsedProblem
- Returns:
- the list of goal defined in the problem file.
-
setGoal
Set the goal of this problem.- Specified by:
setGoal
in interfaceParsedProblem
- Parameters:
goal
- the goal of this problem.
-
getMetric
Returns the metric of the problem ornull
if the problem has no metric specification.- Specified by:
getMetric
in interfaceParsedProblem
- Returns:
- the metric of the problem or
null
if the problem has no metric specification.
-
setMetric
Sets the metric of the problem.- Specified by:
setMetric
in interfaceParsedProblem
- Parameters:
metric
- the metric to set.
-
getObject
Returns the object from a specified symbol.- Specified by:
getObject
in interfaceParsedProblem
- Parameters:
symbol
- The symbol.- Returns:
- the object from a specified symbol or
null
if no object with this symbol was declared.
-
equals
Return if this parsed problem is equal to another specified object. -
hashCode
public int hashCode()Returns the hash code value of this parsed problem. -
isSubType
Returns if the types of two typed symbol matched, i.e., if the types of the first typed symbol can be viewed as a subtype of the second.- Specified by:
isSubType
in interfaceParsedDomain
- Parameters:
s1
- the first typed symbol.s2
- the second typed symbol.- Returns:
true
if the types of the first typed symbol can be viewed as a subtype of the seconds.false
otherwise.
-
normalize
public void normalize()Normalize the domain. This method rename the variables used in the domain and normalize its actions and derived predicates.- Specified by:
normalize
in interfaceParsedDomain
- Specified by:
normalize
in interfaceParsedProblem
-
renameTaskIDs
Renames the tag of the tasks contained in the expression. The tag tasks renames have the form T0, ..., Tn.- Parameters:
exp
- the expression to rename.
-
toString
Returns a string representation of this domain.- Specified by:
toString
in interfaceParsedDomain
- Specified by:
toString
in interfaceParsedProblem
- Overrides:
toString
in classObject
- Returns:
- a string representation of this domain.
-