class_docstr: Feasibility-weighted objective.
  
  An Objective allowing to maximize some scalable objective on the model
  outputs subject to a number of constraints. Constraint feasibilty is
  approximated by a sigmoid function.
  
      mc_acq(X) = (
      (objective(X) + infeasible_cost) * \prod_i (1  - sigmoid(constraint_i(X)))
      ) - infeasible_cost
  
  See `botorch.utils.objective.apply_constraints` for details on the constraint
  handling.
  
  Example:
      >>> bound = 0.0
      >>> objective = lambda Y: Y[..., 0]
      >>> # apply non-negativity constraint on f(x)[1]
      >>> constraint = lambda Y: bound - Y[..., 1]
      >>> constrained_objective = ConstrainedMCObjective(objective, [constraint])
      >>> samples = sampler(posterior)
      >>> objective = constrained_objective(samples)
  
  TODO: Deprecate this as default way to handle constraints with MC acquisition
  functions once we have data on how well SampleReducingMCAcquisitionFunction works.
class_docstr_tok: ["Feasibility-weighted","objective",".","An","Objective","allowing","to","maximize","some","scalable","objective","on","the","model","outputs","subject","to","a","number","of","constraints",".","Constraint","feasibilty","is","approximated","by","a","sigmoid","function",".","mc_acq","(","X",")","=","(","(","objective","(","X",")","+","infeasible_cost",")","*","\\prod_i","(","1","-","sigmoid","(","constraint_i","(","X",")",")",")",")","-","infeasible_cost","See","`","botorch.utils.objective.apply_constraints","`","for","details","on","the","constraint","handling",".","Example",":",">",">",">","bound","=","0.0",">",">",">","objective","=","lambda","Y",":","Y","[","...",",","0","]",">",">",">","#","apply","non-negativity","constraint","on","f","(","x",")","[","1","]",">",">",">","constraint","=","lambda","Y",":","bound","-","Y","[","...",",","1","]",">",">",">","constrained_objective","=","ConstrainedMCObjective","(","objective",",","[","constraint","]",")",">",">",">","samples","=","sampler","(","posterior",")",">",">",">","objective","=","constrained_objective","(","samples",")","TODO",":","Deprecate","this","as","default","way","to","handle","constraints","with","MC","acquisition","functions","once","we","have","data","on","how","well","SampleReducingMCAcquisitionFunction","works","."]
docstr: Evaluate the feasibility-weighted objective on the samples.
  
  Args:
      samples: A `sample_shape x batch_shape x q x m`-dim Tensors of
          samples from a model posterior.
      X: A `batch_shape x q x d`-dim tensor of inputs. Relevant only if
          the objective depends on the inputs explicitly.
  
  Returns:
      A `sample_shape x batch_shape x q`-dim Tensor of objective values
      weighted by feasibility (assuming maximization).
code: def forward(
      self, samples: Tensor, X: Optional[Tensor] = None
  ) -> Tensor:
      r"""Evaluate the feasibility-weighted objective on the samples.
  
      Args:
          samples: A `sample_shape x batch_shape x q x m`-dim Tensors of
              samples from a model posterior.
          X: A `batch_shape x q x d`-dim tensor of inputs. Relevant only if
              the objective depends on the inputs explicitly.
  
      Returns:
          A `sample_shape x batch_shape x q`-dim Tensor of objective values
          weighted by feasibility (assuming maximization).
      """
      obj = super().forward(samples=samples)
      return apply_constraints(
          obj=obj,
          constraints=self.constraints,
          samples=samples,
          infeasible_cost=self.infeasible_cost,
          eta=self.eta,
      )
  
imports: from __future__ import annotations
  import inspect
  import warnings
  from abc import ABC, abstractmethod
  from typing import Callable, List, Optional, TYPE_CHECKING, Union
  import torch
  from botorch.exceptions.errors import BotorchTensorDimensionError, UnsupportedError
  from botorch.exceptions.warnings import InputDataWarning
  from botorch.models.model import Model
  from botorch.models.transforms.outcome import Standardize
  from botorch.posteriors.gpytorch import GPyTorchPosterior, scalarize_posterior
  from botorch.sampling import IIDNormalSampler
  from botorch.utils import apply_constraints
  from gpytorch.distributions import MultitaskMultivariateNormal, MultivariateNormal
  from linear_operator.operators.dense_linear_operator import to_linear_operator
  from torch import Tensor
  from torch.nn import Module
  from botorch.models.deterministic import DeterministicModel
label_desc: Use image node_id 2 for calling the ConstrainedMCObjective obj's underlying member method code with example usage: obj.forward(samples, X) and returns: apply_constraints