Optimal design of micromechatronic systems