add greedy_k_portal function