Repeat optimisation until nothing change.