update docs and perf metrics
This commit is contained in:
parent
1849075b11
commit
725980e694
1 changed files with 1183 additions and 525 deletions
|
|
@ -37,6 +37,7 @@ class RoutingWorld:
|
|||
"clearance",
|
||||
"safety_zone_radius",
|
||||
"grid_cell_size",
|
||||
"metrics",
|
||||
"_dynamic_paths",
|
||||
"_static_obstacles",
|
||||
)
|
||||
|
|
@ -50,6 +51,7 @@ class RoutingWorld:
|
|||
self.safety_zone_radius = safety_zone_radius
|
||||
|
||||
self.grid_cell_size = 50.0
|
||||
self.metrics = None
|
||||
self._static_obstacles = StaticObstacleIndex(self)
|
||||
self._dynamic_paths = DynamicPathIndex(self)
|
||||
|
||||
|
|
@ -265,6 +267,8 @@ class RoutingWorld:
|
|||
|
||||
found_real = False
|
||||
for index in range(len(sub_tree_indices)):
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_congestion_exact_pair_checks += 1
|
||||
test_geometry = geometries_to_test[sub_res_indices[index]]
|
||||
tree_geometry = tree_geometries[sub_tree_indices[index]]
|
||||
if not test_geometry.touches(tree_geometry) and test_geometry.intersection(tree_geometry).area > 1e-7:
|
||||
|
|
@ -277,6 +281,8 @@ class RoutingWorld:
|
|||
return real_hits_count
|
||||
|
||||
def check_move_congestion(self, result: ComponentResult, net_id: str) -> int:
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_congestion_check_calls += 1
|
||||
dynamic_paths = self._dynamic_paths
|
||||
if not dynamic_paths.geometries:
|
||||
return 0
|
||||
|
|
@ -316,6 +322,8 @@ class RoutingWorld:
|
|||
return self._check_real_congestion(result, net_id)
|
||||
|
||||
def verify_path_report(self, net_id: str, components: Sequence[ComponentResult]) -> RoutingReport:
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_verify_path_report_calls += 1
|
||||
static_collision_count = 0
|
||||
dynamic_collision_count = 0
|
||||
self_collision_count = 0
|
||||
|
|
@ -329,6 +337,8 @@ class RoutingWorld:
|
|||
raw_geometries = static_obstacles.raw_tree.geometries
|
||||
for component in components:
|
||||
for polygon in component.physical_geometry:
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_verify_static_buffer_ops += 1
|
||||
buffered = polygon.buffer(self.clearance, join_style="mitre")
|
||||
hits = static_obstacles.raw_tree.query(buffered, predicate="intersects")
|
||||
for hit_idx in hits:
|
||||
|
|
@ -355,6 +365,8 @@ class RoutingWorld:
|
|||
if hit_net_ids[index] == str(net_id):
|
||||
continue
|
||||
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_verify_dynamic_exact_pair_checks += 1
|
||||
new_geometry = test_geometries[res_indices[index]]
|
||||
tree_geometry = tree_geometries[tree_indices[index]]
|
||||
if not new_geometry.touches(tree_geometry) and new_geometry.intersection(tree_geometry).area > 1e-7:
|
||||
|
|
@ -382,6 +394,8 @@ class RoutingWorld:
|
|||
max_dist: float = 2000.0,
|
||||
net_width: float | None = None,
|
||||
) -> float:
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_ray_cast_calls += 1
|
||||
static_obstacles = self._static_obstacles
|
||||
tree: STRtree | None
|
||||
is_rect_array: numpy.ndarray | None
|
||||
|
|
@ -410,6 +424,8 @@ class RoutingWorld:
|
|||
candidates = tree.query(box(min_x, min_y, max_x, max_y))
|
||||
if candidates.size == 0:
|
||||
return max_dist
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_ray_cast_candidate_bounds += int(candidates.size)
|
||||
|
||||
min_dist = max_dist
|
||||
inv_dx = 1.0 / dx if abs(dx) > 1e-12 else 1e30
|
||||
|
|
@ -457,6 +473,8 @@ class RoutingWorld:
|
|||
ray_line = LineString([(origin.x, origin.y), (origin.x + dx, origin.y + dy)])
|
||||
|
||||
obstacle = tree_geometries[candidate_id]
|
||||
if self.metrics is not None:
|
||||
self.metrics.total_ray_cast_exact_geometry_checks += 1
|
||||
if not obstacle.intersects(ray_line):
|
||||
continue
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue