
    -ji              	         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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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 SK(J)r)  S SK*J+r+  S SK*J,r,  S SK-J.r.  S SK/J0r0  S SK1J2r2  S S K3J4r4  S S!K5J6r6  S S"K5J7r7  S S#K8J9r9  S S$K8J:r:  \ " S%5      r;\(       a  S S&K<J=r=  S S'K8J>r>  S S(K8J?r?  \S)/\\@\\@   4   4   rAS*rB\R                  " \D5      rE " S+ S,\R                  5      rG " S- S.5      rH\" / S/QS0S1S29SSSSSS3SS4.               SCS7 jj5       rI\" / S8QS0S1S29SSS9.         SDS: jj5       rJ\" S6S5/S0S1S29      SES; j5       rK\" / S<QS=S0S1S>9SS?.         SFS@ jj5       rL SG     SHSA jjrMSISB jrNg)J    )annotations)Callable)	Container)Iterable)Mapping)SequenceN)Real)Any)cast)TYPE_CHECKING)Union)
exceptions)logging)pruners)samplers)storages)convert_positional_args)deprecated_func)experimental_func)_LazyImport)JSONSerializable)optuna_warn)-_convert_old_distribution_to_new_distribution)BaseDistribution)is_heartbeat_enabled)_CONSTRAINTS_KEY)_get_feasible_trials)_get_pareto_front_trials)	_optimize)StudyDirection)StudySummary)_get_frozen_trial)_tell_with_warning)create_trial)
TrialStatezoptuna.study._dataframe)pd)FrozenTrial)Trialr(   zstudy:metric_namesc                  2    \ rS rSr% SrS\S'   SrS\S'   Srg)	_ThreadLocalStudyAttribute>   Fboolin_optimize_loopNzlist[FrozenTrial] | Nonecached_all_trials )__name__
__module____qualname____firstlineno__r-   __annotations__r.   __static_attributes__r/       L/home/james-whalen/.local/lib/python3.13/site-packages/optuna/study/study.pyr*   r*   >   s    "d"26/6r6   r*   c                     \ rS rSrSr  S'         S(S jjrS)S j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\S0S j5       r\S.S j5       r  S1     S2S jjr   S3       S4S jjrS5S jr\S+S j5       r\\" SS5      S+S j5       5       r\S6S j5       r       S7                 S8S jjrS9S:S jjr   S;         S<S jjrS=S jr\" SS5      S=S j5       r  S>     S?S jjrS@S jr  SA       SBS jjrSCS jrSDS jr \!" S 5      SES! j5       r"SFS" jr#SGS# jr$SHS$ jr%        SIS% jr&S&r'g)JStudyC   a  A study corresponds to an optimization task, i.e., a set of trials.

This object provides interfaces to run a new :class:`~optuna.trial.Trial`, access trials'
history, set/get user-defined attributes of the study itself.

Note that the direct use of this constructor is not recommended.
To create and load a study, please refer to the documentation of
:func:`~optuna.study.create_study` and :func:`~optuna.study.load_study` respectively.

Nc                Z   Xl         [        R                  " U5      nUR                  U5      nXPl        X l        UR                  U5      U l        U=(       d    [        R                  " 5       U l
        U=(       d    [        R                  " 5       U l        [        5       U l        SU l        g NF)
study_namer   get_storageget_study_id_from_name	_study_id_storageget_study_directions_directionsr   
TPESamplersamplerr   MedianPrunerprunerr*   _thread_local
_stop_flag)selfr=   storagerE   rG   study_ids         r7   __init__Study.__init__O   s     %&&w/11*=!"77A7("5"5"76 4 4 679r6   c                @    U R                   R                  5       nUS	 U$ )NrH   )__dict__copyrJ   states     r7   __getstate__Study.__getstate__c   s!    ""$/"r6   c                X    U R                   R                  U5        [        5       U l        g N)rP   updater*   rH   rR   s     r7   __setstate__Study.__setstate__h   s    U#79r6   c                .    U R                   R                  $ )zReturn parameters of the best trial in the study.

.. note::
    This feature can only be used for single-objective optimization.

Returns:
    A dictionary containing parameters of the best trial.

)
best_trialparamsrJ   s    r7   best_paramsStudy.best_paramsl   s     %%%r6   c                <    U R                   R                  nUc   eU$ )zReturn the best objective value in the study.

.. note::
    This feature can only be used for single-objective optimization.

Returns:
    A float representing the best objective value.

)r\   value)rJ   
best_values     r7   rc   Study.best_valuez   s%     __**
%%%r6   c                     U R                  SS9$ )a  Return the best trial in the study.

.. note::
    This feature can only be used for single-objective optimization.
    If your study is multi-objective,
    use :attr:`~optuna.study.Study.best_trials` instead.

Returns:
    A :class:`~optuna.trial.FrozenTrial` object of the best trial.

.. seealso::
    The :ref:`reuse_best_trial` tutorial provides a detailed example of how to use this
    method.

Tdeepcopy)_get_best_trialr^   s    r7   r\   Study.best_trial   s    " ##T#22r6   c                V    U R                  SS9n[        S U 5       5      n[        XS9$ )a  Return trials located at the Pareto front in the study.

A trial is located at the Pareto front if there are no trials that dominate the trial.
It's called that a trial ``t0`` dominates another trial ``t1`` if
``all(v0 <= v1) for v0, v1 in zip(t0.values, t1.values)`` and
``any(v0 < v1) for v0, v1 in zip(t0.values, t1.values)`` are held.

Returns:
    A list of :class:`~optuna.trial.FrozenTrial` objects.
Frf   c              3  H   #    U  H  n[         UR                  ;   v   M     g 7frW   )r   system_attrs).0trials     r7   	<genexpr>$Study.best_trials.<locals>.<genexpr>   s     ZSY%.%2D2DDSYs    ")consider_constraint)
get_trialsanyr   )rJ   trialsis_constraineds      r7   best_trialsStudy.best_trials   s0     %0ZSYZZ'QQr6   c                `    U R                  5       (       a  [        S5      eU R                  S   $ )a  Return the direction of the study.

.. note::
    This feature can only be used for single-objective optimization.
    If your study is multi-objective,
    use :attr:`~optuna.study.Study.directions` instead.

Returns:
    A :class:`~optuna.study.StudyDirection` object.

zA single direction cannot be retrieved from a multi-objective study. Consider using Study.directions to retrieve a list containing all directions.r   )_is_multi_objectiveRuntimeError
directionsr^   s    r7   	directionStudy.direction   s7     ##%%W 
 q!!r6   c                    U R                   $ )zkReturn the directions of the study.

