Criteria for optimality in movements