# Path: vizier/pyvizier/shared/parameter_config.py
# class ParameterType(enum.IntEnum):
# class ScaleType(enum.IntEnum):
# class ExternalType(enum.IntEnum):
# class ParameterConfig:
#   DOUBLE = 1
#   INTEGER = 2
#   CATEGORICAL = 3
#   DISCRETE = 4
#   LINEAR = 1
#   LOG = 2
#   REVERSE_LOG = 3
#   UNIFORM_DISCRETE = 4
#   INTERNAL = 0
#   BOOLEAN = 1
#   INTEGER = 2
#   FLOAT = 3
#   def is_numeric(self) -> bool:
# def _validate_bounds(bounds: Union[Tuple[int, int], Tuple[float, float]]):
# def _get_feasible_points_and_bounds(
#     feasible_values: Sequence[float]
# ) -> Tuple[List[float], Union[Tuple[int, int], Tuple[float, float]]]:
# def _get_categories(categories: Sequence[str]) -> List[str]:
# def _get_default_value(
#     param_type: ParameterType,
#     default_value: Union[float, int, str]) -> Union[float, int, str]:
#   def factory(
#       cls,
#       name: str,
#       *,
#       bounds: Optional[Union[Tuple[int, int], Tuple[float, float]]] = None,
#       feasible_values: Optional[MonotypeParameterSequence] = None,
#       children: Optional[Sequence[Tuple[MonotypeParameterSequence,
#                                         'ParameterConfig']]] = None,
#       scale_type: Optional[ScaleType] = None,
#       default_value: Optional[Union[float, int, str]] = None,
#       external_type: Optional[ExternalType] = ExternalType.INTERNAL
#   ) -> 'ParameterConfig':
#   def name(self) -> str:
#   def type(self) -> ParameterType:
#   def external_type(self) -> ExternalType:
#   def scale_type(self) -> Optional[ScaleType]:
#   def bounds(self) -> Union[Tuple[float, float], Tuple[int, int]]:
#   def matching_parent_values(self) -> MonotypeParameterList:
#   def child_parameter_configs(self) -> List['ParameterConfig']:
#   def _del_child_parameter_configs(self):
#   def clone_without_children(self) -> 'ParameterConfig':
#   def feasible_values(self) -> Union[List[int], List[float], List[str]]:
#   def default_value(self) -> Optional[Union[int, float, str]]:
#   def _set_matching_parent_values(self,
#                                   parent_values: MonotypeParameterSequence):
#   def _set_child_parameter_configs(self, children: List['ParameterConfig']):
#   def add_children(
#       self, new_children: Sequence[Tuple[MonotypeParameterSequence,
#                                          'ParameterConfig']]
#   ) -> 'ParameterConfig':
#   def continuify(self) -> 'ParameterConfig':
#   def merge(cls, one: 'ParameterConfig',
#             other: 'ParameterConfig') -> 'ParameterConfig':
#   def traverse(
#       self,
#       show_children: bool = False) -> Generator['ParameterConfig', None, None]:
#   def contains(
#       self, value: Union[trial.ParameterValueTypes,
#                          trial.ParameterValue]) -> bool:
#   def num_feasible_values(self) -> Union[float, int]:
# 
# Path: vizier/pyvizier/shared/trial.py
# class ParameterExternalType(enum.IntEnum):
# class TrialStatus(enum.IntEnum):
# class Metric:
# class ParameterValue:
# class _MetricDict(collections.UserDict):
# class Measurement:
# class ParameterDict(cabc.MutableMapping):
# class Trial:
# class TrialSuggestion:
#   AS_INTERNAL = 0
#   AS_BOOLEAN = 1
#   AS_INTEGER = 2
#   AS_FLOAT = 3
#   UNKNOWN = 0
#   REQUESTED = 1
#   PENDING = 2
#   COMPLETED = 4
#   DELETED = 5
#   STOPPING = 6
#   def _std_not_negative(self, _, stddev):
#   def cast(
#       self,
#       external_type: ParameterExternalType,
#   ) -> ParameterValueTypes:
#   def as_float(self) -> Optional[float]:
#   def as_int(self) -> Optional[int]:
#   def as_str(self) -> Optional[str]:
#   def as_bool(self) -> Optional[bool]:
#   def __str__(self) -> str:
#   def __repr__(self) -> str:
#   def __setitem__(self, key: str, value: Union[float, Metric]):
#   def _value_is_finite(self, _, value):
# def _to_local_time(
#     dt: Optional[datetime.datetime]) -> Optional[datetime.datetime]:
#   def __init__(self, iterable: Any = tuple(), **kwargs):
#   def __setitem__(self, key: str, value: Union[ParameterValue,
#                                                ParameterValueTypes]):
#   def __delitem__(self, key: str):
#   def __getitem__(self, key: str) -> ParameterValue:
#   def __len__(self) -> int:
#   def __iter__(self):
#   def get_value(
#       self,
#       key: str,
#       default: Optional[ParameterValueTypes] = None
#   ) -> Optional[ParameterValueTypes]:
#   def duration(self) -> Optional[datetime.timedelta]:
#   def is_completed(self) -> bool:
#   def infeasible(self) -> bool:
#   def infeasibility_reason(self) -> Optional[str]:
#   def complete(self,
#                measurement: Measurement,
#                *,
#                inplace: bool = True) -> 'Trial':
#   def to_trial(self, uid: int) -> Trial:


import copy
import enum
import math
import re
import attr
import numpy as np
from typing import Callable, Iterable, List, Optional, Sequence, Tuple, Type, TypeVar, Union, overload
from absl import logging
from vizier.pyvizier.shared import parameter_config
from vizier.pyvizier.shared import trial


################### PyTypes ###################
ScaleType = parameter_config.ScaleType
ExternalType = parameter_config.ExternalType
# A sequence of possible internal parameter values.
MonotypeParameterSequence = parameter_config.MonotypeParameterSequence
_T = TypeVar('_T')


################### Helper Classes ###################
def _min_leq_max(instance: 'MetricInformation', _, value: float):
  if value > instance.max_value:
    raise ValueError(

# Path: vizier/pyvizier/shared/parameter_config.py
# class ParameterType(enum.IntEnum):
# class ScaleType(enum.IntEnum):
# class ExternalType(enum.IntEnum):
# class ParameterConfig:
#   DOUBLE = 1
#   INTEGER = 2
#   CATEGORICAL = 3
#   DISCRETE = 4
#   LINEAR = 1
#   LOG = 2
#   REVERSE_LOG = 3
#   UNIFORM_DISCRETE = 4
#   INTERNAL = 0
#   BOOLEAN = 1
#   INTEGER = 2
#   FLOAT = 3
#   def is_numeric(self) -> bool:
# def _validate_bounds(bounds: Union[Tuple[int, int], Tuple[float, float]]):
# def _get_feasible_points_and_bounds(
#     feasible_values: Sequence[float]
# ) -> Tuple[List[float], Union[Tuple[int, int], Tuple[float, float]]]:
# def _get_categories(categories: Sequence[str]) -> List[str]:
# def _get_default_value(
#     param_type: ParameterType,
#     default_value: Union[float, int, str]) -> Union[float, int, str]:
#   def factory(
#       cls,
#       name: str,
#       *,
#       bounds: Optional[Union[Tuple[int, int], Tuple[float, float]]] = None,
#       feasible_values: Optional[MonotypeParameterSequence] = None,
#       children: Optional[Sequence[Tuple[MonotypeParameterSequence,
#                                         'ParameterConfig']]] = None,
#       scale_type: Optional[ScaleType] = None,
#       default_value: Optional[Union[float, int, str]] = None,
#       external_type: Optional[ExternalType] = ExternalType.INTERNAL
#   ) -> 'ParameterConfig':
#   def name(self) -> str:
#   def type(self) -> ParameterType:
#   def external_type(self) -> ExternalType:
#   def scale_type(self) -> Optional[ScaleType]:
#   def bounds(self) -> Union[Tuple[float, float], Tuple[int, int]]:
#   def matching_parent_values(self) -> MonotypeParameterList:
#   def child_parameter_configs(self) -> List['ParameterConfig']:
#   def _del_child_parameter_configs(self):
#   def clone_without_children(self) -> 'ParameterConfig':
#   def feasible_values(self) -> Union[List[int], List[float], List[str]]:
#   def default_value(self) -> Optional[Union[int, float, str]]:
#   def _set_matching_parent_values(self,
#                                   parent_values: MonotypeParameterSequence):
#   def _set_child_parameter_configs(self, children: List['ParameterConfig']):
#   def add_children(
#       self, new_children: Sequence[Tuple[MonotypeParameterSequence,
#                                          'ParameterConfig']]
#   ) -> 'ParameterConfig':
#   def continuify(self) -> 'ParameterConfig':
#   def merge(cls, one: 'ParameterConfig',
#             other: 'ParameterConfig') -> 'ParameterConfig':
#   def traverse(
#       self,
#       show_children: bool = False) -> Generator['ParameterConfig', None, None]:
#   def contains(
#       self, value: Union[trial.ParameterValueTypes,
#                          trial.ParameterValue]) -> bool:
#   def num_feasible_values(self) -> Union[float, int]:
# 
# Path: vizier/pyvizier/shared/trial.py
# class ParameterExternalType(enum.IntEnum):
# class TrialStatus(enum.IntEnum):
# class Metric:
# class ParameterValue:
# class _MetricDict(collections.UserDict):
# class Measurement:
# class ParameterDict(cabc.MutableMapping):
# class Trial:
# class TrialSuggestion:
#   AS_INTERNAL = 0
#   AS_BOOLEAN = 1
#   AS_INTEGER = 2
#   AS_FLOAT = 3
#   UNKNOWN = 0
#   REQUESTED = 1
#   PENDING = 2
#   COMPLETED = 4
#   DELETED = 5
#   STOPPING = 6
#   def _std_not_negative(self, _, stddev):
#   def cast(
#       self,
#       external_type: ParameterExternalType,
#   ) -> ParameterValueTypes:
#   def as_float(self) -> Optional[float]:
#   def as_int(self) -> Optional[int]:
#   def as_str(self) -> Optional[str]:
#   def as_bool(self) -> Optional[bool]:
#   def __str__(self) -> str:
#   def __repr__(self) -> str:
#   def __setitem__(self, key: str, value: Union[float, Metric]):
#   def _value_is_finite(self, _, value):
# def _to_local_time(
#     dt: Optional[datetime.datetime]) -> Optional[datetime.datetime]:
#   def __init__(self, iterable: Any = tuple(), **kwargs):
#   def __setitem__(self, key: str, value: Union[ParameterValue,
#                                                ParameterValueTypes]):
#   def __delitem__(self, key: str):
#   def __getitem__(self, key: str) -> ParameterValue:
#   def __len__(self) -> int:
#   def __iter__(self):
#   def get_value(
#       self,
#       key: str,
#       default: Optional[ParameterValueTypes] = None
#   ) -> Optional[ParameterValueTypes]:
#   def duration(self) -> Optional[datetime.timedelta]:
#   def is_completed(self) -> bool:
#   def infeasible(self) -> bool:
#   def infeasibility_reason(self) -> Optional[str]:
#   def complete(self,
#                measurement: Measurement,
#                *,
#                inplace: bool = True) -> 'Trial':
#   def to_trial(self, uid: int) -> Trial:


# Path: vizier/pyvizier/shared/base_study_config.py
import copy
import enum
import math
import re
import attr
import numpy as np
from typing import Callable, Iterable, List, Optional, Sequence, Tuple, Type, TypeVar, Union, overload
from absl import logging
from vizier.pyvizier.shared import parameter_config
from vizier.pyvizier.shared import trial



################### PyTypes ###################
ScaleType = parameter_config.ScaleType
ExternalType = parameter_config.ExternalType
# A sequence of possible internal parameter values.
MonotypeParameterSequence = parameter_config.MonotypeParameterSequence
_T = TypeVar('_T')


################### Helper Classes ###################
def _min_leq_max(instance: 'MetricInformation', _, value: float):
  if value > instance.max_value:
    raise ValueError(

        f'min_value={value} cannot exceed max_value={instance.max_value}.')