|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.sat4j.tools.SolverDecorator<ISolver>
org.sat4j.opt.AbstractSelectorVariablesDecorator
public abstract class AbstractSelectorVariablesDecorator
Abstract class which adds a new "selector" variable for each clause entered in the solver. As a consequence, an original problem with n variables and m clauses will end up with n+m variables.
| Field Summary | |
|---|---|
protected int |
nbnewvar
|
protected int |
nborigvars
|
protected boolean[] |
prevboolmodel
|
protected int[] |
prevfullmodel
|
protected int[] |
prevmodel
|
| Constructor Summary | |
|---|---|
AbstractSelectorVariablesDecorator(ISolver solver)
|
|
| Method Summary | |
|---|---|
boolean |
admitABetterSolution()
Look for a solution of the optimization problem. |
boolean |
admitABetterSolution(IVecInt assumps)
Look for a solution of the optimization problem when some literals are satisfied. |
int |
getExpectedNumberOfClauses()
|
int[] |
model()
Provide a model (if any) for a satisfiable formula. |
boolean |
model(int var)
Provide the truth value of a specific variable in the model. |
int |
newVar(int howmany)
Create howmany variables in the solver (and thus in the
vocabulary). |
void |
reset()
Clean up the internal state of the solver. |
void |
setExpectedNumberOfClauses(int nb)
To inform the solver of the expected number of clauses to read. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.sat4j.specs.IOptimizationProblem |
|---|
calculateObjective, discard, discardCurrentSolution, forceObjectiveValueTo, getObjectiveValue, hasNoObjectiveFunction, nonOptimalMeansSatisfiable |
| Methods inherited from interface org.sat4j.specs.IProblem |
|---|
findModel, findModel, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, nConstraints, nVars, printInfos |
| Field Detail |
|---|
protected int nborigvars
protected int nbnewvar
protected int[] prevfullmodel
protected int[] prevmodel
protected boolean[] prevboolmodel
| Constructor Detail |
|---|
public AbstractSelectorVariablesDecorator(ISolver solver)
| Method Detail |
|---|
public int newVar(int howmany)
ISolverhowmany variables in the solver (and thus in the
vocabulary).
newVar in interface ISolvernewVar in class SolverDecorator<ISolver>howmany - number of variables to create
public void setExpectedNumberOfClauses(int nb)
ISolverp cnf line is
read in dimacs formatted input file.
Note that this method is supposed to be called AFTER a call to
newVar(int)
setExpectedNumberOfClauses in interface ISolversetExpectedNumberOfClauses in class SolverDecorator<ISolver>nb - the expected number of clauses.ISolver.newVar(int)public int getExpectedNumberOfClauses()
public void reset()
ISolver
reset in interface ISolverreset in class SolverDecorator<ISolver>
public boolean admitABetterSolution()
throws TimeoutException
IOptimizationProblem
admitABetterSolution in interface IOptimizationProblemTimeoutException - if the solver cannot answer in reasonable time.ISolver.setTimeout(int)
public boolean admitABetterSolution(IVecInt assumps)
throws TimeoutException
IOptimizationProblem
admitABetterSolution in interface IOptimizationProblemassumps - a set of literals in Dimacs format.
TimeoutException - if the solver cannot answer in reasonable time.ISolver.setTimeout(int)public int[] model()
IProblem
model in interface IProblemmodel in class SolverDecorator<ISolver>IProblem.isSatisfiable(),
IProblem.isSatisfiable(IVecInt)public boolean model(int var)
IProblem
model in interface IProblemmodel in class SolverDecorator<ISolver>var - the variable id in Dimacs format
IProblem.model()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||