{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "BiteOpt (BITmask Evolution OPTimization) is a stochastic, population-based, global optimizer that maintains a portfolio of candidate-generation strategies and dynamically tracks their efficiency, favouring whichever works best for the current objective function. This contrasts with classical Differential Evolution, which uses a single fixed strategy throughout "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "BiteOpt targets low- to medium-dimensional continuous problems with finite box bounds and requires no gradient information. Because the search is stochastic, results depend on the random stream; pass "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "rng"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for reproducible runs. BiteOpt has proven to be very competitive especially for nonlinear least squares problems "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The lock of the Generator derived from "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "rng"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is held for the duration of the optimization. Drawing from the same Generator inside "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "func"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is safe."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 2.0.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 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. Important attributes are: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " the solution array, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "fun"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " the value of the objective at the solution, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "nfev"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " the number of objective evaluations performed, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "success"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " a boolean flag indicating whether the optimizer terminated successfully, and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "message"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " describing the cause of termination. When "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "f_min"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is set to a value greater than -inf, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "success"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "True"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " only if that target was reached. If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "f_min"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is -inf (the default), BiteOpt runs its full iteration budget and a completed run reports "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "success"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "True"
                    },
                    {
                      "__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": "Find the global minimum of a function using the BiteOpt algorithm."
            }
          ]
        }
      ],
      "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, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "func(x, *args) -> float"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a 1-D array with shape "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(n,)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "args"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a tuple of fixed parameters."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "bounds",
              "annotation": "sequence or `Bounds`",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Bounds for variables, specified either as an 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": " or as "
                    },
                    {
                      "__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": ". Bounds must be finite and satisfy "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "min < max"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " strictly for every variable; equal bounds (fixing a variable) are not accepted."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "args",
              "annotation": "tuple, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Additional fixed parameters passed to the objective function."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "callback",
              "annotation": "callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Called after each objective evaluation as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "callback(x)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the point that was just evaluated. If the callback raises "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "StopIteration",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "builtins",
                        "version": "?",
                        "kind": "module",
                        "path": "builtins:StopIteration"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the optimization stops early and returns with "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "success=False"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "maxfun",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Maximum number of objective function evaluations. Default is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "1000 * n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", where "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the number of variables inferred from "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "bounds"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "depth",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Number of BiteOpt instances run cooperatively. Whenever one instance finds an improved solution, that solution is injected into another randomly chosen instance for further refinement. This cooperative multi-instance strategy improves the chance of escaping local minima on complex, multi-modal functions but requires a larger function evaluation budget. Valid range is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "[1, 36]"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Default is 1."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "f_min",
              "annotation": "float, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Target objective value. The optimization stops early once the best objective value found is less than or equal to "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "f_min"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". By default (-inf) this criterion is disabled and the full iteration budget is used."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "rng",
              "annotation": "{None, int, `numpy.random.Generator`}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Controls reproducibility. Passed to "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "numpy.random.default_rng",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "numpy",
                        "version": "?",
                        "kind": "module",
                        "path": "numpy.random:default_rng"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "; the resulting Generator's bit stream directly drives BiteOpt's internal random draws."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "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": "build-install/usr/lib/python3.14/site-packages/scipy/optimize/_biteopt_py.py",
  "item_line": 13,
  "item_type": "function",
  "aliases": [
    "scipy.optimize.biteopt"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "The following example is a 2-D problem with four local minima: minimizing\nthe Styblinski-Tang function\n(https://en.wikipedia.org/wiki/Test_functions_for_optimization).\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.optimize import biteopt, Bounds\ndef styblinski_tang(pos):\n    x, y = pos\n    return 0.5 * (x**4 - 16*x**2 + 5*x + y**4 - 16*y**2 + 5*y)\nbounds = Bounds([-4., -4.], [4., 4.])\nresult = biteopt(styblinski_tang, bounds)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.x, result.fun, result.nfev\n",
        "execution_status": "failure",
        "out": "(array([-2.904, -2.904]), -78.33233140754281, 2000)\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nFor reproducible results, pass a seed to `rng`:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result = biteopt(styblinski_tang, bounds, rng=1)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.x, result.fun, result.nfev\n",
        "execution_status": "failure",
        "out": "(array([-2.904, -2.904]), -78.33233140754281, 2000)\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nTo stop the optimization early once a target objective value is reached,\npass `f_min`:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result = biteopt(styblinski_tang, bounds, f_min=-70, rng=1)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "result.x, result.fun, result.nfev\n",
        "execution_status": "failure",
        "out": "(array([-2.673, -2.673]), -76.64070151847848, 38)\n"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "func",
        "annotation": "Callable[Concatenate[np.ndarray, ...], float]",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "bounds",
        "annotation": "Iterable | Bounds",
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "args",
        "annotation": "tuple",
        "kind": "KEYWORD_ONLY",
        "default": "()"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "callback",
        "annotation": "Callable[[np.ndarray], object] | None",
        "kind": "KEYWORD_ONLY",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "maxfun",
        "annotation": "int | None",
        "kind": "KEYWORD_ONLY",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "depth",
        "annotation": "int",
        "kind": "KEYWORD_ONLY",
        "default": "1"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "f_min",
        "annotation": "float",
        "kind": "KEYWORD_ONLY",
        "default": "-inf"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "rng",
        "annotation": "int | np.random.Generator | None",
        "kind": "KEYWORD_ONLY",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "biteopt"
  },
  "references": [
    ".. [1] Aleksey Vaneev. \"BiteOpt - Derivative-Free Global Optimization",
    "       Method (C++)\". https://github.com/avaneev/biteopt",
    ".. [2] Andrea Gavana. \"NIST benchmark\".",
    "       https://infinity77.net/go_2021/nist.html"
  ],
  "qa": "scipy.optimize._biteopt_py:biteopt",
  "arbitrary": [],
  "local_refs": [
    "args",
    "bounds",
    "callback",
    "depth",
    "f_min",
    "func",
    "maxfun",
    "res",
    "rng"
  ]
}