Automated optimal design techniques for inverse electromagnetic problems