|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sat4j.tools.SolverDecorator org.sat4j.opt.MinCostDecorator
public class MinCostDecorator
A decorator that computes minimal cost models. Please make sure that newVar(howmany) is called first to setup the decorator.
Constructor Summary | |
---|---|
MinCostDecorator(ISolver solver)
|
Method Summary | |
---|---|
boolean |
admitABetterSolution()
|
java.lang.Number |
calculateObjective()
|
int |
costOf(int var)
to know the cost of a given var. |
void |
discard()
|
boolean |
hasNoObjectiveFunction()
|
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()
|
void |
setCost(int var,
int cost)
to set the cost of a given var. |
Methods inherited from class org.sat4j.tools.SolverDecorator |
---|
addAllClauses, addAtLeast, addAtMost, addClause, addPseudoBoolean, clearLearntClauses, decorated, findModel, findModel, getStat, getTimeout, isSatisfiable, isSatisfiable, model, nConstraints, nVars, printStat, printStat, removeConstr, reset, setExpectedNumberOfClauses, setTimeout, setTimeoutMs, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.sat4j.specs.IProblem |
---|
findModel, findModel, isSatisfiable, isSatisfiable, model, nConstraints, nVars |
Constructor Detail |
---|
public MinCostDecorator(ISolver solver)
Method Detail |
---|
public int newVar()
ISolver
newVar
in interface ISolver
newVar
in class SolverDecorator
public int newVar(int howmany)
newVar
in interface ISolver
newVar
in class SolverDecorator
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
admitABetterSolution
in interface IOptimizationProblem
TimeoutException
public boolean hasNoObjectiveFunction()
hasNoObjectiveFunction
in interface IOptimizationProblem
public boolean nonOptimalMeansSatisfiable()
nonOptimalMeansSatisfiable
in interface IOptimizationProblem
public java.lang.Number calculateObjective()
calculateObjective
in interface IOptimizationProblem
public void discard() throws ContradictionException
discard
in interface IOptimizationProblem
ContradictionException
public int[] model()
IProblem
model
in interface IProblem
model
in class SolverDecorator
IProblem.isSatisfiable()
,
IProblem.isSatisfiable(IVecInt)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |