
    (^i                    f    d dl mZ d dlZd dlmZ d dlZerd dlmZ  G d dej                        Z
y)    )annotationsN)TYPE_CHECKING)Studyc                      e Zd ZdZddZeej                  dd              Zej                  	 	 	 	 	 	 	 	 	 	 dd       Z	y)	BaseCrossovera  Base class for crossovers.

    A crossover operation is used by :class:`~optuna.samplers.NSGAIISampler`
    to create new parameter combination from parameters of ``n`` parent individuals.

    .. note::
        Concrete implementations of this class are expected to only accept parameters
        from numerical distributions. At the moment, only crossover operation for categorical
        parameters (uniform crossover) is built-in into :class:`~optuna.samplers.NSGAIISampler`.
    c                .    | j                   j                  S )N)	__class____name__selfs    i/var/www/html/hubwallet-dev/venv/lib/python3.12/site-packages/optuna/samplers/nsgaii/_crossovers/_base.py__str__zBaseCrossover.__str__   s    ~~&&&    c                    t         )z;Number of parent individuals required to perform crossover.NotImplementedErrorr   s    r   	n_parentszBaseCrossover.n_parents   s
    
 "!r   c                    t         )aa  Perform crossover of selected parent individuals.

        This method is called in :func:`~optuna.samplers.NSGAIISampler.sample_relative`.

        Args:
            parents_params:
                A ``numpy.ndarray`` with dimensions ``num_parents x num_parameters``.
                Represents a parameter space for each parent individual. This space is
                continuous for numerical parameters.
            rng:
                An instance of ``numpy.random.RandomState``.
            study:
                Target study object.
            search_space_bounds:
                A ``numpy.ndarray`` with dimensions ``len_search_space x 2`` representing
                numerical distribution bounds constructed from transformed search space.

        Returns:
            A 1-dimensional ``numpy.ndarray`` containing new parameter combination.
        r   )r   parents_paramsrngstudysearch_space_boundss        r   	crossoverzBaseCrossover.crossover#   s
    : "!r   N)returnstr)r   int)
r   
np.ndarrayr   znp.random.RandomStater   r   r   r   r   r   )
r
   
__module____qualname____doc__r   propertyabcabstractmethodr   r    r   r   r   r      sx    	' "  "
 	""" #" 	"
 (" 
" "r   r   )
__future__r   r"   typingr   numpynpoptuna.studyr   ABCr   r$   r   r   <module>r+      s)    " 
    "3"CGG 3"r   