Package org.jacop.search
Class NoGoodsCollector<T extends IntVar>
- java.lang.Object
-
- org.jacop.search.NoGoodsCollector<T>
-
- All Implemented Interfaces:
ExitChildListener<T>
,ExitListener
,TimeOutListener
public class NoGoodsCollector<T extends IntVar> extends java.lang.Object implements ExitChildListener<T>, TimeOutListener, ExitListener
NoGoodCollector collects no-goods from search when timeout has occurred. As time-out is executed the search will exit from deeper search levels and no-goods collector will collect neccessary information to create no-goods when finally exiting the search. The no-goods will be immmediately imposed when collector is informed about exiting the search.- Version:
- 4.8
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ExitChildListener<T>[]
exitChildListeners
(package private) ExitListener[]
exitListeners
(package private) java.util.List<java.util.List<java.lang.Integer>>
noGoodsValues
(package private) java.util.List<java.util.List<T>>
noGoodsVariables
boolean
timeOut
It specifies if the timeout has occurred and search is being terminated.(package private) TimeOutListener[]
timeOutListeners
-
Constructor Summary
Constructors Constructor Description NoGoodsCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
executedAtExit(Store store, int solutionsNo)
It is executed right after time out is determined.void
executedAtTimeOut(int noSolutions)
It is executed right after time out is determined.boolean
leftChild(PrimitiveConstraint choice, boolean status)
It is executed after exiting the left child.boolean
leftChild(T var, int value, boolean status)
It is executed after exiting left child.void
rightChild(PrimitiveConstraint choice, boolean status)
It is executed after exiting the right child.void
rightChild(T var, int value, boolean status)
It is executed after exiting the right child.void
setChildrenListeners(ExitChildListener<T> child)
It adds one child listener.void
setChildrenListeners(ExitChildListener<T>[] children)
It sets the children listeners for the current listener.void
setChildrenListeners(ExitListener child)
It sets one child listener.void
setChildrenListeners(ExitListener[] children)
It sets the children of this exit listener.void
setChildrenListeners(TimeOutListener child)
It sets child listener for this timeout listener.void
setChildrenListeners(TimeOutListener[] children)
It sets children listeners for this timeout listener.java.lang.String
toString()
-
-
-
Field Detail
-
noGoodsValues
java.util.List<java.util.List<java.lang.Integer>> noGoodsValues
-
timeOut
public boolean timeOut
It specifies if the timeout has occurred and search is being terminated.
-
exitChildListeners
ExitChildListener<T extends IntVar>[] exitChildListeners
-
timeOutListeners
TimeOutListener[] timeOutListeners
-
exitListeners
ExitListener[] exitListeners
-
-
Method Detail
-
executedAtTimeOut
public void executedAtTimeOut(int noSolutions)
It is executed right after time out is determined.- Specified by:
executedAtTimeOut
in interfaceTimeOutListener
- Parameters:
noSolutions
- number of solutions found before the timeout occurred.
-
leftChild
public boolean leftChild(T var, int value, boolean status)
It is executed after exiting left child. Status specifies if the solution is found or not. The return parameter specifies if the search should continue according to its course or be forced to exit the parent node of the left child.- Specified by:
leftChild
in interfaceExitChildListener<T extends IntVar>
- Parameters:
var
- variable used in the choice point.value
- value used in the choice point.status
- true if the solution was found in the child subtree, false otherwise.- Returns:
- true if the search should continue undisturbed, false if it should exit the current node with false
-
leftChild
public boolean leftChild(PrimitiveConstraint choice, boolean status)
Description copied from interface:ExitChildListener
It is executed after exiting the left child.- Specified by:
leftChild
in interfaceExitChildListener<T extends IntVar>
- Parameters:
choice
- primitive constraint used as the base of the choice point.status
- true if the solution was found in the child subtree, false otherwise.- Returns:
- true if the search should continue undisturbed to the right node, false if it should exit the current node with false
-
rightChild
public void rightChild(T var, int value, boolean status)
Description copied from interface:ExitChildListener
It is executed after exiting the right child.- Specified by:
rightChild
in interfaceExitChildListener<T extends IntVar>
- Parameters:
var
- variable used in the choice point.value
- value used in the choice point.status
- true if the solution was found in the child subtree, false otherwise. exit the current node with false
-
rightChild
public void rightChild(PrimitiveConstraint choice, boolean status)
Description copied from interface:ExitChildListener
It is executed after exiting the right child.- Specified by:
rightChild
in interfaceExitChildListener<T extends IntVar>
- Parameters:
choice
- primitive constraint used as the base of the choice point.status
- true if the solution was found in the child subtree, false otherwise. exit the current node with false
-
executedAtExit
public void executedAtExit(Store store, int solutionsNo)
Description copied from interface:ExitListener
It is executed right after time out is determined.- Specified by:
executedAtExit
in interfaceExitListener
- Parameters:
store
- store in the context of which the search took place.solutionsNo
- the number of solutions found.
-
setChildrenListeners
public void setChildrenListeners(ExitChildListener<T>[] children)
Description copied from interface:ExitChildListener
It sets the children listeners for the current listener.- Specified by:
setChildrenListeners
in interfaceExitChildListener<T extends IntVar>
- Parameters:
children
- array containing children listeners.
-
setChildrenListeners
public void setChildrenListeners(ExitListener[] children)
Description copied from interface:ExitListener
It sets the children of this exit listener.- Specified by:
setChildrenListeners
in interfaceExitListener
- Parameters:
children
- an array containing the children.
-
setChildrenListeners
public void setChildrenListeners(TimeOutListener[] children)
Description copied from interface:TimeOutListener
It sets children listeners for this timeout listener.- Specified by:
setChildrenListeners
in interfaceTimeOutListener
- Parameters:
children
- list of children listeners.
-
setChildrenListeners
public void setChildrenListeners(TimeOutListener child)
Description copied from interface:TimeOutListener
It sets child listener for this timeout listener.- Specified by:
setChildrenListeners
in interfaceTimeOutListener
- Parameters:
child
- child listener for this timeout listener.
-
setChildrenListeners
public void setChildrenListeners(ExitListener child)
Description copied from interface:ExitListener
It sets one child listener.- Specified by:
setChildrenListeners
in interfaceExitListener
- Parameters:
child
- the only child listener used by this listener.
-
setChildrenListeners
public void setChildrenListeners(ExitChildListener<T> child)
Description copied from interface:ExitChildListener
It adds one child listener.- Specified by:
setChildrenListeners
in interfaceExitChildListener<T extends IntVar>
- Parameters:
child
- added child listener.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-