Ë
    þÍ:ja  ã                  óP  — d dl mZ d dlZd dlmZ d dlm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 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rJd dlmZ d dlmZ d dlZd dlmc m Z! d dl"mc m#Z# d dl$mc m%Z% d dl&mc m'Z' d dl(mc m)Z* d dl+m,Z, d dlm-Z- n6d dl.m/Z/  e/d«      Z e/d«      Z* e/d«      Z# e/d«      Z% e/d«      Z! e/d«      Z'd dl0Z0 e0jb                  e2«      Z3dZ4dZ5dZ6d$d„Z7 e
d«       G d „ d!e«      «       Z8	 	 	 	 	 	 d%d"„Z9d&d#„Z:y)'é    )ÚannotationsN)ÚAny)ÚTYPE_CHECKING)Úexperimental_class)Úwarn_experimental_argument)Ú_CONSTRAINTS_KEY)Ú&_INDEPENDENT_SAMPLING_WARNING_TEMPLATE)Ú _process_constraints_after_trial)ÚBaseSampler)ÚLazyRandomState)ÚStudyDirection)Ú_is_pareto_front)ÚFrozenTrial)Ú
TrialState)ÚCallable)ÚSequence)ÚBaseDistribution)ÚStudy)Ú_LazyImportÚtorchzoptuna._gp.search_spacezoptuna._gp.gpzoptuna._gp.optim_mixedzoptuna._gp.acqfzoptuna._gp.priorg»½×Ùß|Û=zgp:relative_paramsiý  c                óÒ   — t        j                  | «      }t        j                  |d¬«      }t        j                  |d¬«      }||z
  t        j
                  t        |«      z  }|||fS )Nr   ©Úaxis)ÚgpÚwarn_and_convert_infÚnpÚmeanÚstdÚmaximumÚEPS)ÚvaluesÚclipped_valuesÚmeansÚstdsÚstandardized_valuess        úp/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/optuna/samplers/_gp/sampler.pyÚ_standardize_valuesr'   :   sZ   € Ü×,Ñ,¨VÓ4€NÜ�G‰G�N¨Ô+€EÜ�6‰6�. qÔ)€DØ)¨EÑ1´R·Z±ZÄÀTÓ5JÑJÐØ  tÐ+Ð+ó    z3.6.0c                  ó  — e Zd ZdZdddddddœ	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdd„Zdd	„Z	 	 	 	 	 	 dd
