On The Optimal Design Of Photonic Structures