(
    train_x: "torch.Tensor",
    train_obj: "torch.Tensor",
    train_con: Optional["torch.Tensor"],
    bounds: "torch.Tensor",
)
return candidates
Quasi MC-based extended ParEGO (qParEGO) for constrained multi-objective optimization.

    The default value of ``candidates_func`` in :class:`~optuna.integration.BoTorchSampler`
    with multi-objective optimization when the number of objectives is larger than three.

    .. seealso::
        :func:`~optuna.integration.botorch.qei_candidates_func` for argument and return value
        descriptions.
Quasi MC-based extended ParEGO (qParEGO) for constrained multi-objective optimization.
Quasi MC - based extended ParEGO ( qParEGO ) for constrained multi - objective optimization .
def qparego_candidates_func(
    train_x: "torch.Tensor",
    train_obj: "torch.Tensor",
    train_con: Optional["torch.Tensor"],
    bounds: "torch.Tensor",
) -> "torch.Tensor":
    """Quasi MC-based extended ParEGO (qParEGO) for constrained multi-objective optimization.

    The default value of ``candidates_func`` in :class:`~optuna.integration.BoTorchSampler`
    with multi-objective optimization when the number of objectives is larger than three.

    .. seealso::
        :func:`~optuna.integration.botorch.qei_candidates_func` for argument and return value
        descriptions.
    """

    n_objectives = train_obj.size(-1)

    weights = sample_simplex(n_objectives).squeeze()
    scalarization = get_chebyshev_scalarization(weights=weights, Y=train_obj)

    if train_con is not None:
        train_y = torch.cat([train_obj, train_con], dim=-1)

        constraints = []
        n_constraints = train_con.size(1)

        for i in range(n_constraints):
            constraints.append(lambda Z, i=i: Z[..., -n_constraints + i])

        objective = ConstrainedMCObjective(
            objective=lambda Z: scalarization(Z[..., :n_objectives]),
            constraints=constraints,
        )
    else:
        train_y = train_obj

        objective = GenericMCObjective(scalarization)

    train_x = normalize(train_x, bounds=bounds)

    model = SingleTaskGP(train_x, train_y, outcome_transform=Standardize(m=train_y.size(-1)))
    mll = ExactMarginalLogLikelihood(model.likelihood, model)
    fit_gpytorch_model(mll)

    acqf = qExpectedImprovement(
        model=model,
        best_f=objective(train_y).max(),
        sampler=SobolQMCNormalSampler(num_samples=256),
        objective=objective,
    )

    standard_bounds = torch.zeros_like(bounds)
    standard_bounds[1] = 1

    candidates, _ = optimize_acqf(
        acq_function=acqf,
        bounds=standard_bounds,
        q=1,
        num_restarts=20,
        raw_samples=1024,
        options={"batch_limit": 5, "maxiter": 200},
        sequential=True,
    )

    candidates = unnormalize(candidates.detach(), bounds=bounds)

    return candidates
def qparego_candidates_func ( train_x : "torch.Tensor" , train_obj : "torch.Tensor" , train_con : Optional [ "torch.Tensor" ] , bounds : "torch.Tensor" , ) -> "torch.Tensor" : n_objectives = train_obj . size ( - 1 ) weights = sample_simplex ( n_objectives ) . squeeze ( ) scalarization = get_chebyshev_scalarization ( weights = weights , Y = train_obj ) if train_con is not None : train_y = torch . cat ( [ train_obj , train_con ] , dim = - 1 ) constraints = [ ] n_constraints = train_con . size ( 1 ) for i in range ( n_constraints ) : constraints . append ( lambda Z , i = i : Z [ ... , - n_constraints + i ] ) objective = ConstrainedMCObjective ( objective = lambda Z : scalarization ( Z [ ... , : n_objectives ] ) , constraints = constraints , ) else : train_y = train_obj objective = GenericMCObjective ( scalarization ) train_x = normalize ( train_x , bounds = bounds ) model = SingleTaskGP ( train_x , train_y , outcome_transform = Standardize ( m = train_y . size ( - 1 ) ) ) mll = ExactMarginalLogLikelihood ( model . likelihood , model ) fit_gpytorch_model ( mll ) acqf = qExpectedImprovement ( model = model , best_f = objective ( train_y ) . max ( ) , sampler = SobolQMCNormalSampler ( num_samples = 256 ) , objective = objective , ) standard_bounds = torch . zeros_like ( bounds ) standard_bounds [ 1 ] = 1 candidates , _ = optimize_acqf ( acq_function = acqf , bounds = standard_bounds , q = 1 , num_restarts = 20 , raw_samples = 1024 , options = { "batch_limit" : 5 , "maxiter" : 200 } , sequential = True , ) candidates = unnormalize ( candidates . detach ( ) , bounds = bounds ) return candidates