„Z	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 dd„Z		 	 	 	 	 	 dd„Z
	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 	 	 dd„Z	 	 	 	 	 	 	 	 	 	 dd„Zdd„Z	 	 	 	 	 	 	 	 	 	 dd„Zy)Ú	GPSampleraè  Sampler using Gaussian process-based Bayesian optimization.

    This sampler fits a Gaussian process (GP) to the objective function and optimizes
    the acquisition function to suggest the next parameters.

    The current implementation uses Matern kernel with nu=2.5 (twice differentiable) with automatic
    relevance determination (ARD) for the length scale of each parameter.
    The hyperparameters of the kernel are obtained by maximizing the marginal log-likelihood of the
    hyperparameters given the past trials.
    To prevent overfitting, Gamma prior is introduced for kernel scale and noise variance and
    a hand-crafted prior is introduced for inverse squared lengthscales.

    As an acquisition function, we use:

    - log expected improvement (logEI) for single-objective optimization,
    - log expected hypervolume improvement (logEHVI) for Multi-objective optimization, and
    - the summation of logEI and the logarithm of the feasible probability with the independent
      assumption of each constraint for (black-box inequality) constrained optimization.

    For further information about these acquisition functions, please refer to the following
    papers:

    - `Unexpected Improvements to Expected Improvement for Bayesian Optimization
      <https://arxiv.org/abs/2310.20708>`__
    - `Differentiable Expected Hypervolume Improvement for Parallel Multi-Objective Bayesian
      Optimization <https://arxiv.org/abs/2006.05078>`__
    - `Bayesian Optimization with Inequality Constraints
      <https://proceedings.mlr.press/v32/gardner14.pdf>`__

    Please also check our articles:

    - `[Optuna v4.5] Gaussian Process-Based Sampler (GPSampler) Can Now Perform Constrained
      Multi-Objective Optimization <https://medium.com/optuna/optuna-v4-5-81e78d8e077a>`__
    - `[Optuna v4.2] Gaussian Process-Based Sampler (GPSampler) Can Now Handle Inequality
      Constraints
      <https://medium.com/optuna/optuna-v4-2-gaussian-process-based-sampler-can-now-handle-inequality-constraints-a4f68e8ee810>`__
    - `Introducing Optuna's Native GPSampler
      <https://medium.com/optuna/introducing-optunas-native-gpsampler-0aa9aa3b4840>`__

    The optimization of the acquisition function is performed via:

    1. Collect the best param from the past trials,
    2. Collect ``n_preliminary_samples`` points using Quasi-Monte Carlo (QMC) sampling,
    3. Choose the best point from the collected points,
    4. Choose ``n_local_search - 2`` points from the collected points using the roulette
       selection,
    5. Perform a local search for each chosen point as an initial point, and
    6. Return the point with the best acquisition function value as the next parameter.

    Decoupled optimizer update with a batched evaluation is employed to perform a batch of local
    searches simultaneously, specifically speeding up Step 5 above.

    The following paper details the methodology:

    - `Batch Acquisition Function Evaluations and Decouple Optimizer Updates for Faster Bayesian
      Optimization <https://arxiv.org/abs/2511.13625>`__

    Note that the procedures for non single-objective optimization setups are slightly different
    from the single-objective version described above, but we omit the descriptions for the others
    for brevity.

    The local search iteratively optimizes the acquisition function by repeating:

    1. Gradient ascent using l-BFGS-B for continuous parameters, and
    2. Line search or exhaustive search for each discrete parameter independently.

    The local search is terminated if the routine stops updating the best parameter set or the
    maximum number of iterations is reached.

    We use line search instead of rounding the results from the continuous optimization since EI
    typically yields a high value between one grid and its adjacent grid.

    .. note::
        This sampler requires ``scipy`` and ``torch``.
        You can install these dependencies with ``pip install scipy torch``.

    Args:
        seed:
            Random seed to initialize internal random number generator.
            Defaults to :obj:`None` (a seed is picked randomly).
        independent_sampler:
            Sampler used for initial sampling (for the first ``n_startup_trials`` trials)
            and for conditional parameters. Defaults to :obj:`None`
            (a random sampler with the same ``seed`` is used).
        n_startup_trials:
            Number of initial trials. Defaults to 10.
        deterministic_objective:
            Whether the objective function is deterministic or not.
            If :obj:`True`, the sampler will fix the noise variance of the surrogate model to
            the minimum value (slightly above 0 to ensure numerical stability).
            Defaults to :obj:`False`. Currently, all the objectives will be assume to be
            deterministic if :obj:`True`.
        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
            constraints is violated. A value equal to or smaller than 0 is considered feasible.
            If ``constraints_func`` returns more than one value for a trial, that trial is
            considered feasible if and only if all values are equal to 0 or smaller.

            The ``constraints_func`` will be evaluated after each successful trial.
            The function won't be called when trials fail or are pruned, but this behavior is
            subject to change in future releases.
        warn_independent_sampling:
            If this is :obj:`True`, a warning message is emitted when
            the value of a parameter is sampled by using an independent sampler,
            meaning that no GP model is used in the sampling.
            Note that the parameters of the first trial in a study are always sampled
            via an independent sampler, so no warning messages are emitted in this case.
    Né
   FT)ÚseedÚindependent_samplerÚn_startup_trialsÚdeterministic_objectiveÚconstraints_funcÚwarn_independent_samplingc               ó¨  — t        |«      | _        |xs  t        j                  j	                  |¬«      | _        t        j                  j                  «       | _        || _	        t        j                  | _        t        j                  | _        d | _        d | _        || _        || _        || _        |�t)        d«       d| _        d| _        d| _        y )N)r,   r0   i   r+   g-Cëâ6?)r   Ú_rngÚoptunaÚsamplersÚRandomSamplerÚ_independent_samplerÚsearch_spaceÚIntersectionSearchSpaceÚ_intersection_search_spaceÚ_n_startup_trialsÚpriorÚdefault_log_priorÚ
