code: def test_population_initiation(self):
      # test the different modes of population initiation
  
      # init must be either 'latinhypercube' or 'random'
      # raising ValueError is something else is passed in
      assert_raises(
          ValueError,
          DifferentialEvolutionSolver,
          *(rosen, self.bounds),
          **{"init": "rubbish"},
      )
  
      solver = DifferentialEvolutionSolver(rosen, self.bounds)
  
      # check that population initiation:
      # 1) resets _nfev to 0
      # 2) all population energies are np.inf
      solver.init_population_random()
      assert_equal(solver._nfev, 0)
      assert_(np.all(np.isinf(solver.population_energies)))
  
      solver.init_population_lhs()
      assert_equal(solver._nfev, 0)
      assert_(np.all(np.isinf(solver.population_energies)))
  
      solver.init_population_qmc(qmc_engine="halton")
      assert_equal(solver._nfev, 0)
      assert_(np.all(np.isinf(solver.population_energies)))
  
      solver = DifferentialEvolutionSolver(
          rosen, self.bounds, init="sobol"
      )
      solver.init_population_qmc(qmc_engine="sobol")
      assert_equal(solver._nfev, 0)
      assert_(np.all(np.isinf(solver.population_energies)))
  
      # we should be able to initialize with our own array
      population = np.linspace(-1, 3, 10).reshape(5, 2)
      solver = DifferentialEvolutionSolver(
          rosen,
          self.bounds,
          init=population,
          strategy="best2bin",
          atol=0.01,
          seed=1,
          popsize=5,
      )
  
      assert_equal(solver._nfev, 0)
      assert_(np.all(np.isinf(solver.population_energies)))
      assert_(solver.num_population_members == 5)
      assert_(solver.population_shape == (5, 2))
  
      # check that the population was initialized correctly
      unscaled_population = np.clip(
          solver._unscale_parameters(population), 0, 1
      )
      assert_almost_equal(solver.population[:5], unscaled_population)
  
      # population values need to be clipped to bounds
      assert_almost_equal(np.min(solver.population[:5]), 0)
      assert_almost_equal(np.max(solver.population[:5]), 1)
  
      # shouldn't be able to initialize with an array if it's the wrong shape
      # this would have too many parameters
      population = np.linspace(-1, 3, 15).reshape(5, 3)
      assert_raises(
          ValueError,
          DifferentialEvolutionSolver,
          *(rosen, self.bounds),
          **{"init": population},
      )
  
      # provide an initial solution
      # bounds are [(0, 2), (0, 2)]
      x0 = np.random.uniform(low=0.0, high=2.0, size=2)
      solver = DifferentialEvolutionSolver(rosen, self.bounds, x0=x0)
      # parameters are scaled to unit interval
      assert_allclose(solver.population[0], x0 / 2.0)
  
imports: import multiprocessing
  import platform
  from scipy.optimize._differentialevolution import DifferentialEvolutionSolver, _ConstraintWrapper
  from scipy.optimize import differential_evolution
  from scipy.optimize._constraints import Bounds, NonlinearConstraint, LinearConstraint
  from scipy.optimize import rosen
  from scipy.sparse import csr_matrix
  from scipy._lib._pep440 import Version
  import numpy
  from numpy.testing import assert_equal, assert_allclose, assert_almost_equal, assert_array_equal, assert_string_equal, assert_, suppress_warnings
  from pytest import raises, warns
  import pytest
label_desc: Use image node_id 33 for calling the TestDifferentialEvolutionSolver obj's underlying member method code with example usage: obj.test_population_initiation() without return types