For given RCN profile r of sample and a grid of purities and ploidies, those pairs for which the tumor ACN profile q fails the non-negativity requirement are removed from the grid
Grid of tumor purities, tumor ploidies is sorted by the associated values of kappas (values of the objective function)
and top k values (i.e., with the smallest kappa) are returned