§
    &`ƒie  ã                   óh   — d dl mZmZmZmZmZ d dlmZ erd dlm	Z	 e G d„ d¦  «        ¦   «         Z
dS )é    )ÚTYPE_CHECKINGÚDictÚListÚOptionalÚUnion)ÚDeveloperAPI)Ú
Experimentc                   ó$  — e Zd ZdZdZdZed„ ¦   «         Zdee	         dee	         de
defd	„Zed
„ ¦   «         Zdeded         e
e	e
f         f         fd„Zd„ Zde	de
fd„Z	 dde	dee
         defd„Zdefd„Zd„ Zde	defd„Zde	fd„Zde	fd„ZdS )ÚSearchAlgorithmaÂ  Interface of an event handler API for hyperparameter search.

    Unlike TrialSchedulers, SearchAlgorithms will not have the ability
    to modify the execution (i.e., stop and pause trials).

    Trials added manually (i.e., via the Client API) will also notify
    this class upon new events, so custom search algorithms should
    maintain a list of trials ID generated from this class.

    See also: `ray.tune.search.BasicVariantGenerator`.
    FNc                 ó   — | j         S )N©Ú_metric©Úselfs    út/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/tune/search/search_algorithm.pyÚmetriczSearchAlgorithm.metric   s
   € àŒ|Ðó    r   ÚmodeÚconfigÚreturnc                 ó.   — | j         r|rdS |r|| _         dS )ay  Pass search properties to search algorithm.

        This method acts as an alternative to instantiating search algorithms
        with their own specific search spaces. Instead they can accept a
        Tune config through this method.

        The search algorithm will usually pass this method to their
        ``Searcher`` instance.

        Args:
            metric: Metric to optimize
            mode: One of ["min", "max"]. Direction to optimize.
            config: Tune config dict.
            **spec: Any kwargs for forward compatiblity.
                Info like Experiment.PUBLIC_KEYS is provided through here.
        FTr   )r   r   r   r   Úspecs        r   Úset_search_propertiesz%SearchAlgorithm.set_search_properties   s.   € ð& Œ<ð 	˜Fð 	Ø5Øð 	"Ø!ˆDŒLØˆtr   c                 ó   — dS )z*Get number of total trials to be generatedr   © r   s    r   Útotal_sampleszSearchAlgorithm.total_samples8   s	   € ð ˆqr   Úexperimentsr	   c                 ó   — t           ‚)zqTracks given experiment specifications.

        Arguments:
            experiments: Experiments to run.
        ©ÚNotImplementedError)r   r   s     r   Úadd_configurationsz"SearchAlgorithm.add_configurations=   s
   € õ "Ð!r   c                 ó   — t           ‚)z„Returns single Trial object to be queued into the TrialRunner.

        Returns:
            trial: Returns a Trial object.
        r   r   s    r   Ú
next_trialzSearchAlgorithm.next_trialG   s
   € õ "Ð!r   Útrial_idÚresultc                 ó   — dS )zõCalled on each intermediate result returned by a trial.

        This will only be called when the trial is in the RUNNING state.

        Arguments:
            trial_id: Identifier for the trial.
            result: Result dictionary.
        Nr   )r   r$   r%   s      r   Úon_trial_resultzSearchAlgorithm.on_trial_resultO   s	   € ð 	ˆr   Úerrorc                 ó   — dS )aÇ  Notification for the completion of trial.

        Arguments:
            trial_id: Identifier for the trial.
            result: Defaults to None. A dict will
                be provided with this notification when the trial is in
                the RUNNING state AND either completes naturally or
                by manual termination.
            error: Defaults to False. True if the trial is in
                the RUNNING state and errors.
        Nr   )r   r$   r%   r(   s       r   Úon_trial_completez!SearchAlgorithm.on_trial_completeZ   s	   € ð 	ˆr   c                 ó   — | j         S )zŠReturns True if no trials left to be queued into TrialRunner.

        Can return True before all trials have finished executing.
        ©Ú	_finishedr   s    r   Úis_finishedzSearchAlgorithm.is_finishedj   s   € ð
 Œ~Ðr   c                 ó   — d| _         dS )z'Marks the search algorithm as finished.TNr,   r   s    r   Úset_finishedzSearchAlgorithm.set_finishedq   s   € àˆŒˆˆr   Údirpathc                 ó   — dS )z4Should return False if restoring is not implemented.Fr   ©r   r1   s     r   Úhas_checkpointzSearchAlgorithm.has_checkpointu   s   € àˆur   c                 ó   — dS )zSaves a search algorithm.Nr   )r   r1   Úkwargss      r   Úsave_to_dirzSearchAlgorithm.save_to_diry   ó   € àˆr   c                 ó   — dS )z9Restores a search algorithm along with its wrapped state.Nr   r3   s     r   Úrestore_from_dirz SearchAlgorithm.restore_from_dir}   r8   r   )NF)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r-   r   Úpropertyr   r   Ústrr   Úboolr   r   r   r   r!   r#   r'   r*   r.   r0   r4   r7   r:   r   r   r   r   r   	   s¾  € € € € € ð
ð 
ð €Ià€Gàðð ñ „XððØ˜s”mðØ+3°C¬=ðØBFðà	ðð ð ð ð2 ðð ñ „Xðð"Ø  ¨t°LÔ/AÀ4ÈÈTÈ	Ä?Ð!RÔSð"ð "ð "ð "ð"ð "ð "ð	¨ð 	°Tð 	ð 	ð 	ð 	ð KPðð ØðØ%-¨d¤^ðØCGðð ð ð ð ˜Tð ð ð ð ðð ð ð cð ¨dð ð ð ð ð 3ð ð ð ð ð¨ð ð ð ð ð ð r   r   N)Útypingr   r   r   r   r   Úray.util.annotationsr   Úray.tune.experimentr	   r   r   r   r   ú<module>rE      s£   ðØ =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ð =à -Ð -Ð -Ð -Ð -Ð -àð /Ø.Ð.Ð.Ð.Ð.Ð.ð ðuð uð uð uð uñ uô uñ „ðuð uð ur   