skillfed

directsearch

A derivative-free solver for unconstrained minimization

directsearch v1.1 437.6K downloads/30d#6,665 on PyPI5
Copyleft license GPL-3.0-or-later Active released

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 directsearch

uv

uv add directsearch

poetry

poetry add directsearch

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleFramework :: IPythonFramework :: JupyterIntended Audience :: Science/ResearchLicense :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)Operating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Mathematics

Tags

derivative-free optimizationdirect search minimizationblack-box optimizationgradient-free solverexpensive function optimizationnoisy objective minimizationunconstrained nonlinear optimization
optimizationderivative-freedirect-search

More Scientific/Engineering packages

Further reading