Package fr.uga.pddl4j.problem.operator
Class TaskNetwork
java.lang.Object
fr.uga.pddl4j.problem.operator.TaskNetwork
- All Implemented Interfaces:
Serializable
This class implements a task network. This class is used to store compact representation of a task network
in a planning problem. This is the first level of implementation of the interface
TaskNetwork
.- See Also:
- Serialized Form
-
Constructor Summary
ConstructorDescriptionCreate a new not durative task network.TaskNetwork(boolean durative)
Create a new task network.TaskNetwork(TaskNetwork other)
Create a new method from a specified task network.TaskNetwork(List<Integer> tasks, DefaultOrderingConstraintNetwork constraints)
Create a new task network with a set of tasks and a set of orderings constraints.TaskNetwork(List<Integer> tasks, TemporalOrderingConstraintNetwork constraints)
Create a new task network with a set of tasks and a set of temporal orderings constraints. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Decompose a tasks of the network with a specific method.boolean
Returnstrue
if this task network is equal to an object.Returns the after constraints of task network.getAfterConstraints(int task)
Returns the condition that must hold after a specific task of the task network.Returns the before constraints of task network.getBeforeConstraints(int task)
Returns the condition that must hold before a specific task of the task network.Returns the between constraints of task network.getBetweenConstraints(int task1, int task2)
Returns the condition that must hold between two specific tasks of the task network.Returns the ordering constraints of the method.getTasks()
Returns the tasks of the task network.Returns the list of tasks with no predecessors.Returns the list of tasks with no successors.Returns the temporal ordering constraints of this temporal task network.int
hashCode()
Returns a hash code value for this task network.boolean
Returns if this task network has a consistent ordering constraints network.boolean
Returns if the task network is durative or not.boolean
isEmpty()
Returns if the task network is empty, i.e., contains not tasks.boolean
Returnstrue
if the task network is totally ordered.void
removeTask(int task)
Remove a task for the task network.void
setDurative(boolean durative)
Set the boolean flag to indicate if a task network is durative or not.void
setOrderingConstraints(DefaultOrderingConstraintNetwork constraints)
Sets the new ordering constraints of the method.void
Sets the tasks of the task network.void
Sets the temporal ordering constraints of the temporal task network.int
size()
Returns the size of the task network, i.e., its number of tasks.
-
Constructor Details
-
TaskNetwork
public TaskNetwork()Create a new not durative task network. The list of task is set to an empty set with no ordering constraints. -
TaskNetwork
public TaskNetwork(boolean durative)Create a new task network. The list of task is set to an empty set with no ordering constraints.- Parameters:
durative
- the flag to indicate if the task network is durative or not.
-
TaskNetwork
Create a new method from a specified task network. This constructor create a deep copy of the specified task network.- Parameters:
other
- the other task network.
-
TaskNetwork
Create a new task network with a set of tasks and a set of orderings constraints. The transitive closure on the ordering constraints is done by the constructor. Moreover, if the ordering constraints specified a totally ordered set of tasks. The list of tasks of the task network are ordered to reflect this implicit order. Warning, the constructor does not check that the ordering constraints are not cyclic.- Parameters:
tasks
- the tasks of the task network.constraints
- the orderings constraints of the task network.
-
TaskNetwork
Create a new task network with a set of tasks and a set of temporal orderings constraints. The transitive closure onthe ordering constraints is done by the constructor.- Parameters:
tasks
- the tasks of the task network.constraints
- the temporal orderings constraints of the task network.
-
-
Method Details
-
getBeforeConstraints
Returns the condition that must hold before a specific task of the task network.- Parameters:
task
- the task.- Returns:
- the condition that must hold before a task or null if the task is not a task of the task network.
-
getBeforeConstraints
Returns the before constraints of task network.- Returns:
- the before constraints of task network.
-
getAfterConstraints
Returns the condition that must hold after a specific task of the task network.- Parameters:
task
- the task.- Returns:
- the condition that must hold after a task or null if the task is not a task of the task network.
-
getAfterConstraints
Returns the after constraints of task network.- Returns:
- the after constraints of task network.
-
getBetweenConstraints
Returns the condition that must hold between two specific tasks of the task network.- Parameters:
task1
- the first task.task2
- the second task.- Returns:
- the condition that must hold between two tasks or null if t1 or t2 task is not a task of the task network.
-
getBetweenConstraints
Returns the between constraints of task network.- Returns:
- the between constraints of task network.
-
size
public final int size()Returns the size of the task network, i.e., its number of tasks.- Returns:
- the size of the task network.
-
getTasks
Returns the tasks of the task network.- Returns:
- the tasks of the task network.
-
setTasks
Sets the tasks of the task network.- Parameters:
tasks
- the tasks to set.
-
isEmpty
public final boolean isEmpty()Returns if the task network is empty, i.e., contains not tasks.- Returns:
true
if the task network is empty,false
otherwise.
-
getOrderingConstraints
Returns the ordering constraints of the method.- Returns:
- the ordering constraints of the method.
-
setOrderingConstraints
Sets the new ordering constraints of the method.- Parameters:
constraints
- the orderings constraints to set
-
getTemporalOrderingConstraints
Returns the temporal ordering constraints of this temporal task network.- Returns:
- the temporal ordering constraints of this temporal task network.
-
setTemporalOrderingConstraints
Sets the temporal ordering constraints of the temporal task network.- Parameters:
constraints
- the temporal ordering constraints to set.
-
isDurative
public boolean isDurative()Returns if the task network is durative or not. If a task network is durative, it means that ordering constraints will use a temporal representation.- Returns:
true
if the task network is durative;false
otherwise.
-
setDurative
public void setDurative(boolean durative)Set the boolean flag to indicate if a task network is durative or not.- Parameters:
durative
-true
if the task network is durative;false
otherwise.
-
decompose
Decompose a tasks of the network with a specific method.- Parameters:
task
- the task to decompose.method
- the method to be used to decompose.
-
removeTask
public final void removeTask(int task)Remove a task for the task network.- Parameters:
task
- the index of the task to remove.
-
isTotallyOrdered
public boolean isTotallyOrdered()Returnstrue
if the task network is totally ordered.- Returns:
true
if the task network is totally ordered;false
otherwise.
-
isConsistent
public final boolean isConsistent()Returns if this task network has a consistent ordering constraints network.- Returns:
true
if this task network has a consistent ordering constraints networks,false
otherwise.
-
getTasksWithNosSuccessors
Returns the list of tasks with no successors. The method works if only if the methodtransitiveClosure()
was previously called.- Returns:
- the list of tasks with no successors.
-
getTasksWithNoPredecessors
Returns the list of tasks with no predecessors. The method works if only if the methodtransitiveClosure()
was previously called.- Returns:
- the list of tasks with no predecessors.
-
equals
Returnstrue
if this task network is equal to an object. This method returnstrue
if the object is a not null instance of the classAbstactTaskNetwork
and both task network have the same set of tasks and before, after and between constraints? -
hashCode
public int hashCode()Returns a hash code value for this task network. This method is supported for the benefit of hash tables such as those provided byjava.util.Hashtable
.
-