- commit
- 6a53e4d
- parent
- 3b3f369
- author
- Eric Bower
- date
- 2024-12-28 21:41:57 -0500 EST
chore: rm deprecated hungarian algo
1 files changed,
+0,
-73
+0,
-73
1@@ -294,76 +294,3 @@ func getCorrespondences(a []*PatchRange, b []*PatchRange, creationFactor int) {
2 }
3 }
4 }
5-
6-// computeAssignment assigns patches using the Hungarian algorithm.
7-/* func computeAssignment(costMatrix [][]int, m, n int) []int {
8- u := make([]int, m+1) // potential for workers
9- v := make([]int, n+1) // potential for jobs
10- p := make([]int, n+1) // job assignment
11- way := make([]int, n+1)
12-
13- for i := 1; i <= m; i++ {
14- links := make([]int, n+1)
15- minV := make([]int, n+1)
16- used := make([]bool, n+1)
17- for j := 0; j <= n; j++ {
18- minV[j] = math.MaxInt32
19- used[j] = false
20- }
21-
22- j0 := 0
23- p[0] = i
24-
25- for {
26- used[j0] = true
27- i0 := p[j0]
28- delta := math.MaxInt32
29- j1 := 0
30-
31- for j := 1; j <= n; j++ {
32- if !used[j] {
33- cur := costMatrix[i0-1][j-1] - u[i0] - v[j]
34- if cur < minV[j] {
35- minV[j] = cur
36- links[j] = j0
37- }
38- if minV[j] < delta {
39- delta = minV[j]
40- j1 = j
41- }
42- }
43- }
44-
45- for j := 0; j <= n; j++ {
46- if used[j] {
47- u[p[j]] += delta
48- v[j] -= delta
49- } else {
50- minV[j] -= delta
51- }
52- }
53-
54- j0 = j1
55- if p[j0] == 0 {
56- break
57- }
58- }
59-
60- for {
61- j1 := way[j0]
62- p[j0] = p[j1]
63- j0 = j1
64- if j0 == 0 {
65- break
66- }
67- }
68- }
69-
70- assignment := make([]int, m)
71- for j := 1; j <= n; j++ {
72- if p[j] > 0 {
73- assignment[p[j]-1] = j - 1
74- }
75- }
76- return assignment
77-} */