Mechanical metamaterials actuators achieve pre-determined input--output operations exploiting architectural features encoded within a single 3D printed element, thus removing the need of assembling different structural components. Despite the rapid progress in the field, there is still a need for efficient strategies to optimize metamaterial design for a variety of functions. We present a computational method for the automatic design of mechanical metamaterial actuators that combines a reinforced Monte Carlo method with discrete element simulations. 3D printing of selected mechanical metamaterial actuators shows that the machine-generated structures can reach high efficiency, exceeding human-designed structures. We also show that it is possible to design efficient actuators by training a deep neural network, eliminating the need for lengthy mechanical simulations. The elementary actuators devised here can be combined to produce metamaterial machines of arbitrary complexity for countless engineering applications.