public final class DefaultClausesDatabase extends AbstractClausesDatabase
Two-watched literals are used for fast unit propagation. The two first literals of each clauses are the watches.
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 |
|---|
DefaultClausesDatabase() |
| Modifier and Type | Method and Description |
|---|---|
int |
addClause(int[] clause,
boolean isModel)
It adds a clause to the database.
|
void |
assertLiteral(int literal)
Notify the watches that this literal is set, updating the watched clauses
and propagating literals if pertinent.
|
void |
backjump(int level)
returns to the given level
|
boolean |
canRemove(int clauseId)
It tells if the implementation of ClausesDatabase can remove clauses or not
|
void |
ensureSize(int size)
be sure that the database can contain @param size clauses
|
int |
rateThisClause(int[] clause)
Indicates how much this database is optimized for this clause.
|
void |
removeClause(int clauseIndex)
It removes the clause which unique ID is @param clauseId.
|
MapClause |
resolutionWith(int clauseId,
MapClause explanation)
It returns the clause obtained by resolution between clauseIndex and clause.
|
int |
size()
number of clauses in the database
|
void |
toCNF(BufferedWriter output)
It creates a CNF description of the clauses stored in this database.
|
addWatch, doesWatch, ensureWatch, getDatabaseIndex, indexToUniqueId, initialize, removeWatch, setDatabaseIndex, swap, toString, toString, uniqueIdToIndexpublic void assertLiteral(int literal)
It always creates a list of new watched list (newWatchedList).
literal - the literal that is being setpublic int addClause(int[] clause,
boolean isModel)
ClauseDatabaseInterfaceclause - the clause to addisModel - defined if the clause is model clausepublic void removeClause(int clauseIndex)
ClauseDatabaseInterfaceclauseIndex - clause idpublic boolean canRemove(int clauseId)
ClauseDatabaseInterfaceclauseId - the unique Id of the clausepublic MapClause resolutionWith(int clauseId, MapClause explanation)
ClauseDatabaseInterfaceclauseId - the unique id of the clauseexplanation - an explanation clause that is modified by resolutionpublic int rateThisClause(int[] clause)
AbstractClausesDatabaserateThisClause in class AbstractClausesDatabaseclause - a clause to ratepublic int size()
AbstractClausesDatabasesize in interface ClauseDatabaseInterfacesize in class AbstractClausesDatabasepublic void backjump(int level)
level - the level to return to. Must be < solver.getCurrentLevel().public void ensureSize(int size)
size - the number of clausespublic 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.