|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchoco.AbstractEntity
choco.AbstractConstraint
choco.integer.constraints.AbstractIntConstraint
choco.integer.constraints.AbstractLargeIntConstraint
choco.integer.constraints.IntLinComb
public class IntLinComb
Implements a constraint Sigma (ai Xi) <=/>=/= C, with Xi variables, ai and C constants.
| Field Summary | |
|---|---|
protected int[] |
coeffs
The coefficients of the linear equations. |
protected int |
cste
The constant of the constraint. |
static int |
EQ
Constant, to be assigned to op,
representing linear equalities. |
static int |
GEQ
Constant, to be assigned to op,
representing linear inequalities. |
protected int |
nbPosVars
Field representing the number of variables with positive coeffficients in the linear combination. |
static int |
NEQ
Constant, to be assigned to op,
representing linear disequalities. |
protected int |
op
Field representing the type of linear constraint (equality, inequality, disequality). |
| Fields inherited from class choco.integer.constraints.AbstractLargeIntConstraint |
|---|
cIndices, vars |
| Fields inherited from class choco.integer.constraints.AbstractIntConstraint |
|---|
logger |
| Fields inherited from class choco.AbstractConstraint |
|---|
active, constAwakeEvent, hook, priority |
| Fields inherited from class choco.AbstractEntity |
|---|
problem |
| Constructor Summary | |
|---|---|
IntLinComb(IntDomainVar[] lvars,
int[] lcoeffs,
int nbPositive,
int c,
int linOperator)
Constructs the constraint with the specified variables and constant. |
|
| Method Summary | |
|---|---|
void |
awakeOnInf(int idx)
Propagation whenever the lower bound of a variable is modified. |
void |
awakeOnInst(int idx)
Propagation whenever a variable is instantiated. |
void |
awakeOnRem(int idx,
int x)
Propagation whenever a value is removed from the variable domain. |
void |
awakeOnSup(int idx)
Propagation whenever the upper bound of a variable is modified. |
void |
awakeOnVar(int idx)
Generic propagation when a variable is modified. |
java.lang.Object |
clone()
Builds a copy of this contraint. |
protected int |
computeLowerBound()
Computes a lower bound estimate of a linear combination of variables. |
protected int |
computeUpperBound()
Computes an upper bound estimate of a linear combination of variables. |
protected void |
filter(boolean startWithLB,
int minNbRules)
A strategy for chaotic iteration with two rules (LB and UB propagation). |
protected boolean |
filterOnImprovedLowerBound()
Checks a new lower bound. |
protected boolean |
filterOnImprovedUpperBound()
Checks a new upper bound. |
protected boolean |
hasConsistentLowerBound()
Tests if the constraint is consistent with respect to the current state of domains. |
protected boolean |
hasConsistentUpperBound()
Tests if the constraint is consistent with respect to the current state of domains. |
void |
init(int[] lcoeffs)
Initializes the constraint by copying the coefficent array. |
boolean |
isConsistent()
Tests if the constraint is consistent with respect to the current state of domains. |
java.lang.Boolean |
isEntailed()
Checks if the constraint is entailed. |
boolean |
isEquivalentTo(Constraint compareTo)
Checks if this constraint is equivalent to the argument constraint. |
boolean |
isSatisfied()
Checks if the constraint is satisfied when all variables are instantiated. |
AbstractConstraint |
opposite()
Computes the opposite of this constraint. |
java.lang.String |
pretty()
Pretty print for this constraint. |
void |
propagate()
Launchs the filtering algorithm. |
protected boolean |
propagateNewLowerBound(int mylb)
Propagates the constraint sigma(ai Xi) + c <= 0 where mylb = sigma(ai inf(Xi)) + c. |
protected boolean |
propagateNewUpperBound(int myub)
Propagates the constraint sigma(ai Xi) + c <= 0 where myub = sigma(ai sup(Xi)) + c. |
| Methods inherited from class choco.integer.constraints.AbstractLargeIntConstraint |
|---|
assignIndices, getConstraintIdx, getIntVar, getNbVars, getVar, isCompletelyInstantiated, setConstraintIndex, setVar |
| Methods inherited from class choco.integer.constraints.AbstractIntConstraint |
|---|
awakeOnBounds, awakeOnRemovals, getSelfIndex |
| Methods inherited from class choco.AbstractConstraint |
|---|
addListener, awake, connectVar, constAwake, delete, fail, getEvent, getPlugIn, getPriority, getProblem, getVarIdxInOpposite, isActive, setActive, setEntailed, setPassive, setPlugIn, substituteVar |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface choco.Propagator |
|---|
awake, constAwake, delete, getEvent, getPlugIn, getPriority |
| Methods inherited from interface choco.prop.VarEventListener |
|---|
addListener, isActive, setActive, setPassive |
| Methods inherited from interface choco.prop.VarEventListener |
|---|
addListener, isActive, setActive, setPassive |
| Field Detail |
|---|
public static final int EQ
op,
representing linear equalities.
public static final int GEQ
op,
representing linear inequalities.
public static final int NEQ
op,
representing linear disequalities.
protected final int op
protected int[] coeffs
protected final int nbPosVars
protected final int cste
| Constructor Detail |
|---|
public IntLinComb(IntDomainVar[] lvars,
int[] lcoeffs,
int nbPositive,
int c,
int linOperator)
lvars - the variables of the constraintlcoeffs - the constant coefficientsnbPositive - number of positive coefficientsc - the constant value of the constraint (the value the linear
expression must equal)linOperator - the operator to use (equality, inequality...)| Method Detail |
|---|
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface Constraintclone in class AbstractLargeIntConstraintjava.lang.CloneNotSupportedException - if an error occurs during cloningpublic void init(int[] lcoeffs)
lcoeffs - the coefficients of the linear equation
public void propagate()
throws ContradictionException
propagate in interface Propagatorpropagate in class AbstractLargeIntConstraintContradictionException - if a domain empties or a contradiction is
infered
public void awakeOnVar(int idx)
throws ContradictionException
awakeOnVar in interface VarEventListenerawakeOnVar in interface PropagatorawakeOnVar in class AbstractConstraintidx - the index of the modified variable
ContradictionException - if a domain empties or a contradiction is
infered
public void awakeOnInf(int idx)
throws ContradictionException
awakeOnInf in interface IntVarEventListenerawakeOnInf in class AbstractIntConstraintidx - the index of the modified variable
ContradictionException - if a domain empties or a contradiction is
infered
public void awakeOnSup(int idx)
throws ContradictionException
awakeOnSup in interface IntVarEventListenerawakeOnSup in class AbstractIntConstraintidx - the index of the modified variable
ContradictionException - if a domain empties or a contradiction is
infered
public void awakeOnInst(int idx)
throws ContradictionException
awakeOnInst in interface IntVarEventListenerawakeOnInst in class AbstractIntConstraintidx - the index of the modified variable
ContradictionException - if a domain empties or a contradiction is
infered
public void awakeOnRem(int idx,
int x)
throws ContradictionException
awakeOnRem in interface IntVarEventListenerawakeOnRem in class AbstractIntConstraintidx - the index of the modified variablex - the removed value
ContradictionException - if a domain empties or a contradiction is
inferedpublic java.lang.Boolean isEntailed()
isEntailed in interface PropagatorisEntailed in class AbstractConstraintpublic boolean isSatisfied()
protected int computeUpperBound()
protected int computeLowerBound()
protected void filter(boolean startWithLB,
int minNbRules)
throws ContradictionException
startWithLB - whether LB must be the first rule appliedminNbRules - minimum number of rules required to reach fix point.
ContradictionException - if a domain empties or a contradiction is
infered
protected boolean filterOnImprovedLowerBound()
throws ContradictionException
ContradictionException - if a domain empties or a contradiction is
infered
protected boolean filterOnImprovedUpperBound()
throws ContradictionException
ContradictionException - if a domain empties or a contradiction is
infered
protected boolean propagateNewLowerBound(int mylb)
throws ContradictionException
mylb - the computed lower bound
ContradictionException - if a domain empties or a contradiction
is infered
protected boolean propagateNewUpperBound(int myub)
throws ContradictionException
myub - the computed upper bound
ContradictionException - if a domain empties or a contradiction
is inferedpublic boolean isConsistent()
isConsistent in interface PropagatorisConsistent in class AbstractIntConstraintprotected boolean hasConsistentLowerBound()
protected boolean hasConsistentUpperBound()
public AbstractConstraint opposite()
opposite in interface Constraintopposite in class AbstractConstraintpublic boolean isEquivalentTo(Constraint compareTo)
isEquivalentTo in interface ConstraintisEquivalentTo in class AbstractConstraintcompareTo - the constraint to compare with the current one
public java.lang.String pretty()
pretty in interface Entitypretty in class AbstractEntity
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||