Returns:
    A list of :class:`~optuna.study.StudyDirection` objects.
)rC   r^   s    r7   r{   Study.directions   s     r6   c                "    U R                  SSS9$ )a:  Return all trials in the study.

The returned trials are ordered by trial number.

This is a short form of ``self.get_trials(deepcopy=True, states=None)``.

Returns:
    A list of :class:`~optuna.trial.FrozenTrial` objects.

    .. seealso::
        See :func:`~optuna.study.Study.get_trials` for related method.

TNrg   states)rr   r^   s    r7   rt   Study.trials   s      T::r6   c                "    U R                  XSS9$ )a  Return all trials in the study.

The returned trials are ordered by trial number.

.. seealso::
    See :attr:`~optuna.study.Study.trials` for related property.

Example:
    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", -1, 1)
            return x**2


        study = optuna.create_study()
        study.optimize(objective, n_trials=3)

        trials = study.get_trials()
        assert len(trials) == 3
Args:
    deepcopy:
        Flag to control whether to apply ``copy.deepcopy()`` to the trials.
        Note that if you set the flag to :obj:`False`, you shouldn't mutate
        any fields of the returned trial. Otherwise the internal state of
        the study may corrupt and unexpected behavior may happen.
    states:
        Trial states to filter on. If :obj:`None`, include all states.

Returns:
    A list of :class:`~optuna.trial.FrozenTrial` objects.
F)	use_cache)_get_trials)rJ   rg   r   s      r7   rr   Study.get_trials   s    P EBBr6   c                   U(       a  U R                   R                  c3  U R                  R                  U R                  SS9U R                   l        U R                   R                  nUb$  U Vs/ s H  oUR
                  U;   d  M  UPM     nnOUnU(       a  [        R                  " U5      $ U$ U R                  R                  U R                  XS9$ s  snf )NFrf   r   )rH   r.   rA   get_all_trialsr@   rS   rQ   rg   )rJ   rg   r   r   rt   tfiltered_trialss          r7   r   Study._get_trials  s     !!33;7;}}7S7SNNU 8T 8""4 ''99F!.4"Jf68I1f"J"(5=4==1R?R}}++DNNX+]] #Ks   /CCc                P   U R                  5       (       a  [        S5      eU R                  R                  U R                  5      nUR
                  R                  [        5      nUb  [        U Vs/ s H  oDS:  PM	     sn5      (       ay  U R                  S[        R                  /S9n[        U5      n[        U5      S:X  a  [        S5      eU R                  [         R"                  :X  a  [%        US S9nO['        US	 S9nU(       a  [(        R*                  " U5      $ U$ s  snf )
a  Return the best trial in the study.

Args:
    deepcopy:
        Flag to control whether to apply ``copy.deepcopy()`` to the trial.
        If :obj:`False`, returns the trial without deep copying for better performance.
        Note that if you set this to :obj:`False`, you shouldn't mutate any fields
        of the returned trial.

Returns:
    A :class:`~optuna.trial.FrozenTrial` object of the best trial.
zA single best trial cannot be retrieved from a multi-objective study. Consider using Study.best_trials to retrieve a list containing the best trials.        Fr   r   z%No feasible trials are completed yet.c                6    [        [        U R                  5      $ rW   r   floatrb   r   s    r7   <lambda>'Study._get_best_trial.<locals>.<lambda>@      UAGG@Tr6   keyc                6    [        [        U R                  5      $ rW   r   r   s    r7   r   r   B  r   r6   )ry   rz   rA   get_best_trialr@   rl   getr   rs   rr   r%   COMPLETEr   len
ValueErrorr|   r    MAXIMIZEmaxminrQ   rg   )rJ   rg   r\   constraintsxcomplete_trialsfeasible_trialss          r7   rh   Study._get_best_trial!  s     ##%%Y 
 ]]11$..A

 !--112BC"s[+I[G[+I'J'J"ooujFYFYEZo[O2?CO?#q( !HII~~!8!88 6TU
 6TU
,4t}}Z(D*D ,Js   1D#c                t    [         R                  " U R                  R                  U R                  5      5      $ )a
  Return user attributes.

.. seealso::

    See :func:`~optuna.study.Study.set_user_attr` for related method.

Example:

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", 0, 1)
            y = trial.suggest_float("y", 0, 1)
            return x**2 + y**2


        study = optuna.create_study()

        study.set_user_attr("objective function", "quadratic function")
        study.set_user_attr("dimensions", 2)
        study.set_user_attr("contributors", ["Akiba", "Sano"])

        assert study.user_attrs == {
            "objective function": "quadratic function",
            "dimensions": 2,
            "contributors": ["Akiba", "Sano"],
        }

Returns:
    A dictionary containing all user attributes.
)rQ   rg   rA   get_study_user_attrsr@   r^   s    r7   
user_attrsStudy.user_attrsF  s'    J }}T]]??OPPr6   z3.1.05.0.0c                t    [         R                  " U R                  R                  U R                  5      5      $ )zWReturn system attributes.

Returns:
    A dictionary containing all system attributes.
)rQ   rg   rA   get_study_system_attrsr@   r^   s    r7   rl   Study.system_attrsm  s&     }}T]]AA$..QRRr6   c                r    U R                   R                  U R                  5      R                  [        5      $ )zReturn metric names.

.. note::
    Use :meth:`~optuna.study.Study.set_metric_names` to set the metric names first.

Returns:
    A list with names for each dimension of the returned values of the objective function.
)rA   r   r@   r   _SYSTEM_ATTR_METRIC_NAMESr^   s    r7   metric_namesStudy.metric_namesx  s)     }}33DNNCGGHabbr6   c	                h    [        U UUUU[        U[        5      (       a  [        U5      OU4UUUS9	  g)a  Optimize an objective function.

Optimization is done by choosing a suitable set of hyperparameter values from a given
range. Uses a sampler which implements the task of value suggestion based on a specified
distribution. The sampler is specified in :func:`~optuna.study.create_study` and the
default choice for the sampler is TPE.
See also :class:`~optuna.samplers.TPESampler` for more details on 'TPE'.

Optimization will be stopped when receiving a termination signal such as SIGINT and
SIGTERM. Unlike other signals, a trial is automatically and cleanly failed when receiving
SIGINT (Ctrl+C). If ``n_jobs`` is greater than one or if another signal than SIGINT
is used, the interrupted trial state won't be properly updated.

Example:

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", -1, 1)
            return x**2


        study = optuna.create_study()
        study.optimize(objective, n_trials=3)

Args:
    func:
        A callable that implements objective function.
    n_trials:
        The number of trials for each process. :obj:`None` represents no limit in terms of
        the number of trials. The study continues to create trials until the number of
        trials reaches ``n_trials``, ``timeout`` period elapses,
        :func:`~optuna.study.Study.stop` is called, or a termination signal such as
        SIGTERM or Ctrl+C is received.

        .. seealso::
            :class:`optuna.study.MaxTrialsCallback` can ensure how many times trials
            will be performed across all processes.
    timeout:
        Stop study after the given number of second(s). :obj:`None` represents no limit in
        terms of elapsed time. The study continues to create trials until the number of
        trials reaches ``n_trials``, ``timeout`` period elapses,
        :func:`~optuna.study.Study.stop` is called or, a termination signal such as
        SIGTERM or Ctrl+C is received.
    n_jobs:
        The number of parallel jobs. If this argument is set to ``-1``, the number is
        set to CPU count.

        .. note::
            ``n_jobs`` allows parallelization using :obj:`threading` and may suffer from
            `Python's GIL <https://wiki.python.org/moin/GlobalInterpreterLock>`__.
            It is recommended to use :ref:`process-based parallelization<distributed>`
            if ``func`` is CPU bound.

    catch:
        A study continues to run even when a trial raises one of the exceptions specified
        in this argument. Default is an empty tuple, i.e. the study will stop for any
        exception except for :class:`~optuna.exceptions.TrialPruned`.
    callbacks:
        List of callback functions that are invoked at the end of each trial. Each function
        must accept two parameters with the following types in this order:
        :class:`~optuna.study.Study` and :class:`~optuna.trial.FrozenTrial`.

        .. seealso::

            See the tutorial of :ref:`optuna_callback` for how to use and implement
            callback functions.

    gc_after_trial:
        Flag to determine whether to automatically run garbage collection after each trial.
        Set to :obj:`True` to run the garbage collection, :obj:`False` otherwise.
        When it runs, it runs a full collection by internally calling :func:`gc.collect`.
        If you see an increase in memory consumption over several trials, try setting this
        flag to :obj:`True`.

        .. seealso::

            :ref:`out-of-memory-gc-collect`

    show_progress_bar:
        Flag to show progress bars or not. To show progress bar, set this :obj:`True`.
        Note that it is disabled when ``n_trials`` is :obj:`None`,
        ``timeout`` is not :obj:`None`, and ``n_jobs`` :math:`\ne 1`.

Raises:
    RuntimeError:
        If nested invocation of this method occurs.
)	studyfuncn_trialstimeoutn_jobscatch	callbacksgc_after_trialshow_progress_barN)r   
isinstancer   tuple)	rJ   r   r   r   r   r   r   r   r   s	            r7   optimizeStudy.optimize  s<    L 	",UH"="=%,E8)/
	
r6   c                   U R                   R                  (       d%  [        U R                  5      (       a  [	        S5        U=(       d    0 nUR                  5        VVs0 s H  u  p#U[        U5      _M     nnnSU R                   l        U R                  5       nUc%  U R                  R                  U R                  5      n[        R                  " X5      nUR                  5        H  u  pgUR                  Xg5        M     U$ s  snnf )a  Create a new trial from which hyperparameters can be suggested.

This method is part of an alternative to :func:`~optuna.study.Study.optimize` that allows
controlling the lifetime of a trial outside the scope of ``func``. Each call to this
method should be followed by a call to :func:`~optuna.study.Study.tell` to finish the
created trial.

.. seealso::

    The :ref:`ask_and_tell` tutorial provides use-cases with examples.

Example:

    Getting the trial object with the :func:`~optuna.study.Study.ask` method.

    .. testcode::

        import optuna


        study = optuna.create_study()

        trial = study.ask()

        x = trial.suggest_float("x", -1, 1)

        study.tell(trial, x**2)

Example:

    Passing previously defined distributions to the :func:`~optuna.study.Study.ask`
    method.

    .. testcode::

        import optuna


        study = optuna.create_study()

        distributions = {
            "optimizer": optuna.distributions.CategoricalDistribution(["adam", "sgd"]),
            "lr": optuna.distributions.FloatDistribution(0.0001, 0.1, log=True),
        }

        # You can pass the distributions previously defined.
        trial = study.ask(fixed_distributions=distributions)

        # `optimizer` and `lr` are already suggested and accessible with `trial.params`.
        assert "optimizer" in trial.params
        assert "lr" in trial.params

Args:
    fixed_distributions:
        A dictionary containing the parameter names and parameter's distributions. Each
        parameter in this dictionary is automatically suggested for the returned trial,
        even when the suggest method is not explicitly invoked by the user. If this
        argument is set to :obj:`None`, no parameter is automatically suggested.

Returns:
    A :class:`~optuna.trial.Trial`.
z@Heartbeat of storage is supposed to be used with Study.optimize.N)rH   r-   r   rA   r   itemsr   r.   _pop_waiting_trial_idcreate_new_trialr@   optunar(   _suggest)rJ   fixed_distributionsr   disttrial_idrn   nameparams           r7   ask	Study.ask  s    @ !!227KDMM7Z7ZZ[17R 1668
8	 >tDD8 	 
 04,--/}}55dnnEHT,.446KDNN4' 7 !
s   Dc                Z    [        U UUUUS9  [        R                  " [        X5      5      $ )a}	  Finish a trial created with :func:`~optuna.study.Study.ask`.

.. seealso::

    The :ref:`ask_and_tell` tutorial provides use-cases with examples.

Example:

    .. testcode::

        import optuna
        from optuna.trial import TrialState


        def f(x):
            return (x - 2) ** 2


        def df(x):
            return 2 * x - 4


        study = optuna.create_study()

        n_trials = 30

        for _ in range(n_trials):
            trial = study.ask()

            lr = trial.suggest_float("lr", 1e-5, 1e-1, log=True)

            # Iterative gradient descent objective function.
            x = 3  # Initial value.
            for step in range(128):
                y = f(x)

                trial.report(y, step=step)

                if trial.should_prune():
                    # Finish the trial with the pruned state.
                    study.tell(trial, state=TrialState.PRUNED)
                    break

                gy = df(x)
                x -= gy * lr
            else:
                # Finish the trial with the final value after all iterations.
                study.tell(trial, y)

Args:
    trial:
        A :class:`~optuna.trial.Trial` object or a trial number.
    values:
        Optional objective value or a sequence of such values in case the study is used
        for multi-objective optimization. Argument must be provided if ``state`` is
        :class:`~optuna.trial.TrialState.COMPLETE` and should be :obj:`None` if ``state``
        is :class:`~optuna.trial.TrialState.FAIL` or
        :class:`~optuna.trial.TrialState.PRUNED`.
    state:
        State to be reported. Must be :obj:`None`,
        :class:`~optuna.trial.TrialState.COMPLETE`,
        :class:`~optuna.trial.TrialState.FAIL` or
        :class:`~optuna.trial.TrialState.PRUNED`.
        If ``state`` is :obj:`None`,
        it will be updated to :class:`~optuna.trial.TrialState.COMPLETE`
        or :class:`~optuna.trial.TrialState.FAIL` depending on whether
        validation for ``values`` reported succeed or not.
    skip_if_finished:
        Flag to control whether exception should be raised when values for already
        finished trial are told. If :obj:`True`, tell is skipped without any error
        when the trial is already finished.

Returns:
    A :class:`~optuna.trial.FrozenTrial` representing the resulting trial.
    A returned trial is deep copied thus user can modify it as needed.
)r   rn   value_or_valuesrS   skip_if_finished)r#   rQ   rg   r"   )rJ   rn   valuesrS   r   s        r7   tell
Study.tellL  s3    h 	"-	
 }}.t;<<r6   c                P    U R                   R                  U R                  X5        g)a  Set a user attribute to the study.

.. seealso::

    See :attr:`~optuna.study.Study.user_attrs` for related attribute.

.. seealso::

    See the recipe on :ref:`attributes`.

Example:

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", 0, 1)
            y = trial.suggest_float("y", 0, 1)
            return x**2 + y**2


        study = optuna.create_study()

        study.set_user_attr("objective function", "quadratic function")
        study.set_user_attr("dimensions", 2)
        study.set_user_attr("contributors", ["Akiba", "Sano"])

        assert study.user_attrs == {
            "objective function": "quadratic function",
            "dimensions": 2,
            "contributors": ["Akiba", "Sano"],
        }

Args:
    key: A key string of the attribute.
    value: A value of the attribute. The value should be JSON serializable.

N)rA   set_study_user_attrr@   rJ   r   rb   s      r7   set_user_attrStudy.set_user_attr  s    T 	))$..#Er6   c                P    U R                   R                  U R                  X5        g)a7  Set a system attribute to the study.

