1. A motion-control system for moving a mass according to different tasks, comprising: a processor; a memory coupled to the processor and storing program instructions executable by the processor: a controller in communication the processor and at least one controllable actuator, wherein the at least one controllable actuator performs the different tasks; an input module in communication with the controller, for receiving a specific task to perform, such that a performance of the specific task is controlled by the controller; a tunable actuator having a tunable parameter of mechanical response, wherein the tunable actuator is mechanically arranged in the system, such that different values of the tunable parameter change dynamics of the system; and an optimization module for jointly selecting a value of the tunable parameter from a set of tunable parameters, and a specific control action from a set of control actions, based on optimizing the performance of the specific task, such that optimizing the performance of the specific task optimizes the performance of the controllable actuator controlling the movement of the mass, wherein the optimization module selects an optimal pair of the value of the tunable parameter and the specific control action based on transforming non-convex constraints into convex constraints.