public abstract class Constraint extends DecomposedConstraint<Constraint>
Modifier and Type | Field and Description |
---|---|
boolean |
atomicExecution
It specifies if the constraint consistency function requires consistency function
executed in one atomic step.
|
Hashtable<Var,Integer> |
consistencyPruningEvents
It specifies the event which must occur in order for the consistency function to
be called.
|
Set<PrimitiveConstraint> |
constraintScope |
boolean |
earlyTerminationOK
It specifies if the constraint consistency function can be prematurely terminated
through other than FailureException exception.
|
boolean |
increaseWeight
It specifies if upon the failure of the constraint, all variables
in the constraint scope should have their weight increased.
|
int |
numberId
It specifies the number id for a given constraint.
|
protected Set<Var> |
scope
It specifies a set of variables that in the scope of this constraint.
|
boolean |
trace |
queueIndex
Modifier | Constructor and Description |
---|---|
protected |
Constraint() |
protected |
Constraint(PrimitiveConstraint[] constraints) |
protected |
Constraint(Set<? extends Var> set) |
protected |
Constraint(Stream<Var> vars) |
protected |
Constraint(Var[]... vars) |
Modifier and Type | Method and Description |
---|---|
double |
afc() |
Set<Var> |
arguments()
It returns the variables in a scope of the constraint.
|
void |
cleanAfterFailure()
It is executed after the constraint has failed.
|
abstract void |
consistency(Store store)
It is a (most probably incomplete) consistency function which removes the
values from variables domains.
|
List<Constraint> |
decompose(Store store)
It returns an array list of constraint which are used to decompose this
constraint.
|
int |
getConsistencyPruningEvent(Var var)
It retrieves the pruning event which causes reevaluation of the
constraint.
|
abstract int |
getDefaultConsistencyPruningEvent() |
Constraint |
getGuideConstraint()
It specifies a constraint which if imposed by search will enhance
propagation of this constraint.
|
int |
getGuideValue()
This function provides a value which if assigned to a variable returned
by getGuideVariable() will enhance propagation of this constraint.
|
Var |
getGuideVariable()
This function provides a variable which assigned a value returned
by will enhance propagation of this constraint.
|
boolean |
grounded()
It checks if the constraint has all variables in its scope grounded (singletons).
|
boolean |
grounded(Var[] vars)
It checks if provided variables are grounded (singletons).
|
String |
id()
It gives the id string of a constraint.
|
void |
impose(Store store)
It imposes the constraint in a given store.
|
void |
impose(Store store,
int queueIndex)
It imposes the constraint and adjusts the queue index.
|
void |
imposeDecomposition(Store store)
It imposes the decomposition of the given constraint in a given store.
|
void |
increaseWeight()
It increases the weight of the variables in the constraint scope.
|
static String |
intArrayToString(int[] array) |
static int |
long2int(long value) |
int |
numberArgs()
It returns the number of variables within a constraint scope.
|
void |
queueVariable(int level,
Var var)
This is a function called to indicate which variable in a scope of
constraint has changed.
|
void |
removeConstraint()
It removes the constraint by removing this constraint from all variables.
|
boolean |
requiresMonotonicity()
It specifies if the constraint allows domains of variables
in its scope only to shrink its domain with the progress
of search downwards.
|
void |
setConsistencyPruningEvent(Var var,
int pruningEvent)
It allows to customize the event for a given variable which
causes the re-execution of the consistency method for a constraint.
|
protected void |
setConstraintScope(PrimitiveConstraint... primitiveConstraints) |
protected void |
setScope(PrimitiveConstraint[] constraints) |
protected void |
setScope(Set<? extends Var> set) |
protected void |
setScope(Stream<Var> scope) |
protected void |
setScope(Var... variables) |
protected void |
setScope(Var[]... variables) |
void |
setWatchedVariableGrounded(Var var) |
void |
supplyGuideFeedback(boolean feedback)
This function allows to provide a guide feedback.
|
String |
toString()
It produces a string representation of a constraint state.
|
void |
updateAFC(Set<Constraint> allConstraints,
double decay) |
boolean |
watchedVariableGrounded() |
auxiliaryVariables, checkInput, checkInput, checkInputForDuplication, checkInputForDuplicationSkipSingletons, checkInputForNullness, checkInputForNullness, checkInputForNullness, derivative, getDubletonsSkipSingletons, imposeDecomposition
public boolean trace
public int numberId
protected Set<Var> scope
public Set<PrimitiveConstraint> constraintScope
public boolean increaseWeight
public Hashtable<Var,Integer> consistencyPruningEvents
public boolean earlyTerminationOK
public boolean atomicExecution
protected Constraint()
protected Constraint(Var[]... vars)
protected Constraint(PrimitiveConstraint[] constraints)
public Set<Var> arguments()
protected void setScope(Var... variables)
protected void setScope(Var[]... variables)
protected void setScope(PrimitiveConstraint[] constraints)
protected void setConstraintScope(PrimitiveConstraint... primitiveConstraints)
public abstract void consistency(Store store)
store
- constraint store within which the constraint consistency is being checked.public int getConsistencyPruningEvent(Var var)
var
- variable for which pruning event is retrievedpublic abstract int getDefaultConsistencyPruningEvent()
public String id()
public void impose(Store store)
store
- the constraint store to which the constraint is imposed to.public void impose(Store store, int queueIndex)
store
- the constraint store to which the constraint is imposed to.queueIndex
- the index of the queue in the store it is assigned to.public void queueVariable(int level, Var var)
level
- the level of the store at which the change has occurred.var
- variable which has changed.public void removeConstraint()
public void setWatchedVariableGrounded(Var var)
public boolean watchedVariableGrounded()
public boolean grounded()
public boolean grounded(Var[] vars)
vars
- variables to be checked if they are grounded.public String toString()
public static String intArrayToString(int[] array)
public Constraint getGuideConstraint()
public Var getGuideVariable()
public int getGuideValue()
public void supplyGuideFeedback(boolean feedback)
feedback
- true if the guide was useful, false otherwise.public void increaseWeight()
public void setConsistencyPruningEvent(Var var, int pruningEvent)
var
- variable for which the events are customized.pruningEvent
- the event which must occur to trigger execution of the consistency method.public int numberArgs()
public boolean requiresMonotonicity()
public void imposeDecomposition(Store store)
imposeDecomposition
in class DecomposedConstraint<Constraint>
store
- the constraint store to which the constraint is imposed to.public List<Constraint> decompose(Store store)
decompose
in class DecomposedConstraint<Constraint>
store
- the constraint store in which context the decomposition takes place.public double afc()
public void updateAFC(Set<Constraint> allConstraints, double decay)
public void cleanAfterFailure()
public static int long2int(long value)
Copyright © 2022. All rights reserved.