class_docstr: Batch Hypervolume Knowledge Gradient using one-shot optimization.
  
  The hypervolume knowledge gradient seeks to maximize the difference in
  hypervolume of the hypervolume-maximizing set of a fixed size after
  conditioning the unknown observation(s) that would be recevied if X where
  evalauted. See [Daulton2023hvkg]_ for details.
  
  This computes the batch Hypervolume Knowledge Gradient using fantasies for
  the outer expectation and MC-sampling for the inner expectation.
  
  In addition to the design variables, the input `X` also includes variables
  for the optimal designs for each of the fantasy models (Note this is
  `N x N_pareto` optimal designs). For a fixed number of fantasies, all points
  in `X` can be optimized in a "one-shot" fashion.
class_docstr_tok: ["Batch","Hypervolume","Knowledge","Gradient","using","one-shot","optimization",".","The","hypervolume","knowledge","gradient","seeks","to","maximize","the","difference","in","hypervolume","of","the","hypervolume-maximizing","set","of","a","fixed","size","after","conditioning","the","unknown","observation","(","s",")","that","would","be","recevied","if","X","where","evalauted",".","See","[","Daulton2023hvkg","]","_","for","details",".","This","computes","the","batch","Hypervolume","Knowledge","Gradient","using","fantasies","for","the","outer","expectation","and","MC-sampling","for","the","inner","expectation",".","In","addition","to","the","design","variables",",","the","input","`","X","`","also","includes","variables","for","the","optimal","designs","for","each","of","the","fantasy","models","(","Note","this","is","`","N","x","N_pareto","`","optimal","designs",")",".","For","a","fixed","number","of","fantasies",",","all","points","in","`","X","`","can","be","optimized","in","a","``","one-shot","''","fashion","."]
code: def cost_sampler(self):
      if self._cost_sampler is None:
          # Note: Using the deepcopy here is essential. Removing this poses a
          # problem if the base model and the cost model have a different number
          # of outputs or test points (this would be caused by expand), as this
          # would trigger re-sampling the base samples in the fantasy sampler.
          # By cloning the sampler here, the right thing will happen if the
          # the sizes are compatible, if they are not this will result in
          # samples being drawn using different base samples, but it will at
          # least avoid changing state of the fantasy sampler.
          self._cost_sampler = deepcopy(self.sampler)
      return self._cost_sampler
  
imports: from copy import deepcopy
  from typing import Any, Callable, Dict, List, Optional, Tuple, Type
  import torch
  from botorch import settings
  from botorch.acquisition.acquisition import AcquisitionFunction, OneShotAcquisitionFunction
  from botorch.acquisition.cost_aware import CostAwareUtility
  from botorch.acquisition.decoupled import DecoupledAcquisitionFunction
  from botorch.acquisition.knowledge_gradient import ProjectedAcquisitionFunction
  from botorch.acquisition.multi_objective.monte_carlo import MultiObjectiveMCAcquisitionFunction, qExpectedHypervolumeImprovement
  from botorch.acquisition.multi_objective.objective import MCMultiOutputObjective
  from botorch.exceptions.errors import UnsupportedError
  from botorch.models.deterministic import PosteriorMeanModel
  from botorch.models.model import Model
  from botorch.sampling.base import MCSampler
  from botorch.sampling.list_sampler import ListSampler
  from botorch.sampling.normal import SobolQMCNormalSampler
  from botorch.sampling.stochastic_samplers import StochasticSampler
  from botorch.utils.multi_objective.box_decompositions.non_dominated import FastNondominatedPartitioning
  from botorch.utils.transforms import match_batch_shape, t_batch_mode_transform
  from torch import Tensor
label_desc: Use image node_id 2 for calling the qHypervolumeKnowledgeGradient obj's underlying member method code with example usage: obj.cost_sampler() and returns: self