kap-solver 0.3.0

k-assignment (k-partite matching) solvers and a rectangular linear assignment solver
Documentation
1
2
3
4
5
6
7
8
9
10
11
use kap::{MatrixView, Sense, linear_sum_assignment};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let data = [8i64, 2, 7, 6, 6, 9, 3, 5, 4, 7, 8, 1];
    let matrix = MatrixView::from_row_major(&data, 3, 4)?;
    let result = linear_sum_assignment(matrix, Sense::Minimize)?;
    println!("rows = {:?}", result.row_ind);
    println!("columns = {:?}", result.col_ind);
    println!("cost = {}", result.cost);
    Ok(())
}