|
||||||||||
| 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
|
static BigInteger |
SAT4J_MAX_BIG_INTEGER
|
protected BigInteger |
top
|
| Constructor Summary | |
|---|---|
WeightedMaxSatDecorator(IPBSolver solver)
|
|
WeightedMaxSatDecorator(IPBSolver solver,
boolean equivalence)
|
|
| Method Summary | |
|---|---|
IConstr |
addClause(IVecInt literals)
Add a soft clause 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 |
addSoftAtLeast(BigInteger weight,
IVecInt literals,
int degree)
Allow adding a new soft cardinality constraint in the solver. |
IConstr |
addSoftAtLeast(int weight,
IVecInt literals,
int degree)
Allow adding a new soft cardinality constraint in the solver. |
IConstr |
addSoftAtLeast(IVecInt literals,
int degree)
Allow adding a new soft cardinality constraint in the solver. |
IConstr |
addSoftAtMost(BigInteger weight,
IVecInt literals,
int degree)
Allow adding a new soft cardinality constraint in the solver. |
IConstr |
addSoftAtMost(int weight,
IVecInt literals,
int degree)
Allow adding a new soft cardinality constraint in the solver. |
IConstr |
addSoftAtMost(IVecInt literals,
int degree)
Allow adding a new soft cardinality constraint in the solver. |
IConstr |
addSoftClause(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<BigInteger> coefficients)
Set some literals whose sum must be minimized. |
void |
addWeightedLiteralsToMinimize(IVecInt literals,
IVecInt coefficients)
Set some literals whose sum must be minimized. |
protected void |
checkMaxVarId()
|
void |
forceObjectiveValueTo(Number forcedValue)
Force the solver to find a solution with a specific value (nice to find all optimal solutions for instance). |
int |
newVar(int howmany)
Declare howmany variables in the problem (and thus in the
vocabulary), that will be represented using the Dimacs format by integers
ranging from 1 to howmany. |
void |
reset()
Clean up the internal state of the solver. |
void |
setExpectedNumberOfClauses(int nb)
To inform the solver of the expected number of clauses to read. |
void |
setTopWeight(BigInteger top)
|
| Methods inherited from class org.sat4j.pb.PBSolverDecorator |
|---|
addAtLeast, addAtLeast, addAtMost, addAtMost, addExactly, addExactly, addPseudoBoolean, getObjectiveFunction, setObjectiveFunction |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.sat4j.specs.IProblem |
|---|
findModel, findModel, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, model, model, nConstraints, nVars, primeImplicant, primeImplicant, printInfos |
| Field Detail |
|---|
public static final BigInteger SAT4J_MAX_BIG_INTEGER
protected int nbnewvar
protected BigInteger top
| Constructor Detail |
|---|
public WeightedMaxSatDecorator(IPBSolver solver)
public WeightedMaxSatDecorator(IPBSolver solver,
boolean equivalence)
| Method Detail |
|---|
public int newVar(int howmany)
IProblemhowmany variables in the problem (and thus in the
vocabulary), that will be represented using the Dimacs format by integers
ranging from 1 to howmany. That feature allows encodings to create
additional variables with identifier starting at howmany+1.
newVar in interface IProblemnewVar in class SolverDecorator<IPBSolver>howmany - number of variables to create
IProblem.nVars()public void setExpectedNumberOfClauses(int nb)
ISolverp cnf line is
read in dimacs formatted input file.
Note that this method is supposed to be called AFTER a call to
newVar(int)
setExpectedNumberOfClauses in interface ISolversetExpectedNumberOfClauses in class SolverDecorator<IPBSolver>nb - the expected number of clauses.IProblem.newVar(int)public void setTopWeight(BigInteger top)
protected void checkMaxVarId()
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 - iff the vector of literals is empty or if it contains only
falsified literals after unit propagation#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(BigInteger weight,
IVecInt literals)
throws ContradictionException
ContradictionException
public IConstr addSoftAtLeast(IVecInt literals,
int degree)
throws ContradictionException
literals - the literals of the cardinality constraint.degree - the degree of the cardinality constraint.
ContradictionException - if a trivial contradiction is found.
public IConstr addSoftAtLeast(int weight,
IVecInt literals,
int degree)
throws ContradictionException
weight - the weight of the constraint.literals - the literals of the cardinality constraint.degree - the degree of the cardinality constraint.
ContradictionException - if a trivial contradiction is found.
public IConstr addSoftAtLeast(BigInteger weight,
IVecInt literals,
int degree)
throws ContradictionException
weight - the weight of the constraint.literals - the literals of the cardinality constraint.degree - the degree of the cardinality constraint.
ContradictionException - if a trivial contradiction is found.
public IConstr addSoftAtMost(IVecInt literals,
int degree)
throws ContradictionException
literals - the literals of the cardinality constraint.degree - the degree of the cardinality constraint.
ContradictionException - if a trivial contradiction is found.
public IConstr addSoftAtMost(int weight,
IVecInt literals,
int degree)
throws ContradictionException
weight - the weight of the constraint.literals - the literals of the cardinality constraint.degree - the degree of the cardinality constraint.
ContradictionException - if a trivial contradiction is found.
public IConstr addSoftAtMost(BigInteger weight,
IVecInt literals,
int degree)
throws ContradictionException
weight - the weight of the constraint.literals - the literals of the cardinality constraint.degree - the degree of the cardinality constraint.
ContradictionException - if a trivial contradiction is found.public void addLiteralsToMinimize(IVecInt literals)
literals - the sum of those literals must be minimized.
public void addWeightedLiteralsToMinimize(IVecInt literals,
IVec<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 void reset()
ISolver
reset in interface ISolverreset in class SolverDecorator<IPBSolver>
public void forceObjectiveValueTo(Number forcedValue)
throws ContradictionException
forcedValue - the expected value of the solution
ContradictionException - if that value is trivially not possible.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||