{"id":6587,"library":"directsearch","title":"Directsearch Optimization Solver","description":"directsearch is a Python package for solving unconstrained minimization problems without requiring derivatives of the objective function. It is particularly useful when objective function evaluations are expensive or noisy, implementing a family of direct search methods. The current version is 1.0.1, with releases focused on stability and compatibility.","status":"active","version":"1.0.1","language":"en","source_language":"en","source_url":"https://github.com/lindonroberts/directsearch","tags":["optimization","derivative-free","minimization","numerical"],"install":[{"cmd":"pip install directsearch","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required for defining initial points (x0) and handling objective function inputs/outputs.","package":"numpy","optional":false},{"reason":"Requires Python 3.9 or higher.","package":"python","optional":false}],"imports":[{"note":"The primary function for initiating a direct search optimization.","symbol":"solve","correct":"from directsearch import solve"}],"quickstart":{"code":"import numpy as np\nfrom directsearch import solve\n\ndef rosenbrock(x):\n    # The Rosenbrock function (a common optimization test problem)\n    return (1.0 - x[0])**2 + 100.0 * (x[1] - x[0]**2)**2\n\n# Initial guess for the minimizer\nx0 = np.array([0.0, 0.0])\n\n# Solve the optimization problem\nsoln = solve(rosenbrock, x0)\n\nprint(f\"Optimal value: {soln.f}\")\nprint(f\"Optimal solution: {soln.x}\")","lang":"python","description":"This example demonstrates how to use `directsearch.solve` to minimize the Rosenbrock function. The objective function `f` must take a one-dimensional NumPy array and return a single float. The initial guess `x0` must also be a one-dimensional NumPy array."},"warnings":[{"fix":"Upgrade to directsearch v1.0.1 or newer: `pip install --upgrade directsearch`.","message":"Older versions of directsearch (e.g., v1.0.0) may encounter errors or deprecation warnings with newer NumPy versions due to internal API changes in NumPy. Version 1.0.1 specifically addresses this.","severity":"gotcha","affected_versions":"<1.0.1"},{"fix":"Ensure `x0` is created as `np.array([...])` and `len(x0.shape) == 1`.","message":"The initial guess `x0` passed to `directsearch.solve` must be a one-dimensional `numpy.ndarray`.","severity":"gotcha","affected_versions":"All"},{"fix":"Verify that your objective function's return type is a scalar float.","message":"The objective function `f` passed to `directsearch.solve` must return a single `float` value.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}