Note that Optuna internally uses this method to save system messages. Please use
:func:`~optuna.study.Study.set_user_attr` to set users' attributes.

Args:
    key: A key string of the attribute.
    value: A value of the attribute. The value should be JSON serializable.

N)rA   set_study_system_attrr@   r   s      r7   set_system_attrStudy.set_system_attr  s     	++DNNCGr6   c                .    [         R                  XU5      $ )aq  Export trials as a pandas DataFrame_.

The DataFrame_ provides various features to analyze studies. It is also useful to draw a
histogram of objective values and to export trials as a CSV file.
If there are no trials, an empty DataFrame_ is returned.

Example:

    .. testcode::

        import optuna
        import pandas


        def objective(trial):
            x = trial.suggest_float("x", -1, 1)
            return x**2


        study = optuna.create_study()
        study.optimize(objective, n_trials=3)

        # Create a dataframe from the study.
        df = study.trials_dataframe()
        assert isinstance(df, pandas.DataFrame)
        assert df.shape[0] == 3  # n_trials.

Args:
    attrs:
        Specifies field names of :class:`~optuna.trial.FrozenTrial` to include them to a
        DataFrame of trials.
    multi_index:
        Specifies whether the returned DataFrame_ employs MultiIndex_ or not. Columns that
        are hierarchical by nature such as ``(params, x)`` will be flattened to
        ``params_x`` when set to :obj:`False`.

Returns:
    A pandas DataFrame_ of trials in the :class:`~optuna.study.Study`.

.. _DataFrame: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html
.. _MultiIndex: https://pandas.pydata.org/pandas-docs/stable/advanced.html

Note:
    If ``value`` is in ``attrs`` during multi-objective optimization, it is implicitly
    replaced with ``values``.

