|
||||||||||
| 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.WeightedMaxSatDecorator
public class WeightedMaxSatDecorator
A decorator for solving weighted MAX SAT problems. The first value of the list of literals in the addClause() method contains the weight of the clause.
| Field Summary | |
|---|---|
protected int |
nbnewvar
|
protected int |
nborigvars
|
protected boolean[] |
prevboolmodel
|
protected int[] |
prevfullmodel
|
protected int[] |
prevmodel
|
protected int |
top
|
| Constructor Summary | |
|---|---|
WeightedMaxSatDecorator(IPBSolver solver)
|
|
| Method Summary | |
|---|---|
IConstr |
addClause(IVecInt literals)
Add a set of literals to the solver. |
IConstr |
addHardClause(IVecInt literals)
Add a hard clause in the solver, i.e. a clause that must be satisfied. |
void |
addLiteralsToMinimize(IVecInt literals)
Set some literals whose sum must be minimized. |
IConstr |
addSoftClause(int weight,
IVecInt literals)
Add a soft clause to the solver. |
IConstr |
addSoftClause(IVecInt literals)
Add a soft clause in the solver, i.e. a clause with a weight of 1. |
void |
addWeightedLiteralsToMinimize(IVecInt literals,
IVec<java.math.BigInteger> coefficients)
Set some literals whose sum must be minimized. |
void |
addWeightedLiteralsToMinimize(IVecInt literals,
IVecInt coefficients)
Set some literals whose sum must be minimized. |
boolean |
admitABetterSolution()
|
java.lang.Number |
calculateObjective()
|
void |
discard()
|
boolean |
hasNoObjectiveFunction()
|
int[] |
model()
|
boolean |
model(int var)
|
int |
newVar(int howmany)
|
boolean |
nonOptimalMeansSatisfiable()
|
void |
reset()
|
void |
setExpectedNumberOfClauses(int nb)
|
void |
setTopWeight(int top)
|
| Methods inherited from class org.sat4j.pb.PBSolverDecorator |
|---|
addPseudoBoolean, getExplanation, setListOfVariablesForExplanation, setObjectiveFunction |
| Methods inherited from class org.sat4j.tools.SolverDecorator |
|---|
addAllClauses, addAtLeast, addAtMost, clearDecorated, clearLearntClauses, decorated, expireTimeout, findModel, findModel, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, nConstraints, newVar, nVars, printInfos, printStat, printStat, removeConstr, setDBSimplificationAllowed, 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.IProblem |
|---|
findModel, findModel, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, nConstraints, nVars, printInfos |
| Methods inherited from interface org.sat4j.specs.ISolver |
|---|
addAllClauses, addAtLeast, addAtMost, clearLearntClauses, expireTimeout, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, newVar, printStat, printStat, removeConstr, setDBSimplificationAllowed, setTimeout, setTimeoutMs, setTimeoutOnConflicts, toString |
| Field Detail |
|---|
protected int nborigvars
protected int nbnewvar
protected int[] prevmodel
protected boolean[] prevboolmodel
protected int[] prevfullmodel
protected int top
| Constructor Detail |
|---|
public WeightedMaxSatDecorator(IPBSolver solver)
| Method Detail |
|---|
public int newVar(int howmany)
newVar in interface ISolvernewVar in class SolverDecorator<IPBSolver>public void setExpectedNumberOfClauses(int nb)
setExpectedNumberOfClauses in interface ISolversetExpectedNumberOfClauses in class SolverDecorator<IPBSolver>public int[] model()
model in interface IProblemmodel in class SolverDecorator<IPBSolver>public boolean model(int var)
model in interface IProblemmodel in class SolverDecorator<IPBSolver>public void setTopWeight(int top)
public IConstr addClause(IVecInt literals)
throws ContradictionException
addClause in interface ISolveraddClause in class SolverDecorator<IPBSolver>literals - a weighted clause, the weight being the first element of the
vector.
ContradictionExceptionsetTopWeight(int)
public IConstr addHardClause(IVecInt literals)
throws ContradictionException
literals - the clause
ContradictionException
public IConstr addSoftClause(IVecInt literals)
throws ContradictionException
literals - the clause.
ContradictionException
public IConstr addSoftClause(int weight,
IVecInt literals)
throws ContradictionException
weight - the weight of the clauseliterals - the clause
ContradictionExceptionpublic void addLiteralsToMinimize(IVecInt literals)
literals - the sum of those literals must be minimized.
public void addWeightedLiteralsToMinimize(IVecInt literals,
IVec<java.math.BigInteger> coefficients)
literals - the sum of those literals must be minimized.coefficients - the weight of the literals.
public void addWeightedLiteralsToMinimize(IVecInt literals,
IVecInt coefficients)
literals - the sum of those literals must be minimized.coefficients - the weight of the literals.
public boolean admitABetterSolution()
throws TimeoutException
admitABetterSolution in interface IOptimizationProblemTimeoutExceptionpublic void reset()
reset in interface ISolverreset in class SolverDecorator<IPBSolver>public 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 IOptimizationProblemContradictionException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||