Optimal routing for protection and restoration in an optical network