|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.sat4j.tools.SolverDecorator<IPBSolver>
org.sat4j.pb.PBSolverDecorator
org.sat4j.maxsat.MinCostDecorator
public class MinCostDecorator
A decorator that computes minimal cost models. That problem is also known as binate covering problem. Please make sure that newVar(howmany) is called first to setup the decorator.
Constructor Summary | |
---|---|
MinCostDecorator(IPBSolver 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. |
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. |
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. |
Methods inherited from class org.sat4j.pb.PBSolverDecorator |
---|
addPseudoBoolean, getObjectiveFunction, setObjectiveFunction |
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, model, nConstraints, nVars, printInfos |
Methods inherited from interface org.sat4j.specs.ISolver |
---|
addAllClauses, addAtLeast, addAtMost, addBlockingClause, addClause, clearLearntClauses, expireTimeout, getLogPrefix, getSearchListener, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isVerbose, nextFreeVarId, printStat, printStat, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setExpectedNumberOfClauses, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setVerbose, toString, unsatExplanation |
Constructor Detail |
---|
public MinCostDecorator(IPBSolver solver)
Method Detail |
---|
public int newVar()
ISolver
newVar
in interface ISolver
newVar
in class SolverDecorator<IPBSolver>
public int newVar(int howmany)
newVar
in interface ISolver
newVar
in class SolverDecorator<IPBSolver>
howmany
- the maximum number of variables in the solver.
public int costOf(int var)
var
- a variable in dimacs format
public void setCost(int var, int cost)
var
- a variable in dimacs formatcost
- the cost of var when assigned to truepublic boolean admitABetterSolution() throws TimeoutException
IOptimizationProblem
admitABetterSolution
in interface IOptimizationProblem
TimeoutException
- if the solver cannot answer in reasonable time.ISolver.setTimeout(int)
public boolean admitABetterSolution(IVecInt assumps) throws TimeoutException
IOptimizationProblem
admitABetterSolution
in interface IOptimizationProblem
assumps
- a set of literals in Dimacs format.
TimeoutException
- if the solver cannot answer in reasonable time.ISolver.setTimeout(int)
public boolean hasNoObjectiveFunction()
IOptimizationProblem
hasNoObjectiveFunction
in interface IOptimizationProblem
public boolean nonOptimalMeansSatisfiable()
IOptimizationProblem
nonOptimalMeansSatisfiable
in interface IOptimizationProblem
public Number calculateObjective()
IOptimizationProblem
calculateObjective
in interface IOptimizationProblem
IOptimizationProblem.getObjectiveValue()
public void discardCurrentSolution() throws ContradictionException
IOptimizationProblem
discardCurrentSolution
in interface IOptimizationProblem
ContradictionException
- if a trivial inconsistency is detected.public void reset()
ISolver
reset
in interface ISolver
reset
in class SolverDecorator<IPBSolver>
public int[] model()
IProblem
model
in interface IProblem
model
in class SolverDecorator<IPBSolver>
IProblem.isSatisfiable()
,
IProblem.isSatisfiable(IVecInt)
public Number getObjectiveValue()
IOptimizationProblem
getObjectiveValue
in interface IOptimizationProblem
public void discard() throws ContradictionException
IOptimizationProblem
discard
in interface IOptimizationProblem
ContradictionException
- if a trivial inconsistency is detected.IOptimizationProblem.discardCurrentSolution()
public void forceObjectiveValueTo(Number forcedValue) throws ContradictionException
IOptimizationProblem
forceObjectiveValueTo
in interface IOptimizationProblem
ContradictionException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |