Added function to get the objectif closest to the first node