public abstract class AbstractNAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>> extends java.lang.Object implements NAryTreeReplayer<H,T,D>
NAryTreeReplayer.PerformanceType, NAryTreeReplayer.VerboseLevel
Modifier and Type | Field and Description |
---|---|
protected nl.tue.astar.impl.memefficient.MemoryEfficientAStarAlgorithm<H,T> |
algorithm |
protected AStarAlgorithm |
aStarLogAbstraction |
protected nl.tue.astar.AStarThread.Canceller |
canceller |
protected D |
delegate |
protected gnu.trove.map.hash.TObjectIntHashMap<H> |
head2int |
protected int |
maxNumOfStates |
protected long |
statecount |
protected java.util.List<nl.tue.astar.impl.State<H,T>> |
stateList |
protected int |
threads |
protected NAryTree |
tree |
Constructor and Description |
---|
AbstractNAryTreeReplayer(AStarAlgorithm aStarLogAbstraction,
nl.tue.astar.AStarThread.Canceller canceller,
NAryTree tree,
int configurationNumber,
int[] node2Cost,
boolean useOrRows,
nl.tue.astar.AStarObserver... observers)
Single threaded variant
|
AbstractNAryTreeReplayer(AStarAlgorithm aStarLogAbstraction,
nl.tue.astar.AStarThread.Canceller canceller,
NAryTree tree,
int configurationNumber,
int[] node2Cost,
boolean useOrRows,
int nrThreads,
nl.tue.astar.AStarObserver... observers) |
Modifier and Type | Method and Description |
---|---|
protected abstract int |
calculateCostAndPostProcess(NAryTreeReplayer.VerboseLevel verbose,
nl.tue.astar.Trace trace,
TreeRecord r,
int frequency)
do post-processing on the given alignment for the given trace.
|
protected abstract D |
constructDelegate(AStarAlgorithm algorithm,
NAryTree tree,
int configurationNumber,
int[] node2Cost,
int threads,
boolean useOrRows)
construct the delegate of the right type for the version of the replayer
to be used.
|
protected abstract H |
createInitialHead(nl.tue.astar.Trace trace)
create the initial head for this replayer.
|
D |
getDelegate() |
static java.util.List<TreeRecord> |
getHistory(TreeRecord r) |
long |
getNumStoredStates() |
long |
getQueuedStateCount() |
long |
getRawCost()
returns the raw cost of aligning a log and a model after a call to run.
|
nl.tue.astar.impl.State<H,T> |
getState(long index) |
long |
getTraversedArcCount() |
boolean |
isStubborn() |
int |
run(NAryTreeReplayer.VerboseLevel verbose,
int stopAt,
int minModelCost,
double timeLimit) |
long |
setMaxNumberOfBlocksToUse(long maxBytestoUse)
Tell the algorithm to clear the memory (in between trace alignments) if
it is close to using the specified amount of megabytes of memory.
|
void |
setStubborn(boolean stubborn) |
void |
setType(NAryTreeReplayer.PerformanceType type) |
void |
setType(NAryTreeReplayer.PerformanceType type,
int blockSize,
int alignment)
Allows the user more control over the type of implementation
|
boolean |
wasReliable() |
protected final nl.tue.astar.AStarThread.Canceller canceller
protected final D extends TreeDelegate<H,T> delegate
protected final int maxNumOfStates
protected final AStarAlgorithm aStarLogAbstraction
protected final NAryTree tree
protected gnu.trove.map.hash.TObjectIntHashMap<H extends NAryTreeHead> head2int
protected java.util.List<nl.tue.astar.impl.State<H extends NAryTreeHead,T extends nl.tue.astar.Tail>> stateList
protected long statecount
protected nl.tue.astar.impl.memefficient.MemoryEfficientAStarAlgorithm<H extends NAryTreeHead,T extends nl.tue.astar.Tail> algorithm
protected final int threads
public AbstractNAryTreeReplayer(AStarAlgorithm aStarLogAbstraction, nl.tue.astar.AStarThread.Canceller canceller, NAryTree tree, int configurationNumber, int[] node2Cost, boolean useOrRows, nl.tue.astar.AStarObserver... observers)
aStarLogAbstraction
- AStarAlgorithm to runcanceller
- Canceller used to listen to, to stop executiontree
- NAryTree to align onconfigurationNumber
- Configuration to usenode2Cost
- Costs assigned to nodes in treeuseOrRows
- Whether OR rows should be usedobservers
- public AbstractNAryTreeReplayer(AStarAlgorithm aStarLogAbstraction, nl.tue.astar.AStarThread.Canceller canceller, NAryTree tree, int configurationNumber, int[] node2Cost, boolean useOrRows, int nrThreads, nl.tue.astar.AStarObserver... observers)
aStarLogAbstraction
- AStarAlgorithm to runcanceller
- Canceller used to listen to, to stop executiontree
- NAryTree to align onconfigurationNumber
- Configuration to usenode2Cost
- Costs assigned to nodes in treeuseOrRows
- Whether OR rows should be usedmultiThreaded
- Specify the number of threads to run in parallel. ADVICE: on
hyperthreading cores take half number of cores. If number is
below 1, 1 is used.observers
- public void setType(NAryTreeReplayer.PerformanceType type)
setType
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
public void setType(NAryTreeReplayer.PerformanceType type, int blockSize, int alignment)
NAryTreeReplayer
setType
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
blockSize
- the size of the blocks of memory. A typical example would be
1024 times the size of an average statealignment
- the alignment. Each stored object uses a multiple of this many
bytes. A value of 1 allows for 4GB to be allocated. A value of
2 for 8GB, etc.public int run(NAryTreeReplayer.VerboseLevel verbose, int stopAt, int minModelCost, double timeLimit) throws nl.tue.astar.AStarException
run
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
nl.tue.astar.AStarException
public long getRawCost()
getRawCost
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
protected abstract int calculateCostAndPostProcess(NAryTreeReplayer.VerboseLevel verbose, nl.tue.astar.Trace trace, TreeRecord r, int frequency)
verbose
- trace
- r
- frequency
- protected abstract H createInitialHead(nl.tue.astar.Trace trace)
trace
- protected abstract D constructDelegate(AStarAlgorithm algorithm, NAryTree tree, int configurationNumber, int[] node2Cost, int threads, boolean useOrRows)
algorithm
- tree
- node2Cost
- threads
- public static java.util.List<TreeRecord> getHistory(TreeRecord r)
public nl.tue.astar.impl.State<H,T> getState(long index)
getState
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
public long getQueuedStateCount()
getQueuedStateCount
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
public long getTraversedArcCount()
getTraversedArcCount
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
public D getDelegate()
getDelegate
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
public long getNumStoredStates()
getNumStoredStates
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
public boolean wasReliable()
wasReliable
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
public long setMaxNumberOfBlocksToUse(long maxBytestoUse)
OutOfMemoryError
s at all times but it will try to, at the
cost of performance for the larger trace/model combinations since it
empties the cache.setMaxNumberOfBlocksToUse
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
maxMemUsage
- maximum memory usage in bytes (negative value indicates no
limit)public boolean isStubborn()
isStubborn
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>
public void setStubborn(boolean stubborn)
setStubborn
in interface NAryTreeReplayer<H extends NAryTreeHead,T extends nl.tue.astar.Tail,D extends TreeDelegate<H,T>>