change candidate_cost from list to vector, so that it can be made into a heap to avoid sorting