Package org.jacop.search
Class LDS<T extends Var>
java.lang.Object
org.jacop.search.LDS<T>
- Type Parameters:
T- type of variable being used in the search.
- All Implemented Interfaces:
ExitChildListener<T>
Defines functionality of limited discrepancy search. Plugin in this object to
search to change your depth first search into limited discrepancy search.
- Version:
- 4.10
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) ExitChildListener<T>[](package private) int(package private) int(package private) boolean(package private) boolean(package private) boolean -
Constructor Summary
ConstructorsConstructorDescriptionLDS(int maxDiscrepancies) The search will not be allowed to deviate more than maxDiscrepancies times from the heuristic (e.g. -
Method Summary
Modifier and TypeMethodDescriptionbooleanleftChild(PrimitiveConstraint choice, boolean status) It is executed after exiting the left child.booleanIt is executed after exiting the left child.voidrightChild(PrimitiveConstraint choice, boolean status) It is executed after exiting the right child.voidrightChild(T var, int value, boolean status) Exiting the right children requires reduction of the current number of discrepancies being used.voidsetChildrenListeners(ExitChildListener<T> child) It adds one child listener.voidsetChildrenListeners(ExitChildListener<T>[] children) It sets the children listeners for the current listener.
-
Field Details
-
timeOut
boolean timeOut -
noDiscrepancies
int noDiscrepancies -
maxNoDiscrepancies
int maxNoDiscrepancies -
recentExitingLeftChildGoingForDiscrepancy
boolean recentExitingLeftChildGoingForDiscrepancy -
recentExitingRightChild
boolean recentExitingRightChild -
exitChildListeners
ExitChildListener<T extends Var>[] exitChildListeners
-
-
Constructor Details
-
LDS
public LDS(int maxDiscrepancies) The search will not be allowed to deviate more than maxDiscrepancies times from the heuristic (e.g. variable and value ordering) in the search.- Parameters:
maxDiscrepancies- maximal number of discrepancies allowed.
-
-
Method Details
-
leftChild
It is executed after exiting the left child. The parameters specify the variable and value used in the choice point. The parameter status specifies the return code from the child. The return parameter of this function specifies if the search should continue undisturbed or exit the current search node with value false.- Specified by:
leftChildin interfaceExitChildListener<T extends Var>- 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
It is executed after exiting the left child. The parameters specify the choice point. The parameter status specifies the return code from the child. The return parameter of this function specifies if the search should continue undisturbed or exit the current search node with false. If the continuing to the right child will exceed the number of allowed discrepancies then this function will return false so the right child will not be explored.- Specified by:
leftChildin interfaceExitChildListener<T extends Var>- 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
Exiting the right children requires reduction of the current number of discrepancies being used.- Specified by:
rightChildin interfaceExitChildListener<T extends Var>- 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
Description copied from interface:ExitChildListenerIt is executed after exiting the right child.- Specified by:
rightChildin interfaceExitChildListener<T extends Var>- 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
-
setChildrenListeners
Description copied from interface:ExitChildListenerIt sets the children listeners for the current listener.- Specified by:
setChildrenListenersin interfaceExitChildListener<T extends Var>- Parameters:
children- array containing children listeners.
-
setChildrenListeners
Description copied from interface:ExitChildListenerIt adds one child listener.- Specified by:
setChildrenListenersin interfaceExitChildListener<T extends Var>- Parameters:
child- added child listener.
-