{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Note 1"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ": The program finds the gridpoint at which the lowest value of the objective function occurs. If "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "finish"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is None, that is the point returned. When the global minimum occurs within (or not very far outside) the grid's boundaries, and the grid is fine enough, that point will be in the neighborhood of the global minimum."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "However, users often employ some other optimization program to \"polish\" the gridpoint values, i.e., to seek a more precise (local) minimum near "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "brute's",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " best gridpoint. The "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "brute",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.optimize._optimize:brute"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " function's "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "finish"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " option provides a convenient way to do that. Any polishing program used must take "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "brute's",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " output as its initial guess as a positional argument, and take "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "brute's",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " input values for "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "args"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as keyword arguments, otherwise an error will be raised. It may additionally take "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "full_output"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and/or "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "disp"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " as keyword arguments."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "brute",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.optimize._optimize:brute"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " assumes that the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "finish"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " function returns either 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": " object or a tuple in the form: "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "(xmin, Jmin, ... , statuscode)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", where "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "xmin"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the minimizing value of the argument, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Jmin"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the minimum value of the objective function, \"...\" may be some other returned values (which are not used by "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "brute",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.optimize._optimize:brute"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "), and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "statuscode"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is the status code of the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "finish"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " program."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Note that when "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "finish"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is not None, the values returned are those of the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "finish"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " program, "
            },
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "not"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " the gridpoint ones. Consequently, while "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "brute",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.optimize._optimize:brute"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " confines its search to the input grid points, the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "finish"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " program's results usually will not coincide with any gridpoint, and may fall outside the grid's boundary. Thus, if a minimum only needs to be found over the provided grid points, make sure to pass in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "finish=None"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Emphasis",
              "__tag": 4047,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Note 2"
                }
              ]
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ": The grid of points is a "
            },
            {
              "__type": "InlineRole",
              "__tag": 4003,
              "value": "numpy.mgrid",
              "domain": null,
              "role": null,
              "inventory": null
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " object. For "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "brute",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.optimize._optimize:brute"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "ranges"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "Ns"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " inputs have the following effect. Each component of the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "ranges"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " tuple can be either a slice object or a two-tuple giving a range of values, such as (0, 5). If the component is a slice object, "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "brute",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.optimize._optimize:brute"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " uses it directly. If the component is a two-tuple range, "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "brute",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.optimize._optimize:brute"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " internally converts it to a slice object that interpolates "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "Ns"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " points from its low-value to its high-value, inclusive."
            }
          ]
        }
      ],
      "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": "x0",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A 1-D array containing the coordinates of a point at which the objective function had its minimum value. (See "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "Note 1",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for which point is returned.)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "fval",
              "annotation": "float",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Function value at the point "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "x0",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "x0"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". (Returned when "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "full_output"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is True.)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "grid",
              "annotation": "tuple",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Representation of the evaluation grid. It has the same length as "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "x0",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": null,
                        "version": null,
                        "kind": "local",
                        "path": "x0"
                      },
                      "kind": "local"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". (Returned when "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "full_output"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is True.)"
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "Jout",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Function values at each point of the evaluation grid, i.e., "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Jout = func(*grid)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". (Returned when "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "full_output"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is True.)"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Minimize a function over a given range by brute force."
            }
          ]
        }
      ],
      "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."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "ranges",
              "annotation": "tuple",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Each component of the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "ranges"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " tuple must be either a \"slice object\" or a range tuple of the form "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(low, high)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". The program uses these to create the grid of points on which the objective function will be computed. See "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "Note 2",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for more detail."
                    }
                  ]
                }
              ]
            },
            {
              "__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 function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "Ns",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Number of grid points along the axes, if not otherwise specified. See "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "Note2",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "full_output",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If True, return the evaluation grid and the objective function's values on it."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "finish",
              "annotation": "callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "An optimization function that is called with the result of brute force minimization as initial guess. "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "finish"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " should take "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "func"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and the initial guess as positional arguments, and take "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "args"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " as keyword arguments. It may additionally take "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "full_output"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and/or "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "disp"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " as keyword arguments. Use None if no \"polishing\" function is to be used. See Notes for more details."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "disp",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Set to True to print convergence messages from the "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "finish"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " callable."
                    }
                  ]
                }
              ]
            },
            {
              "__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 grid 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 "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "-1",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to use all cores available to the Process. 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 grid in parallel. This evaluation is carried out as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "workers(func, iterable)"
                    },
                    {
                      "__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.3.0"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Uses the \"brute force\" method, i.e., computes the function's value at each point of a multidimensional grid of points, to find the global minimum of the function."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The function is evaluated everywhere in the range with the datatype of the first call to the function, as enforced by the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "vectorize"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " NumPy function. The value and type of the function evaluation returned when "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "full_output=True"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are affected in addition by the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "finish"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " argument (see Notes)."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The brute force approach is inefficient because the number of grid points increases exponentially - the number of grid points to evaluate is "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "Ns ** len(x)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Consequently, even with coarse grid spacing, even moderately sized problems can take a long time to run, and/or run into memory limitations."
            }
          ]
        }
      ],
      "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/_optimize.py",
  "item_line": 3673,
  "item_type": "function",
  "aliases": [
    "scipy.optimize.brute"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "We illustrate the use of `brute` to seek the global minimum of a function\nof two variables that is given as the sum of a positive-definite\nquadratic and two deep \"Gaussian-shaped\" craters. Specifically, define\nthe objective function `f` as the sum of three other functions,\n``f = f1 + f2 + f3``. We suppose each of these has a signature\n``(z, *params)``, where ``z = (x, y)``,  and ``params`` and the functions\nare as defined below.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nparams = (2, 3, 7, 8, 9, 10, 44, -1, 2, 26, 1, -2, 0.5)\ndef f1(z, *params):\n    x, y = z\n    a, b, c, d, e, f, g, h, i, j, k, l, scale = params\n    return (a * x**2 + b * x * y + c * y**2 + d*x + e*y + f)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "def f2(z, *params):\n    x, y = z\n    a, b, c, d, e, f, g, h, i, j, k, l, scale = params\n    return (-g*np.exp(-((x-h)**2 + (y-i)**2) / scale))\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "def f3(z, *params):\n    x, y = z\n    a, b, c, d, e, f, g, h, i, j, k, l, scale = params\n    return (-j*np.exp(-((x-k)**2 + (y-l)**2) / scale))\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "def f(z, *params):\n    return f1(z, *params) + f2(z, *params) + f3(z, *params)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThus, the objective function may have local minima near the minimum\nof each of the three functions of which it is composed. To\nuse `fmin` to polish its gridpoint result, we may then continue as\nfollows:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "rranges = (slice(-4, 4, 0.25), slice(-4, 4, 0.25))\nfrom scipy import optimize\nresbrute = optimize.brute(f, rranges, args=params, full_output=True,\n                          finish=optimize.fmin)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "resbrute[0]  # global minimum\nresbrute[1]  # function value at global minimum\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nNote that if `finish` had been set to None, we would have gotten the\ngridpoint [-1.0 1.75] where the rounded function value is -2.892."
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "basinhopping",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.optimize._basinhopping:basinhopping"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "differential_evolution",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.optimize._differentialevolution:differential_evolution"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": null
    }
  ],
  "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": "ranges",
        "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": "Ns",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "20"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "full_output",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "finish",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "<function fmin at 0x0000>"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "disp",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "workers",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "brute"
  },
  "references": null,
  "qa": "scipy.optimize._optimize:brute",
  "arbitrary": [],
  "local_refs": [
    "Jout",
    "Ns",
    "args",
    "disp",
    "finish",
    "full_output",
    "func",
    "fval",
    "grid",
    "ranges",
    "workers",
    "x0"
  ]
}