|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectJaCoP.search.CreditCalculator<T>
T - type of variable being used in the search.public class CreditCalculator<T extends Var>
Defines functionality of credit search. Plugin in this object into search to change your depth first search into credit search. It has to be plugin as ExitChildListener, TimeOutListener, and Consistency Listener.
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
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.| Method Detail |
|---|
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean executeAfterConsistency(boolean consistent)
executeAfterConsistency in interface ConsistencyListenerconsistent - specifies if the consistency call returned true or false.
public void executedAtTimeOut(int noSolutions)
executedAtTimeOut in interface TimeOutListenernoSolutions - 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 false
public 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 ConsistencyListenerchildren - 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 TimeOutListenerchildren - list of children listeners.public void setChildrenListeners(ConsistencyListener child)
ConsistencyListener
setChildrenListeners in interface ConsistencyListenerchild - 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 TimeOutListenerchild - child listener for this timeout listener.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||