Implementation of the highest response ratio algorithm