code: def test_feasibility_weighted_mc_multi_output_objective(self):
      for dtype in (torch.float, torch.double):
          tkwargs = {"dtype": dtype, "device": self.device}
          X = torch.zeros(5, 1, **tkwargs)
          # The infeasible cost will be 0.0.
          means = torch.tensor(
              [
                  [1.0, 0.5],
                  [2.0, -1.0],
                  [3.0, -0.5],
                  [4.0, 1.0],
                  [5.0, 1.0],
              ],
              **tkwargs,
          )
          variances = torch.zeros(5, 2, **tkwargs)
          mm = MockModel(MockPosterior(mean=means, variance=variances))
          feas_obj = FeasibilityWeightedMCMultiOutputObjective(
              model=mm,
              X_baseline=X,
              constraint_idcs=[-1],
              objective=None,
          )
          feas_samples = feas_obj(means)
          expected = torch.tensor(
              [[1.0], [0.0], [0.0], [4.0], [5.0]], **tkwargs
          )
          self.assertTrue(torch.allclose(feas_samples, expected))
          self.assertTrue(feas_obj._verify_output_shape)
  
          # With an objective.
          preprocessing_function = WeightedMCMultiOutputObjective(
              weights=torch.tensor([2.0])
          )
          dummy_obj = MultiOutputExpectation(
              n_w=1, preprocessing_function=preprocessing_function
          )
          dummy_obj._verify_output_shape = False  # for testing
          feas_obj = FeasibilityWeightedMCMultiOutputObjective(
              model=mm,
              X_baseline=X,
              constraint_idcs=[1],
              objective=dummy_obj,
          )
          feas_samples = feas_obj(means)
          self.assertTrue(torch.allclose(feas_samples, expected * 2.0))
          self.assertFalse(feas_obj._verify_output_shape)
  
          # No constraints.
          feas_obj = FeasibilityWeightedMCMultiOutputObjective(
              model=mm,
              X_baseline=X,
              constraint_idcs=[],
              objective=None,
          )
          feas_samples = feas_obj(means)
          self.assertIs(feas_samples, means)
  
          # With a single-output objective.
          feas_obj = FeasibilityWeightedMCMultiOutputObjective(
              model=mm,
              X_baseline=X,
              constraint_idcs=[1],
              objective=IdentityMCObjective(),
          )
          feas_samples = feas_obj(means)
          self.assertTrue(
              torch.allclose(feas_samples, expected.squeeze(-1))
          )
  
          # Error with duplicate idcs.
          with self.assertRaisesRegex(ValueError, "duplicate"):
              FeasibilityWeightedMCMultiOutputObjective(
                  model=mm,
                  X_baseline=X,
                  constraint_idcs=[1, -1],
              )
  
imports: import itertools
  import warnings
  import torch
  from botorch.acquisition.multi_objective.multi_output_risk_measures import MultiOutputExpectation
  from botorch.acquisition.multi_objective.objective import FeasibilityWeightedMCMultiOutputObjective, IdentityMCMultiOutputObjective, MCMultiOutputObjective, UnstandardizeMCMultiOutputObjective, WeightedMCMultiOutputObjective
  from botorch.acquisition.objective import IdentityMCObjective, UnstandardizePosteriorTransform
  from botorch.exceptions.errors import BotorchError, BotorchTensorDimensionError
  from botorch.models.transforms.outcome import Standardize
  from botorch.utils.testing import BotorchTestCase, MockModel, MockPosterior
label_desc: Use image node_id 1 for calling the TestFeasibilityWeightedMCMultiOutputObjective obj's underlying member method code with example usage: obj.test_feasibility_weighted_mc_multi_output_objective() without return types