@InterfaceAudience.Private public class MunkresAssignment extends Object
Modifier and Type | Field and Description |
---|---|
private int[] |
assignments |
private float[] |
colAdjust |
private int |
cols |
private boolean[] |
colsCovered |
private float[][] |
cost |
private float[] |
leastInRow |
private int[] |
leastInRowIndex |
private byte[][] |
mask |
private static byte |
NONE |
private Deque<Pair<Integer,Integer>> |
path |
private static byte |
PRIME |
private float[] |
rowAdjust |
private int |
rows |
private boolean[] |
rowsCovered |
private static byte |
STAR |
private boolean |
transposed |
Constructor and Description |
---|
MunkresAssignment(float[][] costMatrix)
Construct a new problem instance with the specified cost matrix.
|
Modifier and Type | Method and Description |
---|---|
private Pair<Integer,Integer> |
findUncoveredZero()
Find a zero cost assignment which is not covered.
|
private void |
preliminaries()
Corresponds to the "preliminaries" step of the original algorithm.
|
private Pair<Integer,Integer> |
primeInRow(int r)
Find a primed zero in the specified row.
|
int[] |
solve()
Get the optimal assignments.
|
private Pair<Integer,Integer> |
starInCol(int c)
Find a starred zero in the specified column.
|
private Pair<Integer,Integer> |
starInRow(int r)
Find a starred zero in a specified row.
|
private boolean |
stepOne()
Corresponds to step 1 of the original algorithm.
|
private void |
stepThree()
Corresponds to step 3 of the original algorithm.
|
private void |
stepTwo()
Corresponds to step 2 of the original algorithm.
|
private boolean |
testIsDone()
Test whether the algorithm is done, i.e.
|
private void |
updateMin(int row,
int col)
A specified row has become covered, and a specified column has become
uncovered.
|
private static final byte NONE
private static final byte STAR
private static final byte PRIME
private final boolean transposed
private final int rows
private final int cols
private float[][] cost
private byte[][] mask
private boolean[] rowsCovered
private boolean[] colsCovered
private int[] assignments
private float[] leastInRow
private int[] leastInRowIndex
private float[] rowAdjust
private float[] colAdjust
public MunkresAssignment(float[][] costMatrix)
costMatrix
- public int[] solve()
private void preliminaries()
private boolean testIsDone()
private boolean stepOne()
private void stepTwo()
private void stepThree()
private Pair<Integer,Integer> findUncoveredZero()
private void updateMin(int row, int col)
row
- the index of the row which was just coveredcol
- the index of the column which was just uncoveredprivate Pair<Integer,Integer> starInRow(int r)
r
- the index of the row to be searchedprivate Pair<Integer,Integer> starInCol(int c)
c
- the index of the column to be searchedCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.