Optimal control theory based design of elasto-magnetic metamaterial