input: Write a function to optimize the given objective function using the `scipy.optimize.minimize` method. The function should initialize the optimization problem, perform the optimization using the Nelder-Mead method with specified tolerances, and return the optimized values of the variables.
  
  assert list(optimize())==[0.0, 0.0, 0.0]
  assert list(optimize())==[1.0, 1.0, 1.0]
  assert list(optimize())==[-0.5, 0.5, -0.5]
output: def optimize():
      from scipy.optimize import minimize
      def objective(x):
          return x[0]**2 + x[1]**2 + x[2]**2
      initial_guess = [1.0, 1.0, 1.0]
      result = minimize(objective, initial_guess, method='Nelder-Mead', tol=1e-6)
      return result.x