public class OptToSatAdapter extends SolverDecorator<ISolver>
Constructor and Description |
---|
OptToSatAdapter(IOptimizationProblem problem) |
OptToSatAdapter(IOptimizationProblem problem,
SolutionFoundListener sfl) |
Modifier and Type | Method and Description |
---|---|
int[] |
findModel()
Look for a model satisfying all the clauses available in the problem.
|
int[] |
findModel(IVecInt assumps)
Look for a model satisfying all the clauses available in the problem.
|
boolean |
isOptimal()
Allow to easily check is the solution returned by isSatisfiable is
optimal or not.
|
boolean |
isSatisfiable()
Check the satisfiability of the set of constraints contained inside the
solver.
|
boolean |
isSatisfiable(boolean global)
Check the satisfiability of the set of constraints contained inside the
solver.
|
boolean |
isSatisfiable(IVecInt myAssumps)
Check the satisfiability of the set of constraints contained inside the
solver.
|
boolean |
isSatisfiable(IVecInt myAssumps,
boolean global)
Check the satisfiability of the set of constraints contained inside the
solver.
|
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[] |
modelWithInternalVariables()
That method is designed to be used to retrieve the real model of the
current set of constraints, i.e. to provide the truth value of boolean
variables used internally in the solver (for encoding purposes for
instance).
|
void |
reset()
Clean up the internal state of the solver.
|
String |
toString(String prefix)
Display a textual representation of the solver configuration.
|
addAllClauses, addAtLeast, addAtMost, addBlockingClause, addClause, addExactly, clearDecorated, clearLearntClauses, decorated, expireTimeout, getLogPrefix, getSearchListener, getSolvingEngine, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSolverKeptHot, isVerbose, nConstraints, newVar, newVar, nextFreeVarId, nVars, primeImplicant, primeImplicant, printInfos, printInfos, printStat, printStat, printStat, realNumberOfVariables, registerLiteral, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setExpectedNumberOfClauses, setKeepSolverHot, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setUnitClauseProvider, setVerbose, toString, unsatExplanation
public OptToSatAdapter(IOptimizationProblem problem)
public OptToSatAdapter(IOptimizationProblem problem, SolutionFoundListener sfl)
public void reset()
ISolver
reset
in interface ISolver
reset
in class SolverDecorator<ISolver>
public boolean isSatisfiable() throws TimeoutException
IProblem
isSatisfiable
in interface IProblem
isSatisfiable
in class SolverDecorator<ISolver>
TimeoutException
public boolean isSatisfiable(boolean global) throws TimeoutException
IProblem
isSatisfiable
in interface IProblem
isSatisfiable
in class SolverDecorator<ISolver>
global
- whether that call is part of a global process (i.e.
optimization) or not. if (global), the timeout will not be
reset between each call.TimeoutException
public boolean isSatisfiable(IVecInt myAssumps, boolean global) throws TimeoutException
IProblem
isSatisfiable
in interface IProblem
isSatisfiable
in class SolverDecorator<ISolver>
myAssumps
- a set of literals (represented by usual non null integers in
Dimacs format).global
- whether that call is part of a global process (i.e.
optimization) or not. if (global), the timeout will not be
reset between each call.TimeoutException
public boolean isSatisfiable(IVecInt myAssumps) throws TimeoutException
IProblem
isSatisfiable
in interface IProblem
isSatisfiable
in class SolverDecorator<ISolver>
myAssumps
- a set of literals (represented by usual non null integers in
Dimacs format).TimeoutException
public int[] model()
IProblem
model
in interface IProblem
model
in class SolverDecorator<ISolver>
IProblem.isSatisfiable()
,
IProblem.isSatisfiable(IVecInt)
public boolean model(int var)
RandomAccessModel
model
in interface RandomAccessModel
model
in class SolverDecorator<ISolver>
var
- the variable id in Dimacs format#model()
public int[] modelWithInternalVariables()
ISolver
modelWithInternalVariables
in interface ISolver
modelWithInternalVariables
in class SolverDecorator<ISolver>
IProblem.model()
,
ModelIterator
public int[] findModel() throws TimeoutException
IProblem
if (isSatisfiable()) {
return model();
}
return null;
findModel
in interface IProblem
findModel
in class SolverDecorator<ISolver>
null
if no model is foundTimeoutException
- if a model cannot be found within the given timeout.public int[] findModel(IVecInt assumps) throws TimeoutException
IProblem
if (isSatisfiable(assumpt)) {
return model();
}
return null;
findModel
in interface IProblem
findModel
in class SolverDecorator<ISolver>
null
if no model is foundTimeoutException
- if a model cannot be found within the given timeout.public String toString(String prefix)
ISolver
toString
in interface ISolver
toString
in class SolverDecorator<ISolver>
prefix
- the prefix to use on each line.public boolean isOptimal()
Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.