{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Differential evolution is a stochastic population based method that is useful for global optimization problems. At each pass through the population the algorithm mutates each candidate solution by mixing with other candidate solutions to create a trial candidate. There are several strategies "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "3"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for creating trial candidates, which suit some problems more than others. The 'best1bin' strategy is a good starting point for many systems. In this strategy two members of the population are randomly chosen. Their difference is used to mutate the best member (the 'best' in 'best1bin'), "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "x_0"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", so far:"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "b' = x_0 + F \\cdot (x_{r_0} - x_{r_1})"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "F"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "mutation"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " parameter. A trial vector is then constructed. Starting with a randomly chosen ith parameter the trial is sequentially filled (in modulo) with parameters from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or the original candidate. The choice of whether to use "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or the original candidate is made with a binomial distribution (the 'bin' in 'best1bin') - a random number in [0, 1) is generated. If this number is less than the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "recombination"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " constant then the parameter is loaded from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", otherwise it is loaded from the original candidate. A randomly selected parameter is always loaded from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". For binomial crossover, this is a single random parameter. For exponential crossover, this is the starting point of a consecutive sequence of parameters from "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "b'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Once the trial candidate is built its fitness is assessed. If the trial is better than the original candidate then it takes its place. If it is also better than the best overall candidate it also replaces that."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The other strategies available are outlined in Qiang and Mitchell (2014) "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "3"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "rand1"
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "b' = x_{r_0} + F \\cdot (x_{r_1} - x_{r_2})"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "rand2"
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "b' = x_{r_0} + F \\cdot (x_{r_1} + x_{r_2} - x_{r_3} - x_{r_4})"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "best1"
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "b' = x_0 + F \\cdot (x_{r_0} - x_{r_1})"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "best2"
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "b' = x_0 + F \\cdot (x_{r_0} + x_{r_1} - x_{r_2} - x_{r_3})"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "currenttobest1"
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "b' = x_i + F \\cdot (x_0 - x_i + x_{r_0} - x_{r_1})"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "randtobest1"
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "b' = x_{r_0} + F \\cdot (x_0 - x_{r_0} + x_{r_1} - x_{r_2})"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where the integers "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "r_0, r_1, r_2, r_3, r_4"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are chosen randomly from the interval [0, NP) with "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "NP",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " being the total population size and the original candidate having index "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "i",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The user can fully customize the generation of the trial candidates by supplying a callable to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "strategy"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To improve your chances of finding a global minimum use higher "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "popsize"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " values, with higher "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "mutation"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and (dithering), but lower "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "recombination"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " values. This has the effect of widening the search radius, but slowing convergence."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "By default the best solution vector is updated continuously within a single iteration ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "updating='immediate'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "). This is a modification "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "4"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " of the original differential evolution algorithm which can lead to faster convergence as trial vectors can immediately benefit from improved solutions. To use the original Storn and Price behaviour, updating the best solution once per iteration, set "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "updating='deferred'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "'deferred'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " approach is compatible with both parallelization and vectorization ("
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "'workers'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "'vectorized'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " keywords). These may improve minimization speed by using computer resources more efficiently. The "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "'workers'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " distribute calculations over multiple processors. By default the Python "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "multiprocessing",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": "multiprocessing",
                "version": "*",
                "kind": "api",
                "path": "multiprocessing"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " module is used, but other approaches are also possible, such as the Message Passing Interface (MPI) used on clusters "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "6"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "7"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". The overhead from these approaches (creating new Processes, etc) may be significant, meaning that computational speed doesn't necessarily scale with the number of processors used. Parallelization is best suited to computationally expensive objective functions. If the objective function is less expensive, then "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "'vectorized'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " may aid by only calling the objective function once per iteration, rather than multiple times for all the population members; the interpreter overhead is reduced."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 0.15.0"
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "res",
              "annotation": "OptimizeResult",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The optimization result represented as a "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "OptimizeResult",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.optimize._optimize:OptimizeResult"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " object. Important attributes are: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " the solution array, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "success"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " a Boolean flag indicating if the optimizer exited successfully, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "message"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " which describes the cause of the termination, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "population"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " the solution vectors present in the population, and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "population_energies"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " the value of the objective function for each entry in "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "population"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". See "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "OptimizeResult",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.optimize._optimize:OptimizeResult"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for a description of other attributes. If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "polish"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " was employed, and a lower minimum was obtained by the polishing, then OptimizeResult also contains the "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "jac"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " attribute. If the eventual solution does not satisfy the applied constraints "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "success"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will be "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "False",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Finds the global minimum of a multivariate function."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "func",
              "annotation": "callable",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The objective function to be minimized. Must be in the form "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "f(x, *args)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the argument in the form of a 1-D array and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "args"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a tuple of any additional fixed parameters needed to completely specify the function. The number of parameters, N, is equal to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "len(x)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "bounds",
              "annotation": "sequence or `Bounds`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Bounds for variables. There are two ways to specify the bounds:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": true,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Instance of "
                            },
                            {
                              "__type": "CrossRef",
                              "__tag": 4002,
                              "value": "Bounds",
                              "reference": {
                                "__type": "LocalRef",
                                "__tag": 4022,
                                "kind": "module",
                                "path": "scipy.optimize._constraints:Bounds"
                              },
                              "kind": "module"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " class."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "(min, max)"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " pairs for each element in "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "x"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", defining the    finite lower and upper bounds for the optimizing argument of    "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "func"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The total number of bounds is used to determine the number of parameters, N. If there are parameters whose bounds are equal the total number of free parameters is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "N - N_equal"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "args",
              "annotation": "tuple, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Any additional fixed parameters needed to completely specify the objective function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "strategy",
              "annotation": "{str, callable}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The differential evolution strategy to use. Should be one of:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'best1bin'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'best1exp'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'rand1bin'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'rand1exp'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'rand2bin'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'rand2exp'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'randtobest1bin'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'randtobest1exp'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'currenttobest1bin'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'currenttobest1exp'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'best2exp'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'best2bin'"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The default is 'best1bin'. Strategies that may be implemented are outlined in 'Notes'. Alternatively the differential evolution strategy can be customized by providing a callable that constructs a trial vector. The callable must have the form "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "strategy(candidate: int, population: np.ndarray, rng=None)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "candidate"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is an integer specifying which entry of the population is being evolved, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "population"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is an array of shape "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(S, N)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " containing all the population members (where S is the total population size), and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "rng"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the random number generator being used within the solver. "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "candidate"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will be in the range "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "[0, S)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "strategy"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " must return a trial vector with shape "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(N,)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". The fitness of this trial vector is compared against the fitness of "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "population[candidate]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionchanged",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionchanged 1.12.0"
                        }
                      ]
                    },
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Customization of evolution strategy via a callable."
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "maxiter",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The maximum number of generations over which the entire population is evolved. The maximum number of function evaluations (with no polishing) is: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(maxiter + 1) * popsize * (N - N_equal)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "popsize",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A multiplier for setting the total population size. The population has "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "popsize * (N - N_equal)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " individuals. This keyword is overridden if an initial population is supplied via the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "init"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " keyword. When using "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "init='sobol'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " the population size is calculated as the next power of 2 after "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "popsize * (N - N_equal)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "tol",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Relative tolerance for convergence, the solving stops when "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "np.std(population_energies) <= atol + tol * np.abs(np.mean(population_energies))"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "atol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "tol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are the absolute and relative tolerance respectively."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "mutation",
              "annotation": "float or tuple(float, float), optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The mutation constant. In the literature this is also known as differential weight, being denoted by "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "F"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If specified as a float it should be in the range [0, 2). If specified as a tuple "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(min, max)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " dithering is employed. Dithering randomly changes the mutation constant on a generation by generation basis. The mutation constant for that generation is taken from "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "U[min, max)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Dithering can help speed convergence significantly. Increasing the mutation constant increases the search radius, but will slow down convergence."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "recombination",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The recombination constant, should be in the range [0, 1]. In the literature this is also known as the crossover probability, being denoted by CR. Increasing this value allows a larger number of mutants to progress into the next generation, but at the risk of population stability."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rng",
              "annotation": "{None, int, `numpy.random.Generator`}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rng"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is passed by keyword, types other than "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "numpy.random.Generator",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "numpy",
                        "version": "*",
                        "kind": "api",
                        "path": "numpy.random._generator:Generator"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are passed to "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "numpy.random.default_rng",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "numpy",
                        "version": "*",
                        "kind": "api",
                        "path": "numpy.random:default_rng"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to instantiate a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Generator"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rng"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is already a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Generator"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " instance, then the provided instance is used. Specify "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "rng"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for repeatable function behavior."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If this argument is passed by position or "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "seed"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is passed by keyword, legacy behavior for the argument "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "seed"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " applies:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "If "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "seed"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is None (or "
                            },
                            {
                              "__type": "CrossRef",
                              "__tag": 4002,
                              "value": "numpy.random",
                              "reference": {
                                "__type": "RefInfo",
                                "__tag": 4000,
                                "module": "numpy",
                                "version": "*",
                                "kind": "api",
                                "path": "numpy.random"
                              },
                              "kind": "module"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "), the "
                            },
                            {
                              "__type": "CrossRef",
                              "__tag": 4002,
                              "value": "numpy.random.RandomState",
                              "reference": {
                                "__type": "RefInfo",
                                "__tag": 4000,
                                "module": "numpy",
                                "version": "*",
                                "kind": "api",
                                "path": "numpy.random.mtrand:RandomState"
                              },
                              "kind": "module"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "   singleton is used."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "If "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "seed"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is an int, a new "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "RandomState"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " instance is used,   seeded with "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "seed"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "If "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "seed"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is already a "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "Generator"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " or "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "RandomState"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " instance then   that instance is used."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionchanged",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionchanged 1.15.0"
                        }
                      ]
                    },
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "As part of the "
                        },
                        {
                          "__type": "Link",
                          "__tag": 4049,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "SPEC-007"
                            }
                          ],
                          "url": "https://scientific-python.org/specs/spec-0007/",
                          "title": ""
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " transition from use of "
                        },
                        {
                          "__type": "CrossRef",
                          "__tag": 4002,
                          "value": "numpy.random.RandomState",
                          "reference": {
                            "__type": "RefInfo",
                            "__tag": 4000,
                            "module": "numpy",
                            "version": "*",
                            "kind": "api",
                            "path": "numpy.random.mtrand:RandomState"
                          },
                          "kind": "module"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " to "
                        },
                        {
                          "__type": "CrossRef",
                          "__tag": 4002,
                          "value": "numpy.random.Generator",
                          "reference": {
                            "__type": "RefInfo",
                            "__tag": 4000,
                            "module": "numpy",
                            "version": "*",
                            "kind": "api",
                            "path": "numpy.random._generator:Generator"
                          },
                          "kind": "module"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": ", this keyword was changed from "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "seed"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " to "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "rng"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": ". For an interim period, both keywords will continue to work, although only one may be specified at a time. After the interim period, function calls using the "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "seed"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " keyword will emit warnings. The behavior of both "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "seed"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " and "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "rng"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " are outlined above, but only the "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "rng"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " keyword should be used in new code."
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "disp",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Prints the evaluated "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "func"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " at every iteration."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "callback",
              "annotation": "callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A callable called after each iteration. Has the signature      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "callback(intermediate_result: OptimizeResult)",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "where "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "intermediate_result"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a keyword parameter containing an "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "OptimizeResult",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.optimize._optimize:OptimizeResult"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " with attributes "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "fun"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the best solution found so far and the objective function. Note that the name of the parameter must be "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "intermediate_result"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for the callback to be passed an "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "OptimizeResult",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.optimize._optimize:OptimizeResult"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The callback also supports a signature like      "
                    }
                  ]
                },
                {
                  "__type": "Code",
                  "__tag": 4050,
                  "value": "callback(x, convergence: float=val)",
                  "execution_status": null
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "val"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " represents the fractional value of the population convergence. When "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "val"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is greater than "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "1.0"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the function halts."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Introspection is used to determine which of the signatures is invoked."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Global minimization will halt if the callback raises "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "StopIteration"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or returns "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "True"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "; any polishing is still carried out."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionchanged",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionchanged 1.12.0"
                        }
                      ]
                    },
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "callback accepts the "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "intermediate_result"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " keyword."
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "polish",
              "annotation": "{bool, callable}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If True (default), then "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "scipy.optimize.minimize",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "scipy",
                        "version": "*",
                        "kind": "api",
                        "path": "scipy.optimize._minimize:minimize"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " with the "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "L-BFGS-B",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " method is used to polish the best population member at the end, which can improve the minimization slightly. If a constrained problem is being studied then the "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "trust-constr",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " method is used instead. For large problems with many constraints, polishing can take a long time due to the Jacobian computations. Alternatively supply a callable that has a "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "minimize",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "-like signature, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "polish_func(func, x0, **kwds)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and returns an "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "OptimizeResult",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.optimize._optimize:OptimizeResult"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". This allows the user to have fine control over how the polishing occurs. "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "bounds"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "constraints"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will be present in "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "kwds"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Extra keywords could be supplied to "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "polish_func",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " using "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "functools.partial",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "functools",
                        "version": "*",
                        "kind": "api",
                        "path": "functools:partial"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". It is the user's responsibility to ensure that the polishing function obeys bounds, any constraints (including integrality constraints), and that appropriate attributes are set in the "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "OptimizeResult",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.optimize._optimize:OptimizeResult"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", such as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "fun"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "nfev"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "jac"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionchanged",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionchanged 1.15.0"
                        }
                      ]
                    },
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "If "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "workers"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " is specified then the map-like callable that wraps "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "func"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " is supplied to "
                        },
                        {
                          "__type": "InlineRole",
                          "__tag": 4003,
                          "value": "minimize",
                          "domain": null,
                          "role": null,
                          "inventory": null
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " instead of it using "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "func"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " directly. This allows the caller to control how and where the invocations actually run."
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionchanged",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionchanged 1.17.0"
                        }
                      ]
                    },
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "A callable obeying the "
                        },
                        {
                          "__type": "InlineRole",
                          "__tag": 4003,
                          "value": "minimize",
                          "domain": null,
                          "role": null,
                          "inventory": null
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " signature can be supplied to polish the best population member."
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "init",
              "annotation": "str or array-like, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Specify which type of population initialization is performed. Should be one of:"
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'latinhypercube'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'sobol'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'halton'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'random'"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "array specifying the initial population. The array should have   shape "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "(S, N)"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", where S is the total population size and N is   the number of parameters."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "init"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is clipped to "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "bounds"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " before use."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The default is 'latinhypercube'. Latin Hypercube sampling tries to maximize coverage of the available parameter space."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "'sobol' and 'halton' are superior alternatives and maximize even more the parameter space. 'sobol' will enforce an initial population size which is calculated as the next power of 2 after "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "popsize * (N - N_equal)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". 'halton' has no requirements but is a bit less efficient. See "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "scipy.stats.qmc",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.stats.qmc"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for more details."
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "'random' initializes the population randomly - this has the drawback that clustering can occur, preventing the whole of parameter space being covered. Use of an array to specify a population 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."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "atol",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Absolute tolerance for convergence, the solving stops when "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "np.std(population_energies) <= atol + tol * np.abs(np.mean(population_energies))"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "atol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "tol"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are the absolute and relative tolerance respectively."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "updating",
              "annotation": "{'immediate', 'deferred'}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'immediate'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the best solution vector is continuously updated within a single generation "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "4"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". This can lead to faster convergence as trial vectors can take advantage of continuous improvements in the best solution. With "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'deferred'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the best solution vector is updated once per generation. Only "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'deferred'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is compatible with parallelization or vectorization, and the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "workers"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "vectorized"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " keywords can over-ride this option."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 1.2.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "workers",
              "annotation": "int or map-like callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "workers"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is an int the population is subdivided into "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "workers"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " sections and evaluated in parallel (uses "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "multiprocessing.Pool <multiprocessing>",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "). Supply -1 to use all available CPU cores. Alternatively supply a map-like callable, such as "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "multiprocessing.Pool.map",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for evaluating the population in parallel. This evaluation is carried out as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "workers(func, iterable)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". This option will override the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "updating"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " keyword to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "updating='deferred'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "workers != 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". This option overrides the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "vectorized"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " keyword if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "workers != 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Requires that "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "func"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " be pickleable."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 1.2.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "constraints",
              "annotation": "{NonLinearConstraint, LinearConstraint, Bounds}",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Constraints on the solver, over and above those applied by the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "bounds"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " kwd. Uses the approach by Lampinen "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "5"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 1.4.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "x0",
              "annotation": "None or array-like, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Provides an initial guess to the minimization. Once the population has been initialized this vector replaces the first (best) member. This replacement is done even if "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "init"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is given an initial population. "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x0.shape == (N,)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 1.7.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "integrality",
              "annotation": "1-D array, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "For each decision variable, a boolean value indicating whether the decision variable is constrained to integer values. The array is broadcast to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(N,)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If any decision variables are constrained to be integral, they will not be changed during polishing. Only integer values lying between the lower and upper bounds are used. If there are no integer values lying between the bounds then a "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "ValueError",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is raised."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 1.9.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "vectorized",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "vectorized is True"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "func"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is sent an "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "x",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " array with "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x.shape == (N, S)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and is expected to return an array of shape "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(S,)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "S",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the number of solution vectors to be calculated. If constraints are applied, each of the functions used to construct a "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "Constraint",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " object should accept an "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "x",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " array with "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x.shape == (N, S)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and return an array of shape "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(M, S)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "M",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the number of constraint components. This option is an alternative to the parallelization offered by "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "workers"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and may help in optimization speed by reducing interpreter overhead from multiple function calls. This keyword is ignored if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "workers != 1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". This option will override the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "updating"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " keyword to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "updating='deferred'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". See the notes section for further discussion on when to use "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'vectorized'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and when to use "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'workers'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "versionadded",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "versionadded 1.9.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The differential evolution method "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is stochastic in nature. It does not use gradient methods to find the minimum, and can search large areas of candidate space, but often requires larger numbers of function evaluations than conventional gradient-based techniques."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The algorithm is due to Storn and Price "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/optimize/_differentialevolution.py",
  "item_line": 25,
  "item_type": "function",
  "aliases": [
    "scipy.optimize.differential_evolution"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Let us consider the problem of minimizing the Rosenbrock function. This\nfunction is implemented in `rosen` in `scipy.optimize`.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.optimize import rosen, differential_evolution\nbounds = [(0,2), (0, 2), (0, 2), (0, 2), (0, 2)]\nresult = differential_evolution(rosen, bounds)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.x, result.fun\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nNow repeat, but with parallelization.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result = differential_evolution(rosen, bounds, updating='deferred',\n                                workers=2)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.x, result.fun\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nLet's do a constrained minimization.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.optimize import LinearConstraint, Bounds\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nWe add the constraint that the sum of ``x[0]`` and ``x[1]`` must be less\nthan or equal to 1.9.  This is a linear constraint, which may be written\n``A @ x <= 1.9``, where ``A = array([[1, 1]])``.  This can be encoded as\na `LinearConstraint` instance:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "lc = LinearConstraint([[1, 1]], -np.inf, 1.9)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nSpecify limits using a `Bounds` object.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "bounds = Bounds([0., 0.], [2., 2.])\nresult = differential_evolution(rosen, bounds, constraints=lc,\n                                rng=1)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.x, result.fun\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nNext find the minimum of the Ackley function\n(https://en.wikipedia.org/wiki/Test_functions_for_optimization).\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "def ackley(x):\n    arg1 = -0.2 * np.sqrt(0.5 * (x[0] ** 2 + x[1] ** 2))\n    arg2 = 0.5 * (np.cos(2. * np.pi * x[0]) + np.cos(2. * np.pi * x[1]))\n    return -20. * np.exp(arg1) - np.exp(arg2) + 20. + np.e\nbounds = [(-5, 5), (-5, 5)]\nresult = differential_evolution(ackley, bounds, rng=1)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.x, result.fun\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe Ackley function is written in a vectorized manner, so the\n``'vectorized'`` keyword can be employed. Note the reduced number of\nfunction evaluations.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result = differential_evolution(\n    ackley, bounds, vectorized=True, updating='deferred', rng=1\n)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.x, result.fun\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe final polishing step can be customised by providing a callable that\nmimics the `minimize` interface. The user is responsible for ensuring that\nthe minimizer obeys any bounds and constraints.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from functools import partial\nfrom scipy.optimize import minimize\npolish_func = partial(minimize, method=\"SLSQP\")\nresult = differential_evolution(\n    ackley, bounds, vectorized=True, updating='deferred', rng=1,\n    polish=polish_func\n)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.x, result.fun\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe following custom strategy function mimics 'best1bin':\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "def custom_strategy_fn(candidate, population, rng=None):\n    parameter_count = population.shape[-1]\n    mutation, recombination = 0.7, 0.9\n    trial = np.copy(population[candidate])\n    fill_point = rng.choice(parameter_count)\n\n    pool = np.arange(len(population))\n    rng.shuffle(pool)\n\n    # two unique random numbers that aren't the same, and\n    # aren't equal to candidate.\n    idxs = []\n    while len(idxs) < 2 and len(pool) > 0:\n        idx = pool[0]\n        pool = pool[1:]\n        if idx != candidate:\n            idxs.append(idx)\n\n    r0, r1 = idxs[:2]\n\n    bprime = (population[0] + mutation *\n              (population[r0] - population[r1]))\n\n    crossovers = rng.uniform(size=parameter_count)\n    crossovers = crossovers < recombination\n    crossovers[fill_point] = True\n    trial = np.where(crossovers, bprime, trial)\n    return trial\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "func",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "bounds",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "args",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "()"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "strategy",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "best1bin"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "maxiter",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1000"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "popsize",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "15"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "tol",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0.01"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "mutation",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "(0.5, 1)"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "recombination",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0.7"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "rng",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "callback",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "disp",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "polish",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "True"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "init",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "latinhypercube"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "atol",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "updating",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "immediate"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "workers",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "constraints",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "()"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "x0",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "integrality",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "vectorized",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "seed",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "differential_evolution"
  },
  "references": [
    ".. [1] Differential evolution, Wikipedia,",
    "       http://en.wikipedia.org/wiki/Differential_evolution",
    ".. [2] Storn, R and Price, K, Differential Evolution - a Simple and",
    "       Efficient Heuristic for Global Optimization over Continuous Spaces,",
    "       Journal of Global Optimization, 1997, 11, 341 - 359.",
    ".. [3] Qiang, J., Mitchell, C., A Unified Differential Evolution Algorithm",
    "        for Global Optimization, 2014, https://www.osti.gov/servlets/purl/1163659",
    ".. [4] Wormington, M., Panaccione, C., Matney, K. M., Bowen, D. K., -",
    "       Characterization of structures from X-ray scattering data using",
    "       genetic algorithms, Phil. Trans. R. Soc. Lond. A, 1999, 357,",
    "       2827-2848",
    ".. [5] Lampinen, J., A constraint handling approach for the differential",
    "       evolution algorithm. Proceedings of the 2002 Congress on",
    "       Evolutionary Computation. CEC'02 (Cat. No. 02TH8600). Vol. 2. IEEE,",
    "       2002.",
    ".. [6] https://mpi4py.readthedocs.io/en/stable/",
    ".. [7] https://schwimmbad.readthedocs.io/en/latest/"
  ],
  "qa": "scipy.optimize._differentialevolution:differential_evolution",
  "arbitrary": [],
  "local_refs": [
    "args",
    "atol",
    "bounds",
    "callback",
    "constraints",
    "disp",
    "func",
    "init",
    "integrality",
    "maxiter",
    "mutation",
    "polish",
    "popsize",
    "recombination",
    "res",
    "rng",
    "strategy",
    "tol",
    "updating",
    "vectorized",
    "workers",
    "x0"
  ]
}