choco.cp.solver.constraints.global
Class Exactly
java.lang.Object
choco.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.Exactly
- All Implemented Interfaces:
- IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener
public final class Exactly
- extends AbstractLargeIntSConstraint
User : cprudhom
Mail : cprudhom(a)emn.fr
Date : 22 f�vr. 2010
Since : Choco 2.1.1
GCCAT:
NVAR is the number of variables of the collection VARIABLES that take their value in VALUES.
gccat exactly
Propagator :
C. Bessi�re, E. Hebrard, B. Hnich, Z. K?z?ltan, T. Walsh,
Among, common and disjoint Constraints
CP-2005
Could be improved by defining awakes on XX... but required storable data structures and clever management of LB and UB
during INST + INF + SUP + REM.
So not sure it will be that interesting.
Constructor Summary |
Exactly(IntDomainVar[] vars,
int N,
int value)
Constructs a constraint with the specified priority. |
Method Summary |
boolean |
isSatisfied()
Default implementation of the isSatisfied by
delegating to the isSatisfied(int[] tuple) |
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()
pretty printing of the object. |
void |
propagate()
Propagation:
Propagating the constraint until local consistency is reached. |
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint |
addExtension, addListener, clone, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, isEntailed, opposite, setConstraintIndex, setExtension, setVar, toString |
Methods inherited from class choco.kernel.solver.propagation.Propagator |
activate, awake, constAwake, fail, getEvent, getFilteredEventMask, getPriority, isActive, setActive, setActiveSilently, setEntailed, setPassive, setPropagationEngine |
Exactly
public Exactly(IntDomainVar[] vars,
int N,
int value)
- Constructs a constraint with the specified priority.
The last variables of
vars
is the counter.
- Parameters:
vars
- (n-1) variables + N as counterN
- countervalue
- counted values
propagate
public void propagate()
throws ContradictionException
- Propagation:
Propagating the constraint until local consistency is reached.
- Specified by:
propagate
in class Propagator
- Throws:
ContradictionException
- contradiction exception
isSatisfied
public boolean isSatisfied()
- Default implementation of the isSatisfied by
delegating to the isSatisfied(int[] tuple)
- Specified by:
isSatisfied
in interface SConstraint<IntDomainVar>
- Overrides:
isSatisfied
in class AbstractIntSConstraint
- Returns:
isSatisfied
public 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 !
- Specified by:
isSatisfied
in interface IntPropagator
- Overrides:
isSatisfied
in class AbstractIntSConstraint
- Parameters:
tuple
-
- Returns:
pretty
public String pretty()
- Description copied from interface:
IPretty
- pretty printing of the object. This String is not constant and may depend on the context.
- Specified by:
pretty
in interface IPretty
- Overrides:
pretty
in class AbstractSConstraint<IntDomainVar>
- Returns:
- a readable string representation of the object
Copyright © 2012. All Rights Reserved.