class_docstr: Tests for LBFGS optimization algorithm.
class_docstr_tok: ["Tests","for","LBFGS","optimization","algorithm","."]
docstr: Tests minimization on the Himmelblau's function.
  
  Himmelblau's function is a standard optimization test case. The function is
  given by:
  
    f(x, y) = (x^2 + y - 11)^2 + (x + y^2 - 7)^2
  
  The function has four minima located at (3, 2), (-2.805118, 3.131312),
  (-3.779310, -3.283186), (3.584428, -1.848126).
  
  All these minima may be reached from appropriate starting points. To keep
  the runtime of this test small, here we only find the first two minima.
  However, all four can be easily found in `test_himmelblau_batch_all` below
  with the help of batching.
docstr_tok: ["Tests","minimization","on","the","Himmelblau","'s","function",".","Himmelblau","'s","function","is","a","standard","optimization","test","case",".","The","function","is","given","by",":","f","(","x",",","y",")","=","(","x^2","+","y","-","11",")","^2","+","(","x","+","y^2","-","7",")","^2","The","function","has","four","minima","located","at","(","3",",","2",")",",","(","-2.805118",",","3.131312",")",",","(","-3.779310",",","-3.283186",")",",","(","3.584428",",","-1.848126",")",".","All","these","minima","may","be","reached","from","appropriate","starting","points",".","To","keep","the","runtime","of","this","test","small",",","here","we","only","find","the","first","two","minima",".","However",",","all","four","can","be","easily","found","in","`","test_himmelblau_batch_all","`","below","with","the","help","of","batching","."]
code: def test_himmelblau(self):
      """Tests minimization on the Himmelblau's function.
  
      Himmelblau's function is a standard optimization test case. The function is
      given by:
  
        f(x, y) = (x^2 + y - 11)^2 + (x + y^2 - 7)^2
  
      The function has four minima located at (3, 2), (-2.805118, 3.131312),
      (-3.779310, -3.283186), (3.584428, -1.848126).
  
      All these minima may be reached from appropriate starting points. To keep
      the runtime of this test small, here we only find the first two minima.
      However, all four can be easily found in `test_himmelblau_batch_all` below
      with the help of batching.
      """
  
      @_make_val_and_grad_fn
      def himmelblau(coord):
          x, y = coord[0], coord[1]
          return (x * x + y - 11) ** 2 + (x + y * y - 7) ** 2
  
      starts_and_targets = [
          # Start Point, Target Minimum, Num evaluations expected.
          [(1, 1), (3, 2), 31],
          [(-2, 2), (-2.805118, 3.131312), 17],
      ]
      dtype = "float64"
      for start, expected_minima, expected_evals in starts_and_targets:
          start = tf.constant(start, dtype=dtype)
          results = self.evaluate(
              lbfgs.minimize(
                  himmelblau, initial_position=start, tolerance=1e-8
              )
          )
          self.assertTrue(results.converged)
          self.assertArrayNear(
              results.position,
              np.array(expected_minima, dtype=dtype),
              1e-5,
          )
          self.assertEqual(
              results.num_objective_evaluations, expected_evals
          )
  
imports: from absl.testing import parameterized
  import numpy
  from scipy.stats import special_ortho_group
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math import gradient
  from tensorflow_probability.python.optimizer import bfgs_utils
  from tensorflow_probability.python.optimizer import lbfgs
label_desc: Use image node_id 8 for calling the LBfgsTest obj's underlying member method code with example usage: obj.test_himmelblau() and returns: unknown