
    Q-jA                        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 dlmZ d dlmZ erd dlmZ d dlmZ d dlmZ dZ G d de      Zy)    )annotationsN)Any)overload)TYPE_CHECKING)distributions)convert_positional_args)deprecated_func)optuna_warn)CategoricalDistribution)FloatDistribution)IntDistribution)_SUGGEST_INT_POSITIONAL_ARGS)	BaseTrial)Sequence)BaseDistribution)CategoricalChoiceTypez 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      a/Users/jameslopez/projects/TradingBot25/.venv/lib/python3.12/site-packages/optuna/trial/_fixed.py__init__zFixedTrial.__init__B   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_floatK   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_uniformV   s    !!$T22r%   z(..., log=True)c                ,    | j                  |||d      S )NT)r'   r4   r5   s       r#   suggest_loguniformzFixedTrial.suggest_loguniformZ   s    !!$Tt!<<r%   z(..., step=...)c                ,    | j                  ||||      S )N)r&   r4   )r    r,   r-   r.   qs        r#   suggest_discrete_uniformz#FixedTrial.suggest_discrete_uniform^   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_intb   s&     4==sDcPT'UVWWr%   c                     y r    r    r,   choicess      r#   suggest_categoricalzFixedTrial.suggest_categoricall       ORr%   c                     y r   rD   rE   s      r#   rG   zFixedTrial.suggest_categoricalo   rH   r%   c                     y r   rD   rE   s      r#   rG   zFixedTrial.suggest_categoricalr       MPr%   c                     y r   rD   rE   s      r#   rG   zFixedTrial.suggest_categoricalu   s    QTr%   c                     y r   rD   rE   s      r#   rG   zFixedTrial.suggest_categoricalx   rK   r%   c                     y r   rD   rE   s      r#   rG   zFixedTrial.suggest_categorical{   s     !$r%   c                :    | j                  |t        |            S )N)rF   )r*   r   rE   s      r#   rG   zFixedTrial.suggest_categorical   s     }}T#:7#KLLr%   c                     y r   rD   )r    valuer&   s      r#   reportzFixedTrial.report   s    r%   c                     y)NFrD   r    s    r#   should_prunezFixedTrial.should_prune   s    r%   c                "    || j                   |<   y r   r   r    keyrQ   s      r#   set_user_attrzFixedTrial.set_user_attr   s     %r%   z3.1.0c                "    || j                   |<   y r   r   rX   s      r#   set_system_attrzFixedTrial.set_system_attr   s    "'3r%   c           	     j   || j                   vrt        d| d      | j                   |   }|j                  |      }|j                  |      st	        d| d| d| d       || j
                  v r#t        j                  | j
                  |   |       || j                  |<   || j
                  |<   |S )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,   distributionrQ   param_value_in_internal_reprs        r#   r*   zFixedTrial._suggest   s    t||#.tf 5= = 
 T"'3'D'DU'K$%%&BCUG#6tf =11=aA
 4&&&::4;N;Nt;TVbc',t$$0D!r%   c                    | j                   S r   )r   rT   s    r#   r!   zFixedTrial.params   s    %%%r%   c                    | j                   S r   )r   rT   s    r#   r   zFixedTrial.distributions   s    """r%   c                    | j                   S r   rW   rT   s    r#   
user_attrszFixedTrial.user_attrs   s    r%   c                    | j                   S r   r\   rT   s    r#   system_attrszFixedTrial.system_attrs   s    !!!r%   c                    | j                   S r   )r   rT   s    r#   datetime_startzFixedTrial.datetime_start   s    ###r%   c                    | j                   S r   )r   rT   s    r#   r"   zFixedTrial.number   s    ||r%   )r   )r!   dict[str, Any]r"   rA   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   r:   rs   rp   rs   )r,   rr   r-   rA   r.   rA   r&   rA   r'   rt   rp   rA   )r,   rr   rF   zSequence[None]rp   rq   )r,   rr   rF   zSequence[bool]rp   rt   )r,   rr   rF   zSequence[int]rp   rA   )r,   rr   rF   zSequence[float]rp   rs   )r,   rr   rF   zSequence[str]rp   rr   )r,   rr   rF   zSequence[CategoricalChoiceType]rp   r   )rQ   rs   r&   rA   rp   rq   )rp   rt   )rY   rr   rQ   r   rp   rq   )r,   rr   rd   r   rp   r   )rp   ro   )rp   zdict[str, BaseDistribution])rp   zdatetime.datetime | None)rp   rA   )__name__
__module____qualname____doc__r$   r/   r	   _suggest_deprecated_msgformatr6   r8   r;   r   r   rB   r   rG   rR   rU   rZ   r]   r*   propertyr!   r   ri   rk   rm   r"   rD   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   r   typingr   r   r   optunar   optuna._convert_positional_argsr   optuna._deprecatedr	   optuna._warningsr
   optuna.distributionsr   r   r   optuna.trial._baser   r   collections.abcr   r   r   ry   r   rD   r%   r#   <module>r      sQ    "        C . ( 8 2 0 ; ( (5:< c cr%   