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.
pip install directsearchVerified import paths — ran on the pinned version, not inferred.
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.
Upgrade to directsearch v1.0.1 or newer: `pip install --upgrade directsearch`.
Ensure `x0` is created as `np.array([...])` and `len(x0.shape) == 1`.
Verify that your objective function's return type is a scalar float.
Run `pip install directsearch` to install the package.
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).
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)`.