_log_priorÚDEFAULT_MINIMUM_NOISE_VARÚ_minimum_noiseÚ_gprs_cache_listÚ_constraints_gprs_cache_listÚ_deterministicÚ_constraints_funcÚ_warn_independent_samplingr   Ú_n_preliminary_samplesÚ_n_local_searchÚ_tol)Úselfr,   r-   r.   r/   r0   r1   s          r&   Ú__init__zGPSampler.__init__³   s½   € ô& $ DÓ)ˆŒ	Ø$7Ò$c¼6¿?¹?×;XÑ;XÐ^bÐ;XÓ;cˆÔ!Ü*0×*=Ñ*=×*UÑ*UÓ*WˆÔ'Ø!1ˆÔÜDI×D[ÑD[ˆŒÜ%*×%DÑ%DˆÔð >BˆÔØIMˆÔ)Ø5ˆÔØ!1ˆÔØ*CˆÔ'àÐ'Ü&Ð'9Ô:ð ,0ˆÔ#à!ˆÔØˆ�	r(   c                óÚ   — t        j                  ||j                  | j                  j                  j
                  | j                  j
                  d¬«      }t        j                  |«       y )Nz2dynamic search space is not supported by GPSampler)Ú
param_nameÚtrial_numberÚindependent_sampler_nameÚsampler_nameÚfallback_reason)r	   ÚformatÚnumberr7   Ú	__class__Ú__name__Ú_loggerÚwarning)rI   ÚtrialrL   Úmsgs       r&   Ú_log_independent_samplingz#GPSampler._log_independent_samplingÝ   sO   € Ü4×;Ñ;Ø!ØŸ™Ø%)×%>Ñ%>×%HÑ%H×%QÑ%QØŸ™×0Ñ0ØPô
ˆô 	�‰˜Õr(   c                ó€   — | j                   j                  j                  «        | j                  j	                  «        y ©N)r3   Úrngr,   r7   Ú
reseed_rng)rI   s    r&   r]   zGPSampler.reseed_rngç   s(   € Ø�	‰	�‰×ÑÔØ×!Ñ!×,Ñ,Õ.r(   c                ó˜   — i }| j                   j                  |«      j                  «       D ]  \  }}|j                  «       rŒ|||<   Œ |S r[   )r:   Ú	calculateÚitemsÚsingle)rI   ÚstudyrW   r8   ÚnameÚdistributions         r&   Úinfer_relative_search_spacez%GPSampler.infer_relative_search_spaceë   sX   € ð ˆØ"&×"AÑ"A×"KÑ"KÈEÓ"R×"XÑ"XÓ"Zò 	.ÑˆD�,Ø×"Ñ"Ô$ØØ!-ˆL˜Òð	.ð
 Ðr(   c                óÞ   — |�t        |j                  «      dk(  sJ ‚t        j                  ||| j                  | j
                  | j                  | j                  j                  ¬«      \  }}|S )Né   )Ú!warmstart_normalized_params_arrayÚn_preliminary_samplesÚn_local_searchÚtolr\   )	ÚlenÚshapeÚoptim_mixedÚoptimize_acqf_mixedrF   rG   rH   r3   r\   )rI   ÚacqfÚbest_paramsÚnormalized_paramsÚ	_acqf_vals        r&   Ú_optimize_acqfzGPSampler._optimize_acqfö   sj   € ð Ð"¤c¨+×*;Ñ*;Ó&<ÀÒ&AÐAÐAÜ'2×'FÑ'FØØ.9Ø"&×"=Ñ"=Ø×/Ñ/Ø—	‘	Ø—	‘	—‘ô(
Ñ$Ð˜9ð !Ð r(   c           
     ó>  — t        | «      \  }}}| j                  �6t        | j                  d   j                  «      |j                  k7  rd | _        |j                  }g }g }	| t        j                  t        |«      z  j                  «       }	t        |j                  «      D ]m  \  }
}| j
                  �| j
                  |
   nd }t        j                  |||| j                  | j                   || j"                  ¬«      }|j%                  |«       Œo || _        ||	fS )Nr   ©ÚXÚYÚis_categoricalÚ	log_priorÚminimum_noiseÚ	gpr_cacher/   )r'   rA   rl   Úinverse_squared_lengthscalesÚdimrB   ry   r   r   r    ÚtolistÚ	enumerateÚTr   Úfit_kernel_paramsr>   r@   rC   Úappend)rI   Úconstraint_valsÚinternal_search_spacerr   Ústandardized_constraint_valsr#   r$   ry   Úconstraints_gprsÚconstraints_threshold_listÚiÚvalsÚcacheÚgprs                 r&   Ú_get_constraints_acqf_argsz$GPSampler._get_constraints_acqf_args  s1  € ô 5HÈÐHXÓ4YÑ1Ð$ e¨Tà×!Ñ!Ð-Ü�D×)Ñ)¨!Ñ,×IÑIÓJØ$×(Ñ(ò)ð 15ˆDÔ-à.×=Ñ=ˆØÐØ%'Ð"Ø', f¬r¯z©z¼#¸tÓ/DÑ&D×%LÑ%LÓ%NÐ"Ü Ð!=×!?Ñ!?Ó@ò 	)‰GˆAˆtð ×4Ñ4Ð@ð ×1Ñ1°!Ò4àð ô
 ×&Ñ&Ø#ØØ-ØŸ/™/Ø"×1Ñ1ØØ(,×(;Ñ(;ôˆCð ×#Ñ# CÕ(ð	)ð" -=ˆÔ)ØÐ!;Ð;Ð;r(   c                óÆ   — |t        | d¬«         }t        |«      }t        | j                  dz  |«      }| j                  j
                  j                  ||d¬«      }||   S )NF)Úassume_unique_lexsortedrg   )ÚsizeÚreplace)r   rl   ÚminrG   r3   r\   Úchoice)rI   rr   Ústandardized_score_valsÚpareto_paramsÚn_pareto_solsr�   Úchosen_indicess          r&   Ú$_get_best_params_for_multi_objectivez.GPSampler._get_best_params_for_multi_objective/  sj   € ð
 *ÜÐ5Ð5ÈuÔUñ
ˆô ˜MÓ*ˆä�4×'Ñ'¨1Ñ,¨mÓ<ˆØŸ™Ÿ™×-Ñ-¨mÀ$ÐPUÐ-ÓVˆØ˜^Ñ,Ð,r(   c           	     ó:  — |i k(  ri S t         j                  t         j                  f}|j                  d|d¬«      }|D �cg c]"  }|j                  t         j                  k(  sŒ!|‘Œ$ }}|D �cg c]K  }|j                  t         j                  k(  r,|j                  «       t        |«      j                  «       k  r|‘ŒM }}t        |«      | j                  k  ri S t        j                  d«      5  | j                  ||||«      }	d d d «       	i k7  rut        j                  |	«      }
t        dt        |
«      t        «      D ]C  }|j                   j#                  |j$                  t&        › d|t        z  › �|
||t        z    «       ŒE |	S c c}w c c}w # 1 sw Y   Œ�xY w)NF©ÚdeepcopyÚstatesÚ	use_cacheÚcpur   ú:)r   ÚCOMPLETEÚRUNNINGÚ_get_trialsÚstateÚkeysÚ_get_paramsrl   r;   r   ÚdeviceÚ_sample_relative_implÚjsonÚdumpsÚrangeÚ_SYSTEM_ATTR_MAX_LENGTHÚ_storageÚset_trial_system_attrÚ	_trial_idÚ_RELATIVE_PARAMS_KEY)rI   rb   rW   r8   rœ   ÚtrialsÚtÚcompleted_trialsÚrunning_trialsÚparamsÚ
params_strr‰   s               r&   Úsample_relativezGPSampler.sample_relative=  s�  € ð ˜2ÒØˆIä×%Ñ%¤z×'9Ñ'9Ð:ˆØ×"Ñ"¨E¸&ÈEÐ"ÓRˆØ'-ÖP !°·±¼J×<OÑ<OÓ1OšAÐPÐÐPð ö
àØ�w‰wœ*×,Ñ,Ò,°×1BÑ1BÓ1DÌÐTUË×H[ÑH[ÓH]Ò1]ò ð
ˆð 
ô ÐÓ  4×#9Ñ#9Ò9ØˆIô �\‰\˜%Ó ñ 	Ø×/Ñ/ØÐ'¨¸óˆF÷	ð
 �RŠ<äŸ™ FÓ+ˆJÜ˜1œc *›oÔ/FÓGò �Ø—‘×4Ñ4Ø—O‘OÜ+Ð,¨A¨aÔ3JÑ.JÐ-KÐLØ˜q 1Ô'>Ñ#>Ð?õðð ˆùò7 Qùò
÷	ð 	ús   Á "FÁ#FÁ-AFÃ.FÆFc                óÌ  — t        j                  |«      }|j                  |«      }t        |«      dkD  r)|j                  ||D �cg c]  }t	        |«      ‘Œ c}«      nd }t        j                  |j                  D �	cg c]  }	|	t        j                  k(  rdnd‘Œ c}	«      }
t        |
t        j                  |D �cg c]  }|j                  ‘Œ c}«      z  «      \  }}}| j                  �6t        | j                  d   j                  «      |j                  k7  rd | _        g }|j                  d   }|j                   }t#        |«      D ]o  }| j                  �| j                  |   nd }|j%                  t'        j(                  ||d d …|f   || j*                  | j,                  || j.                  ¬«      «       Œq || _        | j0                  €Õ|dk(  rkt        |«      dk(  sJ ‚t3        j4                  |d   ||d d …df   j7                  «       |¬«      }|t        j8                  |«      t
        j:                  f   }�nöt3        j<                  ||t?        j@                  |«      d| jB                  jD                  jG                  d	«      |¬
«      }| jI                  ||«      }�n‘|dk(  råt        |«      dk(  sJ ‚tK        ||«      \  }}t        jL                  ||d d …df   t
        jN                   «      }| jQ                  |||«      \  }}t        j8                  |«      }||   }t3        jR                  |d   |||||¬«      }|j                  d d |j                  k(  sJ ‚t        jT                  |«      rd n||t
        j:                  f   }n§tK        ||«      \  }}| jQ                  |||«      \  }}tW        |«       }t3        jX                  |||st?        j@                  ||   «      nd d| jB                  jD                  jG                  d	«      |||¬«      }|s| jI                  ||   ||   «      nd }| j[                  ||«      }|j]                  |«      S c c}w c c}	w c c}w )Nr   g      ð¿g      ð?éÿÿÿÿrv   é   )rŒ   r8   Ú	thresholdÚ#normalized_params_of_running_trialsé€   i   @)Úgpr_listr8   ÚY_trainÚn_qmc_samplesÚqmc_seedr»   )rŒ   r8   rº   Úconstraints_gpr_listrˆ   r»   )r½   r8   Ú
