Package fr.uga.pddl4j.problem.operator
Class DefaultOrderingConstraintNetwork
java.lang.Object
fr.uga.pddl4j.problem.operator.AbstractOrderingConstraintNetwork
fr.uga.pddl4j.problem.operator.DefaultOrderingConstraintNetwork
- All Implemented Interfaces:
OrderingConstraintNetwork
,Serializable
This class implements a set orderings constraints between tasks.
- See Also:
- Serialized Form
-
Constructor Summary
ConstructorDescriptionDefaultOrderingConstraintNetwork(int size)
Creates a new ordering constraint network.Creates a deep copy from an others ordering constraint network. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear(int task1, int task2)
Removes the ordering constraints between two specified tasks.boolean
getTaskOrderedAfter(int task)
Returns a bit vector of the tasks ordered after a specified task.Returns the list of tasks with no predecessors.Returns the list of tasks with no successors.int
hashCode()
boolean
Returns if this ordering constraint network is consistent .boolean
Returnstrue
if the orderings constraints network is totally ordered.void
removeTask(int task)
Remove a task of the ordering constraints network.void
resize(int newSize)
Resize the ordering constraints network.void
set(int task1, int task2)
Sets an ordering constraints between two specified tasks.int
size()
Returns the size of the ordering constraints network, i.e., its number of tasks.Returns a string representation of the ordering constraints network based on bit representation.toString()
Returns a string representation of this ordering constraints.void
Compute the transitive closure of the ordering constraints.
-
Constructor Details
-
DefaultOrderingConstraintNetwork
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()Returnstrue
if the orderings constraints network is totally ordered.- Returns:
true
if the ordering constraints network is totally ordered;false
otherwise.
-
getTasksWithNoSuccessors
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.
-
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
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
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
-
hashCode
public int hashCode() -
toString
Returns a string representation of this ordering constraints.
-