Skip to content

Comments

Optimization of the OptiSim algorithm (For review)#289

Open
dhruvDev23 wants to merge 1 commit intotheochem:mainfrom
dhruvDev23:intial_optimization_OptiSim
Open

Optimization of the OptiSim algorithm (For review)#289
dhruvDev23 wants to merge 1 commit intotheochem:mainfrom
dhruvDev23:intial_optimization_OptiSim

Conversation

@dhruvDev23
Copy link
Contributor

This PR optimizes the algorithm() method of OptiSim class in the file selector/methods/distance.py.

Original Implementation

  • In the Original implementation, a kd-tree was rebuild from all selected points on every iteration of the selection loop.
  • For a Selection of k candidates, the kd-tree was being rebuilt k times, making the operation expensive as more points are selected.

After Optimization

  • Removed the kd-tree rebuilt from the loop.
  • Implemented a min_dists array that stores the minimum distances between each point and nearest selected point.
  • Then Select and append the candidate farthest from its nearest selected point using min_dists array.
  • Then update the min_dists array after selection of the new candidate.

All Test Cases Passed

Analysis of different input data shapes

Before Optimization
Screenshot 2026-02-18 at 7 09 25 PM

After Optimization
Screenshot 2026-02-18 at 7 10 51 PM

@dhruvDev23 dhruvDev23 force-pushed the intial_optimization_OptiSim branch from ea6063b to e41516f Compare February 18, 2026 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant