| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.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 | 
|---|
equals, 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 ISolvernewVar in class SolverDecoratorpublic int newVar(int howmany)
newVar in interface ISolvernewVar in class SolverDecoratorhowmany - 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 true
public boolean admitABetterSolution()
                             throws TimeoutException
admitABetterSolution in interface IOptimizationProblemTimeoutExceptionpublic boolean hasNoObjectiveFunction()
hasNoObjectiveFunction in interface IOptimizationProblempublic boolean nonOptimalMeansSatisfiable()
nonOptimalMeansSatisfiable in interface IOptimizationProblempublic java.lang.Number calculateObjective()
calculateObjective in interface IOptimizationProblem
public void discard()
             throws ContradictionException
discard in interface IOptimizationProblemContradictionExceptionpublic int[] model()
IProblem
model in interface IProblemmodel in class SolverDecoratorIProblem.isSatisfiable(), 
IProblem.isSatisfiable(IVecInt)
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||