Package randoop.generation
Class OrienteeringSelection.SequenceDetails
- java.lang.Object
-
- randoop.generation.OrienteeringSelection.SequenceDetails
-
- Enclosing class:
- OrienteeringSelection
private static class OrienteeringSelection.SequenceDetails extends Object
Information used by Orienteering to compute a weight for a sequence.
-
-
Field Summary
Fields Modifier and Type Field Description private long
executionTimeNanos
The execution time of the sequence, in nanoseconds.private double
methodSizeSqrt
The square root of the number of method calls in the sequence.private int
selectionCount
Number of times this sequence has been selected byOrienteeringSelection
.private double
weight
ASequence
's weight.
-
Constructor Summary
Constructors Constructor Description SequenceDetails(double methodSizeSqrt, long executionTimeNanos)
Create a SequenceDetails.SequenceDetails(Sequence sequence, long executionTimeNanos)
Create a SequenceDetails for the given sequence, but using the given execution time.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getWeight()
Returns the weight of the sequence.void
incrementSelectionCount()
Increments the selection count.private void
updateWeight()
Compute the weight of a sequence.
-
-
-
Field Detail
-
methodSizeSqrt
private final double methodSizeSqrt
The square root of the number of method calls in the sequence.
-
executionTimeNanos
private final long executionTimeNanos
The execution time of the sequence, in nanoseconds.
-
selectionCount
private int selectionCount
Number of times this sequence has been selected byOrienteeringSelection
.
-
weight
private double weight
ASequence
's weight. This is computed from the other fields and is updated whenselectionCount
is.
-
-
Constructor Detail
-
SequenceDetails
SequenceDetails(Sequence sequence, long executionTimeNanos)
Create a SequenceDetails for the given sequence, but using the given execution time.- Parameters:
sequence
- a sequenceexecutionTimeNanos
- execution time in nanoseconds
-
SequenceDetails
public SequenceDetails(double methodSizeSqrt, long executionTimeNanos)
Create a SequenceDetails.- Parameters:
methodSizeSqrt
- the square root of the number of method callsexecutionTimeNanos
- the execution time, in nanoseconds
-
-
Method Detail
-
incrementSelectionCount
public void incrementSelectionCount()
Increments the selection count.
-
getWeight
public double getWeight()
Returns the weight of the sequence.- Returns:
- the weight of the sequence
-
updateWeight
private void updateWeight()
Compute the weight of a sequence. The formula for a sequence's weight is:1.0 / (k * seq.exec_time * sqrt(seq.meth_size))
where k is the number of selections of seq and exec_time is the execution time of seq and meth_size is the number of method call statements in seq. This formula is a slight simplification of the one described in the GRT paper which maintains a separate exec_time for each execution of seq. However, we assume that every execution time for a sequence is the same as the first execution.
-
-