public abstract class AbstractClausesDatabase extends Object implements SolverComponent, ClauseDatabaseInterface
Those databases must use a MemoryPool to allocate their structures.
All ClausesDatabases have access to the DatabasesStore they belong to, so that they can convert the clauses unique ID to their local clauses index, and conversely.
Modifier and Type | Field and Description |
---|---|
protected static int |
CLAUSE_RATE_AVERAGE |
protected static int |
CLAUSE_RATE_I_WANT_THIS_CLAUSE |
protected static int |
CLAUSE_RATE_LOW |
protected static int |
CLAUSE_RATE_UNSUPPORTED |
protected static int |
CLAUSE_RATE_WELL_SUPPORTED |
Core |
core |
int |
databaseIndex |
DatabasesStore |
dbStore |
protected static int |
MINIMUM_VAR_WATCH_SIZE |
MemoryPool |
pool |
Trail |
trail |
protected int[][] |
watchLists
The first dimension corresponds to the index of the variable for which the watches are stored.
|
Constructor and Description |
---|
AbstractClausesDatabase() |
Modifier and Type | Method and Description |
---|---|
protected void |
addWatch(int literal,
int clauseIndex)
adds a watch (var => clause), ie make var watch clause
|
protected boolean |
doesWatch(int literal,
int clauseIndex) |
protected void |
ensureWatch(int var)
ensures that varWatches.get(var) will succeed with a correct content.
|
int |
getDatabaseIndex() |
int |
indexToUniqueId(int clauseIndex)
gets an unique ID from a clause index in this clause database
|
void |
initialize(Core core)
initializes the component with the given solver.
|
abstract int |
rateThisClause(int[] clause)
Indicates how much this database is optimized for this clause.
|
protected void |
removeWatch(int literal,
int clauseIndex)
removes the clause from the list of clauses that literal watches
|
void |
setDatabaseIndex(int index)
Called by the databaseStore, to inform the DatabasesStore of which
index it has.
|
abstract int |
size()
number of clauses in the database
|
protected void |
swap(int[] clause,
int i,
int j)
swaps the two literals at position i and j in the clause
|
abstract void |
toCNF(BufferedWriter output)
It creates a CNF description of the clauses stored in this database.
|
String |
toString()
print the content of the Database in a nice way
|
String |
toString(String prefix)
prints the content of the database in a nice way, each line being
prefixed with
|
int |
uniqueIdToIndex(int clauseId)
gets a local index from the unique ID
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addClause, assertLiteral, backjump, canRemove, removeClause, resolutionWith
protected static final int CLAUSE_RATE_UNSUPPORTED
protected static final int CLAUSE_RATE_LOW
protected static final int CLAUSE_RATE_AVERAGE
protected static final int CLAUSE_RATE_WELL_SUPPORTED
protected static int CLAUSE_RATE_I_WANT_THIS_CLAUSE
protected static final int MINIMUM_VAR_WATCH_SIZE
public MemoryPool pool
public Trail trail
public Core core
public DatabasesStore dbStore
public int databaseIndex
protected int[][] watchLists
public abstract int rateThisClause(int[] clause)
clause
- a clause to ratepublic final void setDatabaseIndex(int index)
index
- the index of the databasepublic final int getDatabaseIndex()
public final int indexToUniqueId(int clauseIndex)
clauseIndex
- a local clause indexpublic final int uniqueIdToIndex(int clauseId)
clauseId
- the unique Idprotected final boolean doesWatch(int literal, int clauseIndex)
literal
- the literal to checkclauseIndex
- the clause id for checkingprotected final void ensureWatch(int var)
var
- the var we want to be able to add clauses to watch toprotected final void addWatch(int literal, int clauseIndex)
literal
- the watching literalclauseIndex
- the index of clause to watch. Not a unique ID.protected final void removeWatch(int literal, int clauseIndex)
literal
- the literalclauseIndex
- the clause to removepublic abstract int size()
size
in interface ClauseDatabaseInterface
public String toString(String prefix)
prefix
- prefix for printed linepublic final String toString()
public final void initialize(Core core)
SolverComponent
initialize
in interface SolverComponent
core
- core component to initializepublic abstract void toCNF(BufferedWriter output) throws IOException
toCNF
in interface ClauseDatabaseInterface
output
- it specifies the target to which the description will be written.IOException
- execption from java.io packageprotected final void swap(int[] clause, int i, int j)
clause
- the clausei
- the position (index) of the first literalj
- the position of the second literalCopyright © 2022. All rights reserved.