choco.cp.solver.constraints.global
Class Exactly

java.lang.Object
  extended by choco.kernel.solver.propagation.Propagator
      extended by choco.kernel.solver.constraints.AbstractSConstraint<IntDomainVar>
          extended by choco.kernel.solver.constraints.integer.AbstractIntSConstraint
              extended by choco.kernel.solver.constraints.integer.AbstractLargeIntSConstraint
                  extended by 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.


Field Summary
 
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
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.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnInf, awakeOnInst, awakeOnRem, awakeOnRemovals, awakeOnSup, getConstraintType, isConsistent
 
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 counter
N - counter
value - counted values
Method Detail

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.