class_docstr: Class for an objective composed of a linear scalarization of metrics.
  
  Attributes:
      metrics: List of metrics.
      weights: Weights for scalarization; default to 1.
class_docstr_tok: ["Class","for","an","objective","composed","of","a","linear","scalarization","of","metrics",".","Attributes",":","metrics",":","List","of","metrics",".","weights",":","Weights","for","scalarization",";","default","to","1","."]
docstr: Create a new objective.
  
  Args:
      metric: The metric to be optimized.
      weights: The weights for the linear combination of metrics.
      minimize: If true, minimize the linear combination.
docstr_tok: ["Create","a","new","objective",".","Args",":","metric",":","The","metric","to","be","optimized",".","weights",":","The","weights","for","the","linear","combination","of","metrics",".","minimize",":","If","true",",","minimize","the","linear","combination","."]
code: def __init__(
      self,
      metrics: List[Metric],
      weights: Optional[List[float]] = None,
      minimize: bool = False,
  ) -> None:
      """Create a new objective.
  
      Args:
          metric: The metric to be optimized.
          weights: The weights for the linear combination of metrics.
          minimize: If true, minimize the linear combination.
  
      """
      if weights is None:
          weights = [1.0 for i in range(len(metrics))]
      else:
          if len(weights) != len(metrics):
              raise ValueError(
                  "Length of weights must equal length of metrics"
              )
  
      # Check if the optimization direction is consistent with
      # `lower_is_better` (if specified).
      for m, w in zip(metrics, weights):
          is_minimized = minimize if w > 0 else not minimize
          if (
              m.lower_is_better is not None
              and is_minimized != m.lower_is_better
          ):
              raise ValueError(
                  f"Metric with name {m.name} specifies `lower_is_better` = "
                  f"{m.lower_is_better}, which doesn't match the specified "
                  "optimization direction. You most likely want to flip the sign of "
                  "the corresponding metric weight."
              )
  
      self._metrics = metrics
      self.weights = weights
      self.minimize = minimize
  
imports: from __future__ import annotations
  import warnings
  from logging import Logger
  from typing import Any, Iterable, List, Optional, Tuple
  from ax.core.metric import Metric
  from ax.utils.common.base import SortableBase
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import not_none
label_desc: Use image node_id 1 to create a new ScalarizedObjective object from inherited base classes: Objective with example: obj = ScalarizedObjective(metrics, weights, minimize)