Note:
    If :meth:`~optuna.study.Study.set_metric_names` is called, the ``value`` or ``values``
    is implicitly replaced with the dictionary with the objective name as key and the
    objective value as value.
)
_dataframe_trials_dataframe)rJ   attrsmulti_indexs      r7   trials_dataframeStudy.trials_dataframe  s    D ++DEEr6   c                ^    U R                   R                  (       d  [        S5      eSU l        g)a  Exit from the current optimization loop after the running trials finish.

This method lets the running :meth:`~optuna.study.Study.optimize` method return
immediately after all trials which the :meth:`~optuna.study.Study.optimize` method
spawned finishes.
This method does not affect any behaviors of parallel or successive study processes.
This method only works when it is called inside an objective function or callback.

Example:

    .. testcode::

        import optuna


        def objective(trial):
            if trial.number == 4:
                trial.study.stop()
            x = trial.suggest_float("x", 0, 10)
            return x**2


        study = optuna.create_study()
        study.optimize(objective, n_trials=10)
        assert len(study.trials) == 5

zR`Study.stop` is supposed to be invoked inside an objective function or a callback.TN)rH   r-   rz   rI   r^   s    r7   stop
Study.stop(  s.    : !!22 
 r6   c                   [        U[        5      (       d  [        S5      eU(       a0  U R                  U5      (       a  [        R                  SU S35        gU R                  [        [        R                  SU0US95        g)a  Enqueue a trial with given parameter values.

You can fix the next sampling parameters which will be evaluated in your
objective function.

Example:

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", 0, 10)
            return x**2


        study = optuna.create_study()
        study.enqueue_trial({"x": 5})
        study.enqueue_trial({"x": 0}, user_attrs={"memo": "optimal"})
        study.optimize(objective, n_trials=2)

        assert study.trials[0].params == {"x": 5}
        assert study.trials[1].params == {"x": 0}
        assert study.trials[1].user_attrs == {"memo": "optimal"}

Args:
    params:
        Parameter values to pass your objective function.
    user_attrs:
        A dictionary of user-specific attributes other than ``params``.
    skip_if_exists:
        When :obj:`True`, prevents duplicate trials from being enqueued again.

        .. note::
            This method might produce duplicated trials if called simultaneously
            by multiple processes at the same time with same ``params`` dict.

.. seealso::

    Please refer to :ref:`enqueue_trial_tutorial` for the tutorial of specifying
    hyperparameters manually.
zparams must be a dictionary.zTrial with params z" already exists. Skipping enqueue.Nfixed_params)rS   rl   r   )
r   dict	TypeError_should_skip_enqueue_loggerinfo	add_trialr$   r%   WAITING)rJ   r]   r   skip_if_existss       r7   enqueue_trialStudy.enqueue_trialM  ss    d &$'':;;d77??LL-fX5WXY ((,f5%	
r6   c                N   UR                  5         UR                  bd  [        U R                  5      [        UR                  5      :w  a8  [	        S[        UR                  5       S[        U R                  5       S35      eU R
                  R                  U R                  US9  g)a  Add trial to study.

The trial is validated before being added.

Example:

    .. testcode::

        import optuna
        from optuna.distributions import FloatDistribution


        def objective(trial):
            x = trial.suggest_float("x", 0, 10)
            return x**2


        study = optuna.create_study()
        assert len(study.trials) == 0

        trial = optuna.trial.create_trial(
            params={"x": 2.0},
            distributions={"x": FloatDistribution(0, 10)},
            value=4.0,
        )

        study.add_trial(trial)
        assert len(study.trials) == 1

        study.optimize(objective, n_trials=3)
        assert len(study.trials) == 4

        other_study = optuna.create_study()

        for trial in study.trials:
            other_study.add_trial(trial)
        assert len(other_study.trials) == len(study.trials)

        other_study.optimize(objective, n_trials=2)
        assert len(other_study.trials) == len(study.trials) + 2

.. seealso::

    This method should in general be used to add already evaluated trials
    (``trial.state.is_finished() == True``). To queue trials for evaluation,
    please refer to :func:`~optuna.study.Study.enqueue_trial`.

.. seealso::

    See :func:`~optuna.trial.create_trial` for how to create trials.

.. seealso::
    Please refer to :ref:`add_trial_tutorial` for the tutorial of specifying
    hyperparameters with the evaluated value manually.

Args:
    trial: Trial to add.

NThe added trial has : values, which is different from the number of objectives / in the study (determined by Study.directions).template_trial)	_validater   r   r{   r   rA   r   r@   rJ   rn   s     r7   r   Study.add_trial  s    z 	<<#DOO(<ELL@Q(Q&s5<<'8&9 :((+DOO(<'= >%%  	&&t~~e&Lr6   c                8    U H  nU R                  U5        M     g)a  Add trials to study.

The trials are validated before being added.

Example:

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", 0, 10)
            return x**2


        study = optuna.create_study()
        study.optimize(objective, n_trials=3)
        assert len(study.trials) == 3

        other_study = optuna.create_study()
        other_study.add_trials(study.trials)
        assert len(other_study.trials) == len(study.trials)

        other_study.optimize(objective, n_trials=2)
        assert len(other_study.trials) == len(study.trials) + 2

.. seealso::

    See :func:`~optuna.study.Study.add_trial` for addition of each trial.

Args:
    trials: Trials to add.

N)r   )rJ   rt   rn   s      r7   
add_trialsStudy.add_trials  s    J ENN5! r6   z3.2.0c                    [        U R                  5      [        U5      :w  a  [        S5      eU R                  R	                  U R
                  [        U5        g)a  Set metric names.

This method names each dimension of the returned values of the objective function.
It is particularly useful in multi-objective optimization. The metric names are
mainly referenced by the visualization functions.

Example:

    .. testcode::

        import optuna
        import pandas


        def objective(trial):
            x = trial.suggest_float("x", 0, 10)
            return x**2, x + 1


        study = optuna.create_study(directions=["minimize", "minimize"])
        study.set_metric_names(["x**2", "x+1"])
        study.optimize(objective, n_trials=3)

        df = study.trials_dataframe(multi_index=True)
        assert isinstance(df, pandas.DataFrame)
        assert list(df.get("values").keys()) == ["x**2", "x+1"]

.. seealso::
    The names set by this method are used in :meth:`~optuna.study.Study.trials_dataframe`
    and :func:`~optuna.visualization.plot_pareto_front`.

Args:
    metric_names: A list of metric names for the objective function.
zCThe number of objectives must match the length of the metric names.N)r   r{   r   rA   r   r@   r   )rJ   r   s     r7   set_metric_namesStudy.set_metric_names  sE    H t3|#44bcc++NN5|	
r6   c                2    [        U R                  5      S:  $ )zReturn :obj:`True` if the study has multiple objectives.

Returns:
    A boolean value indicates if `self.directions` has more than 1 element or not.
   )r   r{   r^   s    r7   ry   Study._is_multi_objective)  s     4??#a''r6   c                   U R                   R                  U R                  S[        R                  4S9 Hm  n U R                   R                  UR                  [        R                  S9(       d  M=   [        R                  SUR                   S35        UR                  s  $    g ! [        R                   a     M  f = f)NFr   )rS   Trial z popped from the trial queue.)rA   r   r@   r%   r   set_trial_state_values	_trial_idRUNNINGr   UpdateFinishedTrialErrorr   debugnumberr   s     r7   r   Study._pop_waiting_trial_id2  s    ]]11NNUJ4F4F3H 2 
E}};;OO$,, <  	 MMF5<<.0MNO??"%
(  66 s   7B''B?>B?c                   U R                  SS9 GH-  nUR                  R                  SUR                  5      nUR	                  5       UR	                  5       :w  a  MN  / nUR                  5        H  u  pVX5   n[        U[        U5      5      (       d  UR                  S5        M6  [        U[        5      (       aN  [        R                  " [        U5      5      =(       d(    [        R                  " [        U5      [        U5      SS9OXg:H  nUR                  [        U5      5        M     [        U5      (       d  GM.    g   g)NFrf   r   r   )atolT)rr   rl   r   r]   keysr   r   typeappendr	   npisnanr   iscloser,   all)	rJ   r]   rn   trial_paramsrepeated_params
param_nameparam_valueexisting_paramis_repeateds	            r7   r   Study._should_skip_enqueueI  s   __e_4E --11.%,,OL  "fkkm3*,O+1<<>'
!-!9!+tN/CDD
 $**51
 "+t44 HHU;/0 Wzz%"4eN6KRUV$6	   &&tK'89! ,:$ ?##5 58 r6   c           	     6   [         R                  [        R                  5      (       d  g U R                  n[        U5      S:  aE  Uc  UnO[        XA5       VVs0 s H  u  pgXg_M	     nnn[         R                  SU SU SU S35        g [        U5      S:X  ae  Uc  US   nO
US   US   0nSU SU SU S3n	 U R                  SS	9n
U	S
U
R                   SU
R                   S3-  n	[         R                  U	5        g  S5       es  snnf ! [         a     N/f = f)Nr  r  z finished with values: z and parameters: .r   z finished with value: Frf   z Best is trial z with value: zShould not reach.)r   isEnabledForr   INFOr   r   zipr   rh   r  rb   r   )rJ   r   r  r]   r   trial_valuesr   rb   trial_valuemessager\   s              r7   _log_completed_trialStudy._log_completed_trialh  sK    ##GLL11((v;?#%?B<?XY?X?XYLL 7~EVW]V^^_` [A#$Qi+Aq	:  6{mCTU[T\\]^ !1151A
_Z->->,?}ZM]M]L^^_`` LL!---5-  Z"  s   D9/D 
DD)rC   rI   rA   r@   rH   rG   rE   r=   )NN)
r=   strrK   str | storages.BaseStoragerE   'samplers.BaseSampler' | NonerG   pruners.BasePruner | NonereturnNone)r+  dict[Any, Any])rS   r-  r+  r,  )r+  dict[str, Any])r+  r   )r+  r'   )r+  list[FrozenTrial])r+  r    )r+  zlist[StudyDirection])TN)rg   r,   r   Container[TrialState] | Noner+  r/  )TNF)rg   r,   r   r0  r   r,   r+  r/  )rg   r,   r+  r'   )r+  zlist[str] | None)NNr  r/   NFF)r   ObjectiveFuncTyper   
int | Noner   zfloat | Noner   intr   z+Iterable[type[Exception]] | type[Exception]r   z5Iterable[Callable[[Study, FrozenTrial], None]] | Noner   r,   r   r,   r+  r,  rW   )r   z"dict[str, BaseDistribution] | Noner+  r(   )NNF)
rn   zTrial | intr   zfloat | Sequence[float] | NonerS   zTrialState | Noner   r,   r+  r'   )r   r'  rb   r
   r+  r,  ))	r  rb   datetime_startdatetime_completedurationr]   r   rl   rS   F)r   ztuple[str, ...]r   r,   r+  z'pd.DataFrame')r+  r,  r<   )r]   r.  r   zdict[str, Any] | Noner   r,   r+  r,  )rn   r'   r+  r,  )rt   zIterable[FrozenTrial]r+  r,  )r   	list[str]r+  r,  )r+  r,   )r+  r2  )r]   zMapping[str, JSONSerializable]r+  r,   )r   zlist[float]r  r3  r]   r.  r+  r,  )(r0   r1   r2   r3   __doc__rM   rT   rY   propertyr_   rc   r\   rv   r|   r{   rt   rr   r   rh   r   r   rl   r   r   r   r   r   r   r   r   r   r   r   r   r   ry   r   r   r%  r5   r/   r6   r7   r9   r9   C   sZ   	 26,0   ,  /	 
 *  
 (
: & &    3 3$ R R$ " "*     ; ;& /3(C(C -(C 
	(CX /3	^^ -^ 	^
 
^(#EJ $Q $QL Wg&S ' S 	c 	c  $ $=?KO$"'p
p
 p
 	p

 p
 ;p
 Ip
 p
  p
 
p
dTr 26#'!&[=[= /[= !	[=
 [= 
[=z*FX Wg&H 'H 
"
 "BFBF BF 
BFH#P -1$	?
?
 *?
 	?

 
?
BFMP&"P w(
  (
T(.>#.!#.+.#.8F#.	#.r6   r9   )rK   rE   rG   r=   r|   load_if_existsz3.0.0r   )previous_positional_arg_namesdeprecated_versionremoved_versionF)rK   rE   rG   r=   r|   r:  r{   rK   r=   c                R   Uc  Uc  S/nO^Ub  Ub  [        S5      eUb9  [        U[        5      (       a   [        U[        5      (       d  [        S5      eU/nOUb  [	        U5      nO e[        U5      S:  a  [        S5      e[        S U 5       5      (       a  [        SU S35      eU Vs/ s H1  n[        U[        5      (       a  UO[        UR                  5          PM3     nn[        R                  " U 5      n  U R                  X5      n	Uc$  [        U5      S:  a  ["        R$                  " 5       nU R'                  U	5      n[)        X0XS9n
U
$ s  snf ! [        R                   a:    U(       a1  Uc   e[        R                  S	U S
35        U R!                  U5      n	 Ne f = f)aQ  Create a new :class:`~optuna.study.Study`.

Example:

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", 0, 10)
            return x**2


        study = optuna.create_study()
        study.optimize(objective, n_trials=3)

Args:
    storage:
        Database URL. If this argument is set to None,
        :class:`~optuna.storages.InMemoryStorage` is used, and the
        :class:`~optuna.study.Study` will not be persistent.

        .. note::
            When a database URL is passed, Optuna internally uses `SQLAlchemy`_ to handle
            the database. Please refer to `SQLAlchemy's document`_ for further details.
            If you want to specify non-default options to `SQLAlchemy Engine`_, you can
            instantiate :class:`~optuna.storages.RDBStorage` with your desired options and
            pass it to the ``storage`` argument instead of a URL.

         .. _SQLAlchemy: https://www.sqlalchemy.org/
         .. _SQLAlchemy's document:
             https://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls
         .. _SQLAlchemy Engine: https://docs.sqlalchemy.org/en/latest/core/engines.html

    sampler:
        A sampler object that implements background algorithm for value suggestion.
        If :obj:`None` is specified, :class:`~optuna.samplers.TPESampler` is used during
        single-objective optimization and :class:`~optuna.samplers.NSGAIISampler` during
        multi-objective optimization. See also :class:`~optuna.samplers`.
    pruner:
        A pruner object that decides early stopping of unpromising trials. If :obj:`None`
        is specified, :class:`~optuna.pruners.MedianPruner` is used as the default. See
        also :class:`~optuna.pruners`.
    study_name:
        Study's name. If this argument is set to None, a unique name is generated
        automatically.
    direction:
        Direction of optimization. Set ``minimize`` for minimization and ``maximize`` for
        maximization. You can also pass the corresponding :class:`~optuna.study.StudyDirection`
        object. ``direction`` and ``directions`` must not be specified at the same time.

        .. note::
            If none of `direction` and `directions` are specified, the direction of the study
            is set to "minimize".
    load_if_exists:
        Flag to control the behavior to handle a conflict of study names.
        In the case where a study named ``study_name`` already exists in the ``storage``,
        a :class:`~optuna.exceptions.DuplicatedStudyError` is raised if ``load_if_exists`` is
        set to :obj:`False`.
        Otherwise, the creation of the study is skipped, and the existing one is returned.
    directions:
        A sequence of directions during multi-objective optimization.
        ``direction`` and ``directions`` must not be specified at the same time.

Returns:
    A :class:`~optuna.study.Study` object.

See also:
    :func:`optuna.create_study` is an alias of :func:`optuna.study.create_study`.

See also:
    The :ref:`rdb` tutorial provides concrete examples to save and resume optimization using
    RDB.

minimizez1Specify only one of `direction` and `directions`.zIUse `directions` instead of `direction` for multi-objective optimization.r  z0The number of objectives must be greater than 0.c              3  l   #    U  H*  nUS S[         R                  [         R                  4;  v   M,     g7f)r?  maximizeN)r    MINIMIZEr   )rm   ds     r7   ro   create_study.<locals>.<genexpr>  s1      A 	
*j.*A*A>CZCZ[[s   24zA`directions` must be a list of `minimize` or `maximize`, but got zT. For single-objective optimization, please use `direction` instead of `directions`.z#Using an existing study with name 'z ' instead of creating a new one.r=   rK   rE   rG   )r   r   r   r'  listr   rs   r    upperr   r>   create_new_studyr   DuplicatedStudyErrorr   r   r?   r   NSGAIISamplerget_study_name_from_idr9   )rK   rE   rG   r=   r|   r:  r{   rC  direction_objectsrL   r   s              r7   create_studyrM    s   F Z/ \
		:#9LMM		i**:i3M3M[   [
		*%
u
:KLL	  
 
 OPZ| \a a
 	
 T^S]aZ>**qwwy0IIS]   ""7+G++,=J 301A5((*//9JZ'YEL1 ** 	)))LL5j\Aab 55jAH	s   -8E>E A
F&$F&rE  )rE   rG   c                   U cG  [        U5      n[        U5      S:w  a  [        SU S35      eUS   n [        R	                  SU  S35        [        XX#S9nUc3  [        UR                  5      S:  a  [        R                  " 5       Ul	        U$ )a  Load the existing :class:`~optuna.study.Study` that has the specified name.

Example:

    .. testsetup::

        import os

        if os.path.exists("example.db"):
            raise RuntimeError("'example.db' already exists. Please remove it.")

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", 0, 10)
            return x**2


        study = optuna.create_study(storage="sqlite:///example.db", study_name="my_study")
        study.optimize(objective, n_trials=3)

        loaded_study = optuna.load_study(study_name="my_study", storage="sqlite:///example.db")
        assert len(loaded_study.trials) == len(study.trials)

    .. testcleanup::

        os.remove("example.db")

Args:
    study_name:
        Study's name. Each study has a unique name as an identifier. If :obj:`None`, checks
        whether the storage contains a single study, and if so loads that study.
        ``study_name`` is required if there are multiple studies in the storage.
    storage:
        Database URL such as ``sqlite:///example.db``. Please see also the documentation of
        :func:`~optuna.study.create_study` for further details.
    sampler:
        A sampler object that implements background algorithm for value suggestion.
        If :obj:`None` is specified, :class:`~optuna.samplers.TPESampler` is used
        as the default. See also :class:`~optuna.samplers`.
    pruner:
        A pruner object that decides early stopping of unpromising trials.
        If :obj:`None` is specified, :class:`~optuna.pruners.MedianPruner` is used
        as the default. See also :class:`~optuna.pruners`.

Returns:
    A :class:`~optuna.study.Study` object.

See also:
    :func:`optuna.load_study` is an alias of :func:`optuna.study.load_study`.

r  z5Could not determine the study name since the storage z8 does not contain exactly 1 study. Specify `study_name`.r   z+Study name was omitted but trying to load 'z7' because that was the only study found in the storage.rE  )
get_all_study_namesr   r   r   r   r9   r{   r   rJ  rE   )r=   rK   rE   rG   study_namesr   s         r7   
load_studyrQ  &  s    P )'2{q Gy QA A  !^
9* F* *	

 Z'YE3u//014 ..0Lr6   c                t    [         R                  " U5      nUR                  U 5      nUR                  U5        g)a  Delete a :class:`~optuna.study.Study` object.

Example:

    .. testsetup::

        import os

        if os.path.exists("example.db"):
            raise RuntimeError("'example.db' already exists. Please remove it.")

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", -10, 10)
            return (x - 2) ** 2


        study = optuna.create_study(study_name="example-study", storage="sqlite:///example.db")
        study.optimize(objective, n_trials=3)

        optuna.delete_study(study_name="example-study", storage="sqlite:///example.db")

    .. testcleanup::

        os.remove("example.db")

Args:
    study_name:
        Study's name.
    storage:
        Database URL such as ``sqlite:///example.db``. Please see also the documentation of
        :func:`~optuna.study.create_study` for further details.

See also:
    :func:`optuna.delete_study` is an alias of :func:`optuna.study.delete_study`.

N)r   r>   r?   delete_study)r=   rK   rL   s      r7   rS  rS    s3    n ""7+G--j9H"r6   )from_study_namefrom_storage
to_storageto_study_name   )r;  warning_stacklevelr<  r=  )rW  c           	        [        XS9n[        U=(       d    U UUR                  SS9nUR                  R	                  UR
                  5      R                  5        H+  u  pgUR                  R                  UR
                  Xg5        M-     UR                  R                  5        H  u  pgUR                  Xg5        M     UR                  SS9 H  nUR                  bd  [        UR                  5      [        UR                  5      :w  a8  [        S[        UR                  5       S[        UR                  5       S35      eUR                  R                  UR
                  US	9  M     g)
al  Copy study from one storage to another.

The direction(s) of the objective(s) in the study, trials, user attributes and system
attributes are copied.

.. note::
    :func:`~optuna.copy_study` copies a study even if the optimization is working on.
    It means users will get a copied study that contains a trial that is not finished.

Example:

    .. testsetup::

        import os

        if os.path.exists("example.db"):
            raise RuntimeError("'example.db' already exists. Please remove it.")
        if os.path.exists("example_copy.db"):
            raise RuntimeError("'example_copy.db' already exists. Please remove it.")

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", -10, 10)
            return (x - 2) ** 2


        study = optuna.create_study(
            study_name="example-study",
            storage="sqlite:///example.db",
        )
        study.optimize(objective, n_trials=3)

        optuna.copy_study(
            from_study_name="example-study",
            from_storage="sqlite:///example.db",
            to_storage="sqlite:///example_copy.db",
        )

        study = optuna.load_study(
            study_name=None,
            storage="sqlite:///example_copy.db",
        )

    .. testcleanup::

        os.remove("example.db")
        os.remove("example_copy.db")

Args:
    from_study_name:
        Name of study.
    from_storage:
        Source database URL such as ``sqlite:///example.db``. Please see also the
        documentation of :func:`~optuna.study.create_study` for further details.
    to_storage:
        Destination database URL.
    to_study_name:
        Name of the created study. If omitted, ``from_study_name`` is used.

Raises:
    :class:`~optuna.exceptions.DuplicatedStudyError`:
        If a study with a conflicting name already exists in the destination storage.

)r=   rK   F)r=   rK   r{   r:  rf   Nr   r   r   r   )rQ  rM  r{   rA   r   r@   r   r   r   r   rr   r   r   r   r   )	rT  rU  rV  rW  
from_studyto_studyr   rb   rn   s	            r7   
copy_studyr]    sE   n MJ 3O((	H !))@@AUAUV\\^
//0B0BCO _ !++113
s* 4 &&&6<<#H,?,?(@CDU(U&s5<<'8&9 :((+H,?,?(@'A B%% 
 	**8+=+=e*T 7r6   c                   [         R                  " U 5      n U R                  5       n/ nU GHR  nU R                  UR                  5      nU Vs/ s H$  ofR
                  [        R                  :X  d  M"  UPM&     nn[        U5      n[        UR                  5      S:X  aS  UR                  n	Sn
U(       a;  [        U5      S:w  a,  U	[        R                  :X  a  [        US S9nO[        US S9nOSnOSn	UR                  n
Sn[        U Vs/ s H  ofR                  c  M  UR                  PM     snSS9nUR!                  [#        UR$                  U	UUR&                  UR(                  UUUR                  U
S9	5        GMU     U$ s  snf s  snf )	az  Get all history of studies stored in a specified storage.

Example:

    .. testsetup::

        import os

        if os.path.exists("example.db"):
            raise RuntimeError("'example.db' already exists. Please remove it.")

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", -10, 10)
            return (x - 2) ** 2


        study = optuna.create_study(study_name="example-study", storage="sqlite:///example.db")
        study.optimize(objective, n_trials=3)

        study_summaries = optuna.study.get_all_study_summaries(storage="sqlite:///example.db")
        assert len(study_summaries) == 1

        study_summary = study_summaries[0]
        assert study_summary.study_name == "example-study"

    .. testcleanup::

        os.remove("example.db")

Args:
    storage:
        Database URL such as ``sqlite:///example.db``. Please see also the documentation of
        :func:`~optuna.study.create_study` for further details.
    include_best_trial:
        Include the best trials if exist. It potentially increases the number of queries and
        may take longer to fetch summaries depending on the storage.

Returns:
    List of study history summarized as :class:`~optuna.study.StudySummary` objects.

See also:
    :func:`optuna.get_all_study_summaries` is an alias of
    :func:`optuna.study.get_all_study_summaries`.

r  Nr   c                6    [        [        U R                  5      $ rW   r   r   s    r7   r   )get_all_study_summaries.<locals>.<lambda>r      T%QRQXQXEYr6   r   c                6    [        [        U R                  5      $ rW   r   r   s    r7   r   r`  t  ra  r6   )default)	r=   r|   r\   r   rl   r   r4  rL   r{   )r   r>   get_all_studiesr   r@   rS   r%   r   r   r{   r|   r    r   r   r   r4  r  r!   r=   r   rl   )rK   include_best_trialfrozen_studiesstudy_summariess
all_trialsr   completed_trialsr   r|   r{   r\   r4  s                r7   get_all_study_summariesrk  -  sk   l ""7+G,,.NO++AKK8
'1Tz!WW
@S@S5SAzTz?q||!IJ!c*:&;q&@ 7 77!$%5;Y!ZJ!$%5;Y!ZJ!
IJJ'1Rz!5E5EQzR\`
 	<<#%<<^^!-%
	
3 N K U( Ss   !F3FF	
F	
c                    [         R                  " U 5      n U R                  5        Vs/ s H  oR                  PM     nnU$ s  snf )aG  Get all study names stored in a specified storage.

Example:

    .. testsetup::

        import os

        if os.path.exists("example.db"):
            raise RuntimeError("'example.db' already exists. Please remove it.")

    .. testcode::

        import optuna


        def objective(trial):
            x = trial.suggest_float("x", -10, 10)
            return (x - 2) ** 2


        study = optuna.create_study(study_name="example-study", storage="sqlite:///example.db")
        study.optimize(objective, n_trials=3)

        study_names = optuna.study.get_all_study_names(storage="sqlite:///example.db")
        assert len(study_names) == 1

        assert study_names[0] == "example-study"

    .. testcleanup::

        os.remove("example.db")

Args:
    storage:
        Database URL such as ``sqlite:///example.db``. Please see also the documentation of
        :func:`~optuna.study.create_study` for further details.

Returns:
    List of all study names in the storage.

See also:
    :func:`optuna.get_all_study_names` is an alias of
    :func:`optuna.study.get_all_study_names`.

)r   r>   rd  r=   )rK   r   rP  s      r7   rO  rO    sD    ` ""7+G181H1H1JK1J##1JKK Ls   A)rK   z!str | storages.BaseStorage | NonerE   r)  rG   r*  r=   
str | Noner|   zstr | StudyDirection | Noner:  r,   r{   z%Sequence[str | StudyDirection] | Noner+  r9   )
r=   rm  rK   r(  rE   r)  rG   r*  r+  r9   )r=   r'  rK   r(  r+  r,  )
rT  r'  rU  r(  rV  r(  rW  rm  r+  r,  )T)rK   r(  re  r,   r+  zlist[StudySummary])rK   r(  r+  r7  )O
__future__r   collections.abcr   r   r   r   r   rQ   numbersr	   	threadingtypingr
   r   r   r   numpyr  r   r   r   r   r   r   optuna._convert_positional_argsr   optuna._deprecatedr   optuna._experimentalr   optuna._importsr   optuna._typingr   optuna._warningsr   optuna.distributionsr   r   optuna.storages._heartbeatr   &optuna.study._constrained_optimizationr   r   optuna.study._multi_objectiver   optuna.study._optimizer   optuna.study._study_directionr    optuna.study._study_summaryr!   optuna.study._tellr"   r#   optuna.trialr$   r%   r   optuna.study._dataframer&   r'   r(   r   r1  r   
get_loggerr0   r   localr*   r9   rM  rQ  rS  r]  rk  rO  r/   r6   r7   <module>r     s   " $ % $ # $                C . 2 ' + ( N 1 ; C G B , 8 4 0 1 % # 23
*(" gYeXe_.D(EEF  1  

X
&7 7
H. H.V" #  26-1(,!-1 8<I.I +I &	I
 I +I I 6I IIX # 	 .2(,NN (N +	N
 &N N	Nb # 1#1# (1# 
	1#1#h # 
  !%bUbU -bU +	bU
 bU 
bU
bUL EIa'a=AaaH3r6   