directsearch
A derivative-free solver for unconstrained minimization
What it is and what it does
directsearch is a Python package implementing direct search methods for derivative-free optimization. It solves minimization problems where you have an objective function but cannot or do not want to compute its gradient—useful when function evaluations are expensive, noisy, or unavailable analytically. The package supports both unconstrained problems and problems with linear inequality constraints (including bounds). It depends on numpy and scipy for numerical operations.
The core interface is a single `solve()` function that takes your objective, a starting point, and optional constraint matrices, returning the approximate minimizer, its value, the number of function evaluations used, and a termination flag. The package also exposes specialized solvers: deterministic direct search, probabilistic descent variants, subspace methods for higher dimensions, and the stochastic three-points method. Configuration options include maximum evaluations, verbosity, and print frequency.
Use it for:
- Optimize expensive simulations or physical experiments where gradient computation is infeasible or prohibitively costly.
- Tune hyperparameters or model coefficients when the objective is noisy or only available through sampling.
- Solve bound-constrained or linearly constrained problems without implementing custom constraint handling.
- Benchmark derivative-free methods on small to moderate-dimensional problems (roughly under 50 variables).
- Replace gradient-based optimizers when the objective is non-smooth or discontinuous in practice.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Solves unconstrained and linearly constrained nonlinear minimization problems without computing derivatives, using direct search methods that work well when objective function evaluations are expensive or noisy.
Yes, if you need derivative-free optimization for expensive or noisy objectives and accept the GPL-3.0-or-later copyleft license. The package is actively maintained, has no known vulnerabilities, and installs with low friction. It is well-suited for unconstrained problems and problems with linear constraints up to moderate dimension; for very high-dimensional problems, verify that the subspace method meets your scalability needs.
Install
directsearch on PyPI
pip
pip install directsearchuv
uv add directsearchpoetry
poetry add directsearchInstalling directsearch
Before you install
Low friction install with three standard scientific dependencies (setuptools, numpy, scipy). Actively maintained with a recent release and no known vulnerabilities.
License in practice
Released under GPL-3.0-or-later (copyleft). You may use and modify the package freely, but any derivative work or distribution must also be released under a compatible GPL license.
Quickstart
pip install directsearch
import directsearch
import numpy as np
def objective(x):
return (x[0] - 2)**2 + (x[1] + 1)**2
x0 = np.array([0.0, 0.0])
soln = directsearch.solve(objective, x0)
print(soln.x, soln.f, soln.nf)
Requires Python 3.9 or later; objective function must accept and return numpy arrays and floats respectively.
Verify before relying
- Scalability limits for high-dimensional problems beyond the mentioned rule-of-thumb threshold of ~50 dimensions.
- Actual convergence rates and wall-clock performance compared to other derivative-free solvers on standard benchmarks.
- How constraint handling in v1.1 affects solution quality and iteration count for typical constrained problems.
Package facts
| License | GPL-3.0-or-later (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — setuptools, numpy, scipy |
| Maintenance | actively maintained — 71 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 437,576/month — #6,665 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: directsearch-1.1-py3-none-any.whl
Keywords: mathematics, optimization, derivative free optimization, direct search
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
cmaCMA-ES is a derivative-free numerical…
permissive · top 5,000 on PyPI
pyrootsImplements root-finding algorithms (bisect,…
permissive · top 15,000 on PyPI
optimistixOptimistix provides nonlinear solvers for root…
permissive · top 15,000 on PyPI
quadprogSolves strictly convex quadratic programming…
copyleft · top 15,000 on PyPI
nevergradNevergrad is a gradient-free optimization…
permissive · top 15,000 on PyPI
lmfitLmfit provides non-linear least-squares…
permissive · top 5,000 on PyPI
ropwrRoPWR computes optimal piecewise polynomial…
permissive · top 15,000 on PyPI
scikit-optimizeScikit-Optimize is a library for optimizing…
permissive · top 15,000 on PyPI
proxsuiteProxSuite is a numerically robust quadratic…
permissive · top 15,000 on PyPI
moocoreProvides fast implementations of core…
copyleft · top 5,000 on PyPI