Skip to content

Commit

Permalink
fix: point_covered stats for rtree
Browse files Browse the repository at this point in the history
  • Loading branch information
TurtIeSocks committed Oct 21, 2023
1 parent c4f131a commit 0e3cd76
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions server/algorithms/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ impl Stats {

pub fn distance_stats(&mut self, points: &SingleVec) {
self.start_timer();
log::info!("generating distance stats for {} points", points.len());
self.total_distance = 0.;
self.longest_distance = 0.;
for (i, point) in points.iter().enumerate() {
Expand All @@ -144,6 +145,10 @@ impl Stats {
self.longest_distance = distance;
}
}
log::info!(
"distance stats complete {:.4}s",
self.stats_start_time.unwrap().elapsed().as_secs_f32()
);
self.stop_timer();
}

Expand Down Expand Up @@ -171,7 +176,6 @@ impl Stats {

pub fn cluster_stats(&mut self, radius: f64, points: &SingleVec, clusters: &SingleVec) {
self.start_timer();
let time = Instant::now();
log::info!("starting coverage check for {} points", points.len());
self.total_points = points.len();

Expand Down Expand Up @@ -199,16 +203,26 @@ impl Stats {
} else if cluster.all.len() == best {
best_clusters.push(cluster.point.center);
}
if tree.contains(cluster.point) {
points_covered.insert(&cluster.point);
}
points_covered.extend(&cluster.all);
}
self.total_clusters = clusters.len();
self.best_cluster_point_count = best;
self.best_clusters = best_clusters;
self.points_covered = points_covered.len();

if self.points_covered > self.total_points {
log::warn!(
"points covered ({}) is greater than total points ({}), please report this to the developers",
self.points_covered,
self.total_points
);
}
log::info!(
"coverage check complete in {}s",
time.elapsed().as_secs_f32()
"coverage check complete in {:.4}s",
self.stats_start_time.unwrap().elapsed().as_secs_f32()
);
self.stop_timer();
}
Expand Down

0 comments on commit 0e3cd76

Please sign in to comment.