public class MinCostDecorator extends PBSolverDecorator implements IOptimizationProblem
| Constructor and Description | 
|---|
MinCostDecorator(IPBSolver solver)  | 
| 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. 
 | 
int | 
costOf(int var)
to know the cost of a given var. 
 | 
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. 
 | 
int[] | 
model()
Provide a model (if any) for a satisfiable formula. 
 | 
int | 
newVar()
Create a new variable in the solver (and thus in the vocabulary). 
 | 
int | 
newVar(int howmany)
Setup the number of variables to use inside the solver. 
 | 
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 | 
setCost(int var,
       int cost)
to set the cost of a given var. 
 | 
void | 
setTimeoutForFindingBetterSolution(int seconds)
Allow to set a specific timeout when the solver is in optimization mode. 
 | 
addAtLeast, addAtLeast, addAtMost, addAtMost, addExactly, addExactly, addPseudoBoolean, getObjectiveFunction, setObjectiveFunctionaddAllClauses, addAtLeast, addAtMost, addBlockingClause, addClause, addExactly, clearDecorated, clearLearntClauses, decorated, expireTimeout, findModel, findModel, getLogPrefix, getSearchListener, getSolvingEngine, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, isSolverKeptHot, isVerbose, model, modelWithInternalVariables, nConstraints, nextFreeVarId, nVars, primeImplicant, primeImplicant, printInfos, printInfos, printStat, printStat, printStat, realNumberOfVariables, registerLiteral, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setExpectedNumberOfClauses, setKeepSolverHot, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setUnitClauseProvider, setVerbose, toString, toString, unsatExplanationclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfindModel, findModel, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, nConstraints, nVars, primeImplicant, primeImplicant, printInfos, printInfosmodeladdAllClauses, addAtLeast, addAtMost, addBlockingClause, addClause, addExactly, clearLearntClauses, expireTimeout, getLogPrefix, getSearchListener, getSolvingEngine, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSolverKeptHot, isVerbose, modelWithInternalVariables, nextFreeVarId, printStat, printStat, printStat, realNumberOfVariables, registerLiteral, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setExpectedNumberOfClauses, setKeepSolverHot, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setUnitClauseProvider, setVerbose, toString, unsatExplanationpublic MinCostDecorator(IPBSolver solver)
public int newVar()
ISolvernewVar in interface ISolvernewVar in class SolverDecorator<IPBSolver>public int newVar(int howmany)
newVar in interface IProblemnewVar in class SolverDecorator<IPBSolver>howmany - the maximum number of variables in the solver.IProblem.nVars()public int costOf(int var)
var - a variable in dimacs formatpublic void setCost(int var,
           int cost)
var - a variable in dimacs formatcost - the cost of var when assigned to truepublic 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 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 void setTimeoutForFindingBetterSolution(int seconds)
IOptimizationProblemsetTimeoutForFindingBetterSolution in interface IOptimizationProblemCopyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.