Fil / lap-jv

Linear Assignment Problem — A Javascript implementation of R. Jonker and A. Volgenant’s algorithm (LAPJV)
31 stars 6 forks source link

Does not actually calculate the best assignment. #2

Closed MinisculeGirraffe closed 1 year ago

MinisculeGirraffe commented 1 year ago

I was using this as a reference as I was working on a Rust implementation accessible in JS via FFI. However when comparing values it appears this implementation doesn't actually follow the paper and computes a sub-optimal assignment.

I randomly generated a 5000x5000 cost matrix, exported it to JSON, and then timed each implementation against solving the same matrix.

Pure Rust: Calculated in 3.64231825s Total Cost: 11,216.864157676053

Rust via super inefficient NodeJS FFI : Calculated in 10.239015541911126s Total Cost: 11,216.864157676053

This Script: Calculated in 612.758542060852ms Total cost: 30,898.483242653267

The cost is almost 3x as high and the runtime is almost 3 seconds faster than a native compiled language. I haven't dug super deep into the code, but it appears that this isn't a correct implementation of the algorithm.

Fil commented 1 year ago

??