Skip to main content
1 of 2
Pete
  • 617
  • 5
  • 13

pairing algorithm in R

I have two sets of elements M and N, and a scalar-valued distance/similarity function between one element from M and one from N. The problem is to generate a set of pairs (one item from M and one from N) which minimizes the sum of the distance function.

Caveats

  • Using an existing package in R would be ideal
  • M and/or N may contain "extra" elements that don't have a partner; therefore M and N may be of unequal length
  • We have a starting configuration which is reasonably close

My first thought in addressing this is a monte carlo or genetic algorithm. So perhaps as a solution someone could show how to use an R genetic algorithm package for this problem.

Also see this unanswered question.

Pete
  • 617
  • 5
  • 13