choco.cp.solver.constraints.global.regular
Class Regular

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

public final class Regular
extends AbstractLargeIntSConstraint

Created by IntelliJ IDEA. User: Hadrien Enforce the sequence of variable vs to be a word recognized by DFA auto


Field Summary
protected  LightLayeredDFA autom
           
static boolean INCREMENTAL
           
protected  BitSet mark
           
protected  int nbNode
           
protected  ArrayList<LightState>[] Ni
           
protected  int[] offset
           
protected  StoredIndexedBipartiteSet[] Qij
           
protected  HashSet<IndexedObject>[] qijvalues
           
protected  choco.cp.solver.constraints.global.regular.Regular.PropagationData sdata
          Stored data structured map to the original automaton
protected  int[] sizes
           
protected  int[] start
           
 
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
Regular(DFA auto, IntDomainVar[] vs, IEnvironment environment)
          Enforce the sequence of variable vs to be a word recognized by DFA auto
Regular(DFA auto, IntDomainVar[] vs, int[] lbs, int[] dsize, IEnvironment environment)
           
 
Method Summary
 void awake()
          Propagation: Propagating the constraint for the very first time until local consistency is reached.
 void awakeOnRem(int idx, int x)
          Default propagation on one value removal: propagation on domain revision.
 void backward2OnLevel(int i)
           
 void backwardOnLevel(int i)
           
 void backwardUpdate()
          Only consider states st that reached qn (which are on a path (st ~> qn))
 void cleanUp()
          removes values that are not supported by any state of the automata
 void decrement_indeg(LightState st, int i)
          Decrement the in-degree of state st located on the i-th layer
 void decrement_outdeg(LightState st, int i)
          Decrement the out-degree of state st located on the i-th layer
 void forwardOnLevel(int i)
           
 void forwardUpdate()
          Only consider states st that can be reached from q0 (which are on a path (qo ~> st))
 int getFilteredEventMask(int idx)
           
 StoredIndexedBipartiteSet getQij(int var, int val)
           
 void init(LightLayeredDFA auto, int[] lbs, int[] dsize, IEnvironment environment)
           
 void initData()
           
 void initMarck()
          marks allow to know whether a state is reachable from q_0 (during the forward phase) or whether a state can not reach q_n (during the backward phase).
 void initQij(ArrayList[] qijvalues)
           
 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.
 void propagateNullInDeg(LightState st, int i)
           
 void propagateNullOutDeg(LightState st, int i)
           
 void propagateRemoval(int i, int j)
          Incremental propagation of a value removal
 void prune(int i, int val)
           
 String toString()
           
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnInf, awakeOnInst, awakeOnRemovals, awakeOnSup, getConstraintType, isConsistent, isSatisfied
 
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
 
Methods inherited from class choco.kernel.solver.propagation.Propagator
activate, 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

INCREMENTAL

public static final boolean INCREMENTAL
See Also:
Constant Field Values

Qij

protected StoredIndexedBipartiteSet[] Qij

offset

protected int[] offset

start

protected int[] start

sizes

protected int[] sizes

autom

protected LightLayeredDFA autom

nbNode

protected int nbNode

sdata

protected choco.cp.solver.constraints.global.regular.Regular.PropagationData sdata
Stored data structured map to the original automaton


Ni

protected ArrayList<LightState>[] Ni

mark

protected BitSet mark

qijvalues

protected HashSet<IndexedObject>[] qijvalues
Constructor Detail

Regular

public Regular(DFA auto,
               IntDomainVar[] vs,
               int[] lbs,
               int[] dsize,
               IEnvironment environment)

Regular

public Regular(DFA auto,
               IntDomainVar[] vs,
               IEnvironment environment)
Enforce the sequence of variable vs to be a word recognized by DFA auto

Parameters:
auto -
vs -
environment -
Method Detail

init

public void init(LightLayeredDFA auto,
                 int[] lbs,
                 int[] dsize,
                 IEnvironment environment)

initQij

public void initQij(ArrayList[] qijvalues)

getFilteredEventMask

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

getQij

public StoredIndexedBipartiteSet getQij(int var,
                                        int val)

initData

public void initData()

initMarck

public void initMarck()
marks allow to know whether a state is reachable from q_0 (during the forward phase) or whether a state can not reach q_n (during the backward phase). they are therefore re-initialized between the two phase


forwardUpdate

public void forwardUpdate()
Only consider states st that can be reached from q0 (which are on a path (qo ~> st))


forwardOnLevel

public void forwardOnLevel(int i)

backwardUpdate

public void backwardUpdate()
Only consider states st that reached qn (which are on a path (st ~> qn))


backwardOnLevel

public void backwardOnLevel(int i)

backward2OnLevel

public void backward2OnLevel(int i)

cleanUp

public void cleanUp()
             throws ContradictionException
removes values that are not supported by any state of the automata

Throws:
ContradictionException

propagate

public void propagate()
               throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint until local consistency is reached.

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

prune

public void prune(int i,
                  int val)
           throws ContradictionException
Parameters:
i -
val -
Throws:
ContradictionException

awake

public void awake()
           throws ContradictionException
Description copied from class: Propagator
Propagation: Propagating the constraint for the very first time until local consistency is reached.

Overrides:
awake in class Propagator
Throws:
ContradictionException - contradiction exception

propagateRemoval

public void propagateRemoval(int i,
                             int j)
                      throws ContradictionException
Incremental propagation of a value removal

Throws:
ContradictionException

decrement_outdeg

public void decrement_outdeg(LightState st,
                             int i)
                      throws ContradictionException
Decrement the out-degree of state st located on the i-th layer

Throws:
ContradictionException

propagateNullOutDeg

public void propagateNullOutDeg(LightState st,
                                int i)
                         throws ContradictionException
Throws:
ContradictionException

decrement_indeg

public void decrement_indeg(LightState st,
                            int i)
                     throws ContradictionException
Decrement the in-degree of state st located on the i-th layer

Throws:
ContradictionException

propagateNullInDeg

public void propagateNullInDeg(LightState st,
                               int i)
                        throws ContradictionException
Throws:
ContradictionException

awakeOnRem

public void awakeOnRem(int idx,
                       int x)
                throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on one value removal: propagation on domain revision.

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

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

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

toString

public String toString()
Overrides:
toString in class AbstractSConstraint<IntDomainVar>


Copyright © 2012. All Rights Reserved.