|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sat4j.tools.SolverDecorator<ISolver> org.sat4j.opt.AbstractSelectorVariablesDecorator org.sat4j.opt.MaxSatDecorator
public final class MaxSatDecorator
Computes a solution that satisfies the maximum of clauses.
Field Summary |
---|
Fields inherited from class org.sat4j.opt.AbstractSelectorVariablesDecorator |
---|
isSolutionOptimal, prevboolmodel, prevfullmodel, prevmodel |
Constructor Summary | |
---|---|
MaxSatDecorator(ISolver solver)
|
|
MaxSatDecorator(ISolver solver,
boolean equivalence)
|
Method Summary | |
---|---|
IConstr |
addClause(IVecInt literals)
Create a clause from a set of literals The literals are represented by non null integers such that opposite literals a represented by opposite values. |
boolean |
admitABetterSolution(IVecInt assumps)
Look for a solution of the optimization problem when some literals are satisfied. |
Number |
calculateObjective()
Compute the value of the objective function for the current solution. |
void |
discard()
Discard the current solution in the optimization problem. |
void |
discardCurrentSolution()
Discard the current solution in the optimization problem. |
void |
forceObjectiveValueTo(Number forcedValue)
Force the value of the objective function. |
Number |
getObjectiveValue()
Read only access to the value of the objective function for the current solution. |
boolean |
hasNoObjectiveFunction()
If the optimization problem has no objective function, then it is a simple decision problem. |
boolean |
nonOptimalMeansSatisfiable()
A suboptimal solution has different meaning depending of the optimization problem considered. |
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 org.sat4j.opt.AbstractSelectorVariablesDecorator |
---|
admitABetterSolution, getExpectedNumberOfClauses, isOptimal, model, model |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.sat4j.specs.IProblem |
---|
findModel, findModel, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, nConstraints, newVar, nVars, primeImplicant, primeImplicant, printInfos |
Constructor Detail |
---|
public MaxSatDecorator(ISolver solver)
public MaxSatDecorator(ISolver solver, boolean equivalence)
Method Detail |
---|
public void setExpectedNumberOfClauses(int nb)
ISolver
p 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 ISolver
setExpectedNumberOfClauses
in class AbstractSelectorVariablesDecorator
nb
- the expected number of clauses.IProblem.newVar(int)
public IConstr addClause(IVecInt literals) throws ContradictionException
ISolver
addClause
in interface ISolver
addClause
in class SolverDecorator<ISolver>
literals
- a set of literals
ContradictionException
- iff the vector of literals is empty or if it contains only
falsified literals after unit propagationISolver.removeConstr(IConstr)
public void reset()
ISolver
reset
in interface ISolver
reset
in class SolverDecorator<ISolver>
public boolean hasNoObjectiveFunction()
IOptimizationProblem
public boolean nonOptimalMeansSatisfiable()
IOptimizationProblem
public Number calculateObjective()
IOptimizationProblem
IOptimizationProblem.getObjectiveValue()
public void discardCurrentSolution() throws ContradictionException
IOptimizationProblem
ContradictionException
- if a trivial inconsistency is detected.public boolean admitABetterSolution(IVecInt assumps) throws TimeoutException
IOptimizationProblem
admitABetterSolution
in interface IOptimizationProblem
admitABetterSolution
in class AbstractSelectorVariablesDecorator
assumps
- a set of literals in Dimacs format.
TimeoutException
- if the solver cannot answer in reasonable time.ISolver.setTimeout(int)
public void discard() throws ContradictionException
IOptimizationProblem
ContradictionException
- if a trivial inconsistency is detected.IOptimizationProblem.discardCurrentSolution()
public Number getObjectiveValue()
IOptimizationProblem
public void forceObjectiveValueTo(Number forcedValue) throws ContradictionException
IOptimizationProblem
ContradictionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |