HungarianAlgorithm class

Implements the Hungarian Algorithm (Kuhn-Munkres algorithm) to find the minimum cost assignment in a bipartite graph.

The algorithm finds a perfect matching with the minimum total cost. It works by converting the cost matrix to a profit matrix (multiplying by -1), then finding a maximum weight perfect matching.

Constructors

HungarianAlgorithm(List<List<int>> costMatrix)
Constructor for the HungarianAlgorithm. Takes the original cost matrix as input. Note: The input costMatrix here is expected to be actual costs (positive values). The algorithm internally converts it to a profit matrix.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getAssignment() List<int>
Main method to compute the minimum cost assignment. Returns the matching as a list of assigned tasks for each agent (_xy). The total cost is not returned here, as this function is for assignment.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited