choco.cp.solver.constraints.global.tree
Class TreeSConstraint

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.tree.TreeSConstraint
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener

public final class TreeSConstraint
extends AbstractLargeIntSConstraint

A global tree partitioning constraint that deals with several restrictions:

- The number of trees allowed to partition the graph (assuming an isolated node forms a tree),
- The number of proper trees allowed to partition the graph (assuming a proper tree contains at least 2 nodes),
- Partial order between the nodes of the digraph,
- Incomparability relations between the nodes of the digraph,
- Degree restrictions related to the number of incoming arc of each node,
- Time windows associated with each node that represent the starting time from each node.

All these attributes are embedded in a specific data structure, the description of the input data structure is available in the structure.inputStructure package.


Field Summary
protected static boolean AFFICHE
          boolean for debug and show a trace of the execution
protected  DeductionsAdvisor deduction
          deduction manager
protected  FilteringAdvisor filtering
          filtering manager
protected  int nbNodes
          total number of nodes involved in the graph
protected  Solver solver
          Choco problem embedding the tree constraint
protected  StructuresAdvisor structure
          internal structure manager
protected  TreeParameters tree
          attributes
 
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
TreeSConstraint(IntDomainVar[] allVars, TreeParameters tree)
          constructor: allocates the data util for a Choco constraint
 
Method Summary
 void awake()
          Initial awake of the tree constraint.
 void awakeOnBounds(int idx)
          Event based propagation related to the update of the bounds of a variable.
 void awakeOnInf(int idx)
          Event based propagation related to the update of the lower bound of a variable.
 void awakeOnInst(int idx)
          Event based propagation related to the instanciation of a variable.
 void awakeOnRem(int idx, int i)
          Event based propagation related to the removal of a value in the domain of a variable.
 void awakeOnRemovals(int idx, DisposableIntIterator deltaDomain)
          Event based propagation related to the removal of a set of values in the domain of a variable.
 void awakeOnSup(int idx)
          Event based propagation related to the update of the upper bound of a variable.
 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 !
 void propagate()
          The main propagation method.
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
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, pretty, setConstraintIndex, setExtension, setVar, toString
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, 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
 

Field Detail

AFFICHE

protected static final boolean AFFICHE
boolean for debug and show a trace of the execution

See Also:
Constant Field Values

solver

protected Solver solver
Choco problem embedding the tree constraint


tree

protected TreeParameters tree
attributes


nbNodes

protected int nbNodes
total number of nodes involved in the graph


structure

protected StructuresAdvisor structure
internal structure manager


deduction

protected DeductionsAdvisor deduction
deduction manager


filtering

protected FilteringAdvisor filtering
filtering manager

Constructor Detail

TreeSConstraint

public TreeSConstraint(IntDomainVar[] allVars,
                       TreeParameters tree)
constructor: allocates the data util for a Choco constraint

Parameters:
allVars - the set of variable related to the description of the tree constraint
tree - the input data structure available in the structure.inputStructure package
Method Detail

isSatisfied

public boolean isSatisfied(int[] tuple)
Description copied from class: AbstractIntSConstraint
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

isSatisfied

public boolean isSatisfied()
Description copied from class: AbstractIntSConstraint
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:
true if the constraint is satisfied

awake

public void awake()
           throws ContradictionException
Initial awake of the tree constraint. Internal data structures are created from the input structure TreeParameters . Each manager of filtering, deduction and update are initiliazed.

Overrides:
awake in class Propagator
Throws:
ContradictionException

propagate

public void propagate()
               throws ContradictionException
The main propagation method. A fix point for the filetring and the deductions is reached by a basic saturation loop that iteratively call the update, deduction and filtering managers until each one does not leads to an update of the internal structure, or a contradiction over the domain variables is detected.

Specified by:
propagate in class Propagator
Throws:
ContradictionException

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
Event based propagation related to the instanciation of a variable. Only variables depicting a node of the graph to partition are treated here.

Specified by:
awakeOnInst in interface IntPropagator
Overrides:
awakeOnInst in class AbstractIntSConstraint
Parameters:
idx - the index of the variable instanciated
Throws:
ContradictionException

awakeOnInf

public void awakeOnInf(int idx)
                throws ContradictionException
Event based propagation related to the update of the lower bound of a variable. Only variables depicting a node of the graph to partition are treated here.

Specified by:
awakeOnInf in interface IntPropagator
Overrides:
awakeOnInf in class AbstractIntSConstraint
Parameters:
idx - the variable index for which the lower bound is updated
Throws:
ContradictionException

awakeOnSup

public void awakeOnSup(int idx)
                throws ContradictionException
Event based propagation related to the update of the upper bound of a variable. Only variables depicting a node of the graph to partition are treated here.

Specified by:
awakeOnSup in interface IntPropagator
Overrides:
awakeOnSup in class AbstractIntSConstraint
Parameters:
idx - the variable index for which the upper bound is updated
Throws:
ContradictionException

awakeOnBounds

public void awakeOnBounds(int idx)
                   throws ContradictionException
Event based propagation related to the update of the bounds of a variable. Only variables depicting a node of the graph to partition are treated here.

Specified by:
awakeOnBounds in interface IntPropagator
Overrides:
awakeOnBounds in class AbstractIntSConstraint
Parameters:
idx - the variable index for which the bounds are updated
Throws:
ContradictionException

awakeOnRem

public void awakeOnRem(int idx,
                       int i)
                throws ContradictionException
Event based propagation related to the removal of a value in the domain of a variable. Only variables depicting a node of the graph to partition are treated here.

Specified by:
awakeOnRem in interface IntPropagator
Overrides:
awakeOnRem in class AbstractIntSConstraint
Parameters:
idx - the variable index for which a value is removed
i - the value removed
Throws:
ContradictionException

awakeOnRemovals

public void awakeOnRemovals(int idx,
                            DisposableIntIterator deltaDomain)
                     throws ContradictionException
Event based propagation related to the removal of a set of values in the domain of a variable. Only variables depicting a node of the graph to partition are treated here.

Specified by:
awakeOnRemovals in interface IntPropagator
Overrides:
awakeOnRemovals in class AbstractIntSConstraint
Parameters:
idx - the variable index for which a set of values is removed
deltaDomain - an iterator over the removed values
Throws:
ContradictionException


Copyright © 2012. All Rights Reserved.