Greedy optimization of the geometry of Majorana Josephson junctions