|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sat4j.minisat.constraints.card.MinWatchCard
public class MinWatchCard
Field Summary | |
---|---|
static boolean |
ATLEAST
|
static boolean |
ATMOST
|
protected int |
degree
degree of the cardinality constraint |
protected int |
watchCumul
contains the sum of the coefficients of the watched literals |
Constructor Summary | |
---|---|
|
MinWatchCard(ILits voc,
IVecInt ps,
boolean moreThan,
int degree)
Constructs and normalizes a cardinality constraint. used by minWatchCardNew in the non-normalized case. |
protected |
MinWatchCard(ILits voc,
IVecInt ps,
int degree)
Constructs and normalizes a cardinality constraint. used by MinWatchCardPB.normalizedMinWatchCardNew() in the normalized case. |
Method Summary | |
---|---|
void |
assertConstraint(UnitPropagationListener s)
Method called when the constraint is to be asserted. |
void |
calcReason(int p,
IVecInt outReason)
computes the reason for a literal |
protected MinWatchCard |
computePropagation(UnitPropagationListener s)
|
protected void |
computeWatches()
|
boolean |
equals(Object card)
|
void |
forwardActivity(double claInc)
|
int |
get(int i)
returns the ith literal in the constraint |
double |
getActivity()
Returns the activity of the constraint |
int[] |
getLits()
|
ILits |
getVocabulary()
|
int |
hashCode()
|
void |
incActivity(double claInc)
Increments activity of the constraint |
boolean |
learnt()
Returns wether the constraint is learnt or not. |
protected static int |
linearisation(ILits voc,
IVecInt ps)
Simplifies the constraint w.r.t. the assignments of the literals |
boolean |
locked()
Returns if the constraint is the reason for a unit propagation. |
static MinWatchCard |
minWatchCardNew(UnitPropagationListener s,
ILits voc,
IVecInt ps,
boolean moreThan,
int degree)
Constructs a cardinality constraint with a minimal set of watched literals Permet la cr? |
void |
normalize()
normalize the constraint (cf. |
boolean |
propagate(UnitPropagationListener s,
int p)
propagates the value of a falsified literal |
void |
register()
Register the constraint to the solver. |
void |
remove(UnitPropagationListener upl)
Removes a constraint from the solver |
void |
rescaleBy(double d)
Rescales the activity value of the constraint |
void |
setLearnt()
Mark a constraint as learnt. |
boolean |
simplify()
simplifies the constraint |
int |
size()
|
String |
toString()
Returns a string representation of the constraint. |
void |
undo(int p)
Updates information on the constraint in case of a backtrack |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean ATLEAST
public static final boolean ATMOST
protected int degree
protected int watchCumul
Constructor Detail |
---|
public MinWatchCard(ILits voc, IVecInt ps, boolean moreThan, int degree)
voc
- vocabulary used by the constraintps
- literals involved in the constraintmoreThan
- should be ATLEAST or ATMOST;degree
- degree of the constraintprotected MinWatchCard(ILits voc, IVecInt ps, int degree)
voc
- vocabulary used by the constraintps
- literals involved in the constraintdegree
- degree of the constraintMethod Detail |
---|
public void calcReason(int p, IVecInt outReason)
calcReason
in interface Constr
p
- falsified literal (or Lit.UNDEFINED)outReason
- the reason to be computed. Vector of literals.Constr.calcReason(int p, IVecInt outReason)
public double getActivity()
getActivity
in interface IConstr
IConstr.getActivity()
public void incActivity(double claInc)
incActivity
in interface Constr
claInc
- value to be added to the activity of the constraintConstr.incActivity(double claInc)
public boolean learnt()
learnt
in interface IConstr
IConstr.learnt()
protected static int linearisation(ILits voc, IVecInt ps)
voc
- vocabulary usedps
- literals involved
public boolean locked()
locked
in interface Constr
Constr.locked()
public static MinWatchCard minWatchCardNew(UnitPropagationListener s, ILits voc, IVecInt ps, boolean moreThan, int degree) throws ContradictionException
s
- tool for propagationvoc
- vocalulary used by the constraintps
- literals involved in the constraintmoreThan
- sign of the constraint. Should be ATLEAST or ATMOST.degree
- degree of the constraint
ContradictionException
public final void normalize()
public boolean propagate(UnitPropagationListener s, int p)
propagate
in interface Propagatable
s
- tool for literal propagationp
- falsified literal
public void remove(UnitPropagationListener upl)
remove
in interface Constr
public void rescaleBy(double d)
rescaleBy
in interface Constr
d
- rescale factorpublic boolean simplify()
simplify
in interface Constr
public String toString()
toString
in class Object
public void undo(int p)
undo
in interface Undoable
p
- unassigned literalpublic void setLearnt()
Constr
setLearnt
in interface Constr
public void register()
Constr
register
in interface Constr
public int size()
size
in interface IConstr
public int get(int i)
IConstr
get
in interface IConstr
i
- the index of the literal
public void assertConstraint(UnitPropagationListener s)
Constr
assertConstraint
in interface Constr
s
- a UnitPropagationListener to use for unit propagation.protected void computeWatches()
protected MinWatchCard computePropagation(UnitPropagationListener s) throws ContradictionException
ContradictionException
public int[] getLits()
public ILits getVocabulary()
public boolean equals(Object card)
equals
in class Object
public int hashCode()
hashCode
in class Object
public void forwardActivity(double claInc)
forwardActivity
in interface Constr
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |