public class FitnessReplay extends TreeFitnessAbstract
Modifier and Type | Class and Description |
---|---|
static class |
FitnessReplay.FitnessReplayGUI |
TreeFitnessAbstract.TreeFitnessGUISettingsAbstract<F extends TreeFitnessAbstract>, TreeFitnessAbstract.TreeFitnessGUISettingsEmpty<F extends TreeFitnessAbstract>
Modifier and Type | Field and Description |
---|---|
protected nl.tue.astar.AStarThread.Canceller |
c |
protected boolean |
detailedAlignmentInfoEnabled
Boolean to indicate whether the detailed alignment information should be
stored in the tree fitness cache.
|
protected double |
fitnessLimit |
static TreeFitnessInfo |
info |
protected long |
maxBytestoUse |
protected CentralRegistry |
registry |
protected double |
timeLimit |
Constructor and Description |
---|
FitnessReplay(CentralRegistry registry,
nl.tue.astar.AStarThread.Canceller c)
Instantiate a new FitnessReplay instance that calculates the replay
fitness between log and model and provides information required by some
other metrics (such as Precision and Generalization).
|
FitnessReplay(CentralRegistry registry,
nl.tue.astar.AStarThread.Canceller c,
double fitnessLimit,
double timeLimit)
Instantiate a new FitnessReplay instance that calculates the replay
fitness between log and model and provides information required by some
other metrics (such as Precision and Generalization).
|
FitnessReplay(CentralRegistry registry,
nl.tue.astar.AStarThread.Canceller c,
double fitnessLimit,
double timeLimit,
boolean detailedAlignmentInfoEnabled,
long maxBytesToUse,
int nrThreads)
Instantiate a new FitnessReplay instance that calculates the replay
fitness between log and model and provides information required by some
other metrics (such as Precision and Generalization).
|
FitnessReplay(FitnessReplay original)
Deep-clone copy constructor.
|
Modifier and Type | Method and Description |
---|---|
double |
getFitness(NAryTree candidate,
java.util.List<? extends NAryTree> population)
Calculates a fitness score for the given candidate.
|
static FitnessReplay.FitnessReplayGUI |
getGUISettingsPanel(ETMParamAbstract param) |
TreeFitnessInfo |
getInfo()
Returns the STATIC info for the metric instance
|
double |
getMaxF()
Returns the threshold at which calculations are stopped.
|
int |
getNrThreads() |
double |
getTimeLimit() |
boolean |
isCpuEfficient() |
boolean |
isDetailedAlignmentInfoEnabled() |
boolean |
isLastResultReliable()
Returns whether the last result was reliable or not.
|
static int[] |
modelCosts(NAryTree tree) |
void |
setCaching(boolean caching) |
void |
setCpuEfficient(boolean cpuEfficient) |
void |
setDetailedAlignmentInfoEnabled(boolean detailedAlignmentInfoEnabled)
Enables/disables the alignment cache.
|
void |
setMaxF(double maxF)
Set a new limit on the replay fitness value, to improve performance.
|
void |
setNrThreads(int nrThreads) |
void |
setStubborn(boolean stubborn) |
void |
setTimeLimit(double timeLimit) |
NAryTreeReplayer<?,?,?> |
setupReplayer(NAryTree candidate,
AStarAlgorithm algorithm,
java.util.Map<TreeMarkingVisit<ModelPrefix>,gnu.trove.set.TIntSet> marking2modelMove,
gnu.trove.map.TObjectIntMap<TreeMarkingVisit<ModelPrefix>> marking2visitCount,
int[] modelCosts,
int[] syncMoveCount,
int[] aSyncMoveCount,
int[] moveCount,
java.util.Map<nl.tue.astar.Trace,TreeRecord> alignments) |
void |
setUseOrRows(boolean useOrRows) |
void |
updateMaxBytesToUse(long maxBytes)
The alignment algorithm will clear its internal cache when this number of
bytes is (almost) exceeded.
|
deepClone, deepClone, instantiateTreeFitness, isNatural
public static final TreeFitnessInfo info
protected double fitnessLimit
protected double timeLimit
protected nl.tue.astar.AStarThread.Canceller c
protected final CentralRegistry registry
protected boolean detailedAlignmentInfoEnabled
protected long maxBytestoUse
public FitnessReplay(FitnessReplay original)
original
- public FitnessReplay(CentralRegistry registry, nl.tue.astar.AStarThread.Canceller c)
registry
- CentralRegistry
The Central Registry required for
single-point access to log etc.c
- A special canceller that cancels the alignment execution on
the users requestpublic FitnessReplay(CentralRegistry registry, nl.tue.astar.AStarThread.Canceller c, double fitnessLimit, double timeLimit)
registry
- CentralRegistry
The Central Registry required for
single-point access to log etc.c
- A special canceller that cancels the alignment execution on
the users requestfitnessLimit
- The minimum fitness level required. If a certain model has a
worse fitness than this calculations are stopped and the worst
value is returned. Set to a negative value to disable this
limit.timeLimit
- The time limit in seconds that a single-trace alignment
calculation can take. A negative value indicates no limit.public FitnessReplay(CentralRegistry registry, nl.tue.astar.AStarThread.Canceller c, double fitnessLimit, double timeLimit, boolean detailedAlignmentInfoEnabled, long maxBytesToUse, int nrThreads)
registry
- CentralRegistry
The Central Registry required for
single-point access to log etc.c
- A special canceller that cancels the alignment execution on
the users requestconfigurationNumber
- The configuration of the NAryTree to use. If no configurations
are used, supply -1fitnessLimit
- The minimum fitness level required. If a certain model has a
worse fitness than this calculations are stopped and the worst
value is returned. Set to a negative value to disable this
limit.timeLimit
- The time limit in seconds that a single-trace alignment
calculation can take. A negative value indicates no limit.detailedAlignmentInfoEnabled
- If set to TRUE very detailed alignment information is stored
in the
TreeFitness
cache in the CentralRegistry
.maxBytesToUse
- The maximum number of bytes allowed for the algorithm to use,
if it goes over it clears the cache (e.g. does not guarantee
the algorithm does not go over but will use it to clear the
cache). Negative value indicates no limitnrThreads
- The number of threads to use during alignment calculation. For
ETM use 1 is recommended and parallel calculations of trees is
recommended.public double getFitness(NAryTree candidate, java.util.List<? extends NAryTree> population)
FitnessEvaluator.isNatural()
). This method must always
return a value greater than or equal to zero. Framework behaviour is
undefined for negative fitness scores.candidate
- The candidate solution to calculate fitness for.population
- The entire population. This will include the specified
candidate. This is provided for fitness evaluators that
evaluate individuals in the context of the population that
they are part of (e.g. a program that evolves game-playing
strategies may wish to play each strategy against each of the
others). This parameter can be ignored by simple fitness
evaluators. When iterating over the population, a simple
reference equality check (==) can be used to identify which
member of the population is the specified candidate.public NAryTreeReplayer<?,?,?> setupReplayer(NAryTree candidate, AStarAlgorithm algorithm, java.util.Map<TreeMarkingVisit<ModelPrefix>,gnu.trove.set.TIntSet> marking2modelMove, gnu.trove.map.TObjectIntMap<TreeMarkingVisit<ModelPrefix>> marking2visitCount, int[] modelCosts, int[] syncMoveCount, int[] aSyncMoveCount, int[] moveCount, java.util.Map<nl.tue.astar.Trace,TreeRecord> alignments)
public static int[] modelCosts(NAryTree tree)
public TreeFitnessInfo getInfo()
getInfo
in class TreeFitnessAbstract
public double getMaxF()
public void setMaxF(double maxF)
maxF
- the maxF to setpublic double getTimeLimit()
public void setTimeLimit(double timeLimit)
timeLimit
- the timeLimit to setpublic boolean isLastResultReliable()
public boolean isDetailedAlignmentInfoEnabled()
public static FitnessReplay.FitnessReplayGUI getGUISettingsPanel(ETMParamAbstract param)
public void setDetailedAlignmentInfoEnabled(boolean detailedAlignmentInfoEnabled)
TreeFitness
cache in the
CentralRegistry
. ONLY ENABLE DURING DEBUGGING!detailedAlignmentInfoEnabled
- the detailedAlignmentInfoEnabled to setpublic void updateMaxBytesToUse(long maxBytes)
OutOfMemoryError
exceptions, especially for larger models and
longer traces. Set this as high as you can to improve performance but as
low as you think is necessary to prevent a memory overrun.maxBytes
- public void setStubborn(boolean stubborn)
public void setCaching(boolean caching)
public void setUseOrRows(boolean useOrRows)
public void setCpuEfficient(boolean cpuEfficient)
public boolean isCpuEfficient()
public int getNrThreads()
public void setNrThreads(int nrThreads)
nrThreads
- the nrThreads to set. Update the number of threads to be used
for the alignment calculation. Recommended is half the number
of CPU's Java thinks there are, since one half is 'real' and
the other is via hyperThreading...