class_docstr: Tests for Differential Evolution optimization algorithm.
class_docstr_tok: ["Tests","for","Differential","Evolution","optimization","algorithm","."]
docstr: Tests Differential Evolution on the Rosenbrock function.
  
  The Rosenbrock function is a standard optimization test case. In two
  dimensions, the function is (a, b > 0):
    f(x, y) = (a - x)^2 + b (y - x^2)^2
  The function has a global minimum at (a, a^2). This minimum lies inside
  a parabolic valley (y = x^2).
docstr_tok: ["Tests","Differential","Evolution","on","the","Rosenbrock","function",".","The","Rosenbrock","function","is","a","standard","optimization","test","case",".","In","two","dimensions",",","the","function","is","(","a",",","b",">","0",")",":","f","(","x",",","y",")","=","(","a","-","x",")","^2","+","b","(","y","-","x^2",")","^2","The","function","has","a","global","minimum","at","(","a",",","a^2",")",".","This","minimum","lies","inside","a","parabolic","valley","(","y","=","x^2",")","."]
code: def test_rosenbrock_2d(self):
      """Tests Differential Evolution on the Rosenbrock function.
  
      The Rosenbrock function is a standard optimization test case. In two
      dimensions, the function is (a, b > 0):
        f(x, y) = (a - x)^2 + b (y - x^2)^2
      The function has a global minimum at (a, a^2). This minimum lies inside
      a parabolic valley (y = x^2).
      """
  
      def rosenbrock(x, y):
          """The Rosenbrock function in two dimensions with a=1, b=100.
  
          Args:
            x: A `Tensor` of shape [K]. The first coordinate of the point to
              evaluate the function at.
            y: A `Tensor` of the same shape and dtype as `x`. The second coordinate
              of the point to evaluate the function at.
  
          Returns:
            fv: A `Tensor` of shape [K] containing the value of the Rosenbrock
              function at the supplied points.
          """
          fv = (1 - x) ** 2 + 100 * (y - x**2) ** 2
          return fv
  
      start = (tf.constant(-1.0), tf.constant(1.0))
      results = self.evaluate(
          differential_evolution.minimize(
              rosenbrock,
              initial_position=start,
              func_tolerance=1e-12,
              max_iterations=200,
              seed=test_util.test_seed_stream(),
          )
      )
      self.assertTrue(results.converged)
      self.assertArrayNear(results.position, [1.0, 1.0], 1e-5)
  
file_path: probability/tensorflow_probability/python/optimizer/differential_evolution_test.py
imports: import numpy
  from scipy.stats import special_ortho_group
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.optimizer import differential_evolution
label_desc: Use image node_id 8 for calling the DifferentialEvolutionTest obj's underlying member method code with example usage: obj.test_rosenbrock_2d() and returns: fv