Skip to main content

Module assignment

Module assignment 

Source
Expand description

Linear Assignment Problem solvers

The assignment problem finds the optimal one-to-one matching between agents and tasks that minimizes total cost.

§Problem Definition

Given:

  • n agents and m tasks (typically n = m)
  • Cost matrix C where C[i][j] is cost of assigning agent i to task j

Find:

  • Assignment minimizing sum of costs
  • Each agent assigned to exactly one task
  • Each task assigned to at most one agent

§Algorithms

  • hungarian - O(n⁴) Hungarian algorithm, simple and correct
  • auction - O(n³) Auction algorithm, faster for sparse problems

§Example

use converge_optimization::assignment::{solve, AssignmentProblem};

let problem = AssignmentProblem::from_costs(vec![
    vec![10, 5, 13],
    vec![3, 9, 18],
    vec![14, 8, 7],
]);

let solution = solve(&problem).unwrap();
println!("Total cost: {}", solution.total_cost);
for (agent, task) in solution.assignments.iter().enumerate() {
    println!("Agent {} -> Task {}", agent, task);
}

Modules§

auction
Auction Algorithm for the Linear Assignment Problem
hungarian
Hungarian Algorithm for the Linear Assignment Problem

Structs§

AssignmentProblem
An assignment problem instance
AssignmentSolution
Solution to an assignment problem

Traits§

AssignmentSolver
Trait for assignment solvers

Functions§

solve
Solve an assignment problem using the default solver (Hungarian)
solve_with_params
Solve an assignment problem with custom parameters