HungarianSolver: Hungarian Algorithm Solver

Description Usage Arguments Details Value Examples

View source: R/RcppExports.R

Description

Solves weighted bipartite matching problems (e.g., optimal matching of people to cars or optimal matching of students to colleges, etc...)

Usage

1
HungarianSolver(costMatrix)

Arguments

costMatrix

matrix giving cost of each possible pairing - can be rectangular

Details

this is a copy/wrapper for the code developed by Cong Ma and made available as a github repository (mcximing/hungarian-algorithm-cpp). Code was changed to a header only file for use in other Rcpp packages.

Value

List with cost and parings, pairings are given as an Nx2 matrix giving edges that are matched (1-indexed rather than 0-indexed as it will be returned to R)

Examples

1
2
3
4
5
cost <- rbind(c(1, 2, 0), 
              c(2, 0, 1), 
              c(1, 4, 19))
soln <- HungarianSolver(cost)
soln                

RcppHungarian documentation built on Aug. 2, 2019, 9:05 a.m.