public final class DomainClausesDatabase extends AbstractClausesDatabase implements WrapperComponent
This database must be added in the SAT solver (ideally at first position) and linked to the wrapper; it can then propagate literals that have a CP semantic with respect to their meaning about domains.
CLAUSE_RATE_AVERAGE, CLAUSE_RATE_I_WANT_THIS_CLAUSE, CLAUSE_RATE_LOW, CLAUSE_RATE_UNSUPPORTED, CLAUSE_RATE_WELL_SUPPORTED, core, databaseIndex, dbStore, MINIMUM_VAR_WATCH_SIZE, pool, trail, watchLists| Constructor and Description |
|---|
DomainClausesDatabase() |
| Modifier and Type | Method and Description |
|---|---|
int |
addClause(int[] clause,
boolean isModel)
It adds a clause to the database.
|
void |
assertLiteral(int assertedLiteral)
this is responsible for propagating literals within the SAT solver
to keep domain constraints coherent.
|
void |
backjump(int level)
Do everything needed to return to the given level.
|
boolean |
canRemove(int clauseId)
It tells if the implementation of ClausesDatabase can remove clauses or not
|
void |
initialize(SatWrapper wrapper)
connect the component to the wrapper
|
void |
propagate(int literal,
int assertedLiteral)
propagates the literal directly in the SAT solver
|
int |
rateThisClause(int[] clause)
Indicates how much this database is optimized for this clause.
|
void |
removeClause(int clauseId)
It removes the clause which unique ID is @param clauseId.
|
MapClause |
resolutionWith(int clauseIndex,
MapClause clause)
to get a real clause to resolve with, we seek for the clause at the
origin of the propagation.
|
int |
size()
number of clauses in the database
|
void |
toCNF(BufferedWriter output)
It creates a CNF description of the clauses stored in this database.
|
String |
toString(String prefix)
prints the content of the database in a nice way, each line being
prefixed with
|
addWatch, doesWatch, ensureWatch, getDatabaseIndex, indexToUniqueId, initialize, removeWatch, setDatabaseIndex, swap, toString, uniqueIdToIndexpublic void assertLiteral(int assertedLiteral)
assertLiteral in interface ClauseDatabaseInterfaceassertedLiteral - the literal that is setpublic void propagate(int literal,
int assertedLiteral)
literal - the literal to propagateassertedLiteral - the literal that has been the origin of the propagationpublic MapClause resolutionWith(int clauseIndex, MapClause clause)
resolutionWith in interface ClauseDatabaseInterfaceclauseIndex - the unique id of the clauseclause - an explanation clause that is modified by resolutionpublic void backjump(int level)
ClauseDatabaseInterfacebackjump in interface ClauseDatabaseInterfacelevel - the level to return to. Must be < solver.getCurrentLevel().public int rateThisClause(int[] clause)
AbstractClausesDatabaserateThisClause in class AbstractClausesDatabaseclause - a clause to ratepublic int size()
AbstractClausesDatabasesize in interface ClauseDatabaseInterfacesize in class AbstractClausesDatabasepublic int addClause(int[] clause,
boolean isModel)
ClauseDatabaseInterfaceaddClause in interface ClauseDatabaseInterfaceclause - the clause to addisModel - defined if the clause is model clausepublic void removeClause(int clauseId)
ClauseDatabaseInterfaceremoveClause in interface ClauseDatabaseInterfaceclauseId - clause idpublic boolean canRemove(int clauseId)
ClauseDatabaseInterfacecanRemove in interface ClauseDatabaseInterfaceclauseId - the unique Id of the clausepublic String toString(String prefix)
AbstractClausesDatabasetoString in class AbstractClausesDatabaseprefix - prefix for printed linepublic void initialize(SatWrapper wrapper)
WrapperComponentinitialize in interface WrapperComponentwrapper - the wrapperpublic void toCNF(BufferedWriter output) throws IOException
AbstractClausesDatabasetoCNF in interface ClauseDatabaseInterfacetoCNF in class AbstractClausesDatabaseoutput - it specifies the target to which the description will be written.IOException - execption from java.io packageCopyright © 2022. All rights reserved.