class_docstr: TNC non-linear optimization.
  
  These tests are taken from Prof. K. Schittkowski's test examples
  for constrained non-linear programming.
  
  http://www.uni-bayreuth.de/departments/math/~kschittkowski/home.htm
class_docstr_tok: ["TNC","non-linear","optimization",".","These","tests","are","taken","from","Prof.","K.","Schittkowski","'s","test","examples","for","constrained","non-linear","programming",".","http",":","\/\/www.uni-bayreuth.de\/departments\/math\/~kschittkowski\/home.htm"]
code: def test_callback_shouldnt_affect_minimization(self):
      # gh14879. The output of a TNC minimization was different depending
      # on whether a callback was used or not. The two should be equivalent.
      # The issue was that TNC was unscaling/scaling x, and this process was
      # altering x in the process. Now the callback uses an unscaled
      # temporary copy of x.
      def callback(x):
          pass
  
      fun = optimize.rosen
      bounds = [(0, 10)] * 4
      x0 = [1, 2, 3, 4.0]
      res = optimize.minimize(
          fun, x0, bounds=bounds, method="TNC", options={"maxfun": 1000}
      )
      res2 = optimize.minimize(
          fun,
          x0,
          bounds=bounds,
          method="TNC",
          options={"maxfun": 1000},
          callback=callback,
      )
      assert_allclose(res2.x, res.x)
      assert_allclose(res2.fun, res.fun)
      assert_equal(res2.nfev, res.nfev)
  
imports: import pytest
  from numpy.testing import assert_allclose, assert_equal
  import numpy
  from math import pow
  from scipy import optimize
label_desc: Use image node_id 39 for calling the TestTnc obj's underlying member method code with example usage: obj.test_callback_shouldnt_affect_minimization() without return types