
    (^i                        d dl mZ d dlmZ d dlZd dlmZ d dlmZ d dlZd dl	m
Z
 d dlmZ d dlmZ d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ dZ G d de      Zy)    )annotations)SequenceN)Any)overload)distributions)convert_positional_args)deprecated_func)BaseDistribution)CategoricalChoiceType)CategoricalDistribution)FloatDistribution)IntDistribution)_SUGGEST_INT_POSITIONAL_ARGS)	BaseTrialz Use suggest_float{args} instead.c                     e Zd ZdZd)d*dZddd	 	 	 	 	 	 	 	 	 	 	 d+dZ eddej                  d	
            d,d       Z	 eddej                  d
            d,d       Z
 eddej                  d
            d-d       Z eedd      ddd	 	 	 	 	 	 	 	 	 	 	 d.d       Zed/d       Zed0d       Zed1d       Zed2d       Zed3d       Ze	 	 	 	 	 	 d4d       Z	 	 	 	 	 	 d4dZd5dZd6dZd7dZ ed d      d7d!       Zd8d"Zed9d#       Zed:d$       Zed9d%       Zed9d&       Zed;d'       Zed<d(       Zy)=
FixedTriala}  A trial class which suggests a fixed value for each parameter.

    This object has the same methods as :class:`~optuna.trial.Trial`, and it suggests pre-defined
    parameter values. The parameter values can be determined at the construction of the
    :class:`~optuna.trial.FixedTrial` object. In contrast to :class:`~optuna.trial.Trial`,
    :class:`~optuna.trial.FixedTrial` does not depend on :class:`~optuna.study.Study`, and it is
    useful for deploying optimization results.

    Example:

        Evaluate an objective function with parameter values given by a user.

        .. testcode::

            import optuna


            def objective(trial):
                x = trial.suggest_float("x", -100, 100)
                y = trial.suggest_categorical("y", [-1, 0, 1])
                return x**2 + y


            assert objective(optuna.trial.FixedTrial({"x": 1, "y": 0})) == 1


    .. note::
        Please refer to :class:`~optuna.trial.Trial` for details of methods and properties.

    Args:
        params:
            A dictionary containing all parameters.
        number:
            A trial number. Defaults to ``0``.

    c                    || _         i | _        i | _        i | _        i | _        t
        j
                  j                         | _        || _        y N)	_params_suggested_params_distributions_user_attrs_system_attrsdatetimenow_datetime_start_number)selfparamsnumbers      T/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/optuna/trial/_fixed.py__init__zFixedTrial.__init__>   sG    13;=+--/'00446    NF)steplogc          	     @    | j                  |t        ||||            S N)r%   r$   )_suggestr   r   namelowhighr$   r%   s         r!   suggest_floatzFixedTrial.suggest_floatG   s!     }}T#4S$Cd#STTr#   z3.0.0z6.0.0 )args)textc                (    | j                  |||      S r   r-   r   r*   r+   r,   s       r!   suggest_uniformzFixedTrial.suggest_uniformR   s    !!$T22r#   z(..., log=True)c                ,    | j                  |||d      S )NT)r%   r2   r3   s       r!   suggest_loguniformzFixedTrial.suggest_loguniformV   s    !!$Tt!<<r#   z(..., step=...)c                ,    | j                  ||||      S )N)r$   r2   )r   r*   r+   r,   qs        r!   suggest_discrete_uniformz#FixedTrial.suggest_discrete_uniformZ   s    !!$T!::r#   z3.5.0z5.0.0)previous_positional_arg_namesdeprecated_versionremoved_version   c               R    t        | j                  |t        ||||                  S r'   )intr(   r   r)   s         r!   suggest_intzFixedTrial.suggest_int^   s&     4==sDcPT'UVWWr#   c                     y r    r   r*   choicess      r!   suggest_categoricalzFixedTrial.suggest_categoricalh       ORr#   c                     y r   rB   rC   s      r!   rE   zFixedTrial.suggest_categoricalk   rF   r#   c                     y r   rB   rC   s      r!   rE   zFixedTrial.suggest_categoricaln       MPr#   c                     y r   rB   rC   s      r!   rE   zFixedTrial.suggest_categoricalq   s    QTr#   c                     y r   rB   rC   s      r!   rE   zFixedTrial.suggest_categoricalt   rI   r#   c                     y r   rB   rC   s      r!   rE   zFixedTrial.suggest_categoricalw   s     !$r#   c                :    | j                  |t        |            S )N)rD   )r(   r   rC   s      r!   rE   zFixedTrial.suggest_categorical|   s     }}T#:7#KLLr#   c                     y r   rB   )r   valuer$   s      r!   reportzFixedTrial.report   s    r#   c                     y)NFrB   r   s    r!   should_prunezFixedTrial.should_prune   s    r#   c                "    || j                   |<   y r   r   r   keyrO   s      r!   set_user_attrzFixedTrial.set_user_attr   s     %r#   z3.1.0c                "    || j                   |<   y r   r   rV   s      r!   set_system_attrzFixedTrial.set_system_attr   s    "'3r#   c                   || j                   vrt        dj                  |            | j                   |   }|j                  |      }|j	                  |      s&t        j                  dj                  |||             || j                  v r#t        j                  | j                  |   |       || j                  |<   || j                  |<   |S )NziThe value of the parameter '{}' is not found. Please set it at the construction of the FixedTrial object.zNThe value {} of the parameter '{}' is out of the range of the distribution {}.)r   
