Commit a799e5d
authored
Faster Bi-Objective Non-Dominated Sorting with O(N log N) Complexity (#754)
This PR introduces a faster non-dominated sorting algorithm that leverages geometric properties to reduce complexity from O(N^2) to O(N log N), resulting in up to 60.92x faster performance for bi-objective problems.
Before (O(N^2) for all cases):
```python
# Original algorithm for all objective counts
for i in range(n):
for j in range(i + 1, n):
rel = M[i, j] # Full dominance matrix calculation
if rel == 1:
is_dominating[i].append(j)
n_dominated[j] += 1
elif rel == -1:
is_dominating[j].append(i)
n_dominated[i] += 1
```
After (O(N log N) for bi-objective, O(N^2) for others):
```python
# Specialized algorithm for bi-objective problems
if n_objectives == 2:
return _fast_biobjective_nondominated_sort(F) # O(N log N) algorithm
else:
# Fall back to optimized original approach for multi-objective
```
📊 Performance Results
| Size | Original (s) | Evolved (s) | Speedup |
|------|--------------|-------------|---------|
| 50 | 0.000328 | 0.000036 | 9.00x |
| 100 | 0.001024 | 0.000078 | 13.18x |
| 500 | 0.034089 | 0.000842 | 40.49x |
| 1000 | 0.104040 | 0.002246 | 46.33x |
| 2000 | 0.278000 | 0.004547 | 60.92x |
|------|--------------|-------------|---------|
Average speedup: 33.98x
Added comprehensive performance test (`test_comparison.py`) that:
- Uses the same interface as the original `pymoo` implementation
- Tests with actual bi-objective optimization scenarios
- Verifies identical results between original and optimized methods
- Demonstrates performance improvements across multiple problem sizes1 parent e216856 commit a799e5d
File tree
2 files changed
+419
-4
lines changed- pymoo
- functions/standard
2 files changed
+419
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
15 | 28 | | |
16 | 29 | | |
17 | 30 | | |
| |||
38 | 51 | | |
39 | 52 | | |
40 | 53 | | |
41 | | - | |
42 | | - | |
| 54 | + | |
43 | 55 | | |
44 | 56 | | |
45 | 57 | | |
| |||
58 | 70 | | |
59 | 71 | | |
60 | 72 | | |
61 | | - | |
62 | 73 | | |
63 | 74 | | |
64 | 75 | | |
65 | 76 | | |
66 | | - | |
67 | 77 | | |
68 | 78 | | |
69 | 79 | | |
| |||
78 | 88 | | |
79 | 89 | | |
80 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
81 | 144 | | |
82 | 145 | | |
83 | 146 | | |
| |||
0 commit comments