public class WeightedMaxSatDecorator extends PBSolverDecorator
Modifier and Type | Field and Description |
---|---|
protected int |
nbnewvar |
static BigInteger |
SAT4J_MAX_BIG_INTEGER |
protected BigInteger |
top |
Constructor and Description |
---|
WeightedMaxSatDecorator(IPBSolver solver) |
WeightedMaxSatDecorator(IPBSolver solver,
boolean equivalence) |
Modifier and Type | Method and Description |
---|---|
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).
|
Set<Integer> |
getUnitClauses()
Returns the set of unit clauses added to the solver.
|
boolean |
isNoNewVarForUnitSoftClauses()
Returns true if no new variable should be created when adding a soft unit
clause, false otherwise.
|
int |
newVar(int howmany) |
void |
reset() |
void |
setExpectedNumberOfClauses(int nb) |
void |
setNoNewVarForUnitSoftClauses(boolean noNewVarForUnitSoftClauses)
Sets whether new variables should be created when adding new clauses.
|
void |
setTopWeight(BigInteger top) |
addAtLeast, addAtLeast, addAtMost, addAtMost, addExactly, addExactly, addPseudoBoolean, getObjectiveFunction, setObjectiveFunction
addAllClauses, addAtLeast, addAtMost, addBlockingClause, addExactly, clearDecorated, clearLearntClauses, decorated, expireTimeout, findModel, findModel, getLogPrefix, getSearchListener, getSolvingEngine, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, isSolverKeptHot, isVerbose, model, model, modelWithInternalVariables, nConstraints, newVar, nextFreeVarId, nVars, primeImplicant, primeImplicant, printInfos, printInfos, printStat, printStat, printStat, realNumberOfVariables, registerLiteral, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setKeepSolverHot, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setUnitClauseProvider, setVerbose, toString, toString, unsatExplanation
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addAllClauses, addAtLeast, addAtMost, addBlockingClause, addExactly, clearLearntClauses, expireTimeout, getLogPrefix, getSearchListener, getSolvingEngine, getStat, getTimeout, getTimeoutMs, isDBSimplificationAllowed, isSolverKeptHot, isVerbose, modelWithInternalVariables, newVar, nextFreeVarId, printStat, printStat, printStat, realNumberOfVariables, registerLiteral, removeConstr, removeSubsumedConstr, setDBSimplificationAllowed, setKeepSolverHot, setLogPrefix, setSearchListener, setTimeout, setTimeoutMs, setTimeoutOnConflicts, setUnitClauseProvider, setVerbose, toString, unsatExplanation
findModel, findModel, isSatisfiable, isSatisfiable, isSatisfiable, isSatisfiable, model, nConstraints, nVars, primeImplicant, primeImplicant, printInfos, printInfos
model
public static final BigInteger SAT4J_MAX_BIG_INTEGER
protected int nbnewvar
protected BigInteger top
public WeightedMaxSatDecorator(IPBSolver solver)
public WeightedMaxSatDecorator(IPBSolver solver, boolean equivalence)
public int newVar(int howmany)
newVar
in interface IProblem
newVar
in class SolverDecorator<IPBSolver>
public void setExpectedNumberOfClauses(int nb)
setExpectedNumberOfClauses
in interface ISolver
setExpectedNumberOfClauses
in class SolverDecorator<IPBSolver>
public void setTopWeight(BigInteger top)
protected void checkMaxVarId()
public IConstr addClause(IVecInt literals) throws ContradictionException
addClause
in interface ISolver
addClause
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 clauseContradictionException
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 clauseContradictionException
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()
reset
in interface ISolver
reset
in class SolverDecorator<IPBSolver>
public void forceObjectiveValueTo(Number forcedValue) throws ContradictionException
forcedValue
- the expected value of the solutionContradictionException
- if that value is trivially not possible.public Set<Integer> getUnitClauses()
public boolean isNoNewVarForUnitSoftClauses()
public void setNoNewVarForUnitSoftClauses(boolean noNewVarForUnitSoftClauses)
noNewVarForUnitSoftClauses
- Copyright © 2013 Centre de Recherche en Informatique de Lens (CRIL). All Rights Reserved.