Y_feasibler¿   rÀ   rÁ   rˆ   r»   )/Úgp_search_spaceÚSearchSpaceÚget_normalized_paramsrl   r¥   r   ÚarrayÚ
directionsr   ÚMINIMIZEr'   r!   rA   r}   r~   rm   ry   rª   rƒ   r   r‚   r>   r@   rC   rD   Úacqf_moduleÚLogEIÚmaxÚargmaxÚnewaxisÚLogEHVIr   Ú
from_numpyr3   r\   Úrandintr˜   Ú$_get_constraint_vals_and_feasibilityÚwhereÚinfr�   ÚConstrainedLogEIÚisneginfÚanyÚConstrainedLogEHVIrt   Úget_unnormalized_param)rI   rb   r²   r³   r8   r…   rr   r±   r»   ÚdÚ_signrW   r”   Ú_Ú	gprs_listÚn_objectivesry   r‰   r‹   rp   rq   r„   Úis_feasibleÚy_with_neginfÚconstr_gpr_listÚconstr_threshold_listÚi_optÚbest_feasible_yÚis_all_infeasibleÚnormalized_params                                 r&   r§   zGPSampler._sample_relative_implb  s�  € ô !0× ;Ñ ;¸LÓ IÐØ1×GÑGÐHXÓYÐô
 �>Ó" QÒ&ð "×7Ñ7Ø¸Ö H°A¤¨Q¥Ò Hôð ð 	,ô —‘ÐQV×QaÑQaÖbÈA !¤~×'>Ñ'>Ò">™$ÀCÑGÒbÓcˆÜ(;Ø”B—H‘HÐ8HÖI¨u˜eŸl›lÒIÓJÑJó)
Ñ%Ð  Að
 ×!Ñ!Ð-Ü�D×)Ñ)¨!Ñ,×IÑIÓJØ$×(Ñ(ò)ð %)ˆDÔ!àˆ	Ø.×4Ñ4°RÑ8ˆØ.×=Ñ=ˆÜ�|Ó$ò 	ˆAØ04×0EÑ0EÐ0Q�D×)Ñ)¨!Ò,ÐW[ˆEØ×ÑÜ×$Ñ$Ø'Ø-ªa°¨dÑ3Ø#1Ø"Ÿo™oØ"&×"5Ñ"5Ø#Ø,0×,?Ñ,?ôõ
ð	ð !*ˆÔð ×!Ñ!Ð)Ø˜qÒ Ü˜9“~¨Ò*Ð*Ð*Ü"×(Ñ(Ø! !™Ø!6Ø5²a¸°dÑ;×?Ñ?ÓAØ8[ô	�ð 0´·	±	Ð:QÓ0RÔTV×T^ÑT^Ð0^Ñ_’ä"×*Ñ*Ø&Ø!6Ü!×,Ñ,Ð-DÓEØ"%Ø!ŸY™YŸ]™]×2Ñ2°7Ó;Ø8[ô�ð #×GÑGØ%Ð'>ó’ð ˜qÒ Ü˜9“~¨Ò*Ð*Ð*Ü/SØÐ+ó0Ñ,� ô !#§¡¨Ð6MÊaÐQRÈdÑ6SÔVX×V\ÑV\ÐU\Ó ]�ð :>×9XÑ9XØ#Ð%:Ð<Mó:Ñ6�Ð!6ô Ÿ	™	 -Ó0�Ø"/°Ñ"6�Ü"×3Ñ3Ø! !™Ø!6Ø-Ø)8Ø/DØ8[ô�ð )×.Ñ.¨s°Ð3°}×7JÑ7JÒJÐJÐJäŸK™K¨Ô8‘DÐ>OÐPUÔWY×WaÑWaÐPaÑ>bñ ô 0TØÐ+ó0Ñ,� ð :>×9XÑ9XØ#Ð%:Ð<Mó:Ñ6�Ð!6ô ),¨KÓ(8Ð$8Ð!Ü"×5Ñ5Ø&Ø!6ñ  1ô ×(Ñ(Ð)@ÀÑ)MÔNà!à"%Ø!ŸY™YŸ]™]×2Ñ2°7Ó;Ø)8Ø/DØ8[ô�ñ& -ð	 ×=Ñ=Ø)¨+Ñ6Ø/°Ñ<ôð
 ð ð  ×.Ñ.¨t°[ÓAÐØ$×;Ñ;Ð<LÓMÐMùòu !Iùò cùâIs   ÁQ
Á=QÂ;Q!c                óô   — | j                   rOt        j                  f}|j                  d|d¬«      }t	        |«      | j
                  k\  r| j                  ||«       | j                  j                  ||||«      S )NFTrš   )	rE   r   r    r¢   rl   r;   rY   r7   Úsample_independent)rI   rb   rW   rL   Úparam_distributionrœ   r²   s          r&   rç   zGPSampler.sample_independenté  s{   € ð ×*Ò*Ü ×)Ñ)Ð+ˆFØ$×0Ñ0¸%ÈÐZ^Ð0Ó_ÐÜÐ#Ó$¨×(>Ñ(>Ò>Ø×.Ñ.¨u°jÔAØ×(Ñ(×;Ñ;Ø�5˜*Ð&8ó
