Optimally designed microstructures of electromagnetic materials via inverse homogenization