
    -ji                         S SK Jr  S SKJ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  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r " S S\5      rg)    )annotations)SequenceN)Any)overload)distributions)convert_positional_args)deprecated_func)optuna_warn)BaseDistribution)CategoricalChoiceType)CategoricalDistribution)FloatDistribution)IntDistribution)_SUGGEST_INT_POSITIONAL_ARGS)	BaseTrialz Use suggest_float{args} instead.c                     \ rS rSrSrS+S,S jjrSSS.           S-S jjr\" SS	\R                  S
S9S9S.S j5       r
\" SS	\R                  SS9S9S.S j5       r\" SS	\R                  SS9S9S/S j5       r\" \SSS9SSS.           S0S jj5       r\S1S j5       r\S2S j5       r\S3S j5       r\S4S j5       r\S5S j5       r\      S6S j5       r      S6S jrS7S jrS8S jrS9S  jr\" S!S5      S9S" j5       rS:S# jr\S;S$ j5       r\S<S% j5       r\S;S& j5       r\S;S' j5       r\S=S( j5       r\S>S) j5       rS*rg)?
FixedTrial   a%  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                    Xl         0 U l        0 U l        0 U l        0 U l        [
        R
                  R                  5       U l        X l        g N)	_params_suggested_params_distributions_user_attrs_system_attrsdatetimenow_datetime_start_number)selfparamsnumbers      M/home/james-whalen/.local/lib/python3.13/site-packages/optuna/trial/_fixed.py__init__FixedTrial.__init__>   sC    13;=+--/'00446    NF)steplogc          
     6    U R                  U[        X#XTS95      $ N)r(   r'   )_suggestr   r    namelowhighr'   r(   s         r#   suggest_floatFixedTrial.suggest_floatG   s     }}T#4SC#STTr&   z3.0.0z6.0.0 )args)textc                &    U R                  XU5      $ r   r0   r    r-   r.   r/   s       r#   suggest_uniformFixedTrial.suggest_uniformR   s    !!$T22r&   z(..., log=True)c                $    U R                  XUSS9$ )NT)r(   r6   r7   s       r#   suggest_loguniformFixedTrial.suggest_loguniformV   s    !!$Tt!<<r&   z(..., step=...)c                "    U R                  XX4S9$ )N)r'   r6   )r    r-   r.   r/   qs        r#   suggest_discrete_uniform#FixedTrial.suggest_discrete_uniformZ   s    !!$T!::r&   z3.5.0z5.0.0)previous_positional_arg_namesdeprecated_versionremoved_version   c               H    [        U R                  U[        X#XTS95      5      $ r*   )intr+   r   r,   s         r#   suggest_intFixedTrial.suggest_int^   s!     4==sc'UVWWr&   c                    g r    r    r-   choicess      r#   suggest_categoricalFixedTrial.suggest_categoricalh       ORr&   c                    g r   rJ   rK   s      r#   rM   rN   k   rO   r&   c                    g r   rJ   rK   s      r#   rM   rN   n       MPr&   c                    g r   rJ   rK   s      r#   rM   rN   q   s    QTr&   c                    g r   rJ   rK   s      r#   rM   rN   t   rR   r&   c                    g r   rJ   rK   s      r#   rM   rN   w   s     !$r&   c                4    U R                  U[        US95      $ )N)rL   )r+   r   rK   s      r#   rM   rN   |   s     }}T#:7#KLLr&   c                    g r   rJ   )r    valuer'   s      r#   reportFixedTrial.report   s    r&   c                    g)NFrJ   r    s    r#   should_pruneFixedTrial.should_prune   s    r&   c                     X R                   U'   g r   r   r    keyrX   s      r#   set_user_attrFixedTrial.set_user_attr   s     %r&   z3.1.0c                     X R                   U'   g r   r   ra   s      r#   set_system_attrFixedTrial.set_system_attr   s    "'3r&   c           	     v   XR                   ;  a  [        SU S35      eU R                   U   nUR                  U5      nUR                  U5      (       d  [	        SU SU SU S35        XR
                  ;   a$  [        R                  " U R
                  U   U5        X0R                  U'   X R
                  U'   U$ )NzThe value of the parameter 'zK' is not found. Please set it at the construction of the FixedTrial object.z
The value z of the parameter 'z*' is out of the range of the distribution .)	r   
ValueErrorto_internal_repr	_containsr
   r   r    check_distribution_compatibilityr   )r    r-   distributionrX   param_value_in_internal_reprs        r#   r+   FixedTrial._suggest   s    ||#.tf 5= = 
 T"'3'D'DU'K$%%&BCCUG#6tf =11=aA
 &&&::4;N;Nt;TVbc',t$$0D!r&   c                    U R                   $ r   )r   r\   s    r#   r!   FixedTrial.params   s    %%%r&   c                    U R                   $ r   )r   r\   s    r#   r   FixedTrial.distributions   s    """r&   c                    U R                   $ r   r`   r\   s    r#   
user_attrsFixedTrial.user_attrs   s    r&   c                    U R                   $ r   rf   r\   s    r#   system_attrsFixedTrial.system_attrs   s    !!!r&   c                    U R                   $ r   )r   r\   s    r#   datetime_startFixedTrial.datetime_start   s    ###r&   c                    U R                   $ r   )r   r\   s    r#   r"   FixedTrial.number   s    ||r&   )r   r   r   r   r   r   r   )r   )r!   dict[str, Any]r"   rF   returnNone)r-   strr.   floatr/   r   r'   zfloat | Noner(   boolr   r   )r-   r   r.   r   r/   r   r   r   )
r-   r   r.   r   r/   r   r>   r   r   r   )r-   r   r.   rF   r/   rF   r'   rF   r(   r   r   rF   )r-   r   rL   zSequence[None]r   r   )r-   r   rL   zSequence[bool]r   r   )r-   r   rL   zSequence[int]r   rF   )r-   r   rL   zSequence[float]r   r   )r-   r   rL   zSequence[str]r   r   )r-   r   rL   zSequence[CategoricalChoiceType]r   r   )rX   r   r'   rF   r   r   )r   r   )rb   r   rX   r   r   r   )r-   r   ro   r   r   r   )r   r   )r   zdict[str, BaseDistribution])r   zdatetime.datetime | None)r   rF   )__name__
__module____qualname____firstlineno____doc__r$   r0   r	   _suggest_deprecated_msgformatr8   r;   r?   r   r   rG   r   rM   rY   r]   rc   rg   r+   propertyr!   r   rw   rz   r}   r"   __static_attributes__rJ   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   optunar   optuna._convert_positional_argsr   optuna._deprecatedr	   optuna._warningsr
   optuna.distributionsr   r   r   r   r   optuna.trial._baser   r   r   r   rJ   r&   r#   <module>r      sK    " $      C . ( 1 6 8 2 0 ; ( = c cr&   