ð 	
r(   c                ó<   — | j                   j                  ||«       y r[   )r7   Úbefore_trial)rI   rb   rW   s      r&   rê   zGPSampler.before_trialù  s   € Ø×!Ñ!×.Ñ.¨u°eÕ<r(   c                óˆ   — | j                   �t        | j                   |||«       | j                  j                  ||||«       y r[   )rD   r
   r7   Úafter_trial)rI   rb   rW   r£   r!   s        r&   rì   zGPSampler.after_trialü  s?   € ð ×!Ñ!Ð-Ü,¨T×-CÑ-CÀUÈEÐSXÔYØ×!Ñ!×-Ñ-¨e°U¸EÀ6ÕJr(   )r,   z
int | Noner-   zBaseSampler | Noner.   Úintr/   Úboolr0   z/Callable[[FrozenTrial], Sequence[float]] | Noner1   rî   ÚreturnÚNone)rW   r   rL   Ústrrï   rð   )rï   rð   )rb   r   rW   r   rï   údict[str, BaseDistribution])rp   zacqf_module.BaseAcquisitionFuncrq   znp.ndarray | Nonerï   ú
np.ndarray)r„   ró   r…   zgp_search_space.SearchSpacerr   ró   rï   z(tuple[list[gp.GPRegressor], list[float]])rr   ró   r”   ró   rï   ró   )rb   r   rW   r   r8   rò   rï   údict[str, Any])
rb   r   r²   úlist[FrozenTrial]r³   rõ   r8   rò   rï   rô   )
rb   r   rW   r   rL   rñ   rè   r   rï   r   )rb   r   rW   r   rï   rð   )
rb   r   rW   r   r£   r   r!   zSequence[float] | Nonerï   rð   )rT   Ú
__module__Ú__qualname__Ú__doc__rJ   rY   r]   re   rt   r�   r˜   r¶   r§   rç   rê   rì   © r(   r&   r*   r*   B   sØ  „ ñmðd  Ø26Ø "Ø(-ØLPØ*.ñ(ð ð(ð 0ð	(ð
 ð(ð "&ð(ð Jð(ð $(ð(ð 
ó(óTó/ð	Øð	Ø#.ð	à	$ó	ð!Ø3ð!ØBSð!à	ó!ð"&<à#ð&<ð  ;ð&<ð &ð	&<ð
 
2ó&<ðP-à%ð-ð ",ð-ð 
ó	-ð#Øð#Ø#.ð#Ø>Yð#à	ó#ðJENàðENð ,ðENð *ð	ENð
 2ðENð 
óENðN
àð
ð ð
ð ð	
ð
 -ð
ð 
ó
ó =ð	Kàð	Kð ð	Kð ð		Kð
 'ð	Kð 
ô	Kr(   r*   c                óÀ  ‡— |D �cg c];  }| j                   j                  |j                  «      j                  t        d«      ‘Œ= c}Št        ˆfd„‰D «       «      rt        d«      ‚t        j                  ‰«      }t        |j                  «      dk(  sJ d«       ‚t        j                  |dk  d¬«      }t        |t        j                  «      rJ d	«       ‚||fS c c}w )
Nrù   c              3  óR   •K  — | ]  }t        ‰d    «      t        |«      k7  –— Œ  y­w)r   N)rl   )Ú.0ÚcÚ_constraint_valss     €r&   ú	<genexpr>z7_get_constraint_vals_and_feasibility.<locals>.<genexpr>  s%   øè ø€ Ò
H°!Œ3Ð Ñ"Ó#¤s¨1£vÕ-Ñ
Hùs   ƒ$'z:The number of constraints must be the same for all trials.rg   z#constraint_vals must be a 2d array.r   r¹   r   z#MyPy Redefinition for NumPy v2.2.0.)r¬   Úget_trial_system_attrsr®   Úgetr   rÖ   Ú
ValueErrorr   rÆ   rl   rm   ÚallÚ
isinstanceÚbool_)rb   r°   rW   r„   rÞ   rþ   s        @r&   rÑ   rÑ     sÊ   ø€ ð
 öàð 	�‰×-Ñ-¨e¯o©oÓ>×BÑBÔCSÐUWÕXòÐô Ó
