org.sat4j.maxsat
Class MinCostDecorator
java.lang.Object
org.sat4j.tools.SolverDecorator<IPBSolver>
org.sat4j.pb.PBSolverDecorator
org.sat4j.maxsat.MinCostDecorator
- All Implemented Interfaces:
- 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, addBlockingClause, addClause, addExactly, clearDecorated, clearLearntClauses, decorated, expireTimeout, findModel, findModel, getLogPrefix, getSearchListener, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, isVerbose, model, modelWithInternalVariables, nConstraints, nextFreeVarId, nVars, primeImplicant, printInfos, printStat, printStat, realNumberOfVariables, registerLiteral, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setExpectedNumberOfClauses, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setVerbose, toString, toString, unsatExplanation |
Methods inherited from interface org.sat4j.specs.IProblem |
findModel, findModel, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, model, nConstraints, nVars, primeImplicant, printInfos |
Methods inherited from interface org.sat4j.specs.ISolver |
addAllClauses, addAtLeast, addAtMost, addBlockingClause, addClause, addExactly, clearLearntClauses, expireTimeout, getLogPrefix, getSearchListener, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isVerbose, modelWithInternalVariables, nextFreeVarId, printStat, printStat, realNumberOfVariables, registerLiteral, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setExpectedNumberOfClauses, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setVerbose, toString, unsatExplanation |
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 IProblem
- 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
admitABetterSolution
public boolean admitABetterSolution(IVecInt assumps)
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 Number calculateObjective()
- Specified by:
calculateObjective
in interface IOptimizationProblem
discardCurrentSolution
public void discardCurrentSolution()
throws ContradictionException
- Specified by:
discardCurrentSolution
in interface IOptimizationProblem
- Throws:
ContradictionException
reset
public void reset()
- Specified by:
reset
in interface ISolver
- Overrides:
reset
in class SolverDecorator<IPBSolver>
model
public int[] model()
- Specified by:
model
in interface IProblem
- Overrides:
model
in class SolverDecorator<IPBSolver>
getObjectiveValue
public Number getObjectiveValue()
- Specified by:
getObjectiveValue
in interface IOptimizationProblem
discard
public void discard()
throws ContradictionException
- Specified by:
discard
in interface IOptimizationProblem
- Throws:
ContradictionException
forceObjectiveValueTo
public void forceObjectiveValueTo(Number forcedValue)
throws ContradictionException
- Specified by:
forceObjectiveValueTo
in interface IOptimizationProblem
- Throws:
ContradictionException
isOptimal
public boolean isOptimal()
- Specified by:
isOptimal
in interface IOptimizationProblem
Copyright © 2011 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.