Skip to content

blockwise-direct-search/bds_python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bds

Unit test of BDS Gradient test of BDS Stress test of BDS Parallel test of BDS Recursive test of BDS

Python implementation of the Blockwise Direct Search (BDS) method.

BDS is designed for unconstrained derivative-free optimization.

The public API follows the conventions of scipy.optimize: the solver accepts SciPy-style controls such as maxiter, maxfev, xatol, fatol, tol, disp, and return_all, and returns an OptimizeResult-like object with fields such as x, fun, success, status, message, nfev, nit, and optional histories.

Installation

Install the package from the repository root:

python -m pip install .

Quick Start

import numpy as np
from bds import minimize_bds


def rosenbrock(x):
    return np.sum(100.0 * (x[1:] - x[:-1] ** 2) ** 2 + (1.0 - x[:-1]) ** 2)


res = minimize_bds(rosenbrock, np.array([-1.2, 1.0]))
print(res.x, res.fun, res.message)

The shorter alias bds(...) is also available.

SciPy is optional. When SciPy is installed, BDS returns SciPy's scipy.optimize.OptimizeResult; otherwise it returns a compatible fallback object.