public class BooleanConstraint extends Constraint
BooleanConstraints can be instantiated with a factory method from non-CNF formulas
(see createBooleanConstraints(BooleanVariable[], String).annotation, autoRemovable, color, id, logger, masked, numIDs, scope| Constructor and Description |
|---|
BooleanConstraint(BooleanVariable[] scope,
boolean[] positive)
Create a
BooleanConstraint given its scope and a specification
of the polarity of literals. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone() |
static BooleanConstraint[] |
createBooleanConstraints(BooleanVariable[] scope,
java.lang.String wff)
A factory method for creating
BooleanConstraints from an arbitrary
propositional logic formula (wff). |
java.lang.String |
getEdgeLabel()
Every
Constraint should implement this method - its value is
what is drawn by the ConstraintNetwork rendering methods. |
org.sat4j.core.VecInt |
getLiterals() |
boolean |
isEquivalent(Constraint c)
Method for assessing the "equivalence" between two constraints.
|
java.lang.String |
toString()
Every
Constraint should implement a toString method (used by the
ConstraintNetwork rendering methods). |
getAnnotation, getColor, getDescription, getID, getScope, isAutoRemovable, isMasked, isSkippableSolver, isUnary, mask, setAnnotation, setAutoRemovable, setColor, setScope, skipSolver, unmaskpublic BooleanConstraint(BooleanVariable[] scope, boolean[] positive)
BooleanConstraint given its scope and a specification
of the polarity of literals.scope - The scope of the clause.positive - Polarity of literals.public static BooleanConstraint[] createBooleanConstraints(BooleanVariable[] scope, java.lang.String wff)
BooleanConstraints from an arbitrary
propositional logic formula (wff). Allowed connectives are
^ (and), v (or), ~ (not), -> (implies), <-> (iff)}.
Atoms in the formula should be named "xN" where
x is in [a-z] and N is in {1..scope.length}. The signature
of the formula must contain all and only the variables in the scope.
The conversion to CNF is provided by the propositional logic CNFTransformer class
of the aima-java library (see aima-java.googlecode.com).
(x1 ^ x2) ^ (x2 v ~x3 ^ x4) ^ (~x1 v x3) ^ (x2 v ~x3 ^ ~x4)
((((x1 ^ x2) ^ (x2 v (~x3 ^ x4))) ^ (~x1 v x3)) ^ (x2 v (~x3 ^ ~x4)))
(((x1 ^ x2) ^ (x2 v (~x3 ^ x4))) ^ ((~x1 v x3) ^ (x2 v (~x3 ^ ~x4))))
scope - The BooleanVariables referred to in the formula.wff - An arbitrary propositional logic formula.BooleanConstraints representing the given formula in CNF.public org.sat4j.core.VecInt getLiterals()
public java.lang.String toString()
ConstraintConstraint should implement a toString method (used by the
ConstraintNetwork rendering methods).toString in class ConstraintString representation of this Constraint.public java.lang.String getEdgeLabel()
ConstraintConstraint should implement this method - its value is
what is drawn by the ConstraintNetwork rendering methods.getEdgeLabel in class ConstraintString representation of the constraint to be used for
ConstraintNetwork rendering.public java.lang.Object clone()
clone in class Constraintpublic boolean isEquivalent(Constraint c)
ConstraintisEquivalent in class Constraintc - The Constraint to compare against.true iff the two constraints are considered to be equivalent.