public class BooleanSatisfiabilitySolver extends ConstraintSolver
BooleanSatisfiabilitySolver provides a means to reason upon Boolean Satisfiability
constraint problems. It is based on the off the shelf SAT4J solver, available at www.sat4j.org.
The solver's variables are BooleanVariables, which can be bound by BooleanConstraints.
The latter are disjunctive Boolean clauses, thus the collection of all BooleanConstraints in
a ConstraintNetwork represents a well-formed-formula (wff) in Conjunctive Normal Form (CNF).
Note that BooleanConstraints can be instantiated with a factory method from non-CNF formulas
(see BooleanConstraint.createBooleanConstraints(BooleanVariable[], String).ConstraintSolver.OPTIONS| Modifier and Type | Field and Description |
|---|---|
protected int |
BVIDs |
static int |
MAX_SAT_CLAUSES |
static int |
MAX_SAT_VARS |
autoprop, components, constraintTypes, IDs, logger, name, nesting, noPropOnVarCreation, numcalls, skipPropagation, spacing, theNetwork, variableType| Constructor and Description |
|---|
BooleanSatisfiabilitySolver()
Create a new
BooleanSatisfiabilitySolver that will accept at most MAX_SAT_VARS
BooleanVariables and MAX_SAT_CLAUSES BooleanConstraints. |
BooleanSatisfiabilitySolver(int maxVars,
int maxClauses)
Create a new
BooleanSatisfiabilitySolver. |
BooleanSatisfiabilitySolver(int maxVars,
int maxClauses,
boolean propagateOnVarCreation)
Create a new
BooleanSatisfiabilitySolver. |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
addConstraintsSub(Constraint[] c)
This method must be implemented by the developer of the specific
ConstraintSolver
class. |
protected BooleanVariable[] |
createVariablesSub(int num)
This method must be implemented by the developer of the specific
ConstraintSolver
class. |
boolean |
enumeratesModels()
Returns whether this
BooleanSatisfiabilitySolver enumerates models. |
boolean |
propagate()
Propagate the constraint network.
|
void |
registerValueChoiceFunctions() |
protected void |
removeConstraintsSub(Constraint[] c)
This method must be implemented by the developer of the specific
ConstraintSolver
class. |
protected void |
removeVariablesSub(Variable[] v)
This method must be implemented by the developer of the specific
ConstraintSolver
class. |
void |
setEnumerateModels(boolean enumerateModels)
Sets whether this
BooleanSatisfiabilitySolver should enumerate models or not. |
addConstraint, addConstraintNoPropagation, addConstraints, addConstraintsDebug, addConstraintsNoPropagation, containsVariable, createVariable, createVariable, createVariables, createVariables, createVariablesSub, deplenish, getComponent, getComponents, getConstraintNetwork, getConstraints, getConstraints, getDescription, getID, getOption, getVariable, getVariables, getVariables, getVariables, isCompatible, maskConstraints, removeConstraint, removeConstraints, removeVariable, removeVariables, setComponent, setComponents, setConstraintNetwork, setName, setOptions, toString, unmaskConstraintspublic static final int MAX_SAT_VARS
public static final int MAX_SAT_CLAUSES
protected int BVIDs
public BooleanSatisfiabilitySolver()
BooleanSatisfiabilitySolver that will accept at most MAX_SAT_VARS
BooleanVariables and MAX_SAT_CLAUSES BooleanConstraints.public BooleanSatisfiabilitySolver(int maxVars,
int maxClauses)
BooleanSatisfiabilitySolver. This solver will accept
at most maxVars BooleanVariables and
maxClauses BooleanConstraints.maxVars - maxClauses - public BooleanSatisfiabilitySolver(int maxVars,
int maxClauses,
boolean propagateOnVarCreation)
BooleanSatisfiabilitySolver. This solver will accept
at most maxVars BooleanVariables and
maxClauses BooleanConstraints.maxVars - maxClauses - public void setEnumerateModels(boolean enumerateModels)
BooleanSatisfiabilitySolver should enumerate models or not.enumerateModels - Whether this BooleanSatisfiabilitySolver should enumerate models or not.public boolean enumeratesModels()
BooleanSatisfiabilitySolver enumerates models.true iff this BooleanSatisfiabilitySolver enumerates models.public boolean propagate()
ConstraintSolverpropagate in class ConstraintSolverprotected boolean addConstraintsSub(Constraint[] c)
ConstraintSolverConstraintSolver
class. It should implement all operations necessary to add multiple constraints, and should return
true upon success, false otherwise.addConstraintsSub in class ConstraintSolverc - The constraints to add.true iff the constraints were added to the ConstraintNetwork.protected void removeConstraintsSub(Constraint[] c)
ConstraintSolverConstraintSolver
class. Should implement all operations necessary to remove a batch of constraints.removeConstraintsSub in class ConstraintSolverc - The constraints to remove.protected BooleanVariable[] createVariablesSub(int num)
ConstraintSolverConstraintSolver
class. It should implement all operations necessary to create a batch of variable for the specific
type of ConstraintSolver.createVariablesSub in class ConstraintSolvernum - The number of variables to create.Variable for this ConstraintSolver.protected void removeVariablesSub(Variable[] v)
ConstraintSolverConstraintSolver
class. It should implement all operations necessary to remove a batch of variables for
the specific type of ConstraintSolver.removeVariablesSub in class ConstraintSolverv - The Variables to remove.public void registerValueChoiceFunctions()
registerValueChoiceFunctions in class ConstraintSolver