choco.cp.solver.constraints.integer
Class NotEqualXC

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.kernel.solver.constraints.integer.AbstractUnIntSConstraint
                      extended by choco.cp.solver.constraints.integer.NotEqualXC
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener

public final class NotEqualXC
extends AbstractUnIntSConstraint

Implements a constraint X != C, with X a variable and C a constant.


Field Summary
protected  int cste
          The search constant of the constraint
 
Fields inherited from class choco.kernel.solver.constraints.integer.AbstractUnIntSConstraint
v0
 
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
NotEqualXC(IntDomainVar x0, int c)
          Constructs the constraint with the specified variables and constant.
 
Method Summary
 void awakeOnInf(int idx)
          in case the bounds have changed and the domain is approximated by an interval, we need to re-propagate
 void awakeOnInst(int idx)
          When the one and only variable of the constraint becomes instantiated Need to check that the value of the variable is not the value forbidden by the constraint
 void awakeOnRem(int idx, int x)
          When a value is removed from the domain of the one and only variable: Nothing to be propagated.
 void awakeOnSup(int idx)
          in case the bounds have changed and the domain is approximated by an interval, we need to re-propagate
 Object clone()
          Clone the constraint
 int getFilteredEventMask(int idx)
           
 boolean isConsistent()
          tests if the constraint is consistent with respect to the current state of domains
 Boolean isEntailed()
          When the whole domain of v0 is below or above cste, we know for sure whether the constraint will be satisfied or not
 boolean isSatisfied(int[] tuple)
          tests if the constraint is satisfied when the variables are instantiated.
 AbstractSConstraint<IntDomainVar> opposite(Solver solver)
          Get the opposite constraint
 String pretty()
          Pretty print of the constraint.
 void propagate()
          The single propagation method.
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnRemovals, getConstraintType, isSatisfied
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getFineDegree, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, setConstraintIndex, setExtension, setVar, toString
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, awake, 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

cste

protected final int cste
The search constant of the constraint

Constructor Detail

NotEqualXC

public NotEqualXC(IntDomainVar x0,
                  int c)
Constructs the constraint with the specified variables and constant.

Parameters:
x0 - the search valued domain variable
c - the search constant used in the inequality.
Method Detail

getFilteredEventMask

public int getFilteredEventMask(int idx)
Overrides:
getFilteredEventMask in class Propagator

clone

public Object clone()
             throws CloneNotSupportedException
Description copied from class: AbstractSConstraint
Clone the constraint

Overrides:
clone in class AbstractSConstraint<IntDomainVar>
Returns:
the clone of the constraint
Throws:
CloneNotSupportedException - Clone not supported exception

pretty

public String pretty()
Pretty print of the constraint.

Specified by:
pretty in interface IPretty
Overrides:
pretty in class AbstractSConstraint<IntDomainVar>
Returns:
a readable string representation of the object

propagate

public void propagate()
               throws ContradictionException
The single propagation method.
Note that after the first propagation, the constraint is set passive (to prevent from further calls to propagation methods)

Specified by:
propagate in class Propagator
Throws:
ContradictionException - contradiction exception

awakeOnInf

public void awakeOnInf(int idx)
                throws ContradictionException
in case the bounds have changed and the domain is approximated by an interval, we need to re-propagate

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
in case the bounds have changed and the domain is approximated by an interval, we need to re-propagate

Specified by:
awakeOnSup in interface IntPropagator
Overrides:
awakeOnSup in class AbstractIntSConstraint
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
When the one and only variable of the constraint becomes instantiated Need to check that the value of the variable is not the value forbidden by the constraint

Specified by:
awakeOnInst in interface IntPropagator
Overrides:
awakeOnInst in class AbstractIntSConstraint
Parameters:
idx - index of the variable (always 0)
Throws:
ContradictionException

awakeOnRem

public void awakeOnRem(int idx,
                       int x)
                throws ContradictionException
When a value is removed from the domain of the one and only variable: Nothing to be propagated.

Specified by:
awakeOnRem in interface IntPropagator
Overrides:
awakeOnRem in class AbstractIntSConstraint
Parameters:
idx - index of the variable (always 0)
x - value that was removed
Throws:
ContradictionException

isEntailed

public Boolean isEntailed()
When the whole domain of v0 is below or above cste, we know for sure whether the constraint will be satisfied or not

Overrides:
isEntailed in class AbstractSConstraint<IntDomainVar>
Returns:
wether the constraint is entailed

isSatisfied

public boolean isSatisfied(int[] tuple)
tests if the constraint is satisfied when the variables are instantiated.

Specified by:
isSatisfied in interface IntPropagator
Overrides:
isSatisfied in class AbstractIntSConstraint

isConsistent

public boolean isConsistent()
tests if the constraint is consistent with respect to the current state of domains

Overrides:
isConsistent in class AbstractIntSConstraint
Returns:
true iff the constraint is bound consistent (same as arc consistent)

opposite

public AbstractSConstraint<IntDomainVar> opposite(Solver solver)
Description copied from class: AbstractSConstraint
Get the opposite constraint

Specified by:
opposite in interface SConstraint<IntDomainVar>
Overrides:
opposite in class AbstractSConstraint<IntDomainVar>
Parameters:
solver - the current solver
Returns:
the opposite constraint @param solver


Copyright © 2012. All Rights Reserved.