org.sat4j.pb.constraints.pb
Class MaxWatchPbLong

java.lang.Object
  extended by org.sat4j.pb.constraints.pb.WatchPbLong
      extended by org.sat4j.pb.constraints.pb.MaxWatchPbLong
All Implemented Interfaces:
Serializable, Constr, Propagatable, Undoable, IConstr

public final class MaxWatchPbLong
extends WatchPbLong

Data structure for pseudo-boolean constraint with watched literals. All literals are watched. The sum of the literals satisfied or unvalued is always memorized, to detect conflict.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.sat4j.pb.constraints.pb.WatchPbLong
activity, coefs, degree, learnt, lits, voc
 
Method Summary
protected  void computePropagation(UnitPropagationListener s)
           
protected  void computeWatches()
          All the literals are watched.
static MaxWatchPbLong normalizedMaxWatchPbNew(UnitPropagationListener s, ILits voc, int[] lits, BigInteger[] coefs, BigInteger degree)
          build a pseudo boolean constraint.
static WatchPbLong normalizedWatchPbNew(ILits voc, IDataStructurePB mpb)
          build a pseudo boolean constraint from a specific data structure.
 boolean propagate(UnitPropagationListener s, int p)
          Propagation of a falsified literal
 void remove(UnitPropagationListener upl)
          Remove a constraint from the solver
 void undo(int p)
          this method is called during backtrack
 
Methods inherited from class org.sat4j.pb.constraints.pb.WatchPbLong
assertConstraint, calcReason, canBePropagatedMultipleTimes, coefficientsEqualToOne, computeAnImpliedClause, computeLeftSide, computeLeftSide, equals, forwardActivity, get, getActivity, getLits, getVocabulary, hashCode, incActivity, isAssertive, isSatisfiable, learnt, locked, ppcm, register, rescaleBy, setLearnt, simplify, size, slackConstraint, slackConstraint, sort, sort, toLong, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

computeWatches

protected void computeWatches()
                       throws ContradictionException
All the literals are watched.

Specified by:
computeWatches in class WatchPbLong
Throws:
ContradictionException
See Also:
WatchPbLong.computeWatches()

computePropagation

protected void computePropagation(UnitPropagationListener s)
                           throws ContradictionException
Specified by:
computePropagation in class WatchPbLong
Throws:
ContradictionException

propagate

public boolean propagate(UnitPropagationListener s,
                         int p)
Propagation of a falsified literal

Specified by:
propagate in interface Propagatable
Overrides:
propagate in class WatchPbLong
Parameters:
s - the solver
p - the propagated literal (it must be falsified)
Returns:
false iff there is a conflict

remove

public void remove(UnitPropagationListener upl)
Remove a constraint from the solver

Specified by:
remove in interface Constr
Overrides:
remove in class WatchPbLong

undo

public void undo(int p)
this method is called during backtrack

Specified by:
undo in interface Undoable
Overrides:
undo in class WatchPbLong
Parameters:
p - an unassigned literal

normalizedMaxWatchPbNew

public static MaxWatchPbLong normalizedMaxWatchPbNew(UnitPropagationListener s,
                                                     ILits voc,
                                                     int[] lits,
                                                     BigInteger[] coefs,
                                                     BigInteger degree)
                                              throws ContradictionException
build a pseudo boolean constraint. Coefficients are positive integers less than or equal to the degree (this is called a normalized constraint).

Parameters:
s - a unit propagation listener (usually the solver)
voc - the vocabulary
lits - the literals of the constraint
coefs - the coefficients of the constraint
degree - the degree of the constraint
Returns:
a new PB constraint or null if a trivial inconsistency is detected.
Throws:
ContradictionException

normalizedWatchPbNew

public static WatchPbLong normalizedWatchPbNew(ILits voc,
                                               IDataStructurePB mpb)
build a pseudo boolean constraint from a specific data structure. For learnt constraints.

Parameters:
s - a unit propagation listener (usually the solver)
mpb - data structure which contains literals of the constraint, coefficients (a0, a1, ... an), and the degree of the constraint (k). The constraint is a "more than" constraint.
Returns:
a new PB constraint or null if a trivial inconsistency is detected.


Copyright © 2011 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.