A Java library for solving the Assignment Problem using cost minimization or productivity maximization.
The Assignment Solver is a Java library that solves the Assignment Problem efficiently using the Hungarian Algorithm. It supports both:
✔ Cost minimization (e.g., minimizing task assignment costs).
✔ Productivity maximization (e.g., maximizing worker efficiency).
Under construction.
Under construction.
- Download the latest JAR from Releases.
- Add it to your classpath.
import me.rivon0507.or.assignmentproblem.AssignmentSolver;
public class Main {
public static void main(String[] args) {
AssignmentSolver solver = new AssignmentSolver();
int[][] costMatrix = {{9, 2, 7}, {6, 4, 3}, {5, 8, 1}};
solver.configure(costMatrix, AssignmentSolver.OptimizationType.MINIMIZE);
solver.solve();
if (solver.isSolved()) {
int[] optimalAssignment = solver.getSolution();
for (int i = 0; i < optimalAssignment.length; i++) {
System.out.printf("Employee %d is assigned to task %d%n", i, optimalAssignment[i]);
} System.out.println("Optimal value: " + solver.getOptimalValue());
}
}
}
✔ Supports both cost minimization & productivity maximization
✔ Works with square cost matrices
✔ Simple, intuitive API
This project is licensed under the MIT License. See LICENSE for details.
- Fork the repository
- Create a new branch (
git checkout -b feat/feature-name
) - Commit changes (
git commit -m "Add new feature"
) - Push to your branch (
git push origin feat/feature-name
) - Open a pull request
Developed by rivon0507.