choco.cp.solver.constraints.integer.bool.sat
Class ClauseStore

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.integer.bool.sat.ClauseStore
All Implemented Interfaces:
IExtensionnable, IPretty, SConstraint<IntDomainVar>, IntPropagator, Cloneable, EventListener

public final class ClauseStore
extends AbstractLargeIntSConstraint

A global constraint to store and propagate all clauses


Field Summary
protected  int[][][] clause_entailed
           
protected  IStateIntVector clauses_not_entailed
           
 boolean efficient_entailment_test
           
protected  int[] fineDegree
           
protected  LinkedList<IntDomainVar> instToOne
           
protected  LinkedList<IntDomainVar> instToZero
           
protected  ArrayList<WLClause> listclause
           
protected  LinkedList<WLClause> listToPropagate
           
protected  int nbNonBinaryClauses
           
static boolean nonincprop
           
protected  Lits voc
           
 
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
ClauseStore(IntDomainVar[] vars, ArrayList<WLClause> listclause, Lits voc, IEnvironment environment)
           
ClauseStore(IntDomainVar[] vars, IEnvironment environment)
           
 
Method Summary
 void addClause(int[] lits)
           
 void addClause(IntDomainVar[] positivelits, IntDomainVar[] negativelits)
          add a clause in the store WARNING : this method assumes that the variables are in the scope of the ClauseStore
 void addNoGood(IntDomainVar[] positivelits, IntDomainVar[] negativelits)
           
 void awake()
          Propagation: Propagating the constraint for the very first time until local consistency is reached.
 void awakeOnInst(int idx)
          Default propagation on instantiation: full constraint re-propagation.
 void clearEfficientEntailmentTest()
           
 int[] computeLits(IntDomainVar[] plit, IntDomainVar[] nlit)
           
 void createEntailmentStructures()
           
 void delete(WLClause wlc)
          Remove a clause from the store
 DynWLClause fast_addNoGood(int[] lits)
          Add a clause given the set of literals
 void filterFromScratch()
           
 void filterOnInst(int idx)
           
 int findIndex(IntDomainVar v)
           
 ArrayList<WLClause> getClauses()
           
 int getFilteredEventMask(int idx)
           
 int getFineDegree(int idx)
          Some global constraint might be able to provide some fine grained information about the "real" degree of a variables.
 int getNbClause()
           
 int getNbEntailedClauseFrom(int idx, int val)
           
 Lits getVoc()
           
 void initEntailmentStructures()
           
 Boolean isEntailed()
          Indicates if the constraint is entailed, from now on will be always satisfied
 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 maintainEfficientEntailment(int idx, int val)
           
 void printClauses()
           
 void propagate()
          Propagation: Propagating the constraint until local consistency is reached.
 void propagateUnitClause()
           
static IntDomainVar[] removeRedundantVars(IntDomainVar[] vs)
           
 void setEfficientEntailmentTest()
           
 void updateDegree(int[] lit)
           
 
Methods inherited from class choco.kernel.solver.constraints.integer.AbstractIntSConstraint
awakeOnBounds, awakeOnInf, awakeOnRem, awakeOnRemovals, awakeOnSup, getConstraintType, isConsistent
 
Methods inherited from class choco.kernel.solver.constraints.AbstractSConstraint
addExtension, addListener, clone, getAbstractSConstraintExtensionNumber, getConstraintIdx, getExtension, getNbVarNotInst, getNbVars, getVar, getVarQuick, isCompletelyInstantiated, opposite, pretty, setConstraintIndex, setExtension, setVar, toString
 
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

nonincprop

public static final boolean nonincprop
See Also:
Constant Field Values

efficient_entailment_test

public boolean efficient_entailment_test

voc

protected final Lits voc

listclause

protected final ArrayList<WLClause> listclause

listToPropagate

protected final LinkedList<WLClause> listToPropagate

instToOne

protected final LinkedList<IntDomainVar> instToOne

instToZero

protected final LinkedList<IntDomainVar> instToZero

fineDegree

protected final int[] fineDegree

nbNonBinaryClauses

protected int nbNonBinaryClauses

clause_entailed

protected int[][][] clause_entailed

clauses_not_entailed

protected IStateIntVector clauses_not_entailed
Constructor Detail

ClauseStore

public ClauseStore(IntDomainVar[] vars,
                   IEnvironment environment)
Parameters:
vars - must be a table of BooleanVarImpl
environment -

ClauseStore

public ClauseStore(IntDomainVar[] vars,
                   ArrayList<WLClause> listclause,
                   Lits voc,
                   IEnvironment environment)
Method Detail

getClauses

public ArrayList<WLClause> getClauses()

setEfficientEntailmentTest

public void setEfficientEntailmentTest()

clearEfficientEntailmentTest

public void clearEfficientEntailmentTest()

getFilteredEventMask

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

getVoc

public Lits getVoc()

awakeOnInst

public void awakeOnInst(int idx)
                 throws ContradictionException
Description copied from class: AbstractIntSConstraint
Default propagation on instantiation: full constraint re-propagation.

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

filterOnInst

public void filterOnInst(int idx)
                  throws ContradictionException
Throws:
ContradictionException

maintainEfficientEntailment

public void maintainEfficientEntailment(int idx,
                                        int val)

addClause

public void addClause(int[] lits)

removeRedundantVars

public static IntDomainVar[] removeRedundantVars(IntDomainVar[] vs)

computeLits

public int[] computeLits(IntDomainVar[] plit,
                         IntDomainVar[] nlit)

updateDegree

public void updateDegree(int[] lit)

addClause

public void addClause(IntDomainVar[] positivelits,
                      IntDomainVar[] negativelits)
add a clause in the store WARNING : this method assumes that the variables are in the scope of the ClauseStore

Parameters:
positivelits -
negativelits -

findIndex

public int findIndex(IntDomainVar v)

addNoGood

public void addNoGood(IntDomainVar[] positivelits,
                      IntDomainVar[] negativelits)

fast_addNoGood

public DynWLClause fast_addNoGood(int[] lits)
Add a clause given the set of literals

Parameters:
lits -
Returns:

delete

public void delete(WLClause wlc)
Remove a clause from the store

Parameters:
wlc -

createEntailmentStructures

public void createEntailmentStructures()

initEntailmentStructures

public void initEntailmentStructures()

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

propagateUnitClause

public void propagateUnitClause()
                         throws ContradictionException
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

filterFromScratch

public void filterFromScratch()
                       throws ContradictionException
Throws:
ContradictionException

isEntailed

public Boolean isEntailed()
Description copied from class: AbstractSConstraint
Indicates if the constraint is entailed, from now on will be always satisfied

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

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

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

getFineDegree

public int getFineDegree(int idx)
Description copied from class: AbstractSConstraint
Some global constraint might be able to provide some fine grained information about the "real" degree of a variables. For example the global constraint on clauses can give the real number of clauses on each variable

Specified by:
getFineDegree in interface SConstraint<IntDomainVar>
Overrides:
getFineDegree in class AbstractSConstraint<IntDomainVar>
Parameters:
idx - index of the variable in the constraint
Returns:
a weight given to the variable by the constraint

getNbEntailedClauseFrom

public int getNbEntailedClauseFrom(int idx,
                                   int val)

getNbClause

public int getNbClause()

printClauses

public final void printClauses()


Copyright © 2012. All Rights Reserved.