Class TaskNetwork

java.lang.Object
fr.uga.pddl4j.problem.operator.TaskNetwork
All Implemented Interfaces:
Serializable

public class TaskNetwork extends Object implements 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 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

      public TaskNetwork(TaskNetwork other)
      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

      public TaskNetwork(List<Integer> tasks, DefaultOrderingConstraintNetwork constraints)
      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

      public TaskNetwork(List<Integer> tasks, TemporalOrderingConstraintNetwork constraints)
      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

      public Condition getBeforeConstraints(int task)
      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

      protected Map<Integer,​Condition> getBeforeConstraints()
      Returns the before constraints of task network.
      Returns:
      the before constraints of task network.
    • getAfterConstraints

      public Condition getAfterConstraints(int task)
      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

      protected Map<Integer,​Condition> getAfterConstraints()
      Returns the after constraints of task network.
      Returns:
      the after constraints of task network.
    • getBetweenConstraints

      public Condition getBetweenConstraints(int task1, int task2)
      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

      protected Map<Integer,​Map<Integer,​Condition>> 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

      public final List<Integer> getTasks()
      Returns the tasks of the task network.
      Returns:
      the tasks of the task network.
    • setTasks

      public final void setTasks(List<Integer> tasks)
      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

      public final DefaultOrderingConstraintNetwork getOrderingConstraints()
      Returns the ordering constraints of the method.
      Returns:
      the ordering constraints of the method.
    • setOrderingConstraints

      public final void setOrderingConstraints(DefaultOrderingConstraintNetwork constraints)
      Sets the new ordering constraints of the method.
      Parameters:
      constraints - the orderings constraints to set
    • getTemporalOrderingConstraints

      public final TemporalOrderingConstraintNetwork getTemporalOrderingConstraints()
      Returns the temporal ordering constraints of this temporal task network.
      Returns:
      the temporal ordering constraints of this temporal task network.
    • setTemporalOrderingConstraints

      public final void setTemporalOrderingConstraints(TemporalOrderingConstraintNetwork constraints)
      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

      public void decompose(int task, Method method)
      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()
      Returns true 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

      public final List<Integer> getTasksWithNosSuccessors()
      Returns the list of tasks with no successors. The method works if only if the method transitiveClosure() was previously called.
      Returns:
      the list of tasks with no successors.
    • getTasksWithNoPredecessors

      public final List<Integer> getTasksWithNoPredecessors()
      Returns the list of tasks with no predecessors. The method works if only if the method transitiveClosure() was previously called.
      Returns:
      the list of tasks with no predecessors.
    • equals

      public boolean equals(Object obj)
      Returns true if this task network is equal to an object. This method returns true if the object is a not null instance of the class AbstactTaskNetwork and both task network have the same set of tasks and before, after and between constraints?
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to be compared.
      Returns:
      true if this task network is equal to an object; false otherwise.
    • 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 by java.util.Hashtable.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this task network.