
    &`i                     *   d Z ddlZddlZddlmZ ddlmZ ddlmZ d Zd Z	dd	Z
ed
k    rfddlZ ej                    Ze                    ddd           e                                \  ZZ ej        d            e
ej                   dS dS )zThis example demonstrates the usage of Optuna with Ray Tune for
multi-objective optimization.

Please note that schedulers may not work correctly with multi-objective
optimization.

Requires the Optuna library to be installed (`pip install optuna`).
    N)tune)ConcurrencyLimiter)OptunaSearchc                 *    d|| z  dz  z   dz  |dz  z   S )N皙?d    )stepwidthheights      /home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/tune/examples/optuna_multiobjective_example.pyevaluation_fnr      s$    %$,$$"-<<    c                     | d         | d         }}t          | d                   D ]B}t          |||          }t          j        ||||z  d           t	          j        d           Cd S )Nr   r   steps)
iterationslossgainr   )ranger   r   reporttimesleep)configr   r   r   intermediate_scores        r   easy_objectiver      s    7OVH%56EfWo&&  *4??"**U2 	
 	
 	
 	
3 r   Fc                    t          ddgddg          }t          |d          }t          j        t          t          j        || rdnd	
          d	t          j        dd          t          j        dd	          t          j        ddg          d          }|                                }t          d|
                    dd          j                   t          d|
                    dd          j                   d S )Nr   r   minmax)metricmode   )max_concurrent
   r   )
search_algnum_samplesr      irelutanh)r   r   r   
activation)tune_configparam_spacez*Best hyperparameters for loss found were: z*Best hyperparameters for gain found were: )r   r   r   Tunerr   
TuneConfiguniformchoicefitprintget_best_resultr   )
smoke_testalgotunerresultss       r   run_optuna_tuner8   '   s   /uenEEEDd1555DJO(1c
 
 

 \!R((l4--+vv&677
 
  E iikkG	4..5   
4..5    r   __main__z--smoke-test
store_truezFinish quickly for testing)actionhelp)configure_logging)r4   )F)__doc__r   rayr   ray.tune.searchr   ray.tune.search.optunar   r   r   r8   __name__argparseArgumentParserparseradd_argumentparse_known_argsargs_initr4   r
   r   r   <module>rK      s%     



       . . . . . . / / / / / /= = =  $   : zOOO$X$&&F
|2N     %%''GD!CHu%%%%Ot////// r   