Package fr.uga.pddl4j.problem
Class FinalizedProblem
java.lang.Object
fr.uga.pddl4j.problem.AbstractProblem
fr.uga.pddl4j.problem.PreInstantiatedProblem
fr.uga.pddl4j.problem.InstantiatedProblem
fr.uga.pddl4j.problem.PostInstantiatedProblem
fr.uga.pddl4j.problem.FinalizedProblem
- All Implemented Interfaces:
AtomicFormulaSimplifier<Integer>
,Problem
,Serializable
- Direct Known Subclasses:
DefaultProblem
This class contains all the methods needed to post instantiation process of a planning problem. In particular, this
class contains the methods necessary to compactly encode the problem using compact bit set representation.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class fr.uga.pddl4j.problem.AbstractProblem
AbstractProblem.Data
-
Constructor Summary
ConstructorDescriptionFinalizedProblem(DefaultParsedProblem problem)
Creates a new problem from a domain and problem. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Extracts the relevant fluents from the instantiated actions.protected void
extractRelevantFluents(Expression<Integer> exp, Set<Expression<Integer>> fluents)
Extracts the relevant fluents from a specified expression.protected void
Extracts the relevant numeric fluents.protected void
Extract all the relevant task of the problem from the list of primitive and compund tasks of the problem.protected void
Encode a list of specified actions intoBitSet
representation.protected Condition
finalizeCondition(Expression<Integer> exp)
Encode an specifiedExpression
that represents a condition in itsBitExp
representation.protected void
Encode a specified goal in a disjunction ofBitExp
.protected void
Encode the numeric fluent of the initial state.protected void
Encode a specified initial state in it bit compact representation.protected void
Encode the initial task networl into its compact bit set representation.protected void
Encode a list of specified methods into the final compact representation.protected TemporalCondition
Encode an specifiedExpression
that represents a condition in itsBitExp
representation.Returns the list of actions of the problem.Returns the list of instantiated durative actions of the problem.Returns the list of instantiated durative methods of the problem.Returns the list of relevant fluents of the problem.getGoal()
Returns the goal of the problem.Returns the initial state of the problem.Returns the initial task network of the problem.Returns the list of instantiated methods of the problem.Returns the list of relevant numeric fluents of the problem.Returns the relevant operators for the tasks of the problem.getTasks()
The list of relevant tasks of the problem.protected void
Create a map of the relevant numeric fluents with their index to speedup the bit set encoding of the actions.protected void
Creates the map index for the task.protected void
Initializes the map that store for each relevant fluent its index to speedup the bit set encoding of the action.protected void
Init the resolvers for each task.toShortString(AbstractInstantiatedOperator operator)
Returns a short string representation of the specified operator, i.e., its name and its instantiated parameters.Returns a string representation of a hierarchical decomposition of plan.Return a string representation of a search.protected String
toString(AbstractProblem.Data data)
Returns a string representation of the internal data structure used during instantiation process.Returns a string representation of a fluent.toString(InitialState state)
Returns a string representation of a initial state.toString(ArithmeticExpression expression)
Returns a string representation of a numeric expression.toString(NumericAssignment assignment)
Returns a string representation of a numeric assignment.toString(NumericConstraint constraint)
Returns a string representation of a numeric constraints.toString(NumericFluent fluent)
Returns a string representation of a numeric fluent.toString(NumericVariable variable)
Returns a string representation of a numeric variable.Returns a string representation of a specified operator.Returns a string representation of a state.toString(ConditionalEffect effect)
Returns a string representation of a conditional effect.toString(DurativeAction action)
Returns a string representation of a specified operator.toString(DurativeMethod method)
Returns a string representation of the specified method.Returns a string representation of the effect of an action.Returns a string representation of the specified method.toString(TaskNetwork tasknetwork)
Returns a string representation of the specified task network.Returns a string representation of a closed world state.Returns a string representation of a task.toString(TemporalCondition condition)
Returns a string representation of a temporal condition.toString(TemporalConditionalEffect effect)
Returns a string representation of a temporal conditional effect.toString(TemporalEffect effect)
Returns a string representation of a temporal effect.toStringCost(Plan plan)
Return a detailed string representation of a search.Methods inherited from class fr.uga.pddl4j.problem.PostInstantiatedProblem
extractGroundInertia, extractGroundNumericInertia, getGroundInertia, getGroundNumericInertia, simplifyGoalWithGroundInertia, simplifyWithGroundInertia, simplyActionsWithGroundInertia, simplyMethodsWithGroundInertia
Methods inherited from class fr.uga.pddl4j.problem.InstantiatedProblem
getHierarchicalRelevantPrimitiveTasks, getRelevantActions, getRelevantCompoundTasks, getRelevantHierarchicalActions, getRelevantMethods, getRelevantPrimitiveTasks, instantiateActions, instantiateGoal, instantiateInitialTaskNetwork, instantiateMethods
Methods inherited from class fr.uga.pddl4j.problem.PreInstantiatedProblem
createPredicatesTables, extractInertia, extractNumericInertia, getInertia, getNumericInertia, inferTypesFromInertia, printPredicatesTables, simplify, simplifyActionsWithInferredTypes
Methods inherited from class fr.uga.pddl4j.problem.AbstractProblem
finalization, getCompoundTaskSymbols, getConstantSymbols, getDomains, getFunctions, getFunctionSignatures, getIntActions, getIntGoal, getIntInitFunctionCost, getIntInitFunctions, getIntInitialState, getIntInitialTaskNetwork, getIntMethods, getIntTimedFluents, getParsedProblem, getPredicateSignatures, getPredicateSymbols, getPrimitiveTaskSymbols, getRequirements, getTaskSignatures, getTaskSymbols, getTypes, initActions, initCompoundTaskSymbols, initConstants, initEitherTypes, initExpression, initFunctions, initGoal, initialization, initInitialState, initInitialTaskNetwork, initMethods, initPredicates, initPrimitiveTaskSymbols, initRequirements, initTaskNetwork, initTasks, initTypes, instantiate, instantiation, postinstantiation, preinstantiation, setIntInitialTaskNetwork, toShortString, toString, toString, toString, toString, toString, toString, toString
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.problem.Problem
getAcceptedRequirements, isSolvable, isTotallyOrdered
-
Constructor Details
-
FinalizedProblem
Creates a new problem from a domain and problem.- Parameters:
problem
- the problem.
-
-
Method Details
-
getActions
Returns the list of actions of the problem.- Returns:
- the list of actions of the problem.
-
getDurativeActions
Returns the list of instantiated durative actions of the problem.- Returns:
- the list of instantiated durative actions of the problem.
-
getFluents
Returns the list of relevant fluents of the problem.- Returns:
- the list of relevant fluents of the problem.
-
getNumericFluents
Returns the list of relevant numeric fluents of the problem.- Returns:
- the list of relevant numeric fluents of the problem.
-
getInitialState
Returns the initial state of the problem.- Returns:
- the initial state of the problem.
-
getGoal
Returns the goal of the problem.- Returns:
- the goal of the problem.
-
getTaskResolvers
Returns the relevant operators for the tasks of the problem. The method returnnull
if the problem is not hierarchical.Warning a task may have many resolvers event primitives tasks.
The resolvers returned are indexes of operators. To get the list of resolvers of a specific taskt
just write:
Two case must be considered.List<Integer> resolvers = problem.getTaskResolvers().get(t)
- If the task
t
is primitive, i.e.,problem.getTask(t).isPrimtive()
returns true, the list of resolvers contains either indexes of actions either indexes of durative actions. If the index is positive the index represents an action. To get the corresponding action just useproblem.getActions(index)
. If the index is negative the index represents a durative action. To get the corresponding durative action just useproblem.getDurativeActions(-index - 1)
. - Symmetrically, if the task
t
is compound, i.e.,problem.getTask(t).isCompound()
returns true, the list of resolvers contains either indexes of method either indexes of durative methods. If the index is positive the index represents a method. To get the corresponding method just useproblem.getMethods(index)
. If the index is negative the index represents a durative method. To get the corresponding durative method just useproblem.getDurativeMethods(-index - 1)
.
- Returns:
- the relevant operators for a task.
- If the task
-
getInitialTaskNetwork
Returns the initial task network of the problem.- Returns:
- the initial task network of the problem.
-
getTasks
The list of relevant tasks of the problem.- Returns:
- the list of relevant tasks of the problem.
-
getMethods
Returns the list of instantiated methods of the problem.- Returns:
- the list of instantiated methods of the problem.
-
getDurativeMethods
Returns the list of instantiated durative methods of the problem.- Returns:
- the list of instantiated durative methods of the problem.
-
extractRelevantFluents
protected void extractRelevantFluents()Extracts the relevant fluents from the instantiated actions. A fluents is relevant if and only if:- 1. it is an initial fact and not a negative ground inertia, or if
- 2. it is not an initial fact and not a positive ground inertia.
-
extractRelevantFluents
Extracts the relevant fluents from a specified expression. A fluent is relevant if and only if:- 1. it is an initial fluent and not a negative ground inertia, or if
- 2. it is not an initial fact and not a positive ground inertia.
- Parameters:
exp
- the expression.fluents
- the set of relevant fluents.
-
extractRelevantNumericFluents
protected void extractRelevantNumericFluents()Extracts the relevant numeric fluents. -
initOfMapFluentIndex
protected void initOfMapFluentIndex()Initializes the map that store for each relevant fluent its index to speedup the bit set encoding of the action. -
initMapOfNumericFluentIndex
protected void initMapOfNumericFluentIndex()Create a map of the relevant numeric fluents with their index to speedup the bit set encoding of the actions. -
finalizeActions
Encode a list of specified actions intoBitSet
representation. Several specified map is used to speed-up the search by mapping the an expression to this index.- Throws:
UnexpectedExpressionException
-
finalizeGoal
protected void finalizeGoal()Encode a specified goal in a disjunction ofBitExp
. The specified map is used to speed-up the search by mapping an expression to this index. The goal of the problem is set to null if it can be simplified to false. -
finalizeCondition
protected Condition finalizeCondition(Expression<Integer> exp) throws UnexpectedExpressionExceptionEncode an specifiedExpression
that represents a condition in itsBitExp
representation. The map of fluent index is used to speed-up the encoding.- Parameters:
exp
- theExpression
.- Returns:
- the condition encoded.
- Throws:
UnexpectedExpressionException
-
finalizeTimeCondition
protected TemporalCondition finalizeTimeCondition(Expression<Integer> exp) throws UnexpectedExpressionExceptionEncode an specifiedExpression
that represents a condition in itsBitExp
representation. The map of fluent index is used to speed-up the encoding.- Parameters:
exp
- theExpression
.- Returns:
- the condition encoded.
- Throws:
UnexpectedExpressionException
-
finalizeInitialState
protected void finalizeInitialState()Encode a specified initial state in it bit compact representation. The map of the fluent index is used to speedup the encoding. -
finalizeInitialNumericFluent
protected void finalizeInitialNumericFluent()Encode the numeric fluent of the initial state. -
toString
Returns a string representation of a specified operator.- Parameters:
action
- the action.- Returns:
- a string representation of the specified operator.
-
toString
Returns a string representation of a specified operator.- Parameters:
action
- the action.- Returns:
- a string representation of the specified operator.
-
toString
Returns a string representation of a state.- Parameters:
state
- the state.- Returns:
- a string representation of the state.
-
toString
Returns a string representation of a temporal condition.- Parameters:
condition
- the condition.- Returns:
- a string representation of the specified temporal condition.
-
toString
Returns a string representation of a conditional effect.- Parameters:
effect
- the conditional effect.- Returns:
- a string representation of the specified condition effect.
-
toString
Returns a string representation of a temporal conditional effect.- Parameters:
effect
- the temporal conditional effect.- Returns:
- a string representation of the specified temporal condition effect.
-
toString
Returns a string representation of the effect of an action.- Parameters:
effect
- the effect.- Returns:
- a string representation of the effect.
-
toString
Returns a string representation of a temporal effect.- Parameters:
effect
- the effect.- Returns:
- a string representation of the effect.
-
toString
Returns a string representation of a numeric assignment.- Parameters:
assignment
- the assignment.- Returns:
- a string representation of a numeric assignment.
-
toString
Returns a string representation of a closed world state.- Parameters:
state
- the state.- Returns:
- a string representation of the specified expression.
-
toString
Returns a string representation of a initial state.- Parameters:
state
- the state.- Returns:
- a string representation of the specified expression.
-
toString
Returns a string representation of a fluent.- Parameters:
fluent
- the fluent.- Returns:
- a string representation of the specified fluent.
-
toString
Returns a string representation of a numeric fluent.- Parameters:
fluent
- the numeric fluent.- Returns:
- a string representation of the specified numeric fluent.
-
toString
Returns a string representation of a numeric variable.- Parameters:
variable
- the numeric variable.- Returns:
- a string representation of the specified numeric variable.
-
toString
Return a string representation of a search.- Parameters:
plan
- the search.- Returns:
- a string representation of the specified search.
-
toString
Returns a string representation of the specified method.- Parameters:
method
- the method.- Returns:
- a string representation of the specified method.
-
toString
Returns a string representation of the specified method.- Parameters:
method
- the method.- Returns:
- a string representation of the specified method.
-
toString
Returns a string representation of the specified task network.- Parameters:
tasknetwork
- the task network.- Returns:
- a string representation of the specified task network.
-
toString
Returns a string representation of a task.- Parameters:
task
- the formula.- Returns:
- a string representation of the specified expression.
-
toString
Returns a string representation of a hierarchical decomposition of plan.- Parameters:
hierarchy
- the hierarchical decomposition to convert into string represention.- Returns:
- the string representation of the he hierarchical decomposition in parameter.
-
toString
Returns a string representation of a numeric constraints.- Parameters:
constraint
- the numeric constraints.- Returns:
- the string representation of the specified numeric constraint.
-
toString
Returns a string representation of a numeric expression.- Parameters:
expression
- the numeric expression.- Returns:
- the string representation of the specified numeric expression.
-
toString
Returns a string representation of the internal data structure used during instantiation process.- Overrides:
toString
in classPostInstantiatedProblem
- Parameters:
data
- the internal data structure.- Returns:
- a string representation of the internal data structure used during instantiation process.
-
toShortString
Returns a short string representation of the specified operator, i.e., its name and its instantiated parameters. This method can be used for actions and methods.- Parameters:
operator
- the operator.- Returns:
- a string representation of the specified operator.
-
toStringCost
Return a detailed string representation of a search. Not compatible with VAL.- Parameters:
plan
- the search.- Returns:
- a string representation of the specified search.
-
extractRelevantTasks
protected void extractRelevantTasks()Extract all the relevant task of the problem from the list of primitive and compund tasks of the problem. -
initMapOfTaskIndex
protected void initMapOfTaskIndex()Creates the map index for the task. -
initTaskResolvers
protected void initTaskResolvers()Init the resolvers for each task. -
finalizeInitialTaskNetwork
protected void finalizeInitialTaskNetwork()Encode the initial task networl into its compact bit set representation. -
finalizeMethods
protected void finalizeMethods()Encode a list of specified methods into the final compact representation. Several specified maps are used to speed-up the search by mapping an expression to this index.
-