

import collections
import inspect
import unittest

from transformers import DonutSwinConfig
from transformers.testing_utils import require_torch, slow, torch_device
from transformers.utils import is_torch_available

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, _config_zero_init, floats_tensor, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
  import torch
  from torch import nn

  from transformers import DonutSwinModel
  from transformers.models.donut.modeling_donut_swin import DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST






class 							A_				:


     def __init__(							self    :	int    ,						UpperCAmelCase    :	Any    ,						UpperCAmelCase    :	str=1_3    ,						UpperCAmelCase    :	List[Any]=3_2    ,						UpperCAmelCase    :	Tuple=2    ,						UpperCAmelCase    :	List[str]=3    ,						UpperCAmelCase    :	Dict=1_6    ,						UpperCAmelCase    :	Tuple=[1, 2, 1]    ,						UpperCAmelCase    :	List[str]=[2, 2, 4]    ,						UpperCAmelCase    :	Union[str, Any]=2    ,						UpperCAmelCase    :	Optional[int]=2.0    ,						UpperCAmelCase    :	Optional[Any]=True    ,						UpperCAmelCase    :	Tuple=0.0    ,						UpperCAmelCase    :	str=0.0    ,						UpperCAmelCase    :	Tuple=0.1    ,						UpperCAmelCase    :	Tuple="gelu"    ,						UpperCAmelCase    :	Union[str, Any]=False    ,						UpperCAmelCase    :	List[Any]=True    ,						UpperCAmelCase    :	Optional[Any]=0.02    ,						UpperCAmelCase    :	Optional[Any]=1E-5    ,						UpperCAmelCase    :	Optional[int]=True    ,						UpperCAmelCase    :	List[str]=None    ,						UpperCAmelCase    :	int=True    ,						UpperCAmelCase    :	Optional[Any]=1_0    ,						UpperCAmelCase    :	Any=8    ,						)							->			Dict:
      __lowerCAmelCase:     List[Any]     			=   parent
      __lowerCAmelCase:     Union[str, Any]     			=   batch_size
      __lowerCAmelCase:     Dict     			=   image_size
      __lowerCAmelCase:     Union[str, Any]     			=   patch_size
      __lowerCAmelCase:     List[Any]     			=   num_channels
      __lowerCAmelCase:     Dict     			=   embed_dim
      __lowerCAmelCase:     str     			=   depths
      __lowerCAmelCase:     List[Any]     			=   num_heads
      __lowerCAmelCase:     Optional[int]     			=   window_size
      __lowerCAmelCase:     int     			=   mlp_ratio
      __lowerCAmelCase:     Optional[Any]     			=   qkv_bias
      __lowerCAmelCase:     Tuple     			=   hidden_dropout_prob
      __lowerCAmelCase:     Dict     			=   attention_probs_dropout_prob
      __lowerCAmelCase:     List[str]     			=   drop_path_rate
      __lowerCAmelCase:     Tuple     			=   hidden_act
      __lowerCAmelCase:     str     			=   use_absolute_embeddings
      __lowerCAmelCase:     Dict     			=   patch_norm
      __lowerCAmelCase:     Union[str, Any]     			=   layer_norm_eps
      __lowerCAmelCase:     str     			=   initializer_range
      __lowerCAmelCase:     List[str]     			=   is_training
      __lowerCAmelCase:     Optional[int]     			=   scope
      __lowerCAmelCase:     Union[str, Any]     			=   use_labels
      __lowerCAmelCase:     List[str]     			=   type_sequence_label_size
      __lowerCAmelCase:     Optional[Any]     			=   encoder_stride


     def 						UpperCAmelCase						(							self    :	str      )							->			Optional[Any]:
      __lowerCAmelCase:     List[Any]     			=   floats_tensor([self.batch_size, self.num_channels, self.image_size, self.image_size]      )

      __lowerCAmelCase:     Union[str, Any]     			=   None
      if self.use_labels:
       __lowerCAmelCase:     Union[str, Any]     			=   ids_tensor([self.batch_size]    ,						self.type_sequence_label_size      )

      __lowerCAmelCase:     Dict     			=   self.get_config()

      return config, pixel_values, labels


     def 						UpperCAmelCase						(							self    :	int      )							->			List[Any]:
      return DonutSwinConfig(
          image_size=self.image_size    ,						patch_size=self.patch_size    ,						num_channels=self.num_channels    ,						embed_dim=self.embed_dim    ,						depths=self.depths    ,						num_heads=self.num_heads    ,						window_size=self.window_size    ,						mlp_ratio=self.mlp_ratio    ,						qkv_bias=self.qkv_bias    ,						hidden_dropout_prob=self.hidden_dropout_prob    ,						attention_probs_dropout_prob=self.attention_probs_dropout_prob    ,						drop_path_rate=self.drop_path_rate    ,						hidden_act=self.hidden_act    ,						use_absolute_embeddings=self.use_absolute_embeddings    ,						path_norm=self.patch_norm    ,						layer_norm_eps=self.layer_norm_eps    ,						initializer_range=self.initializer_range    ,						encoder_stride=self.encoder_stride    ,						)


     def 						UpperCAmelCase						(							self    :	int    ,						UpperCAmelCase    :	Tuple    ,						UpperCAmelCase    :	Any    ,						UpperCAmelCase    :	Dict      )							->			Optional[int]:
      __lowerCAmelCase:     List[str]     			=   DonutSwinModel(config=UpperCAmelCase      )
      model.to(UpperCAmelCase      )
      model.eval()
      __lowerCAmelCase:     Dict     			=   model(UpperCAmelCase      )

      __lowerCAmelCase:     int     			=   ((config.image_size // config.patch_size) ** 2) // (4 ** (len(config.depths      ) - 1))
      __lowerCAmelCase:     Tuple     			=   int(config.embed_dim * 2 ** (len(config.depths      ) - 1)      )

      self.parent.assertEqual(result.last_hidden_state.shape    ,						(self.batch_size, expected_seq_len, expected_dim)      )


     def 						UpperCAmelCase						(							self    :	List[Any]      )							->			Any:
      __lowerCAmelCase:     str     			=   self.prepare_config_and_inputs()
      (
          (
          __lowerCAmelCase
      )			,							(
          __lowerCAmelCase
      )			,							(
          __lowerCAmelCase
      )			,							
      ):     Union[str, Any]     			=   config_and_inputs
      __lowerCAmelCase:     Tuple     			=   {'pixel_values': pixel_values}
      return config, inputs_dict







@require_torch
class 							A_				(	snake_case__							,			snake_case__							,			unittest.TestCase      ):
     _lowercase    :  Optional[Any]          =			(DonutSwinModel,) if is_torch_available() else ()
     _lowercase    :  Dict          =			{'feature-extraction': DonutSwinModel} if is_torch_available() else {}
     _lowercase    :  Any          =			True

     _lowercase    :  Union[str, Any]          =			False
     _lowercase    :  Dict          =			False
     _lowercase    :  Union[str, Any]          =			False


     def 						UpperCAmelCase						(							self    :	Dict      )							->			Optional[int]:
      __lowerCAmelCase:     List[Any]     			=   DonutSwinModelTester(self      )
      __lowerCAmelCase:     Optional[Any]     			=   ConfigTester(self    ,						config_class=UpperCAmelCase    ,						embed_dim=3_7      )


     def 						UpperCAmelCase						(							self    :	str      )							->			Optional[Any]:
      self.create_and_test_config_common_properties()
      self.config_tester.create_and_test_config_to_json_string()
      self.config_tester.create_and_test_config_to_json_file()
      self.config_tester.create_and_test_config_from_and_save_pretrained()
      self.config_tester.create_and_test_config_with_num_labels()
      self.config_tester.check_config_can_be_init_without_params()
      self.config_tester.check_config_arguments_init()


     def 						UpperCAmelCase						(							self    :	str      )							->			List[Any]:
      return


     def 						UpperCAmelCase						(							self    :	Optional[int]      )							->			Tuple:
      __lowerCAmelCase:     int     			=   self.model_tester.prepare_config_and_inputs()
      self.model_tester.create_and_check_model(*UpperCAmelCase      )


     def 						UpperCAmelCase						(							self    :	str      )							->			Dict:
      # DonutSwin does not use inputs_embeds
      pass


     def 						UpperCAmelCase						(							self    :	str      )							->			Tuple:
      __lowerCAmelCase			,							__lowerCAmelCase:     Tuple     			=   self.model_tester.prepare_config_and_inputs_for_common()

      for model_class in self.all_model_classes:
       __lowerCAmelCase:     List[str]     			=   model_class(UpperCAmelCase      )
       self.assertIsInstance(model.get_input_embeddings()    ,						(nn.Module)      )
       __lowerCAmelCase:     Union[str, Any]     			=   model.get_output_embeddings()
       self.assertTrue(x is None or isinstance(UpperCAmelCase    ,						nn.Linear      )      )


     def 						UpperCAmelCase						(							self    :	Dict      )							->			Union[str, Any]:
      __lowerCAmelCase			,							__lowerCAmelCase:     Union[str, Any]     			=   self.model_tester.prepare_config_and_inputs_for_common()

      for model_class in self.all_model_classes:
       __lowerCAmelCase:     List[str]     			=   model_class(UpperCAmelCase      )
       __lowerCAmelCase:     Tuple     			=   inspect.signature(model.forward      )
       # signature.parameters is an OrderedDict => so arg_names order is deterministic
       __lowerCAmelCase:     Any     			=   [*signature.parameters.keys()]

       __lowerCAmelCase:     Tuple     			=   ['pixel_values']
       self.assertListEqual(arg_names[:1]    ,						UpperCAmelCase      )


     def 						UpperCAmelCase						(							self    :	Optional[Any]      )							->			Union[str, Any]:
      __lowerCAmelCase			,							__lowerCAmelCase:     List[Any]     			=   self.model_tester.prepare_config_and_inputs_for_common()
      __lowerCAmelCase:     List[Any]     			=   True

      for model_class in self.all_model_classes:
       __lowerCAmelCase:     int     			=   True
       __lowerCAmelCase:     Tuple     			=   False
       __lowerCAmelCase:     int     			=   True
       __lowerCAmelCase:     Dict     			=   model_class(UpperCAmelCase      )
       model.to(UpperCAmelCase      )
       model.eval()
       with torch.no_grad():
        __lowerCAmelCase:     Optional[Any]     			=   model(**self._prepare_for_class(UpperCAmelCase    ,						UpperCAmelCase      )      )
       __lowerCAmelCase:     Tuple     			=   outputs.attentions
       __lowerCAmelCase:     Union[str, Any]     			=   len(self.model_tester.depths      )
       self.assertEqual(len(UpperCAmelCase      )    ,						UpperCAmelCase      )

       # check that output_attentions also work using config
       del inputs_dict["output_attentions"]
       __lowerCAmelCase:     int     			=   True
       __lowerCAmelCase:     Tuple     			=   config.window_size**2
       __lowerCAmelCase:     str     			=   model_class(UpperCAmelCase      )
       model.to(UpperCAmelCase      )
       model.eval()
       with torch.no_grad():
        __lowerCAmelCase:     Optional[Any]     			=   model(**self._prepare_for_class(UpperCAmelCase    ,						UpperCAmelCase      )      )
       __lowerCAmelCase:     Union[str, Any]     			=   outputs.attentions
       self.assertEqual(len(UpperCAmelCase      )    ,						UpperCAmelCase      )

       self.assertListEqual(
           list(attentions[0].shape[-3:]      )    ,						[self.model_tester.num_heads[0], window_size_squared, window_size_squared]    ,						)
       __lowerCAmelCase:     Union[str, Any]     			=   len(UpperCAmelCase      )

       # Check attention is always last and order is fine
       __lowerCAmelCase:     int     			=   True
       __lowerCAmelCase:     Optional[Any]     			=   True
       __lowerCAmelCase:     int     			=   model_class(UpperCAmelCase      )
       model.to(UpperCAmelCase      )
       model.eval()
       with torch.no_grad():
        __lowerCAmelCase:     int     			=   model(**self._prepare_for_class(UpperCAmelCase    ,						UpperCAmelCase      )      )

       if hasattr(self.model_tester    ,						'num_hidden_states_types'      ):
        __lowerCAmelCase:     Any     			=   self.model_tester.num_hidden_states_types
       else:
        # also another +1 for reshaped_hidden_states
        __lowerCAmelCase:     str     			=   2
       self.assertEqual(out_len + added_hidden_states    ,						len(UpperCAmelCase      )      )

       __lowerCAmelCase:     List[Any]     			=   outputs.attentions

       self.assertEqual(len(UpperCAmelCase      )    ,						UpperCAmelCase      )

       self.assertListEqual(
           list(self_attentions[0].shape[-3:]      )    ,						[self.model_tester.num_heads[0], window_size_squared, window_size_squared]    ,						)


     def 						UpperCAmelCase						(							self    :	Tuple    ,						UpperCAmelCase    :	Optional[int]    ,						UpperCAmelCase    :	Tuple    ,						UpperCAmelCase    :	Optional[Any]    ,						UpperCAmelCase    :	str      )							->			Optional[int]:
      __lowerCAmelCase:     int     			=   model_class(UpperCAmelCase      )
      model.to(UpperCAmelCase      )
      model.eval()

      with torch.no_grad():
       __lowerCAmelCase:     str     			=   model(**self._prepare_for_class(UpperCAmelCase    ,						UpperCAmelCase      )      )

      __lowerCAmelCase:     Union[str, Any]     			=   outputs.hidden_states

      __lowerCAmelCase:     int     			=   getattr(
          self.model_tester    ,						'expected_num_hidden_layers'    ,						len(self.model_tester.depths      ) + 1      )
      self.assertEqual(len(UpperCAmelCase      )    ,						UpperCAmelCase      )

      # DonutSwin has a different seq_length
      __lowerCAmelCase:     str     			=   (
          config.patch_size
          if isinstance(config.patch_size    ,						collections.abc.Iterable      )
          else (config.patch_size, config.patch_size)
      )

      __lowerCAmelCase:     str     			=   (image_size[1] // patch_size[1]) * (image_size[0] // patch_size[0])

      self.assertListEqual(
          list(hidden_states[0].shape[-2:]      )    ,						[num_patches, self.model_tester.embed_dim]    ,						)

      __lowerCAmelCase:     Dict     			=   outputs.reshaped_hidden_states
      self.assertEqual(len(UpperCAmelCase      )    ,						UpperCAmelCase      )

      __lowerCAmelCase			,							__lowerCAmelCase			,							__lowerCAmelCase			,							__lowerCAmelCase:     Tuple     			=   reshaped_hidden_states[0].shape
      __lowerCAmelCase:     str     			=   (
          reshaped_hidden_states[0].view(UpperCAmelCase    ,						UpperCAmelCase    ,						height * width      ).permute(0    ,						2    ,						1      )
      )
      self.assertListEqual(
          list(reshaped_hidden_states.shape[-2:]      )    ,						[num_patches, self.model_tester.embed_dim]    ,						)


     def 						UpperCAmelCase						(							self    :	Optional[int]      )							->			Optional[Any]:
      __lowerCAmelCase			,							__lowerCAmelCase:     Union[str, Any]     			=   self.model_tester.prepare_config_and_inputs_for_common()

      __lowerCAmelCase:     Optional[Any]     			=   (
          self.model_tester.image_size
          if isinstance(self.model_tester.image_size    ,						collections.abc.Iterable      )
          else (self.model_tester.image_size, self.model_tester.image_size)
      )

      for model_class in self.all_model_classes:
       __lowerCAmelCase:     Optional[int]     			=   True
       self.check_hidden_states_output(UpperCAmelCase    ,						UpperCAmelCase    ,						UpperCAmelCase    ,						UpperCAmelCase      )

       # check that output_hidden_states also work using config
       del inputs_dict["output_hidden_states"]
       __lowerCAmelCase:     Optional[int]     			=   True

       self.check_hidden_states_output(UpperCAmelCase    ,						UpperCAmelCase    ,						UpperCAmelCase    ,						UpperCAmelCase      )


     def 						UpperCAmelCase						(							self    :	str      )							->			List[Any]:
      __lowerCAmelCase			,							__lowerCAmelCase:     Tuple     			=   self.model_tester.prepare_config_and_inputs_for_common()
      __lowerCAmelCase:     List[str]     			=   3

      __lowerCAmelCase:     Optional[int]     			=   (
          self.model_tester.image_size
          if isinstance(self.model_tester.image_size    ,						collections.abc.Iterable      )
          else (self.model_tester.image_size, self.model_tester.image_size)
      )
      __lowerCAmelCase:     str     			=   (
          config.patch_size
          if isinstance(config.patch_size    ,						collections.abc.Iterable      )
          else (config.patch_size, config.patch_size)
      )

      __lowerCAmelCase:     Any     			=   image_size[0] + patch_size[0] - (image_size[0] % patch_size[0])
      __lowerCAmelCase:     Dict     			=   image_size[1] + patch_size[1] - (image_size[1] % patch_size[1])

      for model_class in self.all_model_classes:
       __lowerCAmelCase:     Tuple     			=   True
       self.check_hidden_states_output(UpperCAmelCase    ,						UpperCAmelCase    ,						UpperCAmelCase    ,						(padded_height, padded_width)      )

       # check that output_hidden_states also work using config
       del inputs_dict["output_hidden_states"]
       __lowerCAmelCase:     List[Any]     			=   True
       self.check_hidden_states_output(UpperCAmelCase    ,						UpperCAmelCase    ,						UpperCAmelCase    ,						(padded_height, padded_width)      )


     @slow
     def 						UpperCAmelCase						(							self    :	Dict      )							->			Optional[int]:
      for model_name in DONUT_SWIN_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
       __lowerCAmelCase:     int     			=   DonutSwinModel.from_pretrained(UpperCAmelCase      )
       self.assertIsNotNone(UpperCAmelCase      )


     def 						UpperCAmelCase						(							self    :	Any      )							->			Dict:
      __lowerCAmelCase			,							__lowerCAmelCase:     List[str]     			=   self.model_tester.prepare_config_and_inputs_for_common()

      __lowerCAmelCase:     Dict     			=   _config_zero_init(UpperCAmelCase      )
      for model_class in self.all_model_classes:
       __lowerCAmelCase:     Optional[int]     			=   model_class(config=UpperCAmelCase      )
       for name, param in model.named_parameters():
        if "embeddings" not in name and param.requires_grad:
         self.assertIn(
             ((param.data.mean() * 1E9).round() / 1E9).item()    ,						[0.0, 1.0]    ,						msg=F'''Parameter {name} of model {model_class} seems not properly initialized'''    ,						)








import math






class 							A_				:


     def __init__(							self    :	Any    ,						UpperCAmelCase    :	int    ,						UpperCAmelCase    :	int    ,						UpperCAmelCase    :	int    ,						UpperCAmelCase    :	Any      )							->			Any:
      __lowerCAmelCase:     Optional[Any]     			=   x
      __lowerCAmelCase:     Any     			=   y
      __lowerCAmelCase:     Tuple     			=   step_size
      __lowerCAmelCase:     Dict     			=   function_to_optimize


     def 						UpperCAmelCase						(							self    :	Dict      )							->			int:
      return self.function(self.x    ,						self.y      )


     def 						UpperCAmelCase						(							self    :	str      )							->			int:
      __lowerCAmelCase:     Union[str, Any]     			=   self.step_size
      return [
          SearchProblem(UpperCAmelCase    ,						UpperCAmelCase    ,						UpperCAmelCase    ,						self.function      )
          for x, y in (
              (self.x - step_size, self.y - step_size),
              (self.x - step_size, self.y),
              (self.x - step_size, self.y + step_size),
              (self.x, self.y - step_size),
              (self.x, self.y + step_size),
              (self.x + step_size, self.y - step_size),
              (self.x + step_size, self.y),
              (self.x + step_size, self.y + step_size),
          )
      ]


     def __hash__(							self    :	Optional[Any]      )							->			int:
      return hash(str(self      )      )


     def __eq__(							self    :	Dict    ,						UpperCAmelCase    :	Tuple      )							->			Any:
      if isinstance(UpperCAmelCase    ,						UpperCAmelCase      ):
       return hash(str(self      )      ) == hash(str(UpperCAmelCase      )      )
      return False


     def __str__(							self    :	Optional[Any]      )							->			Dict:
      return F'''x: {self.x} y: {self.y}'''







def _a				( SCREAMING_SNAKE_CASE	:    List[str]					,      SCREAMING_SNAKE_CASE	:    bool = True					,      SCREAMING_SNAKE_CASE	:    float = math.inf					,      SCREAMING_SNAKE_CASE	:    float = -math.inf					,      SCREAMING_SNAKE_CASE	:    float = math.inf					,      SCREAMING_SNAKE_CASE	:    float = -math.inf					,      SCREAMING_SNAKE_CASE	:    bool = False					,      SCREAMING_SNAKE_CASE	:    int = 1_00_00					,      )					->					SearchProblem:

 """simple docstring"""






 __lowerCAmelCase:     Dict     			=   search_prob
 __lowerCAmelCase:     str     			=   []  # list to store the current score at each iteration
 __lowerCAmelCase:     Optional[int]     			=   0
 __lowerCAmelCase:     int     			=   False
 __lowerCAmelCase:     Any     			=   set()
 while not solution_found and iterations < max_iter:
  visited.add(SCREAMING_SNAKE_CASE	)
  iterations += 1
  __lowerCAmelCase:     int     			=   current_state.score()
  scores.append(SCREAMING_SNAKE_CASE	)
  __lowerCAmelCase:     Any     			=   current_state.get_neighbors()
  __lowerCAmelCase:     Tuple     			=   -math.inf
  __lowerCAmelCase:     Any     			=   math.inf
  __lowerCAmelCase:     Dict     			=   None  # to hold the next best neighbor
  for neighbor in neighbors:
   if neighbor in visited:
    continue  # do not want to visit the same state again
   if (
       neighbor.x > max_x
       or neighbor.x < min_x
       or neighbor.y > max_y
       or neighbor.y < min_y
   ):
    continue  # neighbor outside our bounds
   __lowerCAmelCase:     List[str]     			=   neighbor.score() - current_score
   if find_max:  # finding max
    # going to direction with greatest ascent
    if change > max_change and change > 0:
     __lowerCAmelCase:     int     			=   change
     __lowerCAmelCase:     int     			=   neighbor
   else:  # finding min
    # to direction with greatest descent
    if change < min_change and change < 0:
     __lowerCAmelCase:     str     			=   change
     __lowerCAmelCase:     str     			=   neighbor
  if next_state is not None:
   # we found at least one neighbor which improved the current state
   __lowerCAmelCase:     Optional[Any]     			=   next_state
  else:
   # since we have no neighbor that improves the solution we stop the search
   __lowerCAmelCase:     Dict     			=   True

 if visualization:
  from matplotlib import pyplot as plt

  plt.plot(range(SCREAMING_SNAKE_CASE	)					,      SCREAMING_SNAKE_CASE	)
  plt.xlabel('Iterations'	)
  plt.ylabel('Function values'	)
  plt.show()

 return current_state


if __name__ == "__main__":
  import doctest

  doctest.testmod()







  def _a				( SCREAMING_SNAKE_CASE	:    List[str]					,      SCREAMING_SNAKE_CASE	:    List[str]	)					->					Optional[Any]:

   """simple docstring"""






   return (x**2) + (y**2)

  # starting the problem with initial coordinates (3, 4)
  _a	 =     SearchProblem(x=3, y=4, step_size=1, function_to_optimize=test_fa)
  _a	 =     hill_climbing(prob, find_max=False)
  print(
      '''The minimum score for f(x, y) = x^2 + y^2 found via hill climbing: '''
      f"{local_min.score()}"
  )

  # starting the problem with initial coordinates (12, 47)
  _a	 =     SearchProblem(x=1_2, y=4_7, step_size=1, function_to_optimize=test_fa)
  _a	 =     hill_climbing(
      prob, find_max=False, max_x=1_0_0, min_x=5, max_y=5_0, min_y=-5, visualization=True
  )
  print(
      '''The minimum score for f(x, y) = x^2 + y^2 with the domain 100 > x > 5 '''
      f"and 50 > y > - 5 found via hill climbing: {local_min.score()}"
  )







  def _a				( SCREAMING_SNAKE_CASE	:    Tuple					,      SCREAMING_SNAKE_CASE	:    List[Any]	)					->					Dict:

   """simple docstring"""






   return (3 * x**2) - (6 * y)

  _a	 =     SearchProblem(x=3, y=4, step_size=1, function_to_optimize=test_fa)
  _a	 =     hill_climbing(prob, find_max=True)



  print(
      '''The maximum score for f(x, y) = x^2 + y^2 found via hill climbing: '''
      f"{local_min.score()}"
  )





