public class Shaving<T extends IntVar> extends Object implements ExitChildListener<T>, ConsistencyListener
| Modifier and Type | Field and Description |
|---|---|
int |
failures
It stores number of failed shaving attempts.
|
boolean |
onlyFailedConstraint
It specifies if only the last failed constraint is allowed to suggest shaving values.
|
boolean |
onlyIntVarsOfFailedConstraint
It specifies if only variables in the scope of the last failed constraint are
allowed to be used in shaving attempts.
|
boolean |
quickShave
It specifies if the quickShave approach should be also used.
|
int |
successes
It stores number of successful shaving attempts.
|
HashSet<IntVar> |
varsOfFailedConstraint
It stores the variables of the last failed constraints.
|
| Constructor and Description |
|---|
Shaving() |
| Modifier and Type | Method and Description |
|---|---|
void |
addShavingConstraint(Constraint c)
It adds shaving constraint to the list of constraints guiding shaving.
|
boolean |
executeAfterConsistency(boolean consistent)
It is executed right after consistency of the current search node.
|
boolean |
leftChild(IntVar var,
int value,
boolean status)
It is executed after exiting the left child.
|
boolean |
leftChild(PrimitiveConstraint choice,
boolean status)
It is executed after exiting the left child.
|
void |
rightChild(IntVar var,
int value,
boolean status)
It is executed after exiting the right child.
|
void |
rightChild(PrimitiveConstraint choice,
boolean status)
It is executed after exiting the right child.
|
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 child)
It adds one child listener.
|
void |
setChildrenListeners(ExitChildListener[] children)
It sets the children listeners for the current listener.
|
void |
setStore(Store store)
It specifies the constraint store in which context the shaving will take place.
|
public boolean onlyFailedConstraint
public boolean onlyIntVarsOfFailedConstraint
public HashSet<IntVar> varsOfFailedConstraint
public boolean quickShave
public int successes
public int failures
public boolean leftChild(IntVar var, int value, boolean status)
ExitChildListenerleftChild in interface ExitChildListener<T extends IntVar>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)
ExitChildListenerleftChild in interface ExitChildListener<T extends IntVar>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(IntVar var, int value, boolean status)
ExitChildListenerrightChild in interface ExitChildListener<T extends IntVar>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)
ExitChildListenerrightChild in interface ExitChildListener<T extends IntVar>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)
ConsistencyListenersetChildrenListeners in interface ConsistencyListenerchildren - the children listeners attached to this listener.public void setChildrenListeners(ExitChildListener[] children)
ExitChildListenersetChildrenListeners in interface ExitChildListener<T extends IntVar>children - array containing children listeners.public void setChildrenListeners(ConsistencyListener child)
ConsistencyListenersetChildrenListeners in interface ConsistencyListenerchild - the only child listener added to this consistency listener.public void setChildrenListeners(ExitChildListener child)
ExitChildListenersetChildrenListeners in interface ExitChildListener<T extends IntVar>child - added child listener.public boolean executeAfterConsistency(boolean consistent)
ConsistencyListenerexecuteAfterConsistency in interface ConsistencyListenerconsistent - specifies if the consistency call returned true or false.public void addShavingConstraint(Constraint c)
c - constraint which is added to the list of guiding constraints.public void setStore(Store store)
store - constraint store.Copyright © 2016. All rights reserved.