
    -jiJ                    B   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
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  \R0                  " 5       (       a  S SKJr  \" \5      r " S S\5      r\	" S5            SS j5       r    SS jr      SS jrg)    )annotations)Sequence)
NamedTupleN)experimental_func)compute_hypervolume)
get_logger)_CONSTRAINTS_KEY)Study)StudyDirection)
TrialState)_imports)goc                  *    \ rS rSr% S\S'   S\S'   Srg)_HypervolumeHistoryInfo   z	list[int]trial_numberszlist[float]values N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r       c/home/james-whalen/.local/lib/python3.13/site-packages/optuna/visualization/_hypervolume_history.pyr   r      s    r   r   z3.3.0c                6   [         R                  " 5         U R                  5       (       d  [        S5      e[	        U5      [	        U R
                  5      :w  a  [        S5      e[        U [        R                  " U[        R                  S95      n[        U5      $ )a  Plot hypervolume history of all trials in a study.

Args:
    study:
        A :class:`~optuna.study.Study` object whose trials are plotted for their hypervolumes.
        The number of objectives must be 2 or more.

    reference_point:
        A reference point to use for hypervolume computation.
        The dimension of the reference point must be the same as the number of objectives.

Returns:
    A :class:`plotly.graph_objects.Figure` object.
zoStudy must be multi-objective. For single-objective optimization, please use plot_optimization_history instead.zRThe dimension of the reference point must be the same as the number of objectives.)dtype)r   check_is_multi_objective
ValueErrorlen
directions_get_hypervolume_history_infonpasarrayfloat64_get_hypervolume_history_plot)studyreference_pointinfos      r   plot_hypervolume_historyr,      s    ( NN$$&&<
 	

 ?s5#3#344`
 	
 )

?RTR\R\0]^D(..r   c                    [         R                  " SSS0SS0S9n[         R                  " U R                  U R                  SS9n[         R
                  " X!S9$ )	NzHypervolume History PlottitleTrialHypervolume)r.   xaxisyaxiszlines+markers)xymode)datalayout)r   LayoutScatterr   r   Figure)r+   r7   r6   s      r   r(   r(   B   sY     YY( &F ::



++D
 99$..r   c                   U R                  S[        R                  4S9n[        U5      S:X  a  [        R                  S5        [        R                  " U R                   Vs/ s H  o3[        R                  :X  a  SOSPM     sn5      nXA-  n/ n/ nS nSn	U GH  n
UR                  U
R                  5        [        U
R                  ;   nU(       aA  U
R                  [           n[        [!        S U5      5      (       a  UR                  U	5        Mz  XJR"                  -  [        R$                  S S 24   nUb6  X:*  R'                  SS	9R                  SS	9(       a  UR                  U	5        M  X:  R                  5       (       a  UR                  U	5        GM  U	[        R(                  " X]-
  5      -  n	Uc  UnOR[        R*                  " X5      nU	[-        X5      -  n	X:  R                  SS	9n[        R.                  " XS S 24   U/SS	9nUR                  U	5        GM     Uc  [        R                  S
5        [1        Xg5      $ s  snf )NF)deepcopystatesr   z.Your study does not have any completed trials.           c                    U S:  $ )Nr@   r   )r3   s    r   <lambda>/_get_hypervolume_history_info.<locals>.<lambda>l   s    Sr   )axisz-Your study does not have any feasible trials.)
get_trialsr   COMPLETEr"   _loggerwarningr%   r&   r#   r   MINIMIZEappendnumberr	   system_attrsanymapr   newaxisallprodmaximumr   concatenater   )r)   r*   completed_trialsdsignsminimization_reference_pointr   hypervolume_valuesbest_trials_values_normalizedhypervolumetrialhas_constraintsconstraints_valuesvalues_normalizedlimited_solsis_kepts                   r   r$   r$   S   s&    ''
@S@S?U'V
!HI JJ5K[K[\K[a."9"99rAK[\]E#(#:  M7;!K!U\\**e.@.@@!&!3!34D!E3(*<=>>"))+6"\\12::q=A(4-BGGQGOSSYZS["))+6<AACC%%k2rww;OPP(0,=)::&CWL.|ZZK4HMMSTMUG,.NN.z:<MNUV-) 	!!+.? "B %,GH"=EEY ]s   "!I)r)   r
   r*   zSequence[float]return'go.Figure')r+   r   ra   rb   )r)   r
   r*   z
np.ndarrayra   r   ) 
__future__r   collections.abcr   typingr   numpyr%   optuna._experimentalr   optuna._hypervolumer   optuna.loggingr   optuna.samplers._baser	   optuna.studyr
   optuna.study._study_directionr   optuna.trialr   $optuna.visualization._plotly_importsr   is_successfulr   r   rG   r   r,   r(   r$   r   r   r   <module>rp      s    " $   2 3 % 2  8 # 9 7
X
j 
 7!/!/$!/ !/ !/H/
!//"7F7F7F 7Fr   