Optimal task allocation between operator and machine