Binary search for shape optimization