I've got a problem:
I have a class A and a class B, whose instance objects can be inspected programatically to be similar or different from one another in varying amounts. For instance they may match perfectly, or be quite different (even though the classes are different, they can still represent the same information and be scored identical.)
Now, given two collections, one of A, and one of B, what would be the best way to pair up the As and Bs in such a way that they are best-matched leaving some orphans if either collection is larger than the other or if some of the As or Bs are simply too different to be matched?
My first attempt was to create a 2-dimensional array, where each cell was the "score" of the match (0 = perfect, with larger numbers being worse) and recursing through every path looking for the lowest accumulated score. This works and the results are perfect, but it is hideously slow.
Any ideas on more efficient algorithms?
In case you are wondering, my A class represents an audio mixer input channel, and my B represents the persisted state of the same (called a scene). The problem I'm trying to solve is how to import a scene into an existing mixer, where the scene (B) might be slightly or even highly different from any of the existing channels (A). I don't want to just add channels (A) if I could slightly modify either to match. For instance, I might could add an effect insert to the A in order to match perfectly with the B and avoid having to add another A.
Mike