evenfurther / pathfinding

Pathfinding library for rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about kuhn-munkres / assignment problem

Boscop opened this issue · comments

Hi, thanks for making this crate :)
Do you know any crate that works like kuhn_munkres but works for assigning multiple columns to one row?
(If there are a different number of rows and columns.)

I have an unbalanced Assignment Problem and which is also modified to allow one "destination" to be assigned to multiple "sources". There are also limits, it's not the case that it can be reduced to a balanced assignment problem and then leftover sources are assigned to their best-matching destination:
In my use case (a hobby project) I want to do midi channel routing between up to N source channels (which each have an assigned GM instrument and a certain ADSR envelope and a certain maximum concurrent voices (their effective polyphony)) and M (often <=N but can be larger, too) destination channels (synthesizers), that each have a max polyphony limit and also a ADSR envelope and there is a certain compatibility score for each pairing of the possible 128 midi instruments and each of the synthesizers (because not every synth can play the timbre of every instrument).
Without the polyphony limit, I could just treat it as an assignment problem (calculating the score of each pairing by only taking into account instrument and envelope compatibility) and use this crate to solve it, and then assign leftover source channels to their best-matching destination channel.
But with the polyphony limit, considering each pair score in isolation is not valid, because the polyphony of a destination is used up by all sources, so they are competing in a knapsack-like way.
This means that the global configuration has to be considered/scored as a whole.
Not sure what kind of name this problem has, or which algorithm would be best.
N and M are both up to 16, and it's important to find the best matching in the shortest time possible.
Do you know which algorithm/approach (or existing crate) is most suitable for this? :)

Sorry for the absence of answer, but I know of no such algorithm that could be used out of the box. I'd be interested in the solution you chose though.

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.