public class PseudoOptDecorator extends PBSolverDecorator implements IOptimizationProblem
| Constructor and Description |
|---|
PseudoOptDecorator(IPBSolver solver)
Create a PB decorator for which a non optimal solution means that the
problem is satisfiable.
|
PseudoOptDecorator(IPBSolver solver,
boolean nonOptimalMeansSatisfiable)
Create a PB decorator with a specific semantic of non optimal solution.
|
PseudoOptDecorator(IPBSolver solver,
boolean nonOptimalMeansSatisfiable,
boolean useAnImplicantForEvaluation)
Create a PB decorator with a specific semantic of non optimal solution.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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 |
isOptimal()
Allows to check afterwards if the solution provided by the solver 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 assumps)
Check the satisfiability of the set of constraints contained inside the
solver.
|
boolean |
isSatisfiable(IVecInt assumps,
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).
|
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 |
setObjectiveFunction(ObjectiveFunction objf)
Provide an objective function to the solver.
|
void |
setTimeout(int t)
To set the internal timeout of the solver.
|
void |
setTimeoutForFindingBetterSolution(int seconds)
Allow to set a specific timeout when the solver is in optimization mode.
|
String |
toString(String prefix)
Display a textual representation of the solver configuration.
|
addAtLeast, addAtLeast, addAtMost, addAtMost, addExactly, addExactly, addPseudoBoolean, getObjectiveFunctionaddAllClauses, addAtLeast, addAtMost, addBlockingClause, addClause, addExactly, clearDecorated, clearLearntClauses, decorated, expireTimeout, findModel, findModel, 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, setTimeoutMs, setTimeoutOnConflicts, setVerbose, toString, unsatExplanationclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfindModel, findModel, nConstraints, newVar, nVars, primeImplicant, primeImplicant, printInfos, printInfosaddAllClauses, addAtLeast, addAtMost, addBlockingClause, addClause, addExactly, clearLearntClauses, expireTimeout, getLogPrefix, getSearchListener, getSolvingEngine, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSolverKeptHot, isVerbose, newVar, nextFreeVarId, printStat, printStat, printStat, realNumberOfVariables, registerLiteral, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setExpectedNumberOfClauses, setKeepSolverHot, setLogPrefix, setSearchListener, setTimeoutMs, setTimeoutOnConflicts, setVerbose, unsatExplanationpublic PseudoOptDecorator(IPBSolver solver)
solver - a PB solver.public PseudoOptDecorator(IPBSolver solver, boolean nonOptimalMeansSatisfiable)
solver - a PB solvernonOptimalMeansSatisfiable - true if a suboptimal solution means that the problem is
satisfiable (e.g. as in the PB competition), else false (e.g.
as in the MAXSAT competition).public PseudoOptDecorator(IPBSolver solver, boolean nonOptimalMeansSatisfiable, boolean useAnImplicantForEvaluation)
solver - a PB solvernonOptimalMeansSatisfiable - true if a suboptimal solution means that the problem is
satisfiable (e.g. as in the PB competition), else false (e.g.
as in the MAXSAT competition).useAnImplicantForEvaluation - uses an implicant (a prime implicant computed using
SolverDecorator.primeImplicant()) instead of a plain model to
evaluate the objective function.public boolean isSatisfiable()
throws TimeoutException
IProblemisSatisfiable in interface IProblemisSatisfiable in class SolverDecorator<IPBSolver>TimeoutExceptionpublic boolean isSatisfiable(boolean global)
throws TimeoutException
IProblemisSatisfiable in interface IProblemisSatisfiable in class SolverDecorator<IPBSolver>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.TimeoutExceptionpublic boolean isSatisfiable(IVecInt assumps, boolean global) throws TimeoutException
IProblemisSatisfiable in interface IProblemisSatisfiable in class SolverDecorator<IPBSolver>assumps - 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.TimeoutExceptionpublic boolean isSatisfiable(IVecInt assumps) throws TimeoutException
IProblemisSatisfiable in interface IProblemisSatisfiable in class SolverDecorator<IPBSolver>assumps - a set of literals (represented by usual non null integers in
Dimacs format).TimeoutExceptionpublic void setObjectiveFunction(ObjectiveFunction objf)
IPBSolversetObjectiveFunction in interface IPBSolversetObjectiveFunction in class PBSolverDecoratorobjf - the objective functionpublic boolean admitABetterSolution()
throws TimeoutException
IOptimizationProblemadmitABetterSolution in interface IOptimizationProblemTimeoutException - if the solver cannot answer in reasonable time.ISolver.setTimeout(int)public boolean admitABetterSolution(IVecInt assumps) throws TimeoutException
IOptimizationProblemadmitABetterSolution in interface IOptimizationProblemassumps - a set of literals in Dimacs format.TimeoutException - if the solver cannot answer in reasonable time.ISolver.setTimeout(int)public boolean hasNoObjectiveFunction()
IOptimizationProblemhasNoObjectiveFunction in interface IOptimizationProblempublic boolean nonOptimalMeansSatisfiable()
IOptimizationProblemnonOptimalMeansSatisfiable in interface IOptimizationProblempublic Number calculateObjective()
IOptimizationProblemcalculateObjective in interface IOptimizationProblemIOptimizationProblem.getObjectiveValue()public void discardCurrentSolution()
throws ContradictionException
IOptimizationProblemdiscardCurrentSolution in interface IOptimizationProblemContradictionException - if a trivial inconsistency is detected.public void reset()
ISolverreset in interface ISolverreset in class SolverDecorator<IPBSolver>public int[] model()
IProblemmodel in interface IProblemmodel in class SolverDecorator<IPBSolver>IProblem.isSatisfiable(),
IProblem.isSatisfiable(IVecInt)public boolean model(int var)
RandomAccessModelmodel in interface RandomAccessModelmodel in class SolverDecorator<IPBSolver>var - the variable id in Dimacs format#model()public String toString(String prefix)
ISolvertoString in interface ISolvertoString in class SolverDecorator<IPBSolver>prefix - the prefix to use on each line.public Number getObjectiveValue()
IOptimizationProblemgetObjectiveValue in interface IOptimizationProblempublic void discard()
throws ContradictionException
IOptimizationProblemdiscard in interface IOptimizationProblemContradictionException - if a trivial inconsistency is detected.IOptimizationProblem.discardCurrentSolution()public void forceObjectiveValueTo(Number forcedValue) throws ContradictionException
IOptimizationProblemforceObjectiveValueTo in interface IOptimizationProblemContradictionExceptionpublic boolean isOptimal()
IOptimizationProblemisOptimal in interface IOptimizationProblempublic int[] modelWithInternalVariables()
ISolvermodelWithInternalVariables in interface ISolvermodelWithInternalVariables in class SolverDecorator<IPBSolver>IProblem.model(),
ModelIteratorpublic void setTimeoutForFindingBetterSolution(int seconds)
IOptimizationProblemsetTimeoutForFindingBetterSolution in interface IOptimizationProblempublic void setTimeout(int t)
ISolversetTimeout in interface ISolversetTimeout in class SolverDecorator<IPBSolver>t - the timeout (in s)Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.