Class DefaultOrderingConstraintNetwork

java.lang.Object
fr.uga.pddl4j.problem.operator.AbstractOrderingConstraintNetwork
fr.uga.pddl4j.problem.operator.DefaultOrderingConstraintNetwork
All Implemented Interfaces:
OrderingConstraintNetwork, Serializable

public class DefaultOrderingConstraintNetwork extends AbstractOrderingConstraintNetwork
This class implements a set orderings constraints between tasks.
See Also:
Serialized Form
  • Constructor Details

    • DefaultOrderingConstraintNetwork

      public DefaultOrderingConstraintNetwork(DefaultOrderingConstraintNetwork other)
      Creates a deep copy from an others ordering constraint network.
      Parameters:
      other - The other ordering constraints.
    • DefaultOrderingConstraintNetwork

      public DefaultOrderingConstraintNetwork(int size)
      Creates a new ordering constraint network.
      Parameters:
      size - the number of tasks of ordering constraint network.
  • Method Details

    • isTotallyOrdered

      public final boolean isTotallyOrdered()
      Returns true if the orderings constraints network is totally ordered.
      Returns:
      true if the ordering constraints network is totally ordered; false otherwise.
    • getTasksWithNoSuccessors

      public final List<Integer> getTasksWithNoSuccessors()
      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 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.
    • isConsistent

      public final boolean isConsistent()
      Returns if this ordering constraint network is consistent .
      Returns:
      true if the ordering constraints network is consistent, false otherwise.
    • transitiveClosure

      public final void transitiveClosure()
      Compute the transitive closure of the ordering constraints. The computation of the transitive closure is based on Warshall algorithm. The complexity is O(n^3) where n is the number of tasks of the task network.
      See Also:
      SquareBitMatrix
    • set

      public void set(int task1, int task2)
      Sets an ordering constraints between two specified tasks.
      Parameters:
      task1 - the first task.
      task2 - the second task.
    • clear

      public void clear(int task1, int task2)
      Removes the ordering constraints between two specified tasks.
      Parameters:
      task1 - the first task.
      task2 - the second task.
    • getTaskOrderedAfter

      public BitVector getTaskOrderedAfter(int task)
      Returns a bit vector of the tasks ordered after a specified task.
      Parameters:
      task - the task.
      Returns:
      a bit vector of the tasks ordered after a specified task.
    • resize

      public void resize(int newSize)
      Resize the ordering constraints network.
      Parameters:
      newSize - the new size.
    • size

      public int size()
      Returns the size of the ordering constraints network, i.e., its number of tasks.
      Returns:
      the size of the ordering constraints network, i.e., its number of tasks.
    • toBitString

      public String toBitString()
      Returns a string representation of the ordering constraints network based on bit representation.
      Returns:
      a string representation of the ordering constraints network based on bit representation.
    • removeTask

      public void removeTask(int task)
      Remove a task of the ordering constraints network.
      Parameters:
      task - the task to removed.
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public final String toString()
      Returns a string representation of this ordering constraints.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the ordering constraints.