Title: | Murty's Algorithm for k-Best Assignments |
Version: | 0.3.1 |
Author: | Aljaz Jelenko [aut, cre] |
Maintainer: | Aljaz Jelenko <aljaz.jelenko@amis.net> |
Description: | Calculates k-best solutions and costs for an assignment problem following the method outlined in Murty (1968) <doi:10.1287/opre.16.3.682>. |
URL: | https://github.com/arg0naut91/muRty |
BugReports: | https://github.com/arg0naut91/muRty/issues |
Depends: | R (≥ 3.1.0) |
Imports: | clue, lpSolve |
Suggests: | testthat |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 7.0.2 |
NeedsCompilation: | no |
Packaged: | 2020-02-29 13:14:19 UTC; Aljaz |
Repository: | CRAN |
Date/Publication: | 2020-02-29 13:40:06 UTC |
Murty's algorithm for k-best assignments
Description
Find k-best assignments for a given matrix (returns both solved matrices and costs).
Usage
get_k_best(
mat,
k_best = NULL,
algo = "hungarian",
by_rank = FALSE,
objective = "min",
proxy_Inf = 10000000L
)
Arguments
mat |
Square matrix (N x N) in which values represent the weights. |
k_best |
How many best scenarios should be returned. If by_rank = TRUE, this equals best ranks. |
algo |
Algorithm to be used, either 'lp' or 'hungarian'; defaults to 'hungarian'. |
by_rank |
Should the solutions with same cost be counted as one and stored in a sublist? Defaults to FALSE. |
objective |
Should the cost be minimized ('min') or maximized ('max')? Defaults to 'min'. |
proxy_Inf |
What should be considered as a proxy for Inf? Defaults to 10e06; if objective = 'max' the sign is automatically reversed. |
Value
A list with solutions and costs (objective values).
Examples
set.seed(1)
mat <- matrix(sample.int(15, 10*10, TRUE), 10, 10)
get_k_best(mat, 3)