HÐ7GÔ
HÔHÜÐUÓVÐVä—h‘hÐ/Ó0€OÜˆ×$Ñ$Ó%¨Ò*ÐQÐ,QÓQÐ*Ü—&‘&˜¨AÑ-°AÔ6€KÜ˜+¤r§x¡xÔ0ÐWÐ2WÓWÐ0Ø˜KÐ'Ð'ùòs   †A Cc                óÒ  — | j                   j                  «       r| j                  S g }d}| j                  j	                  t
        › d|› �«      x}r=|j                  |«       |dz  }| j                  j	                  t
        › d|› �«      x}rŒ=t        |«      dk(  r| j                  S t        j                  dj                  |«      «      }|j                  | j                  «       |S )Nr   rŸ   r¹   Ú )r£   Úis_finishedr´   Úsystem_attrsr  r¯   rƒ   rl   r¨   ÚloadsÚjoinÚupdate)rW   Úparams_strsr‰   Úparams_str_ir´   s        r&   r¥   r¥     sÖ   € Ø‡{�{×ÑÔ Ø�|‰|Ðà€KØ	€AØ×,Ñ,×0Ñ0Ô4HÐ3IÈÈ1È#Ð1NÓOÐ
Oˆ,Ð
OØ×Ñ˜<Ô(Ø	ˆQ‰ˆð  ×,Ñ,×0Ñ0Ô4HÐ3IÈÈ1È#Ð1NÓOÐ
Oˆ,Ñ
Oô ˆ;Ó˜1ÒØ�|‰|ÐÜ�Z‰Z˜Ÿ™ Ó,Ó-€FØ
‡M�M�%—,‘,ÔØ€Mr(   )r!   ró   rï   z)tuple[np.ndarray, np.ndarray, np.ndarray])rb   r   r°   rõ   rï   ztuple[np.ndarray, np.ndarray])rW   r   rï   rô   );Ú
__future__r   r¨   Útypingr   r   Únumpyr   r4   Úoptuna._experimentalr   r   Úoptuna.samplers._baser   r	   r
   r   Ú"optuna.samplers._lazy_random_stater   Úoptuna.studyr   Úoptuna.study._multi_objectiver   Úoptuna.trialr   r   Úcollections.abcr   r   r   Úoptuna._gp.acqfÚ_gprp   rÉ   Úoptuna._gp.gpr   Úoptuna._gp.optim_mixedrn   Úoptuna._gp.priorr<   Úoptuna._gp.search_spacer8   rÃ   Úoptuna.distributionsr   r   Úoptuna._importsr   ÚloggingÚ	getLoggerrT   rU   r    r¯   r«   r'   r*   rÑ   r¥   rù   r(   r&   ú<module>r#     s#  ðÝ "ã Ý Ý  ã ã Ý 3Ý ;Ý 2Ý HÝ BÝ -Ý >Ý 'Ý :Ý $Ý #ñ Ý(Ý(ãç)Ð)ßÐß0Ð0ß$Ð$ß5Ð5Ý5Þ"å+á˜Ó €EÙ!Ð";Ó<€OÙ	�_Ó	%€BÙÐ6Ó7€KÙÐ/Ó0€KÙÐ*Ó+€Eã ð ˆ'×
Ñ
˜HÓ
%€à€à+Ð àÐ ó,ñ �GÓôBK�ó BKó ðBKðJ(Øð(Ø+ð(à"ó(ô"r(   