Automated design of photonic devices