Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
4eb71440
Commit
4eb71440
authored
Jun 24, 2026
by
Numanoglu
Browse files
Streamline BVH heuristic measurements
parent
2c9eea60
Changes
7
Show whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/aabb/fixtures/BvhSyntheticScenarioCatalog.java
View file @
4eb71440
...
@@ -43,25 +43,25 @@ public final class BvhSyntheticScenarioCatalog {
...
@@ -43,25 +43,25 @@ public final class BvhSyntheticScenarioCatalog {
new
SsiScenario
(
"flat-box-grid-large"
,
new
SsiScenario
(
"flat-box-grid-large"
,
SyntheticSolidGeometryFactory
.
flatBoxGrid
(
Lod
.
LOD2
,
240
)),
SyntheticSolidGeometryFactory
.
flatBoxGrid
(
Lod
.
LOD2
,
240
)),
new
SsiScenario
(
"thin-ratio-025"
,
new
SsiScenario
(
"thin-ratio-025"
,
SyntheticSolidGeometryFactory
.
thinRatio
Sweep
Boxes
(
Lod
.
LOD2
,
120
,
0.25
)),
SyntheticSolidGeometryFactory
.
thinRatio
Variation
Boxes
(
Lod
.
LOD2
,
120
,
0.25
)),
new
SsiScenario
(
"thin-ratio-050"
,
new
SsiScenario
(
"thin-ratio-050"
,
SyntheticSolidGeometryFactory
.
thinRatio
Sweep
Boxes
(
Lod
.
LOD2
,
120
,
0.50
)),
SyntheticSolidGeometryFactory
.
thinRatio
Variation
Boxes
(
Lod
.
LOD2
,
120
,
0.50
)),
new
SsiScenario
(
"thin-ratio-075"
,
new
SsiScenario
(
"thin-ratio-075"
,
SyntheticSolidGeometryFactory
.
thinRatio
Sweep
Boxes
(
Lod
.
LOD2
,
120
,
0.75
)),
SyntheticSolidGeometryFactory
.
thinRatio
Variation
Boxes
(
Lod
.
LOD2
,
120
,
0.75
)),
new
SsiScenario
(
"aspect-005"
,
new
SsiScenario
(
"aspect-005"
,
SyntheticSolidGeometryFactory
.
aspect
Sweep
Boxes
(
Lod
.
LOD2
,
120
,
5.0
)),
SyntheticSolidGeometryFactory
.
aspect
RatioVariation
Boxes
(
Lod
.
LOD2
,
120
,
5.0
)),
new
SsiScenario
(
"aspect-020"
,
new
SsiScenario
(
"aspect-020"
,
SyntheticSolidGeometryFactory
.
aspect
Sweep
Boxes
(
Lod
.
LOD2
,
120
,
20.0
)),
SyntheticSolidGeometryFactory
.
aspect
RatioVariation
Boxes
(
Lod
.
LOD2
,
120
,
20.0
)),
new
SsiScenario
(
"aspect-080"
,
new
SsiScenario
(
"aspect-080"
,
SyntheticSolidGeometryFactory
.
aspect
Sweep
Boxes
(
Lod
.
LOD2
,
120
,
80.0
)),
SyntheticSolidGeometryFactory
.
aspect
RatioVariation
Boxes
(
Lod
.
LOD2
,
120
,
80.0
)),
new
SsiScenario
(
"spread-tight"
,
new
SsiScenario
(
"spread-tight"
,
SyntheticSolidGeometryFactory
.
spreadSweep
Boxes
(
Lod
.
LOD2
,
120
,
3.5
)),
SyntheticSolidGeometryFactory
.
centerSpreadVariation
Boxes
(
Lod
.
LOD2
,
120
,
3.5
)),
new
SsiScenario
(
"spread-wide"
,
new
SsiScenario
(
"spread-wide"
,
SyntheticSolidGeometryFactory
.
spreadSweep
Boxes
(
Lod
.
LOD2
,
120
,
20.0
)),
SyntheticSolidGeometryFactory
.
centerSpreadVariation
Boxes
(
Lod
.
LOD2
,
120
,
20.0
)),
new
SsiScenario
(
"relvol-compact"
,
new
SsiScenario
(
"relvol-compact"
,
SyntheticSolidGeometryFactory
.
relativeVolume
Sweep
Boxes
(
Lod
.
LOD2
,
80
,
5.0
,
1.1
)),
SyntheticSolidGeometryFactory
.
relativeVolume
Variation
Boxes
(
Lod
.
LOD2
,
80
,
5.0
,
1.1
)),
new
SsiScenario
(
"relvol-sparse"
,
new
SsiScenario
(
"relvol-sparse"
,
SyntheticSolidGeometryFactory
.
relativeVolume
Sweep
Boxes
(
Lod
.
LOD2
,
80
,
5.0
,
5.0
)),
SyntheticSolidGeometryFactory
.
relativeVolume
Variation
Boxes
(
Lod
.
LOD2
,
80
,
5.0
,
5.0
)),
new
SsiScenario
(
"citylike-mixed-small"
,
new
SsiScenario
(
"citylike-mixed-small"
,
SyntheticCityGmlLikeGeometryFactory
.
mixedUrbanDistrict
(
Lod
.
LOD2
,
3
,
3
)),
SyntheticCityGmlLikeGeometryFactory
.
mixedUrbanDistrict
(
Lod
.
LOD2
,
3
,
3
)),
new
SsiScenario
(
"citylike-mixed-large"
,
new
SsiScenario
(
"citylike-mixed-large"
,
...
@@ -97,15 +97,15 @@ public final class BvhSyntheticScenarioCatalog {
...
@@ -97,15 +97,15 @@ public final class BvhSyntheticScenarioCatalog {
new
NestedScenario
(
"clustered-pair"
,
new
NestedScenario
(
"clustered-pair"
,
SyntheticNestedRingGeometryFactory
.
clusteredInnerRingsWithNestedPair
(
16
,
80
)),
SyntheticNestedRingGeometryFactory
.
clusteredInnerRingsWithNestedPair
(
16
,
80
)),
new
NestedScenario
(
"aspect-005"
,
new
NestedScenario
(
"aspect-005"
,
SyntheticNestedRingGeometryFactory
.
aspect
Sweep
InnerRings
(
180
,
5.0
)),
SyntheticNestedRingGeometryFactory
.
aspect
RatioVariation
InnerRings
(
180
,
5.0
)),
new
NestedScenario
(
"aspect-020"
,
new
NestedScenario
(
"aspect-020"
,
SyntheticNestedRingGeometryFactory
.
aspect
Sweep
InnerRings
(
180
,
20.0
)),
SyntheticNestedRingGeometryFactory
.
aspect
RatioVariation
InnerRings
(
180
,
20.0
)),
new
NestedScenario
(
"aspect-080"
,
new
NestedScenario
(
"aspect-080"
,
SyntheticNestedRingGeometryFactory
.
aspect
Sweep
InnerRings
(
180
,
80.0
)),
SyntheticNestedRingGeometryFactory
.
aspect
RatioVariation
InnerRings
(
180
,
80.0
)),
new
NestedScenario
(
"spread-tight"
,
new
NestedScenario
(
"spread-tight"
,
SyntheticNestedRingGeometryFactory
.
spreadSweep
InnerRings
(
240
,
2.0
)),
SyntheticNestedRingGeometryFactory
.
centerSpreadVariation
InnerRings
(
240
,
2.0
)),
new
NestedScenario
(
"spread-wide"
,
new
NestedScenario
(
"spread-wide"
,
SyntheticNestedRingGeometryFactory
.
spreadSweep
InnerRings
(
240
,
20.0
)));
SyntheticNestedRingGeometryFactory
.
centerSpreadVariation
InnerRings
(
240
,
20.0
)));
}
}
public
static
List
<
RsiScenario
>
rsiScenarios
()
{
public
static
List
<
RsiScenario
>
rsiScenarios
()
{
...
@@ -121,15 +121,15 @@ public final class BvhSyntheticScenarioCatalog {
...
@@ -121,15 +121,15 @@ public final class BvhSyntheticScenarioCatalog {
new
RsiScenario
(
"rsi-zigzag-heavy"
,
new
RsiScenario
(
"rsi-zigzag-heavy"
,
SyntheticRingGeometryFactory
.
performanceRingGeometry
(
400
,
4_000
,
EPSILON
)),
SyntheticRingGeometryFactory
.
performanceRingGeometry
(
400
,
4_000
,
EPSILON
)),
new
RsiScenario
(
"rsi-aspect-005"
,
new
RsiScenario
(
"rsi-aspect-005"
,
SyntheticRingGeometryFactory
.
aspect
Sweep
Geometry
(
240
,
5.0
)),
SyntheticRingGeometryFactory
.
aspect
RatioVariation
Geometry
(
240
,
5.0
)),
new
RsiScenario
(
"rsi-aspect-020"
,
new
RsiScenario
(
"rsi-aspect-020"
,
SyntheticRingGeometryFactory
.
aspect
Sweep
Geometry
(
240
,
20.0
)),
SyntheticRingGeometryFactory
.
aspect
RatioVariation
Geometry
(
240
,
20.0
)),
new
RsiScenario
(
"rsi-aspect-080"
,
new
RsiScenario
(
"rsi-aspect-080"
,
SyntheticRingGeometryFactory
.
aspect
Sweep
Geometry
(
240
,
80.0
)),
SyntheticRingGeometryFactory
.
aspect
RatioVariation
Geometry
(
240
,
80.0
)),
new
RsiScenario
(
"rsi-spread-tight"
,
new
RsiScenario
(
"rsi-spread-tight"
,
SyntheticRingGeometryFactory
.
spreadSweep
Geometry
(
240
,
4.0
)),
SyntheticRingGeometryFactory
.
centerSpreadVariation
Geometry
(
240
,
4.0
)),
new
RsiScenario
(
"rsi-spread-wide"
,
new
RsiScenario
(
"rsi-spread-wide"
,
SyntheticRingGeometryFactory
.
spreadSweep
Geometry
(
240
,
30.0
)));
SyntheticRingGeometryFactory
.
centerSpreadVariation
Geometry
(
240
,
30.0
)));
}
}
public
static
final
class
SsiScenario
{
public
static
final
class
SsiScenario
{
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/aabb/fixtures/SyntheticNestedRingGeometryFactory.java
View file @
4eb71440
...
@@ -139,7 +139,7 @@ public final class SyntheticNestedRingGeometryFactory {
...
@@ -139,7 +139,7 @@ public final class SyntheticNestedRingGeometryFactory {
return
polygon
;
return
polygon
;
}
}
public
static
ConcretePolygon
aspect
Sweep
InnerRings
(
int
count
,
double
aspectRatio
)
{
public
static
ConcretePolygon
aspect
RatioVariation
InnerRings
(
int
count
,
double
aspectRatio
)
{
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
double
width
=
Math
.
max
(
1.0
,
aspectRatio
);
double
width
=
Math
.
max
(
1.0
,
aspectRatio
);
double
extent
=
columns
*
(
width
+
4.0
)
+
20.0
;
double
extent
=
columns
*
(
width
+
4.0
)
+
20.0
;
...
@@ -152,7 +152,7 @@ public final class SyntheticNestedRingGeometryFactory {
...
@@ -152,7 +152,7 @@ public final class SyntheticNestedRingGeometryFactory {
return
polygon
;
return
polygon
;
}
}
public
static
ConcretePolygon
spreadSweep
InnerRings
(
int
count
,
double
spacing
)
{
public
static
ConcretePolygon
centerSpreadVariation
InnerRings
(
int
count
,
double
spacing
)
{
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
double
extent
=
columns
*
spacing
+
20.0
;
double
extent
=
columns
*
spacing
+
20.0
;
ConcretePolygon
polygon
=
basePolygonWithExtent
(
extent
);
ConcretePolygon
polygon
=
basePolygonWithExtent
(
extent
);
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/aabb/fixtures/SyntheticRingGeometryFactory.java
View file @
4eb71440
...
@@ -68,7 +68,7 @@ public final class SyntheticRingGeometryFactory {
...
@@ -68,7 +68,7 @@ public final class SyntheticRingGeometryFactory {
return
geometry
;
return
geometry
;
}
}
public
static
Geometry
aspect
Sweep
Geometry
(
int
ringCount
,
double
aspectRatio
)
{
public
static
Geometry
aspect
RatioVariation
Geometry
(
int
ringCount
,
double
aspectRatio
)
{
Geometry
geometry
=
new
Geometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
,
Orientation
.
OUTWARD
);
Geometry
geometry
=
new
Geometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
,
Orientation
.
OUTWARD
);
double
width
=
Math
.
max
(
1.0
,
aspectRatio
);
double
width
=
Math
.
max
(
1.0
,
aspectRatio
);
for
(
int
i
=
0
;
i
<
ringCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
ringCount
;
i
++)
{
...
@@ -80,7 +80,7 @@ public final class SyntheticRingGeometryFactory {
...
@@ -80,7 +80,7 @@ public final class SyntheticRingGeometryFactory {
return
geometry
;
return
geometry
;
}
}
public
static
Geometry
spreadSweep
Geometry
(
int
ringCount
,
double
spacing
)
{
public
static
Geometry
centerSpreadVariation
Geometry
(
int
ringCount
,
double
spacing
)
{
Geometry
geometry
=
new
Geometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
,
Orientation
.
OUTWARD
);
Geometry
geometry
=
new
Geometry
(
GeometryType
.
SOLID
,
Lod
.
LOD2
,
Orientation
.
OUTWARD
);
for
(
int
i
=
0
;
i
<
ringCount
;
i
++)
{
for
(
int
i
=
0
;
i
<
ringCount
;
i
++)
{
double
x
=
(
i
%
20
)
*
spacing
;
double
x
=
(
i
%
20
)
*
spacing
;
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/aabb/fixtures/SyntheticSolidGeometryFactory.java
View file @
4eb71440
...
@@ -91,7 +91,7 @@ public final class SyntheticSolidGeometryFactory {
...
@@ -91,7 +91,7 @@ public final class SyntheticSolidGeometryFactory {
return
geometry
;
return
geometry
;
}
}
public
static
Geometry
thinRatio
Sweep
Boxes
(
Lod
lod
,
int
count
,
double
thinRatio
)
{
public
static
Geometry
thinRatio
Variation
Boxes
(
Lod
lod
,
int
count
,
double
thinRatio
)
{
Geometry
geometry
=
newSolid
(
lod
);
Geometry
geometry
=
newSolid
(
lod
);
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
int
thinCount
=
(
int
)
Math
.
round
(
count
*
thinRatio
);
int
thinCount
=
(
int
)
Math
.
round
(
count
*
thinRatio
);
...
@@ -108,7 +108,7 @@ public final class SyntheticSolidGeometryFactory {
...
@@ -108,7 +108,7 @@ public final class SyntheticSolidGeometryFactory {
return
geometry
;
return
geometry
;
}
}
public
static
Geometry
aspect
Sweep
Boxes
(
Lod
lod
,
int
count
,
double
aspectRatio
)
{
public
static
Geometry
aspect
RatioVariation
Boxes
(
Lod
lod
,
int
count
,
double
aspectRatio
)
{
Geometry
geometry
=
newSolid
(
lod
);
Geometry
geometry
=
newSolid
(
lod
);
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
double
width
=
Math
.
max
(
1.0
,
aspectRatio
);
double
width
=
Math
.
max
(
1.0
,
aspectRatio
);
...
@@ -122,7 +122,7 @@ public final class SyntheticSolidGeometryFactory {
...
@@ -122,7 +122,7 @@ public final class SyntheticSolidGeometryFactory {
return
geometry
;
return
geometry
;
}
}
public
static
Geometry
spreadSweep
Boxes
(
Lod
lod
,
int
count
,
double
spacing
)
{
public
static
Geometry
centerSpreadVariation
Boxes
(
Lod
lod
,
int
count
,
double
spacing
)
{
Geometry
geometry
=
newSolid
(
lod
);
Geometry
geometry
=
newSolid
(
lod
);
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
...
@@ -134,7 +134,7 @@ public final class SyntheticSolidGeometryFactory {
...
@@ -134,7 +134,7 @@ public final class SyntheticSolidGeometryFactory {
return
geometry
;
return
geometry
;
}
}
public
static
Geometry
relativeVolume
Sweep
Boxes
(
Lod
lod
,
int
count
,
double
boxSize
,
double
spacingFactor
)
{
public
static
Geometry
relativeVolume
Variation
Boxes
(
Lod
lod
,
int
count
,
double
boxSize
,
double
spacingFactor
)
{
Geometry
geometry
=
newSolid
(
lod
);
Geometry
geometry
=
newSolid
(
lod
);
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
int
columns
=
(
int
)
Math
.
ceil
(
Math
.
sqrt
(
count
));
double
spacing
=
boxSize
*
spacingFactor
;
double
spacing
=
boxSize
*
spacingFactor
;
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/aabb/heuristics/BvhStrategyHeuristicExplorationTest.java
View file @
4eb71440
...
@@ -82,7 +82,7 @@ public class BvhStrategyHeuristicExplorationTest {
...
@@ -82,7 +82,7 @@ public class BvhStrategyHeuristicExplorationTest {
}
}
private
static
void
addSsiObservations
(
List
<
BvhHeuristicTimingSupport
.
Observation
>
observations
)
{
private
static
void
addSsiObservations
(
List
<
BvhHeuristicTimingSupport
.
Observation
>
observations
)
{
// SSI uses polygons as BVH elements
and compares against the brute-force solid check
.
// SSI uses polygons as BVH elements.
for
(
BvhSyntheticScenarioCatalog
.
SsiScenario
scenario
:
BvhSyntheticScenarioCatalog
.
ssiScenarios
())
{
for
(
BvhSyntheticScenarioCatalog
.
SsiScenario
scenario
:
BvhSyntheticScenarioCatalog
.
ssiScenarios
())
{
List
<
Polygon
>
polygons
=
scenario
.
geometry
.
getPolygons
();
List
<
Polygon
>
polygons
=
scenario
.
geometry
.
getPolygons
();
BvhInputMetricsCollector
.
Metrics
metrics
=
BvhInputMetricsCollector
.
Metrics
metrics
=
...
@@ -92,8 +92,6 @@ public class BvhStrategyHeuristicExplorationTest {
...
@@ -92,8 +92,6 @@ public class BvhStrategyHeuristicExplorationTest {
scenario
.
name
,
scenario
.
name
,
metrics
,
metrics
,
polygons
.
size
(),
polygons
.
size
(),
"BRUTE_FORCE"
,
()
->
SelfIntersectionUtil
.
calculateSolidSelfIntersection0
(
scenario
.
geometry
,
DELTA
).
size
(),
strategy
->
calculateSsiWithTree
(
scenario
.
geometry
,
strategy
)));
strategy
->
calculateSsiWithTree
(
scenario
.
geometry
,
strategy
)));
}
}
}
}
...
@@ -109,8 +107,6 @@ public class BvhStrategyHeuristicExplorationTest {
...
@@ -109,8 +107,6 @@ public class BvhStrategyHeuristicExplorationTest {
scenario
.
name
,
scenario
.
name
,
metrics
,
metrics
,
rings
.
size
(),
rings
.
size
(),
NestedRingsCheck
.
Variant
.
OLD
.
name
(),
()
->
runNestedCheck
(
scenario
.
polygon
,
NestedRingsCheck
.
Variant
.
OLD
),
strategy
->
runNestedCheck
(
scenario
.
polygon
,
BvhHeuristicTimingSupport
.
nestedVariantFor
(
strategy
))));
strategy
->
runNestedCheck
(
scenario
.
polygon
,
BvhHeuristicTimingSupport
.
nestedVariantFor
(
strategy
))));
}
}
}
}
...
@@ -125,8 +121,6 @@ public class BvhStrategyHeuristicExplorationTest {
...
@@ -125,8 +121,6 @@ public class BvhStrategyHeuristicExplorationTest {
scenario
.
name
,
scenario
.
name
,
metrics
,
metrics
,
countEdges
(
scenario
.
geometry
),
countEdges
(
scenario
.
geometry
),
RingSelfIntCheck
.
Variant
.
OLD
.
name
(),
()
->
runRsiCheck
(
scenario
.
geometry
,
RingSelfIntCheck
.
Variant
.
OLD
),
strategy
->
runRsiCheck
(
scenario
.
geometry
,
BvhHeuristicTimingSupport
.
rsiVariantFor
(
strategy
))));
strategy
->
runRsiCheck
(
scenario
.
geometry
,
BvhHeuristicTimingSupport
.
rsiVariantFor
(
strategy
))));
}
}
}
}
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/aabb/support/BvhExplorationCsvWriter.java
View file @
4eb71440
...
@@ -41,8 +41,6 @@ public final class BvhExplorationCsvWriter {
...
@@ -41,8 +41,6 @@ public final class BvhExplorationCsvWriter {
"candidatePolicy"
,
"candidatePolicy"
,
"winnerBvh"
,
"winnerBvh"
,
"match"
,
"match"
,
"baselineVariant"
,
"baselineMs"
,
"bestBvhMs"
,
"bestBvhMs"
,
"candidatePolicyMs"
,
"candidatePolicyMs"
,
"regretMs"
,
"regretMs"
,
...
@@ -96,8 +94,6 @@ public final class BvhExplorationCsvWriter {
...
@@ -96,8 +94,6 @@ public final class BvhExplorationCsvWriter {
observation
.
candidateRulePrediction
,
observation
.
candidateRulePrediction
,
observation
.
fastestBvh
.
variant
,
observation
.
fastestBvh
.
variant
,
observation
.
candidateRuleMatchLabel
(),
observation
.
candidateRuleMatchLabel
(),
observation
.
baseline
==
null
?
""
:
observation
.
baseline
.
variant
,
measurementMillis
(
observation
.
baseline
),
measurementMillis
(
observation
.
fastestBvh
),
measurementMillis
(
observation
.
fastestBvh
),
measurementMillis
(
observation
.
candidateRuleMeasurement
),
measurementMillis
(
observation
.
candidateRuleMeasurement
),
decimalOrEmpty
(
observation
.
candidateRegretMillis
()),
decimalOrEmpty
(
observation
.
candidateRegretMillis
()),
...
...
CityDoctorParent/CityDoctorValidation/src/test/java/de/hft/stuttgart/citydoctor2/checks/aabb/support/BvhHeuristicTimingSupport.java
View file @
4eb71440
...
@@ -30,18 +30,10 @@ public final class BvhHeuristicTimingSupport {
...
@@ -30,18 +30,10 @@ public final class BvhHeuristicTimingSupport {
String
scenarioName
,
String
scenarioName
,
BvhInputMetricsCollector
.
Metrics
metrics
,
BvhInputMetricsCollector
.
Metrics
metrics
,
int
inputSize
,
int
inputSize
,
String
baselineName
,
MeasuredOperation
baselineOperation
,
StrategyOperation
strategyOperation
)
{
StrategyOperation
strategyOperation
)
{
//
Full checks compare each BVH variant
against
the old
or brute
-
force i
mplementation
.
//
Correctness
against
OLD
or brute
force i
s covered by the dedicated variant tests
.
List
<
BvhPerformanceTestSupport
.
Measurement
>
measurements
=
new
ArrayList
<>();
List
<
BvhPerformanceTestSupport
.
Measurement
>
measurements
=
new
ArrayList
<>();
BvhPerformanceTestSupport
.
Measurement
baseline
=
BvhPerformanceTestSupport
.
measure
(
Integer
expectedResultCount
=
null
;
scenarioName
,
baselineName
,
inputSize
,
baselineOperation:
:
run
);
measurements
.
add
(
baseline
);
for
(
SplitStrategy
strategy
:
BvhPerformanceTestSupport
.
concreteStrategies
())
{
for
(
SplitStrategy
strategy
:
BvhPerformanceTestSupport
.
concreteStrategies
())
{
BvhPerformanceTestSupport
.
Measurement
bvhMeasurement
=
BvhPerformanceTestSupport
.
measure
(
BvhPerformanceTestSupport
.
Measurement
bvhMeasurement
=
BvhPerformanceTestSupport
.
measure
(
scenarioName
,
scenarioName
,
...
@@ -49,8 +41,12 @@ public final class BvhHeuristicTimingSupport {
...
@@ -49,8 +41,12 @@ public final class BvhHeuristicTimingSupport {
inputSize
,
inputSize
,
()
->
strategyOperation
.
run
(
strategy
));
()
->
strategyOperation
.
run
(
strategy
));
measurements
.
add
(
bvhMeasurement
);
measurements
.
add
(
bvhMeasurement
);
if
(
expectedResultCount
==
null
)
{
expectedResultCount
=
bvhMeasurement
.
resultCount
;
}
else
{
assertEquals
(
checkName
+
" result differs for "
+
scenarioName
+
" / "
+
strategy
,
assertEquals
(
checkName
+
" result differs for "
+
scenarioName
+
" / "
+
strategy
,
baseline
.
resultCount
,
bvhMeasurement
.
resultCount
);
expectedResultCount
.
intValue
(),
bvhMeasurement
.
resultCount
);
}
}
}
String
currentPolicyPrediction
=
predictFromCurrentPolicy
(
checkName
,
metrics
);
String
currentPolicyPrediction
=
predictFromCurrentPolicy
(
checkName
,
metrics
);
...
@@ -58,9 +54,7 @@ public final class BvhHeuristicTimingSupport {
...
@@ -58,9 +54,7 @@ public final class BvhHeuristicTimingSupport {
return
new
Observation
(
return
new
Observation
(
checkName
,
checkName
,
metrics
,
metrics
,
fastest
(
measurements
),
fastestBvh
(
measurements
),
fastestBvh
(
measurements
),
baseline
,
currentPolicyPrediction
,
currentPolicyPrediction
,
candidateRulePrediction
,
candidateRulePrediction
,
measurementForPrediction
(
measurements
,
currentPolicyPrediction
),
measurementForPrediction
(
measurements
,
currentPolicyPrediction
),
...
@@ -73,20 +67,20 @@ public final class BvhHeuristicTimingSupport {
...
@@ -73,20 +67,20 @@ public final class BvhHeuristicTimingSupport {
BvhInputMetricsCollector
.
Metrics
metrics
,
BvhInputMetricsCollector
.
Metrics
metrics
,
int
inputSize
,
int
inputSize
,
StrategyOperation
strategyOperation
)
{
StrategyOperation
strategyOperation
)
{
//
Real CityGML runs measure only broad-phase candidate search, so the first BVH variant is the count baseline
.
//
The first BVH result count is reused only to verify the remaining variants
.
List
<
BvhPerformanceTestSupport
.
Measurement
>
measurements
=
new
ArrayList
<>();
List
<
BvhPerformanceTestSupport
.
Measurement
>
measurements
=
new
ArrayList
<>();
BvhPerformanceTestSupport
.
Measurement
baseline
=
null
;
Integer
expectedResultCount
=
null
;
for
(
SplitStrategy
strategy
:
BvhPerformanceTestSupport
.
concreteStrategies
())
{
for
(
SplitStrategy
strategy
:
BvhPerformanceTestSupport
.
concreteStrategies
())
{
BvhPerformanceTestSupport
.
Measurement
bvhMeasurement
=
BvhPerformanceTestSupport
.
measure
(
BvhPerformanceTestSupport
.
Measurement
bvhMeasurement
=
BvhPerformanceTestSupport
.
measure
(
scenarioName
,
scenarioName
,
strategy
.
name
(),
strategy
.
name
(),
inputSize
,
inputSize
,
()
->
strategyOperation
.
run
(
strategy
));
()
->
strategyOperation
.
run
(
strategy
));
if
(
baseline
==
null
)
{
if
(
expectedResultCount
==
null
)
{
baseline
=
bvhMeasurement
;
expectedResultCount
=
bvhMeasurement
.
resultCount
;
}
else
{
}
else
{
assertEquals
(
checkName
+
" broad-phase count differs for "
+
scenarioName
+
" / "
+
strategy
,
assertEquals
(
checkName
+
" broad-phase count differs for "
+
scenarioName
+
" / "
+
strategy
,
baseline
.
resultCount
,
bvhMeasurement
.
resultCount
);
expectedResultCount
.
intValue
()
,
bvhMeasurement
.
resultCount
);
}
}
measurements
.
add
(
bvhMeasurement
);
measurements
.
add
(
bvhMeasurement
);
}
}
...
@@ -96,9 +90,7 @@ public final class BvhHeuristicTimingSupport {
...
@@ -96,9 +90,7 @@ public final class BvhHeuristicTimingSupport {
return
new
Observation
(
return
new
Observation
(
checkName
,
checkName
,
metrics
,
metrics
,
fastest
(
measurements
),
fastestBvh
(
measurements
),
fastestBvh
(
measurements
),
baseline
,
currentPolicyPrediction
,
currentPolicyPrediction
,
candidateRulePrediction
,
candidateRulePrediction
,
measurementForPrediction
(
measurements
,
currentPolicyPrediction
),
measurementForPrediction
(
measurements
,
currentPolicyPrediction
),
...
@@ -199,26 +191,10 @@ public final class BvhHeuristicTimingSupport {
...
@@ -199,26 +191,10 @@ public final class BvhHeuristicTimingSupport {
throw
new
IllegalArgumentException
(
"Unsupported check name: "
+
checkName
);
throw
new
IllegalArgumentException
(
"Unsupported check name: "
+
checkName
);
}
}
private
static
BvhPerformanceTestSupport
.
Measurement
fastest
(
List
<
BvhPerformanceTestSupport
.
Measurement
>
measurements
)
{
BvhPerformanceTestSupport
.
Measurement
fastest
=
measurements
.
get
(
0
);
for
(
BvhPerformanceTestSupport
.
Measurement
measurement
:
measurements
)
{
if
(
measurement
.
averageNanos
<
fastest
.
averageNanos
)
{
fastest
=
measurement
;
}
}
return
fastest
;
}
private
static
BvhPerformanceTestSupport
.
Measurement
fastestBvh
(
private
static
BvhPerformanceTestSupport
.
Measurement
fastestBvh
(
List
<
BvhPerformanceTestSupport
.
Measurement
>
measurements
)
{
List
<
BvhPerformanceTestSupport
.
Measurement
>
measurements
)
{
BvhPerformanceTestSupport
.
Measurement
fastest
=
null
;
BvhPerformanceTestSupport
.
Measurement
fastest
=
null
;
for
(
BvhPerformanceTestSupport
.
Measurement
measurement
:
measurements
)
{
for
(
BvhPerformanceTestSupport
.
Measurement
measurement
:
measurements
)
{
if
(
"BRUTE_FORCE"
.
equals
(
measurement
.
variant
)
||
NestedRingsCheck
.
Variant
.
OLD
.
name
().
equals
(
measurement
.
variant
)
||
RingSelfIntCheck
.
Variant
.
OLD
.
name
().
equals
(
measurement
.
variant
))
{
continue
;
}
if
(
fastest
==
null
||
measurement
.
averageNanos
<
fastest
.
averageNanos
)
{
if
(
fastest
==
null
||
measurement
.
averageNanos
<
fastest
.
averageNanos
)
{
fastest
=
measurement
;
fastest
=
measurement
;
}
}
...
@@ -230,18 +206,13 @@ public final class BvhHeuristicTimingSupport {
...
@@ -230,18 +206,13 @@ public final class BvhHeuristicTimingSupport {
List
<
BvhPerformanceTestSupport
.
Measurement
>
measurements
,
List
<
BvhPerformanceTestSupport
.
Measurement
>
measurements
,
String
prediction
)
{
String
prediction
)
{
for
(
BvhPerformanceTestSupport
.
Measurement
measurement
:
measurements
)
{
for
(
BvhPerformanceTestSupport
.
Measurement
measurement
:
measurements
)
{
if
(
measurement
.
variant
.
equals
(
prediction
)
if
(
measurement
.
variant
.
equals
(
prediction
))
{
||
(
"OLD"
.
equals
(
prediction
)
&&
"BRUTE_FORCE"
.
equals
(
measurement
.
variant
)))
{
return
measurement
;
return
measurement
;
}
}
}
}
return
null
;
return
null
;
}
}
public
interface
MeasuredOperation
{
int
run
();
}
/**
/**
* Operation that can be executed with each concrete BVH split strategy.
* Operation that can be executed with each concrete BVH split strategy.
*/
*/
...
@@ -259,9 +230,7 @@ public final class BvhHeuristicTimingSupport {
...
@@ -259,9 +230,7 @@ public final class BvhHeuristicTimingSupport {
public
static
final
class
Observation
{
public
static
final
class
Observation
{
public
final
String
checkName
;
public
final
String
checkName
;
public
final
BvhInputMetricsCollector
.
Metrics
metrics
;
public
final
BvhInputMetricsCollector
.
Metrics
metrics
;
public
final
BvhPerformanceTestSupport
.
Measurement
fastest
;
public
final
BvhPerformanceTestSupport
.
Measurement
fastestBvh
;
public
final
BvhPerformanceTestSupport
.
Measurement
fastestBvh
;
public
final
BvhPerformanceTestSupport
.
Measurement
baseline
;
public
final
BvhPerformanceTestSupport
.
Measurement
currentPolicyMeasurement
;
public
final
BvhPerformanceTestSupport
.
Measurement
currentPolicyMeasurement
;
public
final
BvhPerformanceTestSupport
.
Measurement
candidateRuleMeasurement
;
public
final
BvhPerformanceTestSupport
.
Measurement
candidateRuleMeasurement
;
public
final
String
currentPolicyPrediction
;
public
final
String
currentPolicyPrediction
;
...
@@ -270,18 +239,14 @@ public final class BvhHeuristicTimingSupport {
...
@@ -270,18 +239,14 @@ public final class BvhHeuristicTimingSupport {
Observation
(
Observation
(
String
checkName
,
String
checkName
,
BvhInputMetricsCollector
.
Metrics
metrics
,
BvhInputMetricsCollector
.
Metrics
metrics
,
BvhPerformanceTestSupport
.
Measurement
fastest
,
BvhPerformanceTestSupport
.
Measurement
fastestBvh
,
BvhPerformanceTestSupport
.
Measurement
fastestBvh
,
BvhPerformanceTestSupport
.
Measurement
baseline
,
String
currentPolicyPrediction
,
String
currentPolicyPrediction
,
String
candidateRulePrediction
,
String
candidateRulePrediction
,
BvhPerformanceTestSupport
.
Measurement
currentPolicyMeasurement
,
BvhPerformanceTestSupport
.
Measurement
currentPolicyMeasurement
,
BvhPerformanceTestSupport
.
Measurement
candidateRuleMeasurement
)
{
BvhPerformanceTestSupport
.
Measurement
candidateRuleMeasurement
)
{
this
.
checkName
=
checkName
;
this
.
checkName
=
checkName
;
this
.
metrics
=
metrics
;
this
.
metrics
=
metrics
;
this
.
fastest
=
fastest
;
this
.
fastestBvh
=
fastestBvh
;
this
.
fastestBvh
=
fastestBvh
;
this
.
baseline
=
baseline
;
this
.
currentPolicyPrediction
=
currentPolicyPrediction
;
this
.
currentPolicyPrediction
=
currentPolicyPrediction
;
this
.
candidateRulePrediction
=
candidateRulePrediction
;
this
.
candidateRulePrediction
=
candidateRulePrediction
;
this
.
currentPolicyMeasurement
=
currentPolicyMeasurement
;
this
.
currentPolicyMeasurement
=
currentPolicyMeasurement
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment