class_docstr: This is a lightweight stateless class that bundles together instantiation utils.
  It is used both on its own and as a mixin to AxClient, with the intent that
  these methods can be overridden by its subclasses for specific use cases.
class_docstr_tok: ["This","is","a","lightweight","stateless","class","that","bundles","together","instantiation","utils",".","It","is","used","both","on","its","own","and","as","a","mixin","to","AxClient",",","with","the","intent","that","these","methods","can","be","overridden","by","its","subclasses","for","specific","use","cases","."]
docstr: Parse string representation of an outcome constraint.
docstr_tok: ["Parse","string","representation","of","an","outcome","constraint","."]
code: def outcome_constraint_from_str(
      cls,
      representation: str,
      metric_definitions: Optional[Dict[str, Dict[str, Any]]] = None,
  ) -> OutcomeConstraint:
      """Parse string representation of an outcome constraint."""
      tokens = representation.split()
      assert len(tokens) == 3 and tokens[1] in COMPARISON_OPS, (
          "Outcome constraint should be of form `metric_name >= x`, where x is a "
          "float bound and comparison operator is >= or <=."
      )
      op = COMPARISON_OPS[tokens[1]]
      rel = False
      try:
          bound_repr = tokens[2]
          if bound_repr[-1] == "%":
              rel = True
              bound_repr = bound_repr[:-1]
          bound = float(bound_repr)
      except ValueError:
          raise ValueError(
              "Outcome constraint bound should be a float."
          )
      return OutcomeConstraint(
          cls._make_metric(
              name=tokens[0],
              for_opt_config=True,
              metric_definitions=metric_definitions,
              lower_is_better=op is ComparisonOp.LEQ,
          ),
          op=op,
          bound=bound,
          relative=rel,
      )
  
imports: import enum
  from dataclasses import dataclass
  from logging import Logger
  from typing import Any, Dict, List, Optional, Sequence, Type, Union
  from ax.core.arm import Arm
  from ax.core.experiment import DataType, DEFAULT_OBJECTIVE_NAME, Experiment
  from ax.core.map_metric import MapMetric
  from ax.core.metric import Metric
  from ax.core.objective import MultiObjective, Objective
  from ax.core.observation import ObservationFeatures
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig, ObjectiveThreshold, OptimizationConfig
  from ax.core.outcome_constraint import OutcomeConstraint
  from ax.core.parameter import ChoiceParameter, FixedParameter, Parameter, PARAMETER_PYTHON_TYPE_MAP, ParameterType, RangeParameter, TParameterType
  from ax.core.parameter_constraint import OrderConstraint, ParameterConstraint
  from ax.core.search_space import HierarchicalSearchSpace, SearchSpace
  from ax.core.types import ComparisonOp, TParameterization, TParamValue
  from ax.exceptions.core import UnsupportedError
  from ax.utils.common.constants import Keys
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import checked_cast, checked_cast_optional, checked_cast_to_tuple, not_none
label_desc: Use image node_id 10 for calling the InstantiationBase obj's underlying member method code with example usage: obj.outcome_constraint_from_str(cls, representation, metric_definitions) and returns: OutcomeConstraint