ValueErrorformatto_internal_repr	_containswarningswarnr   r    check_distribution_compatibilityr   )r   r*   distributionrO   param_value_in_internal_reprs        r!   r(   zFixedTrial._suggest   s    t||#==CVD\ 
 T"'3'D'DU'K$%%&BCMM44:F5$4U
 4&&&::4;N;Nt;TVbc',t$$0D!r#   c                    | j                   S r   )r   rR   s    r!   r   zFixedTrial.params   s    %%%r#   c                    | j                   S r   )r   rR   s    r!   r   zFixedTrial.distributions   s    """r#   c                    | j                   S r   rU   rR   s    r!   
user_attrszFixedTrial.user_attrs   s    r#   c                    | j                   S r   rZ   rR   s    r!   system_attrszFixedTrial.system_attrs   s    !!!r#   c                    | j                   S r   )r   rR   s    r!   datetime_startzFixedTrial.datetime_start   s    ###r#   c                    | j                   S r   )r   rR   s    r!   r    zFixedTrial.number   s    ||r#   )r   )r   dict[str, Any]r    r?   returnNone)r*   strr+   floatr,   rs   r$   zfloat | Noner%   boolrp   rs   )r*   rr   r+   rs   r,   rs   rp   rs   )
r*   rr   r+   rs   r,   rs   r8   rs   rp   rs   )r*   rr   r+   r?   r,   r?   r$   r?   r%   rt   rp   r?   )r*   rr   rD   zSequence[None]rp   rq   )r*   rr   rD   zSequence[bool]rp   rt   )r*   rr   rD   zSequence[int]rp   r?   )r*   rr   rD   zSequence[float]rp   rs   )r*   rr   rD   zSequence[str]rp   rr   )r*   rr   rD   zSequence[CategoricalChoiceType]rp   r   )rO   rs   r$   r?   rp   rq   )rp   rt   )rW   rr   rO   r   rp   rq   )r*   rr   rd   r
   rp   r   )rp   ro   )rp   zdict[str, BaseDistribution])rp   zdatetime.datetime | None)rp   r?   )__name__
__module____qualname____doc__r"   r-   r	   _suggest_deprecated_msgr^   r4   r6   r9   r   r   r@   r   rE   rP   rS   rX   r[   r(   propertyr   r   ri   rk   rm   r    rB   r#   r!   r   r      s   #J "	U	U 	U 		U 	U 	U 
	U Wg,C,J,JPR,J,ST3 U3 Wg,C,J,JPa,J,bc= d= Wg,C,J,JPa,J,bc; d; &B" >?EXX!X),X7:XEIX	X
X
 R RR RP PT TP P$$"A$	$ $MM"AM	M
& Wg&( '(. & & # #     " " $ $  r#   r   )
__future__r   collections.abcr   r   typingr   r   ra   optunar   optuna._convert_positional_argsr   optuna._deprecatedr	   optuna.distributionsr
   r   r   r   r   optuna.trial._baser   r   ry   r   rB   r#   r!   <module>r      sK    " $       C . 1 6 8 2 0 ; ( = c cr#   