T
- type of variable being used in the search.public class CreditCalculator<T extends Var> extends Object implements ExitChildListener<T>, TimeOutListener, ConsistencyListener
Constructor and Description |
---|
CreditCalculator(int credit,
int backtracks)
The constructor allows to specify number of credits.
|
CreditCalculator(int credit,
int backtracks,
int maxDepth)
The constructor allows to specify number of credits.
|
Modifier and Type | Method and Description |
---|---|
boolean |
executeAfterConsistency(boolean consistent)
It is executed right after consistency of the current search node.
|
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 the left child.
|
void |
rightChild(PrimitiveConstraint choice,
boolean status)
It is executed after exiting the right child.
|
void |
rightChild(T var,
int value,
boolean status)
Exiting the right children if no credits have been distributed to a right
child involves increasing the number of backtracks occurred.
|
void |
setChildrenListeners(ConsistencyListener child)
Setting one child listener.
|
void |
setChildrenListeners(ConsistencyListener[] children)
Each of the child listeners will be called and the return code from them
will be combined (taken into account) by a parent).
|
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(TimeOutListener child)
It sets child listener for this timeout listener.
|
void |
setChildrenListeners(TimeOutListener[] children)
It sets children listeners for this timeout listener.
|
String |
toString() |
public CreditCalculator(int credit, int backtracks, int maxDepth)
credit
- the number of credits given to a search.backtracks
- the maximum number of allowed backtracks from the node which has no remaining credits.maxDepth
- the maximum depth at which it is still alowed to distribute credits.public CreditCalculator(int credit, int backtracks)
credit
- the number of credits given to a search.backtracks
- the maximum number of allowed backtracks from the node which has no remaining credits.public boolean executeAfterConsistency(boolean consistent)
executeAfterConsistency
in interface ConsistencyListener
consistent
- specifies if the consistency call returned true or false.public void executedAtTimeOut(int noSolutions)
executedAtTimeOut
in interface TimeOutListener
noSolutions
- number of solutions found before the timeout occurred.public boolean leftChild(T var, int value, boolean status)
leftChild
in interface ExitChildListener<T extends Var>
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.public boolean leftChild(PrimitiveConstraint choice, boolean status)
leftChild
in interface ExitChildListener<T extends Var>
choice
- primitive constraint used as the base of the choice point.status
- true if the solution was found in the child subtree, false otherwise.public void rightChild(T var, int value, boolean status)
rightChild
in interface ExitChildListener<T extends Var>
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 falsepublic void rightChild(PrimitiveConstraint choice, boolean status)
ExitChildListener
rightChild
in interface ExitChildListener<T extends Var>
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 falsepublic void setChildrenListeners(ConsistencyListener[] children)
ConsistencyListener
setChildrenListeners
in interface ConsistencyListener
children
- the children listeners attached to this listener.public void setChildrenListeners(ExitChildListener<T>[] children)
ExitChildListener
setChildrenListeners
in interface ExitChildListener<T extends Var>
children
- array containing children listeners.public void setChildrenListeners(TimeOutListener[] children)
TimeOutListener
setChildrenListeners
in interface TimeOutListener
children
- list of children listeners.public void setChildrenListeners(ConsistencyListener child)
ConsistencyListener
setChildrenListeners
in interface ConsistencyListener
child
- the only child listener added to this consistency listener.public void setChildrenListeners(ExitChildListener<T> child)
ExitChildListener
setChildrenListeners
in interface ExitChildListener<T extends Var>
child
- added child listener.public void setChildrenListeners(TimeOutListener child)
TimeOutListener
setChildrenListeners
in interface TimeOutListener
child
- child listener for this timeout listener.Copyright © 2022. All rights reserved.