choco.integer.var
Class AbstractIntDomain

java.lang.Object
  extended by choco.AbstractEntity
      extended by choco.integer.var.AbstractIntDomain
All Implemented Interfaces:
Entity, IntDomain
Direct Known Subclasses:
BitSetIntDomain, IntervalIntDomain

public abstract class AbstractIntDomain
extends AbstractEntity
implements IntDomain


Nested Class Summary
protected  class AbstractIntDomain.IntDomainIterator
           
 
Field Summary
protected  int currentInfPropagated
          for the delta domain: current value of the inf (domain lower bound) when the bound started beeing propagated (just to check that it does not change during the propagation phase)
protected  int currentSupPropagated
          for the delta domain: current value of the sup (domain upper bound) when the bound started beeing propagated (just to check that it does not change during the propagation phase)
protected static java.util.logging.Logger logger
          Reference to an object for logging trace statements related to domains of search variables (using the java.util.logging package)
protected  IntDomainVarImpl variable
          The involved variable.
 
Fields inherited from class choco.AbstractEntity
hook, problem
 
Constructor Summary
AbstractIntDomain()
           
 
Method Summary
protected  boolean _instantiate(int x)
          Instantiating a variable to an search value.
protected  boolean _removeVal(int x)
          Removing a value from the domain of a variable.
protected  boolean _updateInf(int x)
          Improving the lower bound.
protected  boolean _updateSup(int x)
          Improving the upper bound.
 void clearDeltaDomain()
          cleans the data structure implementing the delta domain
 void freezeDeltaDomain()
          The delta domain container is "frozen" (it can no longer accept new value removals) so that this set of values can be iterated as such
 IntIterator getIterator()
          Returns an getIterator.
 boolean getReleasedDeltaDomain()
          checks whether the delta domain has indeed been released (ie: chechks that no domain updates are pending)
 boolean instantiate(int x, int idx)
          Internal var: instantiation of the variable caused by its i-th constraint Returns a boolean indicating whether the call indeed added new information.
 boolean releaseDeltaDomain()
          after an iteration over the delta domain, the delta domain is reopened again.
 boolean removeInterval(int a, int b, int idx)
          Internal var: remove an interval (a sequence of consecutive values) from the domain of a variable caused by its i-th constraint.
 boolean removeVal(int x, int idx)
          Internal var: update (value removal) on the domain of a variable caused by its i-th constraint.
 boolean updateInf(int x, int idx)
          Internal var: update on the variable lower bound caused by its i-th constraint.
 boolean updateSup(int x, int idx)
          Internal var: update on the variable upper bound caused by its i-th constraint.
 
Methods inherited from class choco.AbstractEntity
getProblem, pretty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface choco.integer.var.IntDomain
contains, getDeltaIterator, getInf, getNextValue, getPrevValue, getRandomValue, getSize, getSup, hasNextValue, hasPrevValue, isEnumerated, remove, restrict, updateInf, updateSup
 
Methods inherited from interface choco.Entity
getProblem, pretty
 

Field Detail

logger

protected static java.util.logging.Logger logger
Reference to an object for logging trace statements related to domains of search variables (using the java.util.logging package)


variable

protected IntDomainVarImpl variable
The involved variable.


currentInfPropagated

protected int currentInfPropagated
for the delta domain: current value of the inf (domain lower bound) when the bound started beeing propagated (just to check that it does not change during the propagation phase)


currentSupPropagated

protected int currentSupPropagated
for the delta domain: current value of the sup (domain upper bound) when the bound started beeing propagated (just to check that it does not change during the propagation phase)

Constructor Detail

AbstractIntDomain

public AbstractIntDomain()
Method Detail

getIterator

public IntIterator getIterator()
Returns an getIterator.

Specified by:
getIterator in interface IntDomain

updateSup

public boolean updateSup(int x,
                         int idx)
                  throws ContradictionException
Internal var: update on the variable upper bound caused by its i-th constraint. Returns a boolean indicating whether the call indeed added new information.

Parameters:
x - The new upper bound
idx - The index of the constraint (among all constraints linked to the variable) responsible for the update
Throws:
ContradictionException

updateInf

public boolean updateInf(int x,
                         int idx)
                  throws ContradictionException
Internal var: update on the variable lower bound caused by its i-th constraint. Returns a boolean indicating whether the call indeed added new information

Parameters:
x - The new lower bound.
idx - The index of the constraint (among all constraints linked to the variable) responsible for the update.
Throws:
ContradictionException

removeVal

public boolean removeVal(int x,
                         int idx)
                  throws ContradictionException
Internal var: update (value removal) on the domain of a variable caused by its i-th constraint. Note: Whenever the hole results in a stronger var (such as a bound update or an instantiation, then we forget about the index of the var generating constraint. Indeed the propagated var is stronger than the initial one that was generated; thus the generating constraint should be informed about such a new var. Returns a boolean indicating whether the call indeed added new information.

Parameters:
x - The removed value
idx - The index of the constraint (among all constraints linked to the variable) responsible for the update
Throws:
ContradictionException

removeInterval

public boolean removeInterval(int a,
                              int b,
                              int idx)
                       throws ContradictionException
Internal var: remove an interval (a sequence of consecutive values) from the domain of a variable caused by its i-th constraint. Returns a boolean indicating whether the call indeed added new information.

Parameters:
a - the first removed value
b - the last removed value
idx - the index of the constraint (among all constraints linked to the variable) responsible for the update
Throws:
ContradictionException

instantiate

public boolean instantiate(int x,
                           int idx)
                    throws ContradictionException
Internal var: instantiation of the variable caused by its i-th constraint Returns a boolean indicating whether the call indeed added new information.

Parameters:
x - the new upper bound
idx - the index of the constraint (among all constraints linked to the variable) responsible for the update
Throws:
ContradictionException

_instantiate

protected boolean _instantiate(int x)
                        throws ContradictionException
Instantiating a variable to an search value. Returns true if this was a real modification or not

Throws:
ContradictionException

_updateInf

protected boolean _updateInf(int x)
                      throws ContradictionException
Improving the lower bound.

Throws:
ContradictionException

_updateSup

protected boolean _updateSup(int x)
                      throws ContradictionException
Improving the upper bound.

Throws:
ContradictionException

_removeVal

protected boolean _removeVal(int x)
                      throws ContradictionException
Removing a value from the domain of a variable. Returns true if this was a real modification on the domain.

Throws:
ContradictionException

freezeDeltaDomain

public void freezeDeltaDomain()
Description copied from interface: IntDomain
The delta domain container is "frozen" (it can no longer accept new value removals) so that this set of values can be iterated as such

Specified by:
freezeDeltaDomain in interface IntDomain

releaseDeltaDomain

public boolean releaseDeltaDomain()
Description copied from interface: IntDomain
after an iteration over the delta domain, the delta domain is reopened again.

Specified by:
releaseDeltaDomain in interface IntDomain
Returns:
true iff the delta domain is reopened empty (no updates have been made to the domain while it was frozen, false iff the delta domain is reopened with pending value removals (updates were made to the domain, while the delta domain was frozen).

clearDeltaDomain

public void clearDeltaDomain()
Description copied from interface: IntDomain
cleans the data structure implementing the delta domain

Specified by:
clearDeltaDomain in interface IntDomain

getReleasedDeltaDomain

public boolean getReleasedDeltaDomain()
Description copied from interface: IntDomain
checks whether the delta domain has indeed been released (ie: chechks that no domain updates are pending)

Specified by:
getReleasedDeltaDomain in interface IntDomain