2

In a differential evolution optimization algorithm from scipy, is it possible to set initial parameters if I have some good starting points?

For example, suppose i know the best x is [0.1, 0.5,0.3], is it possible to add it inside scipy.differential_evolution

manlio
  • 18,345
  • 14
  • 76
  • 126
user40780
  • 1,828
  • 7
  • 29
  • 50

1 Answers1

0

The scipy.optimize.differential_evolution function has two parameters you can work with:

  1. bounds : sequence

    Bounds for variables. (min, max) pairs for each element in x, defining the lower and upper bounds for the optimizing argument of func. [CUT]

    You could try:

    >>> bounds = [(0.0, 0.2), (0.4, 0.6), (0.2, 0.4)]
    >>> result = differential_evolution(my_func, bounds)
    
  2. Recent versions of the library (from SciPy v1.1.0) allow to specify which type of population initialization is performed via the init keyword:

    init : str or array-like, optional

    Specify which type of population initialization is performed. Should be one of:

    • ‘latinhypercube’
    • ‘random’
    • array specifying the initial population. The array should have shape (M, len(x)), where len(x) is the number of parameters. init is clipped to bounds before use.

    [CUT]

    Use of an array to specify a population subset could be used, for example, to create a tight bunch of initial guesses in an location where the solution is known to exist, thereby reducing time for convergence.

manlio
  • 18,345
  • 14
  • 76
  • 126