code: def optimize(
      parameters: List[TParameterRepresentation],
      evaluation_function: TEvaluationFunction,
      experiment_name: Optional[str] = None,
      objective_name: Optional[str] = None,
      minimize: bool = False,
      parameter_constraints: Optional[List[str]] = None,
      outcome_constraints: Optional[List[str]] = None,
      total_trials: int = 20,
      arms_per_trial: int = 1,
      random_seed: Optional[int] = None,
      generation_strategy: Optional[GenerationStrategy] = None,
  ) -> Tuple[
      TParameterization,
      Optional[TModelPredictArm],
      Experiment,
      Optional[ModelBridge],
  ]:
      """Construct and run a full optimization loop."""
      loop = OptimizationLoop.with_evaluation_function(
          parameters=parameters,
          objective_name=objective_name,
          evaluation_function=evaluation_function,
          experiment_name=experiment_name,
          minimize=minimize,
          parameter_constraints=parameter_constraints,
          outcome_constraints=outcome_constraints,
          total_trials=total_trials,
          arms_per_trial=arms_per_trial,
          random_seed=random_seed,
          generation_strategy=generation_strategy,
      )
      loop.full_run()
      parameterization, values = loop.get_best_point()
      return (
          parameterization,
          values,
          loop.experiment,
          loop.get_current_model(),
      )
  
imports: from __future__ import annotations
  import inspect
  import logging
  from typing import Iterable, List, Optional, Tuple
  from ax.core.arm import Arm
  from ax.core.base_trial import BaseTrial
  from ax.core.batch_trial import BatchTrial
  from ax.core.experiment import Experiment
  from ax.core.formatting_utils import data_and_evaluations_from_raw_data
  from ax.core.trial import Trial
  from ax.core.types import TEvaluationFunction, TEvaluationOutcome, TModelPredictArm, TParameterization
  from ax.core.utils import get_pending_observation_features
  from ax.exceptions.constants import CHOLESKY_ERROR_ANNOTATION
  from ax.exceptions.core import SearchSpaceExhausted, UserInputError
  from ax.modelbridge.base import ModelBridge
  from ax.modelbridge.dispatch_utils import choose_generation_strategy
  from ax.modelbridge.generation_strategy import GenerationStrategy
  from ax.modelbridge.registry import Models
  from ax.service.utils.best_point import get_best_parameters_from_model_predictions, get_best_raw_objective_point
  from ax.service.utils.instantiation import InstantiationBase, TParameterRepresentation
  from ax.utils.common.executils import retry_on_exception
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import not_none
label_desc: Use image node_id 1 for calling a global function with example usage: optimize(parameters, evaluation_function, experiment_name, objective_name, minimize, parameter_constraints, outcome_constraints, total_trials, arms_per_trial, random_seed, generation_strategy) and returns: parameterization,  values,  loop,  loop