Optimal design of multiphase composites under elastodynamic loading