{"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":"python","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,"search_vec":"'1.0.1':44 'compat':51 'current':41 'deriv':16,54 'derivative-fre':53 'direct':37 'directsearch':1,4 'evalu':28 'expens':30 'famili':35 'focus':47 'free':55 'function':20,27 'implement':33 'method':39 'minim':12,56 'noisi':32 'numer':57 'object':19,26 'optim':2,52 'packag':8 'particular':23 'problem':13 'python':7 'releas':46 'requir':15 'search':38 'solv':10 'solver':3 'stabil':49 'unconstrain':11 'use':24 'version':42 'without':14","created_at":"2026-04-15T18:34:18.649418+00:00","updated_at":"2026-04-16T14:25:47.822802+00:00","problems":[{"fix":"Run `pip install directsearch` to install the package.","cause":"The 'directsearch' package is not installed in your Python environment or is not accessible via the Python path.","error":"ModuleNotFoundError: No module named 'directsearch'"},{"fix":"Upgrade `directsearch` to its latest version (e.g., `pip install --upgrade directsearch`) and ensure NumPy is updated to a compatible version (e.g., `pip install --upgrade numpy`). If the issue persists due to other dependencies, consider creating a dedicated virtual environment or downgrading numpy to a version compatible with all installed packages (e.g., `pip install numpy==1.23.0` if necessary, though this is less ideal).","cause":"This error occurs when an older version of `directsearch` or one of its dependencies attempts to use `np.bool`, which was deprecated and removed in recent NumPy versions.","error":"AttributeError: module 'numpy' has no attribute 'bool'"},{"fix":"Ensure you pass the objective function without parentheses, for example: `result = directsearch.solve_directsearch(my_objective_function, initial_point)` instead of `result = directsearch.solve_directsearch(my_objective_function(), initial_point)`.","cause":"You are passing the result of a function call (a float value) instead of the function object itself to a `directsearch` optimization method, which expects a callable objective function.","error":"TypeError: 'float' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.1","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/lindonroberts/directsearch","docs":"https://github.com/lindonroberts/directsearch","changelog":null,"pypi":"https://pypi.org/project/directsearch/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}