public final class Trail extends Object implements SolverComponent
Modifier and Type | Field and Description |
---|---|
IntStack |
assertionStack |
int[] |
explanations |
MemoryPool |
pool |
int[] |
values |
Constructor and Description |
---|
Trail() |
Modifier and Type | Method and Description |
---|---|
void |
addVariable(int var)
It adds a variable to the trail.
|
void |
assertLiteral(int literal,
int level)
Sets a literal, that is, a variable signed with its value (> 0 for true,
< 0 for false).
|
void |
assertLiteral(int literal,
int level,
int causeId)
Sets a literal, with an explanation clause.
|
void |
backjump(int level)
It tells the trail to return to given level.
|
void |
ensureCapacity(int numVar)
It ensures the trail can contain @param numVar variables
|
int |
getExplanation(int var)
It returns the index of the clause that caused this variable to be set
|
int |
getLevel(int var)
It returns the level at which @param var has been set.
|
void |
initialize(Core core)
to be called before any use of the trail
|
boolean |
isAsserted(int var)
It returns information if a variable was asserted or only propagated.
|
boolean |
isSet(int var)
predicate which meaning is : is this variable set or unknown ?
|
int |
size()
returns the number of currently set variables
|
String |
toString() |
void |
unset(int var)
It unsets the given variable.
|
public MemoryPool pool
public int[] values
public int[] explanations
public IntStack assertionStack
public void addVariable(int var)
var
- the variablepublic void ensureCapacity(int numVar)
numVar
- the number of variables the trail must be able to containpublic void assertLiteral(int literal, int level)
literal
- the literallevel
- the current levelpublic void assertLiteral(int literal, int level, int causeId)
literal
- the literal (non nul relative number)level
- the level at which this assertion occurscauseId
- the ID of the clause that triggered this assertionpublic void unset(int var)
var
- the variable to unset. Must be positive.public void backjump(int level)
level
- the level to jump to.public int getLevel(int var)
var
- the literal which level we wish to knowpublic int getExplanation(int var)
var
- the literal. Must be set.public boolean isAsserted(int var)
var
- the variablepublic boolean isSet(int var)
var
- the variable, must be positivepublic int size()
public void initialize(Core core)
initialize
in interface SolverComponent
core
- the Solver instanceCopyright © 2022. All rights reserved.