o
    }oi	                     @  s   d dl mZ d dlmZ d dl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 r>d d	lmZ d d
lmZ eddddZdddZdS )    )annotations)SequenceN)experimental_func)Study)_get_hypervolume_history_info)_HypervolumeHistoryInfo)_imports)Axes)pltz3.3.0studyr   reference_pointSequence[float]return'Axes'c                 C  sP   t   |  stdt|t| jkrtdt| tj|tj	d}t
|S )a  Plot hypervolume history of all trials in a study with Matplotlib.

    .. note::
        You need to adjust the size of the plot by yourself using ``plt.tight_layout()`` or
        ``plt.savefig(IMAGE_NAME, bbox_inches='tight')``.

    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:`matplotlib.axes.Axes` 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
directionsr   npasarrayfloat64_get_hypervolume_history_plot)r   r   info r   h/home/ubuntu/.local/lib/python3.10/site-packages/optuna/visualization/matplotlib/_hypervolume_history.pyplot_hypervolume_history   s   r   r   r   c                 C  s`   t jd t  \}}|d |d |d t d}|j| j	| j
d|ddd	 |S )
NggplotzHypervolume History PlotTrialHypervolumetab10or   g      ?)markercoloralpha)r
   styleusesubplots	set_title
set_xlabel
set_ylabelget_cmapplottrial_numbersvalues)r   _axcmapr   r   r   r   <   s   



r   )r   r   r   r   r   r   )r   r   r   r   )
__future__r   collections.abcr   numpyr   optuna._experimentalr   optuna.studyr   )optuna.visualization._hypervolume_historyr   r   3optuna.visualization.matplotlib._matplotlib_importsr   is_successfulr	   r
   r   r   r   r   r   r   <module>   s    (