Top-level LMNN algorithm. Lower-level functions WIP.