tune examples for faster completion
This commit is contained in:
parent
de7254f8f5
commit
bc4184693d
12 changed files with 35 additions and 34 deletions
|
|
@ -64,23 +64,24 @@ def main() -> None:
|
|||
overlap_matrix = {} # (net_a, net_b) -> count
|
||||
|
||||
for nid, res in current_results.items():
|
||||
if res.path:
|
||||
for comp in res.path:
|
||||
for poly in comp.geometry:
|
||||
# Check what it overlaps with
|
||||
overlaps = engine.dynamic_index.intersection(poly.bounds)
|
||||
for other_obj_id in overlaps:
|
||||
other_nid, other_poly = engine.dynamic_geometries[other_obj_id]
|
||||
if other_nid != nid:
|
||||
if poly.intersects(other_poly):
|
||||
# Record hotspot
|
||||
cx, cy = poly.centroid.x, poly.centroid.y
|
||||
grid_key = (int(cx/20)*20, int(cy/20)*20)
|
||||
hotspots[grid_key] = hotspots.get(grid_key, 0) + 1
|
||||
if not res.path:
|
||||
continue
|
||||
for comp in res.path:
|
||||
for poly in comp.geometry:
|
||||
# Check what it overlaps with
|
||||
overlaps = engine.dynamic_index.intersection(poly.bounds)
|
||||
for other_obj_id in overlaps:
|
||||
other_nid, other_poly = engine.dynamic_geometries[other_obj_id]
|
||||
if other_nid != nid:
|
||||
if poly.intersects(other_poly):
|
||||
# Record hotspot
|
||||
cx, cy = poly.centroid.x, poly.centroid.y
|
||||
grid_key = (int(cx/20)*20, int(cy/20)*20)
|
||||
hotspots[grid_key] = hotspots.get(grid_key, 0) + 1
|
||||
|
||||
# Record pair
|
||||
pair = tuple(sorted((nid, other_nid)))
|
||||
overlap_matrix[pair] = overlap_matrix.get(pair, 0) + 1
|
||||
# Record pair
|
||||
pair = tuple(sorted((nid, other_nid)))
|
||||
overlap_matrix[pair] = overlap_matrix.get(pair, 0) + 1
|
||||
|
||||
print(f" Iteration {idx} finished. Successes: {successes}/{len(netlist)}, Collisions: {total_collisions}")
|
||||
if overlap_matrix:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue