ó
    ,Êžj,k  ã                  ó–  • S SK Jr  S SKrS SKrS SKrS SKrS SKrS SKJr  S SK	J
r
  S SK	Jr  S SK	Jr  S SK	Jr  S SKJr  S S	KJr  \(       a  S S
KJr  \S\\\\4   rSrSr " S S\R6                  5      r " S S\5      r\" SS\S9 " S S\5      5       r\" SS\S9 " S S\5      5       r\" SS\S9 " S S\5      5       r  " S S\5      r!\" SS\S9 " S S\!5      5       r"\" SS\S9 " S S\!5      5       r#      S*S  jr$ " S! S"\5      r%\!\#\"\\\\ \%4r&S+S# jr'S,S$ jr(      S-S% jr)S.S& jr*S/S' jr+S0S( jr, S1     S2S) jjr-g)3é    )ÚannotationsN)ÚReal)ÚAny)Úcast)ÚTYPE_CHECKING)ÚUnion)Údeprecated_class©Úoptuna_warn)ÚSequencez=Use :class:`~optuna.distributions.FloatDistribution` instead.z;Use :class:`~optuna.distributions.IntDistribution` instead.c                  óÂ   • \ rS rSrSrSS jr\R                  SS j5       r\R                  SS j5       r	\R                  SS j5       r
SS jrSS jrSS	 jrSS
 jrSrg)ÚBaseDistributioné   zÆBase class for distributions.

Note that distribution classes are not supposed to be called by library users.
They are used by :class:`~optuna.trial.Trial` and :class:`~optuna.samplers` internally.
c                ó   • U$ )a   Convert internal representation of a parameter value into external representation.

Args:
    param_value_in_internal_repr:
        Optuna's internal representation of a parameter value.

Returns:
    Optuna's external representation of a parameter value.
© ©ÚselfÚparam_value_in_internal_reprs     Ú¢C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\optuna/distributions.pyÚto_external_reprÚ!BaseDistribution.to_external_repr&   s
   € ð ,Ð+ó    c                ó   • [         e)a   Convert external representation of a parameter value into internal representation.

Args:
    param_value_in_external_repr:
        Optuna's external representation of a parameter value.

Returns:
    Optuna's internal representation of a parameter value.
©ÚNotImplementedError)r   Úparam_value_in_external_reprs     r   Úto_internal_reprÚ!BaseDistribution.to_internal_repr3   s
   € ô "Ð!r   c                ó   • [         e)zÀTest whether the range of this distribution contains just a single value.

Returns:
    :obj:`True` if the range of this distribution contains just a single value,
    otherwise :obj:`False`.
r   ©r   s    r   ÚsingleÚBaseDistribution.singleA   s
   € ô "Ð!r   c                ó   • [         e)a/  Test if a parameter value is contained in the range of this distribution.

Args:
    param_value_in_internal_repr:
        Optuna's internal representation of a parameter value.

Returns:
    :obj:`True` if the parameter value is contained in the range of this distribution,
    otherwise :obj:`False`.
r   r   s     r   Ú	_containsÚBaseDistribution._containsL   s
   € ô "Ð!r   c                ó   • U R                   $ ©N)Ú__dict__r    s    r   Ú_asdictÚBaseDistribution._asdict[   s   € Ø�}‰}Ðr   c                óš   • [        U[        5      (       d  [        $ [        U 5      [        U5      La  gU R                  UR                  :H  $ )NF)Ú
isinstancer   ÚNotImplementedÚtyper(   )r   Úothers     r   Ú__eq__ÚBaseDistribution.__eq__^   s<   € Ü˜%Ô!1×2Ñ2Ü!Ð!Ü�‹:œT %›[Ò(ØØ�}‰} §¡Ñ.Ð.r   c           	     óˆ   • [        U R                  4[        [        U R                  R                  5       5      5      -   5      $ r'   )ÚhashÚ	__class__ÚtupleÚsortedr(   Úitemsr    s    r   Ú__hash__ÚBaseDistribution.__hash__e   s0   € Ü�T—^‘^Ð%¬¬f°T·]±]×5HÑ5HÓ5JÓ.KÓ(LÑLÓMÐMr   c                ó´   • SR                  S [        U R                  5       R                  5       5       5       5      nU R                  R
                   SU S3$ )Nú, c              3  ó4   #   • U  H  u  pU S U 3v •  M     g7f)Ú=Nr   )Ú.0ÚkÚvs      r   Ú	<genexpr>Ú,BaseDistribution.__repr__.<locals>.<genexpr>i   s   é € ÐQÒ2P©$¨!˜a˜S  ! �:Ò2Pùs   ‚Ú(Ú))Újoinr6   r)   r7   r4   Ú__name__)r   Úkwargss     r   Ú__repr__ÚBaseDistribution.__repr__h   sH   € Ø—‘ÑQ´&¸¿¹»×9MÑ9MÓ9OÔ2PÓQÓQˆØ—.‘.×)Ñ)Ð*¨!¨F¨8°1Ð5Ð5r   r   N)r   ÚfloatÚreturnr   )r   r   rK   rJ   ©rK   Úbool©r   rJ   rK   rM   ©rK   Údict©r/   r   rK   rM   )rK   Úint)rK   Ústr)rF   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   ÚabcÚabstractmethodr   r!   r$   r)   r0   r8   rH   Ú__static_attributes__r   r   r   r   r      so   † ñô,ð 	×Ñó"ó ð"ð 	×Ñó"ó ð"ð 	×Ñó"ó ð"ôô/ôN÷6r   r   c                  óX   • \ rS rSrSr S	         S
S jjrSS jrSS jrSS jrSr	g)ÚFloatDistributioném   a  A distribution on floats.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_float`, and passed to
:mod:`~optuna.samplers` in general.

.. note::
    When ``step`` is not :obj:`None`, if the range :math:`[\mathsf{low}, \mathsf{high}]`
    is not divisible by :math:`\mathsf{step}`, :math:`\mathsf{high}` will be replaced
    with the maximum of :math:`k \times \mathsf{step} + \mathsf{low} < \mathsf{high}`,
    where :math:`k` is an integer.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``. If ``log`` is :obj:`True`,
        ``low`` must be larger than 0.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    log:
        If ``log`` is :obj:`True`, this distribution is in log-scaled domain.
        In this case, all parameters enqueued to the distribution must be positive values.
        This parameter must be :obj:`False` when the parameter ``step`` is not :obj:`None`.
    step:
        A discretization step. ``step`` must be larger than 0.
        This parameter must be :obj:`None` when the parameter ``log`` is :obj:`True`.

Nc                ól  • U(       a  Ub  [        S5      eX:”  a  [        SU< SU< S35      eU(       a  US::  a  [        SU< SU< S35      eUb  US::  a  [        SU< S	35      eS U l        Ub  [        XU5      n[        U5      U l        [        U5      U l        [        U5      U l        X0l        g )
Nz9The parameter `step` is not supported when `log` is true.ú&`low <= high` must hold, but got (low=ú, high=ú).ç        z1`low > 0` must hold for `log=True`, but got (low=r   ú#`step > 0` must hold, but got step=Ú.)Ú
ValueErrorÚstepÚ_adjust_discrete_uniform_highrJ   ÚlowÚhighÚlog©r   rh   ri   rj   rf   s        r   Ú__init__ÚFloatDistribution.__init__‹   sÁ   € ö �4Ñ#ÜÐXÓYÐYà‹:ÜÐFÀ#ÁÀxÈ$ÉÐPRÐSÓTÐTæ�3˜#“:ÜÐQÈSÉFÐRZÐUYÑT[Ð[]Ð^Ó_Ð_àÑ ¨£	ÜÐC¸d¹WÀAÐFÓGÐGàˆŒ	ØÑÜ0°¸DÓAˆDÜ˜d›ˆDŒIä˜“:ˆŒÜ˜$“KˆŒ	Ø�r   c                óˆ  • U R                   c  U R                  U R                  :H  $ U R                  U R                  :X  a  g[        R                  " [        U R                  5      5      n[        R                  " [        U R                  5      5      n[        R                  " [        U R                   5      5      nX-
  U:  $ ©NT)rf   rh   ri   ÚdecimalÚDecimalrS   )r   ri   rh   rf   s       r   r!   ÚFloatDistribution.single£   s�   € Ø�9‰9ÑØ—8‘8˜tŸy™yÑ(Ð(à�x‰x˜4Ÿ9™9Ó$ØÜ—?’?¤3 t§y¡y£>Ó2ˆDÜ—/’/¤# d§h¡h£-Ó0ˆCÜ—?’?¤3 t§y¡y£>Ó2ˆDØ‘J $Ñ&Ð&r   c                ó<  • UnU R                   c)  U R                  Us=:*  =(       a    U R                  :*  $ s  $ X R                  -
  U R                   -  nU R                  Us=:*  =(       a    U R                  :*  Os  =(       a    [        U[	        U5      -
  5      S:  $ )Ng:Œ0âŽyE>)rf   rh   ri   ÚabsÚround)r   r   Úvaluer?   s       r   r$   ÚFloatDistribution._contains®   sy   € Ø,ˆØ�9‰9ÑØ—8‘8˜u×1Ó1¨¯	©	Ñ1Ð1Ñ1Ð1àŸ™Ñ! T§Y¡YÑ.ˆAØ—8‘8˜u×1Ó1¨¯	©	Ô1×P´c¸!¼eÀA»h¹,Ó6GÈ&Ñ6PÐPr   c                ó  •  [        U5      n[        R                  " U5      (       a  [        SU S35      eU R
                  (       a  US::  a  [        SU S35      eU$ ! [        [        4 a  n[        SU S35      UeS nAff = f©NÚ'z8' is not a valid type. float-castable value is expected.Ú`z` is invalid value.rb   z)` is invalid value for the case log=True.©rJ   re   Ú	TypeErrorÚmathÚisnanrj   ©r   r   Úinternal_reprÚes       r   r   Ú"FloatDistribution.to_internal_repr¶   ó¨   € ð	Ü!Ð">Ó?ˆMô �:Š:�m×$Ñ$Ü˜qÐ!=Ð >Ð>QÐRÓSÐSØ�8�8˜¨Ó,ÜØÐ0Ð1Ð1ZÐ[óð ð Ðøô œIÐ&ó 	ÜØÐ0Ð1ð 24ð 4óð ðûð	úó   ‚A ÁBÁ/A?Á?B©ri   rj   rh   rf   )FN)
