public abstract class MemoryVariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable> extends Object implements VariableTermStore<T,V>
Constructor and Description |
---|
MemoryVariableTermStore() |
Modifier and Type | Method and Description |
---|---|
void |
add(GroundRule rule,
T term,
Hyperplane hyperplane)
Add a term to the store that was generated from the given ground rule.
|
void |
clear()
Remove any existing terms and prepare for a new set.
|
void |
close()
Close down the term store, it will not be used any more.
|
protected abstract V |
convertAtomToVariable(RandomVariableAtom atom)
Get the variable (V) representation of the atom.
|
V |
createLocalVariable(GroundAtom groundAtom)
Create a variable local to a specific reasoner term.
|
void |
ensureCapacity(long capacity)
Ensure that the underlying structures can have the required term capacity.
|
void |
ensureVariableCapacity(int capacity)
Make sure we allocate the right amount of memory for global variables.
|
T |
get(long index) |
RandomVariableAtom |
getAtom(int index) |
int |
getNumObservedVariables()
Get the total number of observed variables tracked by this term store.
|
int |
getNumRandomVariables()
Get the total number of random variables tracked by this term store.
|
int |
getNumVariables()
Get the total number of variables (dead or alive) tracked by this term store.
|
GroundAtom[] |
getVariableAtoms()
Get all the variables tracked by this term store.
|
int |
getVariableIndex(V variable)
Get the index that matches up to getVariableValues().
|
Iterable<V> |
getVariables() |
boolean |
getVariablesExternallyUpdatedFlag()
Check of the variables were updated externally.
|
float |
getVariableValue(int index)
Get the variable for the given index.
|
float[] |
getVariableValues()
Get the values for the variable atoms.
|
void |
initForOptimization()
A notification by the Reasoner that optimization is about to begin.
|
boolean |
isLoaded()
Is the term store loaded, and can it give an accurate term and variable count.
|
void |
iterationComplete()
A notification by the Reasoner that a single iteration is complete.
|
Iterator<T> |
iterator() |
Iterator<T> |
noWriteIterator()
Get an iterator over the terms in the store that does not write to disk.
|
void |
reset()
Reset the existing terms for another round of inference.
|
void |
resetVariablesExternallyUpdatedFlag()
Clear the flag for variables being updated externally.
|
long |
size() |
double |
syncAtoms()
Ensure that atoms tracked by this term store match the internal representation of those atoms.
|
void |
variablesExternallyUpdated()
Notify the term store that the variables have been updated through a process external to standard optimization.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public int getVariableIndex(V variable)
VariableTermStore
getVariableIndex
in interface VariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public float getVariableValue(int index)
VariableTermStore
getVariableValue
in interface VariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public float[] getVariableValues()
VariableTermStore
getVariableValues
in interface VariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public double syncAtoms()
TermStore
syncAtoms
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public GroundAtom[] getVariableAtoms()
VariableTermStore
getVariableAtoms
in interface VariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public int getNumVariables()
VariableTermStore
getNumVariables
in interface VariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public int getNumRandomVariables()
VariableTermStore
getNumRandomVariables
in interface VariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public int getNumObservedVariables()
VariableTermStore
getNumObservedVariables
in interface VariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public boolean isLoaded()
VariableTermStore
isLoaded
in interface VariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public V createLocalVariable(GroundAtom groundAtom)
TermStore
createLocalVariable
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public void variablesExternallyUpdated()
TermStore
variablesExternallyUpdated
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public boolean getVariablesExternallyUpdatedFlag()
public void resetVariablesExternallyUpdatedFlag()
public void ensureVariableCapacity(int capacity)
ensureVariableCapacity
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public Iterable<V> getVariables()
getVariables
in interface VariableTermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public void add(GroundRule rule, T term, Hyperplane hyperplane)
TermStore
add
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public void clear()
TermStore
clear
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public void reset()
TermStore
reset
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public void close()
TermStore
close
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public void initForOptimization()
TermStore
initForOptimization
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public void iterationComplete()
TermStore
iterationComplete
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public RandomVariableAtom getAtom(int index)
public T get(long index)
get
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public long size()
size
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public void ensureCapacity(long capacity)
TermStore
ensureCapacity
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
public Iterator<T> iterator()
iterator
in interface Iterable<T extends ReasonerTerm>
public Iterator<T> noWriteIterator()
TermStore
noWriteIterator
in interface TermStore<T extends ReasonerTerm,V extends ReasonerLocalVariable>
protected abstract V convertAtomToVariable(RandomVariableAtom atom)
Copyright © 2022 University of California, Santa Cruz. All rights reserved.