Library of matching and ordering algorithms, used for "reference problem"