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
ConstructorsConstructorDescriptionDefaultParsedProblem(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 TypeMethodDescriptionbooleanaddAction(ParsedAction action)Adds an action to the domain.booleanaddConstant(TypedSymbol<String> constant)Adds a constant to the domain.booleanaddDerivedPredicate(ParsedDerivedPredicate predicate)Adds a derived predicate to the domain.booleanaddFunction(NamedTypedList function)Adds a function to the domain.booleanaddInitialFact(Expression<String> fact)Adds an initial fact to the problem.booleanaddMethod(ParsedMethod method)Adds a method to the domain.booleanaddObject(TypedSymbol<String> object)Adds an object to the problem.booleanaddPredicate(NamedTypedList predicate)Adds a predicate to the domain.booleanaddRequirement(RequireKey requirement)Adds a requirements to the domain.booleanaddTask(NamedTypedList task)Adds a task to the domain.booleanaddType(TypedSymbol<String> type)Adds a type to the domain.booleanReturn 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 ornullif 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.inthashCode()Returns the hash code value of this parsed problem.booleanisDeclaredConstant(Symbol<String> constant)Returns if a specified constant symbol was declared.booleanisDeclaredType(Symbol<String> type)Returns if a specified type symbol was declared.booleanisSubType(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.voidNormalize the domain.voidrenameTaskIDs(Expression<String> exp)Renames the tag of the tasks contained in the expression.voidsetConstraints(Expression<String> constraints)Sets the constraints to the domain.voidsetDomainName(Symbol<String> name)Sets a problemName to the domain.voidsetGoal(Expression<String> goal)Set the goal of this problem.voidsetInitialTaskNetwork(ParsedTaskNetwork network)Set the initial task network of the problem.voidsetMetric(Expression<String> metric)Sets the metric of the problem.voidsetProblemName(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:
getDomainNamein interfaceParsedDomain- Specified by:
getDomainNamein interfaceParsedProblem- Returns:
- the problemName of the domain.
-
setDomainName
Sets a problemName to the domain.- Specified by:
setDomainNamein interfaceParsedDomain- Specified by:
setDomainNamein interfaceParsedProblem- Parameters:
name- the problemName to set.
-
getRequirements
Returns the set of requirements.- Specified by:
getRequirementsin interfaceParsedDomain- Specified by:
getRequirementsin interfaceParsedProblem- Returns:
- the set of requirements.
-
addRequirement
Adds a requirements to the domain.- Specified by:
addRequirementin interfaceParsedDomain- Specified by:
addRequirementin interfaceParsedProblem- Parameters:
requirement- the requirement to add.- Returns:
trueif the requirement was added;falseotherwise.
-
getTypes
Returns the parsed types in the domain file.- Specified by:
getTypesin interfaceParsedDomain- Returns:
- the parsed types in the domain file.
-
addType
Adds a type to the domain.- Specified by:
addTypein interfaceParsedDomain- Parameters:
type- the type to add.- Returns:
trueif the type was added;falseotherwise.
-
getConstants
Returns the parsed constants in the domain file.- Specified by:
getConstantsin interfaceParsedDomain- Returns:
- the parsed constants in the domain file.
-
addConstant
Adds a constant to the domain.- Specified by:
addConstantin interfaceParsedDomain- Parameters:
constant- the constant to add.- Returns:
trueif the constant was added;falseotherwise.
-
getPredicates
Returns the parsed predicates in the domain file.- Specified by:
getPredicatesin interfaceParsedDomain- Returns:
- the parsed predicates in the domain file.
-
addPredicate
Adds a predicate to the domain.- Specified by:
addPredicatein interfaceParsedDomain- Parameters:
predicate- the predicate to add.- Returns:
trueif the predicate was added;falseotherwise.- Throws:
NullPointerException- if the specified predicate is null.
-
getFunctions
Returns the parsed functions in the domain file.- Specified by:
getFunctionsin interfaceParsedDomain- Returns:
- the parsed functions in the domain file.
-
addFunction
Adds a function to the domain.- Specified by:
addFunctionin interfaceParsedDomain- Parameters:
function- the function to add.- Returns:
trueif the function was added;falseotherwise.
-
getTasks
Returns the parsed tasks un the domain file.- Specified by:
getTasksin interfaceParsedDomain- Returns:
- the parsed tasks in the domain file.
-
addTask
Adds a task to the domain.- Specified by:
addTaskin interfaceParsedDomain- Parameters:
task- the task to add.- Returns:
trueif the task was added;falseotherwise.
-
getConstraints
Returns the constraints loaded in the domain file.- Specified by:
getConstraintsin interfaceParsedDomain- Specified by:
getConstraintsin 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:
setConstraintsin interfaceParsedDomain- Specified by:
setConstraintsin interfaceParsedProblem- Parameters:
constraints- the constraint of the domain.
-
getActions
Returns the list of parsed actions.- Specified by:
getActionsin interfaceParsedDomain- Returns:
- the list of parsed actions.
-
addAction
Adds an action to the domain.- Specified by:
addActionin interfaceParsedDomain- Parameters:
action- the action to add.- Returns:
trueif the action was added;falseotherwise.
-
getMethods
Returns the list of parsed methods.- Specified by:
getMethodsin interfaceParsedDomain- Returns:
- the list of parsed methods.
-
addMethod
Adds a method to the domain.- Specified by:
addMethodin interfaceParsedDomain- Parameters:
method- the method to add.- Returns:
trueif the method was added;falseotherwise.
-
getDerivesPredicates
Returns the list of parsed derived predicates.- Specified by:
getDerivesPredicatesin interfaceParsedDomain- Returns:
- the list of parsed derived predicates.
-
addDerivedPredicate
Adds a derived predicate to the domain.- Specified by:
addDerivedPredicatein interfaceParsedDomain- Parameters:
predicate- the derived predicate to add.- Returns:
trueif the derived predicate was added;falseotherwise.- Throws:
NullPointerException- if the specified predicate is null.
-
isDeclaredType
Returns if a specified type symbol was declared.- Specified by:
isDeclaredTypein interfaceParsedDomain- Parameters:
type- the type symbol.- Returns:
trueif the specified symbol is a declared type;falseotherwise.
-
getType
Returns the type from a specified symbol.- Specified by:
getTypein interfaceParsedDomain- Parameters:
symbol- The symbol.- Returns:
- the type from a specified symbol or
nullif no type with this symbol was declared.
-
isDeclaredConstant
Returns if a specified constant symbol was declared.- Specified by:
isDeclaredConstantin interfaceParsedDomain- Parameters:
constant- the constant symbol.- Returns:
trueif the specified symbol is a declared constant;falseotherwise.
-
getConstant
Returns the constant from a specified symbol.- Specified by:
getConstantin interfaceParsedDomain- Parameters:
symbol- The symbol.- Returns:
- the constant from a specified symbol or
nullif no constant with this symbol was declared.
-
getProblemName
Return the problemName of the problem.- Specified by:
getProblemNamein interfaceParsedProblem- Returns:
- the problemName of the problem.
-
setProblemName
Sets the problemName of the problem.- Specified by:
setProblemNamein interfaceParsedProblem- Parameters:
problemName- the problemName to set.
-
getObjects
Returns the list of objects declared in the problem file.- Specified by:
getObjectsin interfaceParsedProblem- Returns:
- the list of objects declared in the problem file.
-
addObject
Adds an object to the problem.- Specified by:
addObjectin interfaceParsedProblem- Parameters:
object- the object to add.- Returns:
trueif the object was added;falseotherwise.
-
setInitialTaskNetwork
Set the initial task network of the problem.- Specified by:
setInitialTaskNetworkin interfaceParsedProblem- Parameters:
network- The task network to set.
-
getInitialTaskNetwork
Returns the task network of the problem.- Specified by:
getInitialTaskNetworkin 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:
getInitin interfaceParsedProblem- Returns:
- the list of initial facts defined in the problem file.
-
addInitialFact
Adds an initial fact to the problem.- Specified by:
addInitialFactin interfaceParsedProblem- Parameters:
fact- the fact to add.- Returns:
trueif the fact was added;falseotherwise.
-
getGoal
Returns the list of goal defined in the problem file.- Specified by:
getGoalin interfaceParsedProblem- Returns:
- the list of goal defined in the problem file.
-
setGoal
Set the goal of this problem.- Specified by:
setGoalin interfaceParsedProblem- Parameters:
goal- the goal of this problem.
-
getMetric
Returns the metric of the problem ornullif the problem has no metric specification.- Specified by:
getMetricin interfaceParsedProblem- Returns:
- the metric of the problem or
nullif the problem has no metric specification.
-
setMetric
Sets the metric of the problem.- Specified by:
setMetricin interfaceParsedProblem- Parameters:
metric- the metric to set.
-
getObject
Returns the object from a specified symbol.- Specified by:
getObjectin interfaceParsedProblem- Parameters:
symbol- The symbol.- Returns:
- the object from a specified symbol or
nullif 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:
isSubTypein interfaceParsedDomain- Parameters:
s1- the first typed symbol.s2- the second typed symbol.- Returns:
trueif the types of the first typed symbol can be viewed as a subtype of the seconds.falseotherwise.
-
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:
normalizein interfaceParsedDomain- Specified by:
normalizein 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:
toStringin interfaceParsedDomain- Specified by:
toStringin interfaceParsedProblem- Overrides:
toStringin classObject- Returns:
- a string representation of this domain.
-