code: def test_SetStatusQuoAndOptimizePower(self) -> None:
      batch_trial = self.experiment.new_batch_trial()
      status_quo = Arm(
          name="status_quo",
          parameters={"w": 0.0, "x": 1, "y": "foo", "z": True},
      )
  
      # Test adding status quo and optimizing power on empty batch
      batch_trial.set_status_quo_and_optimize_power(status_quo)
      self.assertEqual(batch_trial.arm_weights[status_quo], 1.0)
  
      # Test adding status quo and optimizing power on non-empty batch
      batch_trial = self.experiment.new_batch_trial()
      parameterizations = [
          {"w": 0.75, "x": 1, "y": "foo", "z": True},
          {"w": 0.77, "x": 2, "y": "foo", "z": True},
      ]
      # pyre-fixme[6]: For 1st param expected `Dict[str, Union[None, bool, float,
      #  int, str]]` but got `Dict[str, Union[float, str]]`.
      arms = [
          Arm(parameters=p) for i, p in enumerate(parameterizations)
      ]
      batch_trial.add_arms_and_weights(arms=arms)
      batch_trial.set_status_quo_and_optimize_power(status_quo)
      self.assertEqual(batch_trial.arm_weights[status_quo], np.sqrt(2))
  
      # Test adding status quo and optimizing power when trial already
      # has a status quo
      batch_trial = self.experiment.new_batch_trial()
      batch_trial.set_status_quo_with_weight(status_quo, 1)
      self.assertEqual(batch_trial.arm_weights[status_quo], 1.0)
      batch_trial.add_arms_and_weights(arms=arms)
      batch_trial.set_status_quo_and_optimize_power(status_quo)
      self.assertEqual(batch_trial.arm_weights[status_quo], np.sqrt(2))
      # Since status quo is not in the generator runs, all of its weight
      # comes from _status_quo_weight_override
      self.assertEqual(
          batch_trial._status_quo_weight_override, np.sqrt(2)
      )
  
      # Test adding status quo and optimizing power when status quo
      # is in the generator runs
      batch_trial = self.experiment.new_batch_trial()
      parameterizations = [
          {"w": 0.75, "x": 1, "y": "foo", "z": True},
          {"w": 0.77, "x": 2, "y": "foo", "z": True},
          {"w": 0.0, "x": 1, "y": "foo", "z": True},
      ]
      # pyre-fixme[6]: For 1st param expected `Dict[str, Union[None, bool, float,
      #  int, str]]` but got `Dict[str, Union[float, str]]`.
      arms = [
          Arm(parameters=p) for i, p in enumerate(parameterizations)
      ]
      batch_trial.add_arms_and_weights(arms=arms)
      batch_trial.set_status_quo_and_optimize_power(status_quo)
      self.assertEqual(batch_trial.arm_weights[status_quo], np.sqrt(2))
      # Since status quo has a weight of 1 in the generator runs, only part of
      # its weight comes from _status_quo_weight_override
      self.assertEqual(
          batch_trial._status_quo_weight_override, np.sqrt(2)
      )
  
imports: import math
  from time import sleep
  from unittest import mock
  from unittest.mock import patch, PropertyMock
  import numpy
  from ax.core.arm import Arm
  from ax.core.base_trial import TrialStatus
  from ax.core.batch_trial import BatchTrial, GeneratorRunStruct
  from ax.core.experiment import Experiment
  from ax.core.generator_run import GeneratorRun, GeneratorRunType
  from ax.core.parameter import FixedParameter, ParameterType
  from ax.core.search_space import SearchSpace
  from ax.runners.synthetic import SyntheticRunner
  from ax.utils.common.testutils import TestCase
  from ax.utils.common.typeutils import checked_cast
  from ax.utils.testing.core_stubs import get_abandoned_arm, get_arm, get_arm_weights1, get_arms, get_experiment, get_generator_run, get_generator_run2, get_weights
label_desc: Use image node_id 23 for calling the BatchTrialTest obj's underlying member method code with example usage: obj.test_SetStatusQuoAndOptimizePower() without return types