|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.kernel.solver.propagation.Propagator
choco.kernel.solver.constraints.AbstractSConstraint<IntDomainVar>
choco.kernel.solver.constraints.integer.AbstractIntSConstraint
choco.kernel.solver.constraints.integer.AbstractLargeIntSConstraint
choco.cp.solver.constraints.global.LexChain
public final class LexChain
Created by IntelliJ IDEA. User: Ashish Date: Jun 23, 2008 Time: 9:12:41 AM Solver constraint of the LexChain constraint. Allows to sort lexical chain with strict lexicographic ordering or not.
Field Summary | |
---|---|
int[][] |
lowerBoundVector
array for holding lexicographically smallest feasible lower bound of each vector |
int |
n
the number of variables in each vector of the chain - v1 <= lexChainEq/lexChain <= v2 ..... |
int |
numOfVectors
total number of vector in the lex chain constraint |
boolean |
strict
If strict's value is true then lexChain is implemented , if false lexChainEq |
int[][] |
upperBoundVector
array for holding lexicographically largest feasible upper bound of each vector |
IntDomainVar[][] |
x
array of vectors in the lex chain constraint |
Fields inherited from class choco.kernel.solver.constraints.AbstractSConstraint |
---|
cIndices, constraintType, extensions, vars |
Fields inherited from class choco.kernel.solver.propagation.Propagator |
---|
active, constAwakeEvent, priority, propagationEngine |
Fields inherited from interface choco.kernel.solver.constraints.SConstraint |
---|
LOGGER |
Constructor Summary | |
---|---|
LexChain(IntDomainVar[] vars,
int n,
boolean strict)
Constructor for the lex_chain constraint |
Method Summary | |
---|---|
void |
awake()
Propagation: Propagating the constraint for the very first time until local consistency is reached. |
void |
awakeOnInst(int idx)
Default propagation on instantiation: full constraint re-propagation. |
void |
boundsLex(int[] a,
IntDomainVar[] x,
int[] b,
int j)
Filtering algorithm for between(a,x,b) Ensures that x is lexicographically greater than a and less than b if strict is false otherwise x is lexicographically greater than or equal to a and less than or equal to b |
int |
computeAlpha(IntDomainVar[] x,
int[] b)
computes alpha for use in computing lexicographically largest feasible upper bound of x in computUB |
int |
computeBeta(IntDomainVar[] x,
int[] a)
computes beta for use in computing lexicographically smallest feasible lower bound of x in computeLB |
void |
computeLB(IntDomainVar[] x,
int[] a,
int[] lower)
Computes the lexicographically smallest feasible lower bound vector of integers of x . |
void |
computeUB(IntDomainVar[] x,
int[] b,
int[] u)
Computes the lexicographically largest feasible upper bound vector of integers of x . |
void |
filter()
Implements the main filtering algorithm by calling boundsLex for
each vector in the chain. |
int |
getFilteredEventMask(int idx)
|
Boolean |
isEntailed()
Indicates if the constraint is entailed, from now on will be always satisfied |
boolean |
isSatisfied(int[] tuple)
TEMPORARY: if not overriden by the constraint, throws an error to avoid bug using reified constraints in constraints that have not been changed to fulfill this api yet ! |
String |
pretty()
Method for printing the constraint in a readable form |
void |
propagate()
Propagation: Propagating the constraint until local consistency is reached. |
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint |
---|
awakeOnBounds, awakeOnInf, awakeOnRem, awakeOnRemovals, awakeOnSup, getConstraintType, isConsistent, isSatisfied |
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint |
---|
addExtension, addListener, clone, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, opposite, setConstraintIndex, setExtension, setVar, toString |
Methods inherited from class choco.kernel.solver.propagation.Propagator |
---|
activate, constAwake, fail, getEvent, getPriority, isActive, setActive, setActiveSilently, setEntailed, setPassive, setPropagationEngine |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int n
public IntDomainVar[][] x
public int[][] upperBoundVector
public int[][] lowerBoundVector
public boolean strict
public int numOfVectors
Constructor Detail |
---|
public LexChain(IntDomainVar[] vars, int n, boolean strict)
vars
- an array containing all the variables in all the vectors of variables in the chain of vectorsn
- the number of variables in each vector of the chain - v1 <= lexChainEq/lexChain <= v2 .....strict
- whether strict lexicographic ordering or not .True value means lexChain { < } else lexChainEq { <= }Method Detail |
---|
public int getFilteredEventMask(int idx)
getFilteredEventMask
in class Propagator
public void boundsLex(int[] a, IntDomainVar[] x, int[] b, int j) throws ContradictionException
a
- lexicographically smallest feasible lower boundx
- the vector of variables among other vectors in the chain of vectorsb
- lexicographically largest feasible upper boundj
- index of the vector x in the chain
ContradictionException
public int computeAlpha(IntDomainVar[] x, int[] b) throws ContradictionException
computUB
x
- the vector of variables whose lexicographically largest feasible upper bound is to be computedb
- the vector of integers claimed to be the feasible upper bound
ContradictionException
public int computeBeta(IntDomainVar[] x, int[] a) throws ContradictionException
computeLB
x
- the vector of variables whose lexicographically smallest feasible lower bound is to be computeda
- the vector of integers claimed to be the feasible lower bound
ContradictionException
public void computeUB(IntDomainVar[] x, int[] b, int[] u) throws ContradictionException
computeAlpha
is -1 then
the current domain values can't satisfy the constraint .So the current intantiations if any are dropped and fresh search is continued.
x
- the vector of variables whose lexicographically largest feasible upper bound is to be computedb
- the vector of integers claimed to be the feasible upper boundu
- lexicographically largest feasible upper bound of x
ContradictionException
public void computeLB(IntDomainVar[] x, int[] a, int[] lower) throws ContradictionException
computeBeta
is -1 then
the current domain values can't satisfy the constraint .So the current intantiations if any are dropped and fresh search is continued.
x
- the vector of variables whose lexicographically smallest feasible
lower bound is to be computeda
- the vector of integers claimed to be the feasible lower boundlower
- lexicographically smallest feasible lower bound of x
ContradictionException
public void filter() throws ContradictionException
boundsLex
for
each vector in the chain.
If there is no variable aliasing then the fixed-point is reached in one run.
ContradictionException
public void awake() throws ContradictionException
Propagator
awake
in class Propagator
ContradictionException
- contradiction exceptionpublic Boolean isEntailed()
AbstractSConstraint
isEntailed
in class AbstractSConstraint<IntDomainVar>
public void propagate() throws ContradictionException
Propagator
propagate
in class Propagator
ContradictionException
- contradiction exceptionpublic void awakeOnInst(int idx) throws ContradictionException
AbstractIntSConstraint
awakeOnInst
in interface IntPropagator
awakeOnInst
in class AbstractIntSConstraint
ContradictionException
public boolean isSatisfied(int[] tuple)
AbstractIntSConstraint
isSatisfied
in interface IntPropagator
isSatisfied
in class AbstractIntSConstraint
public String pretty()
pretty
in interface IPretty
pretty
in class AbstractSConstraint<IntDomainVar>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |