Optimization of multilevel optical networks