docstr: This test should be run for each non-abstract subclass of `BoxDecomposition`.
docstr_tok: ["This","test","should","be","run","for","each","non-abstract","subclass","of","`","BoxDecomposition","`","."]
code: def helper_hypervolume(self, Box_Decomp_cls: type) -> None:
      """
      This test should be run for each non-abstract subclass of `BoxDecomposition`.
      """
      # batching
      n_outcomes, batch_dim, n = 2, 3, 4
  
      ref_point = torch.zeros(n_outcomes)
      Y = torch.ones(batch_dim, n, n_outcomes)
  
      box_decomp = Box_Decomp_cls(ref_point=ref_point, Y=Y)
      hv = box_decomp.compute_hypervolume()
      self.assertEqual(hv.shape, (batch_dim,))
      self.assertAllClose(hv, torch.ones(batch_dim))
  
      # no batching
      Y = torch.ones(n, n_outcomes)
  
      box_decomp = Box_Decomp_cls(ref_point=ref_point, Y=Y)
      hv = box_decomp.compute_hypervolume()
      self.assertEqual(hv.shape, ())
      self.assertAllClose(hv, torch.tensor(1.0))
  
      # cases where there is nothing in Y, either because n=0 or Y is None
      n = 0
      Y_and_expected_shape = [
          (torch.ones(batch_dim, n, n_outcomes), (batch_dim,)),
          (torch.ones(n, n_outcomes), ()),
          (None, ()),
      ]
      for Y, expected_shape in Y_and_expected_shape:
          box_decomp = Box_Decomp_cls(ref_point=ref_point, Y=Y)
          hv = box_decomp.compute_hypervolume()
          self.assertEqual(hv.shape, expected_shape)
          self.assertAllClose(hv, torch.zeros(expected_shape))
  
imports: from __future__ import annotations
  from itertools import product
  from unittest import mock
  import torch
  from botorch.exceptions.errors import BotorchError
  from botorch.utils.multi_objective.box_decompositions.box_decomposition import BoxDecomposition, FastPartitioning
  from botorch.utils.multi_objective.box_decompositions.dominated import DominatedPartitioning
  from botorch.utils.multi_objective.box_decompositions.non_dominated import FastNondominatedPartitioning, NondominatedPartitioning
  from botorch.utils.multi_objective.box_decompositions.utils import update_local_upper_bounds_incremental
  from botorch.utils.testing import BotorchTestCase
label_desc: Use image node_id 1 for calling the TestBoxDecomposition_no_set_up obj's underlying member method code with example usage: obj.helper_hypervolume(Box_Decomp_cls) without return types