
    ,YHhi                        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j                          rd d
lmZ d dlmZ  ed      dddddd	 	 	 	 	 	 	 	 	 	 	 	 	 dd       ZddZddZddZy)    )annotations)Callable)Sequence)experimental_func)Study)FrozenTrial)_get_pareto_front_info)_ParetoFrontInfo)_imports)Axes)pltz2.8.0NT)target_namesinclude_dominated_trials
axis_orderconstraints_functargetsc               `    t        j                          t        | |||||      }t        |      S )a  Plot the Pareto front of a study.

    .. seealso::
        Please refer to :func:`optuna.visualization.plot_pareto_front` for an example.

    Args:
        study:
            A :class:`~optuna.study.Study` object whose trials are plotted for their objective
            values. ``study.n_objectives`` must be either 2 or 3 when ``targets`` is :obj:`None`.
        target_names:
            Objective name list used as the axis titles. If :obj:`None` is specified,
            "Objective {objective_index}" is used instead. If ``targets`` is specified
            for a study that does not contain any completed trial,
            ``target_name`` must be specified.
        include_dominated_trials:
            A flag to include all dominated trial's objective values.
        axis_order:
            A list of indices indicating the axis order. If :obj:`None` is specified,
            default order is used. ``axis_order`` and ``targets`` cannot be used at the same time.

            .. warning::
                Deprecated in v3.0.0. This feature will be removed in the future. The removal of
                this feature is currently scheduled for v5.0.0, but this schedule is subject to
                change. See https://github.com/optuna/optuna/releases/tag/v3.0.0.
        constraints_func:
            An optional function that computes the objective constraints. It must take a
            :class:`~optuna.trial.FrozenTrial` and return the constraints. The return value must
            be a sequence of :obj:`float` s. A value strictly larger than 0 means that a
            constraint is violated. A value equal to or smaller than 0 is considered feasible.
            This specification is the same as in, for example,
            :class:`~optuna.samplers.NSGAIISampler`.

            If given, trials are classified into three categories: feasible and best, feasible but
            non-best, and infeasible. Categories are shown in different colors. Here, whether a
            trial is best (on Pareto front) or not is determined ignoring all infeasible trials.

            .. warning::
                Deprecated in v4.0.0. This feature will be removed in the future. The removal of
                this feature is currently scheduled for v6.0.0, but this schedule is subject to
                change. See https://github.com/optuna/optuna/releases/tag/v4.0.0.
        targets:
            A function that returns a tuple of target values to display.
            The argument to this function is :class:`~optuna.trial.FrozenTrial`.
            ``targets`` must be :obj:`None` or return 2 or 3 values.
            ``axis_order`` and ``targets`` cannot be used at the same time.
            If the number of objectives is neither 2 nor 3, ``targets`` must be specified.

            .. note::
                Added in v3.0.0 as an experimental feature. The interface may change in newer
                versions without prior notice.
                See https://github.com/optuna/optuna/releases/tag/v3.0.0.

    Returns:
        A :class:`matplotlib.axes.Axes` object.
    )r   checkr	   _get_pareto_front_plot)studyr   r   r   r   r   infos          f/var/www/html/planif/env/lib/python3.12/site-packages/optuna/visualization/matplotlib/_pareto_front.pyplot_pareto_frontr      s6    D NN!|5zCSU\D "$''    c                x    | j                   dk(  rt        |       S | j                   dk(  rt        |       S J d       )N      zMust not reach here)	n_targets_get_pareto_front_2d_get_pareto_front_3d)r   s    r   r   r   ]   s;    ~~#D))	1	#D))+++ur   c           
     T   t         j                  j                  d       t        j                         \  }}|j	                  d       t        j
                  d      }|j                  | j                  | j                  d             |j                  | j                  | j                  d             d}t        | j                        dkD  rq|j                  | j                  D cg c]  \  }}|| j                  d       c}}| j                  D cg c]  \  }}|| j                  d       c}}dd	       d
}t        | j                        dkD  ru|j                  | j                  D cg c]  \  }}|| j                  d       c}}| j                  D cg c]  \  }}|| j                  d       c}} |d      |	       t        | j                        dkD  ru|j                  | j                  D cg c]  \  }}|| j                  d       c}}| j                  D cg c]  \  }}|| j                  d       c}} |d      d	       | j                   |j                         r|j!                          |S c c}}w c c}}w c c}}w c c}}w c c}}w c c}}w )NggplotPareto-front Plottab10r      Trial#ccccccInfeasible Trial)xycolorlabelFeasible Trialr   
Best Trial)r   styleusesubplots	set_titleget_cmap
set_xlabelr   r   
set_ylabelleninfeasible_trials_with_valuesscatternon_best_trials_with_valuesbest_trials_with_valueshas_datalegend)r   _axcmaptrial_labelvaluess         r   r   r   f   s3   IIMM(LLNEArLL$%<< DMM$##DOOA$678MM$##DOOA$678K
4--.2


;?;];]^iavdooa()^;?;];]^iavdooa()^$	 	 	
 '
4++,q0


;?;[;[\iavdooa()\;?;[;[\iavdooa()\q'	 	 	
 4''(1,


;?;W;WXiavdooa()X;?;W;WXiavdooa()Xq'	 	 	
 ''3
		I1 _^ ]\ YXs$   'J
J0J
J=J
+J$c                B   t         j                  j                  d       t        j                         }|j	                  d      }|j                  d       t        j                  d      }|j                  | j                  | j                  d             |j                  | j                  | j                  d             |j                  | j                  | j                  d             d	}| j                  t        | j                        dkD  r|j                  | j                  D cg c]  \  }}|| j                  d       c}}| j                  D cg c]  \  }}|| j                  d       c}}| j                  D cg c]  \  }}|| j                  d       c}}d
d       d}| j                  t        | j                        dkD  r|j                  | j                  D cg c]  \  }}|| j                  d       c}}| j                  D cg c]  \  }}|| j                  d       c}}| j                  D cg c]  \  }}|| j                  d       c}} |d      |       | j                   t        | j                         r|j                  | j                   D cg c]  \  }}|| j                  d       c}}| j                   D cg c]  \  }}|| j                  d       c}}| j                   D cg c]  \  }}|| j                  d       c}} |d      d       | j                   |j#                         r|j%                          |S c c}}w c c}}w c c}}w c c}}w c c}}w c c}}w c c}}w c c}}w c c}}w )Nr"   3d)
projectionr#   r$   r   r%   r   r&   r'   r(   )xsyszsr+   r,   r-   r   r.   )r   r/   r0   figureadd_subplotr2   r3   r4   r   r   r5   
set_zlabelr7   r6   r8   r9   r:   r;   r<   )r   figr>   r?   r@   r=   rA   s          r   r    r       s   IIMM(
**,C	D	)BLL$%<< DMM$##DOOA$678MM$##DOOA$678MM$##DOOA$678K**6223a7


<@<^<^_yq&tq)*_<@<^<^_yq&tq)*_<@<^<^_yq&tq)*_$ 	 	
 '''3D<\<\8]`a8a


<@<\<\]yq&tq)*]<@<\<\]yq&tq)*]<@<\<\]yq&tq)*]q' 	 	
 ##/C8T8T4U


<@<X<XYyq&tq)*Y<@<X<XYyq&tq)*Y<@<X<XYyq&tq)*Yq' 	 	
 ''3
		I; `__ ^]] ZYYs6   -M+
M1	M70M=
NN	4N
"NN)r   r   r   zlist[str] | Noner   boolr   zlist[int] | Noner   /Callable[[FrozenTrial], Sequence[float]] | Noner   rM   return'Axes')r   r
   rN   rO   )
__future__r   collections.abcr   r   optuna._experimentalr   optuna.studyr   optuna.trialr   "optuna.visualization._pareto_frontr	   r
   3optuna.visualization.matplotlib._matplotlib_importsr   is_successfulr   r   r   r   r   r     r   r   <module>rY      s    " $ $ 2  $ E ? H 8HG 7 &*%)#'HL?CF(F( #F( #	F(
 !F( FF( =F( F( F(R,%P/r   