|
||||||||||
| 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
|
static java.math.BigInteger |
SAT4J_MAX_BIG_INTEGER
|
protected java.math.BigInteger |
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(java.math.BigInteger weight,
IVecInt literals)
|
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()
|
boolean |
admitABetterSolution(IVecInt assumps)
|
java.lang.Number |
calculateObjective()
|
void |
discard()
|
void |
discardCurrentSolution()
|
void |
forceObjectiveValueTo(java.lang.Number forcedValue)
|
java.lang.Number |
getObjectiveValue()
|
boolean |
hasNoObjectiveFunction()
|
int[] |
model()
|
boolean |
model(int var)
|
int |
newVar(int howmany)
|
boolean |
nonOptimalMeansSatisfiable()
|
void |
reset()
|
void |
setExpectedNumberOfClauses(int nb)
|
void |
setTopWeight(java.math.BigInteger top)
|
| Methods inherited from class org.sat4j.pb.PBSolverDecorator |
|---|
addPseudoBoolean, getObjectiveFunction, setObjectiveFunction |
| Methods inherited from class org.sat4j.tools.SolverDecorator |
|---|
addAllClauses, addAtLeast, addAtMost, addBlockingClause, clearDecorated, clearLearntClauses, decorated, expireTimeout, findModel, findModel, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, nConstraints, newVar, nextFreeVarId, nVars, printInfos, printStat, printStat, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setSearchListener, 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, addBlockingClause, clearLearntClauses, expireTimeout, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, newVar, nextFreeVarId, printStat, printStat, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, toString |
| Field Detail |
|---|
public static final java.math.BigInteger SAT4J_MAX_BIG_INTEGER
protected int nborigvars
protected int nbnewvar
protected int[] prevmodel
protected boolean[] prevboolmodel
protected int[] prevfullmodel
protected java.math.BigInteger 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(java.math.BigInteger 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.
ContradictionException#setTopWeight(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
ContradictionException
public IConstr addSoftClause(java.math.BigInteger weight,
IVecInt literals)
throws ContradictionException
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 IOptimizationProblemTimeoutException
public boolean admitABetterSolution(IVecInt assumps)
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 discardCurrentSolution()
throws ContradictionException
discardCurrentSolution in interface IOptimizationProblemContradictionExceptionpublic java.lang.Number getObjectiveValue()
getObjectiveValue in interface IOptimizationProblem
public void discard()
throws ContradictionException
discard in interface IOptimizationProblemContradictionException
public void forceObjectiveValueTo(java.lang.Number forcedValue)
throws ContradictionException
forceObjectiveValueTo in interface IOptimizationProblemContradictionException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||