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
12
13
14
15
16
17
use kap::{Algo, MatrixView, Options, k_assignment};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let c01 = [4, 12, 15, 18, 20, 15, 2, 21, 28i64];
    let c02 = [19, 25, 26, 18, 18, 4, 16, 23, 23i64];
    let c12 = [24, 7, 24, 4, 11, 3, 11, 14, 2i64];
    let costs = [
        MatrixView::from_row_major(&c01, 3, 3)?,
        MatrixView::from_row_major(&c02, 3, 3)?,
        MatrixView::from_row_major(&c12, 3, 3)?,
    ];
    let result = k_assignment(&costs, Algo::Bm, &Options::default())?;
    println!("cliques = {:?}", result.cliques);
    println!("costs = {:?}", result.costs);
    println!("free = {:?}", result.free);
    Ok(())
}