rh   rJ   ri   rJ   rj   rM   rf   zNone | floatrK   ÚNonerL   rN   )r   rJ   rK   rJ   )
rF   rT   rU   rV   rW   rl   r!   r$   r   rZ   r   r   r   r\   r\   m   sK   † ñð< PTðØðØ %ðØ,0ðØ@Lðà	õô0	'ôQ÷r   r\   z3.0.0z6.0.0)Útextc                  ó:   ^ • \ rS rSrSrSU 4S jjrSS jrSrU =r$ )ÚUniformDistributionéÈ   aõ  A uniform distribution in the linear domain.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_float`, and passed to
:mod:`~optuna.samplers` in general.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.

c                ó$   >• [         TU ]  XSS S9  g ©NF©rh   ri   rj   rf   ©Úsuperrl   ©r   rh   ri   r4   s      €r   rl   ÚUniformDistribution.__init__Ù   ó   ø€ Ü‰Ñ˜S°¸TÐÒBr   c                óŠ   • [         R                  " U R                  5      nUR                  S5        UR                  S5        U$ ©Nrj   rf   ©ÚcopyÚdeepcopyr(   Úpop©r   Úds     r   r)   ÚUniformDistribution._asdictÜ   ó/   € Ü�MŠM˜$Ÿ-™-Ó(ˆØ	�‰ˆeŒØ	�‰ˆfŒØˆr   r   ©rh   rJ   ri   rJ   rK   r‡   rO   ©	rF   rT   rU   rV   rW   rl   r)   rZ   Ú__classcell__©r4   s   @r   rŠ   rŠ   È   s   ø† ñ÷C÷ò r   rŠ   c                  ó:   ^ • \ rS rSrSrSU 4S jjrSS jrSrU =r$ )ÚLogUniformDistributionéã   a#  A uniform distribution in the log domain.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_float` with ``log=True``,
and passed to :mod:`~optuna.samplers` in general.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be larger than 0. ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.

c                ó$   >• [         TU ]  XSS S9  g ©NTrŽ   r�   r‘   s      €r   rl   ÚLogUniformDistribution.__init__ô   ó   ø€ Ü‰Ñ˜S°¸DÐÒAr   c                óŠ   • [         R                  " U R                  5      nUR                  S5        UR                  S5        U$ r•   r–   rš   s     r   r)   ÚLogUniformDistribution._asdict÷   r�   r   r   rž   rO   rŸ   r¡   s   @r   r£   r£   ã   s   ø† ñ÷B÷ò r   r£   c                  óv   ^ • \ rS rSrSrSU 4S jjrS	S jr\S
S j5       r\R                  SS j5       rSr
U =r$ )ÚDiscreteUniformDistributionéþ   a  A discretized uniform distribution in the linear domain.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_float` with ``step``
argument, and passed to :mod:`~optuna.samplers` in general.

.. note::
    If the range :math:`[\mathsf{low}, \mathsf{high}]` is not divisible by :math:`q`,
    :math:`\mathsf{high}` will be replaced with the maximum of :math:`k q + \mathsf{low}
    < \mathsf{high}`, where :math:`k` is an integer.

Args:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    q:
        A discretization step. ``q`` must be larger than 0.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.

c                ó"   >• [         TU ]  XUS9  g )N©rh   ri   rf   r�   )r   rh   ri   Úqr4   s       €r   rl   Ú$DiscreteUniformDistribution.__init__  s   ø€ Ü‰Ñ˜S°!ÐÒ4r   c                ó’   • [         R                  " U R                  5      nUR                  S5        UR                  S5      nX!S'   U$ )Nrj   rf   r°   r–   )r   r›   rf   s      r   r)   Ú#DiscreteUniformDistribution._asdict  s8   € Ü�MŠM˜$Ÿ-™-Ó(ˆØ	�‰ˆeŒà�u‰u�V‹}ˆØˆ#‰Øˆr   c                ó.   • [        SU R                  5      $ )zÈDiscretization step.

:class:`~optuna.distributions.DiscreteUniformDistribution` is a subtype of
:class:`~optuna.distributions.FloatDistribution`.
This property is a proxy for its ``step`` attribute.
rJ   )r   rf   r    s    r   r°   ÚDiscreteUniformDistribution.q'  s   € ô �G˜TŸY™YÓ'Ð'r   c                ó   • Xl         g r'   ©rf   )r   r@   s     r   r°   rµ   1  s   € à�	r   r·   )rh   rJ   ri   rJ   r°   rJ   rK   r‡   rO   )rK   rJ   )r@   rJ   rK   r‡   )rF   rT   rU   rV   rW   rl   r)   Úpropertyr°   ÚsetterrZ   r    r¡   s   @r   r¬   r¬   þ   s>   ø† ñ÷85ôð ó(ó ð(ð ‡X�Xóó ör   r¬   c                  óN   • \ rS rSrSrS
SS jjrSS jrSS jrSS jrSS jr	Sr
g	)ÚIntDistributioni6  a  A distribution on integers.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_int`, and passed to
:mod:`~optuna.samplers` in general.

.. note::
    When ``step`` is not :obj:`None`, if the range :math:`[\mathsf{low}, \mathsf{high}]`
    is not divisible by :math:`\mathsf{step}`, :math:`\mathsf{high}` will be replaced
    with the maximum of :math:`k \times \mathsf{step} + \mathsf{low} < \mathsf{high}`,
    where :math:`k` is an integer.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``. If ``log`` is :obj:`True`,
        ``low`` must be larger than or equal to 1.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    log:
        If ``log`` is :obj:`True`, this distribution is in log-scaled domain.
        In this case, all parameters enqueued to the distribution must be positive values.
        This parameter must be :obj:`False` when the parameter ``step`` is not 1.
    step:
        A discretization step. ``step`` must be a positive integer. This parameter must be 1
        when the parameter ``log`` is :obj:`True`.

c                ó€  • U(       a  US:w  a  [        S5      eX:”  a  [        SU< SU< S35      eU(       a  US:  a  [        SU< SU< S35      eUS::  a  [        SU< S	35      eX0l        [        U5      U l        [        U5      U l        [        U5      n[        U R                  X R                  5      U l        g )
Né   zZSamplers and other components in Optuna only accept step is 1 when `log` argument is True.r_   r`   ra   z2`low >= 1` must hold for `log=True`, but got (low=r   rc   rd   )re   rj   rR   rf   rh   Ú_adjust_int_uniform_highri   rk   s        r   rl   ÚIntDistribution.__init__T  s¾   € Þ�4˜1“9Üð/óð ð
 ‹:ÜÐFÀ#ÁÀxÈ$ÉÐPRÐSÓTÐTæ�3˜“7ÜÐRÈcÉVÐS[ÐVZÑU\Ð\^Ð_Ó`Ð`à�1‹9ÜÐC¸d¹WÀAÐFÓGÐGàŒÜ˜“IˆŒ	Ü�s“8ˆŒÜ�4‹yˆÜ,¨T¯X©X°t¿Y¹YÓGˆ�	r   c                ó   • [        U5      $ r'   )rR   r   s     r   r   Ú IntDistribution.to_external_reprj  s   € ÜÐ/Ó0Ð0r   c                ó  •  [        U5      n[        R                  " U5      (       a  [        SU S35      eU R
                  (       a  US::  a  [        SU S35      eU$ ! [        [        4 a  n[        SU S35      UeS nAff = fry   r|   r€   s       r   r   Ú IntDistribution.to_internal_reprm  r„   r…   c                óØ   • U R                   (       a  U R                  U R                  :H  $ U R                  U R                  :X  a  gU R                  U R                  -
  U R                  :  $ ro   )rj   rh   ri   rf   r    s    r   r!   ÚIntDistribution.single~  sK   € Ø�8�8Ø—8‘8˜tŸy™yÑ(Ð(à�8‰8�t—y‘yÓ ØØ—	‘	˜DŸH™HÑ$¨¯	©	Ñ1Ð1r   c                ó¢   • UnU R                   Us=:*  =(       a    U R                  :*  Os  =(       a    X R                   -
  U R                  -  S:H  $ ©Nr   r¯   )r   r   rv   s      r   r$   ÚIntDistribution._contains†  s=   € Ø,ˆØ�x‰x˜5×-Ó- D§I¡IÔ-×U°5¿8¹8Ñ3CÀtÇyÁyÑ2PÐTUÑ2UÐUr   r†   N)Fr½   )
rh   rR   ri   rR   rj   rM   rf   rR   rK   r‡   )r   rJ   rK   rR   )r   rR   rK   rJ   rL   rN   )rF   rT   rU   rV   rW   rl   r   r   r!   r$   rZ   r   r   r   r»   r»   6  s"   † ñö:Hô,1ôô"2÷Vr   r»   c                  ó>   ^ • \ rS rSrSrSSU 4S jjjrSS jrSrU =r$ )	ÚIntUniformDistributioni‹  aJ  A uniform distribution on integers.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_int`, and passed to
:mod:`~optuna.samplers` in general.

.. note::
    If the range :math:`[\mathsf{low}, \mathsf{high}]` is not divisible by
    :math:`\mathsf{step}`, :math:`\mathsf{high}` will be replaced with the maximum of
    :math:`k \times \mathsf{step} + \mathsf{low} < \mathsf{high}`, where :math:`k` is
    an integer.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range.
        ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    step:
        A discretization step. ``step`` must be a positive integer.

c                ó$   >• [         TU ]  XSUS9  g r�   r�   ©r   rh   ri   rf   r4   s       €r   rl   ÚIntUniformDistribution.__init__¤  r“   r   c                óh   • [         R                  " U R                  5      nUR                  S5        U$ ©Nrj   r–   rš   s     r   r)   ÚIntUniformDistribution._asdict§  ó$   € Ü�MŠM˜$Ÿ-™-Ó(ˆØ	�‰ˆeŒØˆr   r   ©r½   ©rh   rR   ri   rR   rf   rR   rK   r‡   rO   rŸ   r¡   s   @r   rÊ   rÊ   ‹  s   ø† ñ÷.Cñ C÷ò r   rÊ   c                  ó>   ^ • \ rS rSrSrSSU 4S jjjrSS jrSrU =r$ )	ÚIntLogUniformDistributioni­  ap  A uniform distribution on integers in the log domain.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_int`, and passed to
:mod:`~optuna.samplers` in general.

Attributes:
    low:
        Lower endpoint of the range of the distribution. ``low`` is included in the range
        and must be larger than or equal to 1. ``low`` must be less than or equal to ``high``.
    high:
        Upper endpoint of the range of the distribution. ``high`` is included in the range.
        ``high`` must be greater than or equal to ``low``.
    step:
        A discretization step. ``step`` must be a positive integer.

c                ó$   >• [         TU ]  XSUS9  g r¦   r�   rÌ   s       €r   rl   Ú"IntLogUniformDistribution.__init__À  r¨   r   c                óh   • [         R                  " U R                  5      nUR                  S5        U$ rÏ   r–   rš   s     r   r)   Ú!IntLogUniformDistribution._asdictÃ  rÑ   r   r   rÒ   rÓ   rO   rŸ   r¡   s   @r   rÕ   rÕ   ­  s   ø† ñ÷"Bñ B÷ò r   rÕ   c                ó  • [        U [        5      =(       a    [        R                  " [	        U 5      5      n[        U[        5      =(       a    [        R                  " [	        U5      5      nX:H  =(       d    U=(       a    U$ )zA function to check two choices equal considering NaN.

This function can handle NaNs like np.float32("nan") other than float.
)r,   r   r~   r   rJ   )Úvalue1Úvalue2Úvalue1_is_nanÚvalue2_is_nans       r   Ú_categorical_choice_equalrß   É  sS   € ô ˜v¤tÓ,×J´·²¼EÀ&»MÓ1J€MÜ˜v¤tÓ,×J´·²¼EÀ&»MÓ1J€MØÑ×B -×"A°MÐBr   c                  ól   • \ rS rSrSrSS jrSS jrSS jrSS jrSS jr	SS jr
\R                  rS	rg
)ÚCategoricalDistributioniÖ  a   A categorical distribution.

This object is instantiated by :func:`~optuna.trial.Trial.suggest_categorical`, and
passed to :mod:`~optuna.samplers` in general.

Args:
    choices:
        Parameter value candidates. ``choices`` must have one element at least.

.. note::

    Not all types are guaranteed to be compatible with all storages. It is recommended to
    restrict the types of the choices to :obj:`None`, :class:`bool`, :class:`int`,
    :class:`float` and :class:`str`.

Attributes:
    choices:
        Parameter value candidates.

c                ó  • [        U5      S:X  a  [        S5      eU HV  nUc  M  [        U[        [        [
        [        45      (       a  M/  SU S[        U5      R                   S3n[        U5        MX     [        U5      U l        g )Nr   z0The `choices` must contain one or more elements.zChoices for a categorical distribution should be a tuple of None, bool, int, float and str for persistent storage but contains z which is of type rd   )Úlenre   r,   rM   rR   rJ   rS   r.   rF   r   r5   Úchoices)r   rä   ÚchoiceÚmessages       r   rl   Ú CategoricalDistribution.__init__ì  s�   € Üˆw‹<˜1ÓÜÐOÓPÐPÛˆFØÓ!¬*°V¼dÄCÌÔPSÐ=T×*UÓ*UðIà�hÐ0´°f³×1FÑ1FÐ0GÀqðJð ô
 ˜GÖ$ñ ô ˜W“~ˆ�r   c                ó2   • U R                   [        U5         $ r'   )rä   rR   r   s     r   r   Ú(CategoricalDistribution.to_external_reprú  s   € Ø�|‰|œCÐ <Ó=Ñ>Ð>r   c                óú   •  U R                   R                  U5      $ ! [         a7    [        U R                   5       H  u  p#[	        X5      (       d  M  Us  s $     Of = f[        SU SU R                    S35      e)Nrz   z	' not in rd   )rä   Úindexre   Ú	enumeraterß   )r   r   rë   rå   s       r   r   Ú(CategoricalDistribution.to_internal_reprý  sw   € ð
	!ð
 —<‘<×%Ñ%Ð&BÓCÐCøÜó 	!ä!*¨4¯<©<Ö!8‘�Ü,Ð-I×RÓRØ ”Ló "9ð	!úô ˜1Ð9Ð:¸)ÀDÇLÁLÀ>ÐQRÐSÓTÐTs   ‚ �2AÁAÁAÁAc                ó2   • [        U R                  5      S:H  $ )Nr½   )rã   rä   r    s    r   r!   ÚCategoricalDistribution.single  s   € Ü�4—<‘<Ó  AÑ%Ð%r   c                óh   • [        U5      nSUs=:*  =(       a    [        U R                  5      :  $ s  $ rÇ   )rR   rã   rä   )r   r   rë   s      r   r$   Ú!CategoricalDistribution._contains  s/   € ÜÐ0Ó1ˆØ�E×-Ó-œC §¡Ó-Ñ-Ð-Ñ-Ð-r   c                óþ  • [        U[        5      (       d  [        $ [        XR                  5      (       d  gU R                  R                  5       UR                  R                  5       :w  a  gU R                  R                  5        Hr  u  p#US:X  aV  [        U5      [        [        X5      5      :w  a    g[        U[        X5      5       H  u  pE[        XE5      (       a  M      g   Ma  U[        X5      :w  d  Mr    g   g)NFrä   T)r,   r   r-   r4   r(   Úkeysr7   rã   ÚgetattrÚziprß   )r   r/   Úkeyrv   rå   Úother_choices         r   r0   ÚCategoricalDistribution.__eq__  sÆ   € Ü˜%Ô!1×2Ñ2Ü!Ð!Ü˜%§¡×0Ñ0ØØ�=‰=×ÑÓ 5§>¡>×#6Ñ#6Ó#8Ó8ØØŸ-™-×-Ñ-Ö/‰JˆCØ�iÓÜ�u“:¤¤W¨UÓ%8Ó!9Ó9Ù Ü,/°´w¸uÓ7JÖ,KÑ(�FÜ4°V×JÓJÚ$ó -Lð œG EÓ/Õ/Ù ñ 0ð r   )rä   N)rä   zSequence[CategoricalChoiceType]rK   r‡   )r   rJ   rK   ÚCategoricalChoiceType)r   rù   rK   rJ   rL   rN   rQ   )rF   rT   rU   rV   rW   rl   r   r   r!   r$   r0   r   r8   rZ   r   r   r   rá   rá   Ö  s3   † ñô*&ô?ôUô&ô.ôð&  ×(Ñ(ƒHr   rá   c                ó  • [         R                  " U 5      nSU;   al  US   [        R                  :X  a  [	        US   S   5      US   S'   [
         H#  nUS   UR                  :X  d  M  U" S0 US   D6s  $    [        SUS    35      eUS   S:X  a  [        US   5      $ US   S;   aO  US   nUS	   nUR                  S
5      nUR                  SS5      nUS   S:X  a
  [        X4XeS9$ Uc  Sn[        X4XeS9$ [        SUS    35      e)zŒDeserialize a distribution in JSON format.

Args:
    json_str: A JSON-serialized distribution.

Returns:
    A deserialized distribution.

ÚnameÚ
attributesrä   zUnknown distribution class: r.   Úcategorical)rJ   rR   rh   ri   rf   rj   FrJ   )rj   rf   r½   rŽ   zUnknown distribution type: r   )
ÚjsonÚloadsrá   rF   r5   ÚDISTRIBUTION_CLASSESre   Úgetr\   r»   )Újson_strÚ	json_dictÚclsrh   ri   rf   rj   s          r   Újson_to_distributionr  5  s@  € ô —
’
˜8Ó$€Ià�ÓØ�VÑÔ 7× @Ñ @Ó@Ü16°yÀÑ7NÈyÑ7YÓ1ZˆI�lÑ# IÑ.ç'ˆCØ˜Ñ  C§L¡LÕ0ÙÑ5˜Y |Ñ4Ñ5Ò5ñ (ô Ð7¸	À&Ñ8IÐ7JÐKÓLÐLð �VÑ Ó-Ü*¨9°YÑ+?Ó@Ð@Ø�vÑÐ"2Ó2Ø˜EÑ"ˆCØ˜VÑ$ˆDØ—=‘= Ó(ˆDØ—-‘-  uÓ-ˆCà˜Ñ  GÓ+Ü(¨¸ÑGÐGð ‘<Ø�DÜ&¨3¸sÑNÐNäÐ6°yÀÑ7HÐ6IÐJÓKÐKr   c                óx   • [         R                  " U R                  R                  U R	                  5       S.5      $ )z‘Serialize a distribution to JSON format.

Args:
    dist: A distribution to be serialized.

Returns:
    A JSON string of a given distribution.

)rû   rü   )rþ   Údumpsr4   rF   r)   )Údists    r   Údistribution_to_jsonr	  a  s(   € ô �:Š:˜tŸ~™~×6Ñ6ÀdÇlÁlÃnÑUÓVÐVr   c                ó¢  • U R                   UR                   :w  a  [        S5      e[        U [        [        45      (       aB  [        U[        [        45      (       d   eU R
                  UR
                  :w  a  [        S5      e[        U [        5      (       d  g[        U[        5      (       d  gX:w  a  [        [        R                  S-   5      eg)aù  A function to check compatibility of two distributions.

It checks whether ``dist_old`` and ``dist_new`` are the same kind of distributions.
If ``dist_old`` is :class:`~optuna.distributions.CategoricalDistribution`,
it further checks ``choices`` are the same between ``dist_old`` and ``dist_new``.
Note that this method is not supposed to be called by library users.

Args:
    dist_old:
        A distribution previously recorded in storage.
    dist_new:
        A distribution newly added to storage.

zBCannot set different distribution kind to the same parameter name.zBCannot set different log configuration to the same parameter name.Nz& does not support dynamic value space.)r4   re   r,   r\   r»   rj   rá   rF   )Údist_oldÚdist_news     r   Ú check_distribution_compatibilityr  o  sµ   € ð$ ×Ñ˜X×/Ñ/Ó/ÜÐ]Ó^Ð^ä�(Ô.´Ð@×AÑAä˜(Ô%6¼Ð$H×IÑIÐIÐIà�<‰<˜8Ÿ<™<Ó'ÜÐaÓbÐbä�hÔ 7×8Ñ8ØÜ�hÔ 7×8Ñ8ØØÓÜÜ#×,Ñ,Ð/WÑWó
ð 	
ð r   c                ób  • [         R                  " [        U5      5      n[         R                  " [        U 5      5      n[         R                  " [        U5      5      nX4-
  nXe-  [         R                  " S5      :w  a1  Un[        Xe-  U-  U-   5      n[	        SU  SU SU< SU  SU S35        U$ )NÚ0ú"The distribution is specified by [r;   ú] and step=úF, but the range is not divisible by `step`. It will be replaced with [ú].)rp   rq   rS   rJ   r   )rh   ri   rf   Úd_highÚd_lowÚd_stepÚd_rÚold_highs           r   rg   rg   •  s©   € Ü�_Š_œS ›YÓ'€FÜ�OŠOœC ›HÓ%€EÜ�_Š_œS ›YÓ'€Fà
‰.€Cà
�|”w—’ sÓ+Ó+ØˆÜ�c‘m vÑ-°Ñ5Ó6ˆÜØ0°°°R¸°zÀÈÁwð OBØBEÀÀbÈÈÈbðRô	
ð
 €Kr   c                ón   • X-
  nX2-  S:w  a(  UnX2-  U-  U -   n[        SU  SU SU< SU  SU S35        U$ )Nr   r  r;   r  r  r  r
   )rh   ri   rf   Úrr  s        r   r¾   r¾   §  sd   € Ø‰
€AØ�x�1ƒ}ØˆØ‰y˜4Ñ #Ñ%ˆÜØ0°°°R¸°zÀÈÁwð OBØBEÀÀbÈÈÈbðRô	
ð €Kr   c                óÊ   • U R                  5       (       d   e[        U [        [        45      (       a  U R                  $ [        U [
        5      (       a  U R                  S   $  erÇ   )r!   r,   r\   r»   rh   rá   rä   )Údistributions    r   Ú_get_single_valuer  ³  sd   € Ø×Ñ× Ñ Ð Ð äØäÜð	
÷ñ ð ×ÑÐÜ	�LÔ"9×	:Ñ	:Ø×#Ñ# AÑ&Ð&Øˆ5r   c                óª  • [        U [        5      (       a!  [        U R                  U R                  SS S9nOø[        U [
        5      (       a!  [        U R                  U R                  SS S9nOÂ[        U [        5      (       a+  [        U R                  U R                  SU R                  S9nO‚[        U [        5      (       a+  [        U R                  U R                  SU R                  S9nOB[        U [        5      (       a+  [        U R                  U R                  SU R                  S9nOU nX :w  a  U(       d  U  SU S3n[        U[        5        U$ )NFrŽ   Tz+ is deprecated and internally converted to z3. See https://github.com/optuna/optuna/issues/2941.)r,   rŠ   r\   rh   ri   r£   r¬   r°   rÊ   r»   rf   rÕ   r   ÚFutureWarning)r  Úsuppress_warningÚnew_distributionræ   s       r   Ú-_convert_old_distribution_to_new_distributionr"  Å  sR  € ô �,Ô 3×4Ñ4Ü,Ø× Ñ Ø×"Ñ"ØØñ	
Ñô 
�LÔ"8×	9Ñ	9Ü,Ø× Ñ Ø×"Ñ"ØØñ	
Ñô 
�LÔ"=×	>Ñ	>Ü,Ø× Ñ Ø×"Ñ"ØØ—‘ñ	
Ñô 
�LÔ"8×	9Ñ	9Ü*Ø× Ñ Ø×"Ñ"ØØ×"Ñ"ñ	
Ñô 
�LÔ";×	<Ñ	<Ü*Ø× Ñ Ø×"Ñ"ØØ×"Ñ"ñ	
Ñð (ÐàÓ'Ö0@àˆnð Ø Ð!Ð!TðVð 	ô 	�Gœ]Ô+àÐr   )rÛ   rù   rÜ   rù   rK   rM   )r  rS   rK   r   )r  r   rK   rS   )r  r   r  r   rK   r‡   )rh   rJ   ri   rJ   rf   rJ   rK   rJ   )rh   rR   ri   rR   rf   rR   rK   rR   )r  r   rK   z#int | float | CategoricalChoiceType)F)r  r   r   rM   rK   r   ).Ú
__future__r   rX   r—   rp   rþ   r~   Únumbersr   Útypingr   r   r   r   Úoptuna._deprecatedr	   Úoptuna._warningsr   Úcollections.abcr   rM   rR   rJ   rS   rù   Ú"_float_distribution_deprecated_msgÚ _int_distribution_deprecated_msgÚABCr   r\   rŠ   r£   r¬   r»   rÊ   rÕ   rß   rá   r   r  r	  r  rg   r¾   r  r"  r   r   r   Ú<module>r,     s	  ðÝ "ã 
Û Û Û Û Ý Ý Ý Ý  Ý å /Ý (ö Ý(ð ˜d D¨#¨u°cÐ9Ñ:Ð ð Dð #ð $aÐ  ôK6�s—w‘wô K6ô\XÐ(ô Xñv �'˜7Ð)KÑLôÐ+ó ó Mðñ4 �'˜7Ð)KÑLôÐ.ó ó Mðñ4 �'˜7Ð)KÑLô4Ð"3ó 4ó Mð4ônRVÐ&ô RVñj �'˜7Ð)IÑJô˜_ó ó KðñB �'˜7Ð)IÑJô ó ó Kðð6
CØ!ð
CØ+@ð
Cà	ô
CôP)Ð.ô P)ðh ØØØØØØØð	Ð ô)LôXWð#
Øð#
Ø*:ð#
à	ô#
ôLô$	ôð( #ð8Ø"ð8àð8ð ö8r   