org.sat4j.maxsat
Class MinCostDecorator
java.lang.Object
org.sat4j.tools.SolverDecorator<IPBSolver>
org.sat4j.pb.PBSolverDecorator
org.sat4j.maxsat.MinCostDecorator
- All Implemented Interfaces:
- java.io.Serializable, IPBSolver, IOptimizationProblem, IProblem, ISolver
public class MinCostDecorator
- extends PBSolverDecorator
- implements IOptimizationProblem
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.
- Author:
- daniel
- See Also:
- Serialized Form
| Methods inherited from class org.sat4j.tools.SolverDecorator |
addAllClauses, addAtLeast, addAtMost, addClause, clearDecorated, clearLearntClauses, decorated, expireTimeout, findModel, findModel, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, model, nConstraints, nVars, printInfos, printStat, printStat, removeConstr, reset, setDBSimplificationAllowed, setExpectedNumberOfClauses, setTimeout, setTimeoutMs, setTimeoutOnConflicts, 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.ISolver |
addAllClauses, addAtLeast, addAtMost, addClause, clearLearntClauses, expireTimeout, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, printStat, printStat, removeConstr, reset, setDBSimplificationAllowed, setExpectedNumberOfClauses, setTimeout, setTimeoutMs, setTimeoutOnConflicts, toString |
MinCostDecorator
public MinCostDecorator(IPBSolver solver)
newVar
public int newVar()
- Specified by:
newVar in interface ISolver- Overrides:
newVar in class SolverDecorator<IPBSolver>
newVar
public int newVar(int howmany)
- Setup the number of variables to use inside the solver.
It is mandatory to call that method before setting the cost of the
variables.
- Specified by:
newVar in interface ISolver- Overrides:
newVar in class SolverDecorator<IPBSolver>
- Parameters:
howmany - the maximum number of variables in the solver.
costOf
public int costOf(int var)
- to know the cost of a given var.
- Parameters:
var - a variable in dimacs format
- Returns:
- the cost of that variable when assigned to true
setCost
public void setCost(int var,
int cost)
- to set the cost of a given var.
- Parameters:
var - a variable in dimacs formatcost - the cost of var when assigned to true
admitABetterSolution
public boolean admitABetterSolution()
throws TimeoutException
- Specified by:
admitABetterSolution in interface IOptimizationProblem
- Throws:
TimeoutException
hasNoObjectiveFunction
public boolean hasNoObjectiveFunction()
- Specified by:
hasNoObjectiveFunction in interface IOptimizationProblem
nonOptimalMeansSatisfiable
public boolean nonOptimalMeansSatisfiable()
- Specified by:
nonOptimalMeansSatisfiable in interface IOptimizationProblem
calculateObjective
public java.lang.Number calculateObjective()
- Specified by:
calculateObjective in interface IOptimizationProblem
discard
public void discard()
throws ContradictionException
- Specified by:
discard in interface IOptimizationProblem
- Throws:
ContradictionException
model
public int[] model()
- Specified by:
model in interface IProblem- Overrides:
model in class SolverDecorator<IPBSolver>
Copyright © 2009 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.