Mesh Adaptive Direct Search (MADS)
This package provides an implementation of the Mesh Adaptive Direct Search (MADS) algorithm for gradient-free optimization [1]. More specifically, it uses a modified variant of MADS with orthogonal search directions (OrthoMADS) [2]. However, it abandons using the deterministic Halton sequence for search directions in favor of random search directions, and only performs poll steps.
Using MADS
The user must provide the following arguments
- A numpy array of initial design variables
- A numpy array of upper bounds for the design variables
- A numpy array of lower bounds for the design variables
- An objective function to be minimized
- An initial poll size
- An initial mesh size
- A stopping tolerance based on the poll size e.g. 1E-6
- A stopping tolerance based on the objective function e.g. 1E-6
- A stopping tolerance based on the maximum number of iterations
- True/False flag for printing optimization statistics
- True/False flag for saving optimization statistics to a log.txt file
MADS will perform up to the specified maximum number of design iterations. At each iteration it will perform up to 2N evaluations of the objective function, where N is the number of design variables, skipping points that have already been evaluated. It automatically shrinks/expands the poll size to search the design space, and exits when any one of the three aforementioned stopping criteria is met.
Upon completion, MADS returns
- The mimimized value of the objective function
- A numpy array of the design variables that yielded this minima
Example Applications
Here we provide a simple example problem to minimize f(x,y) = (x-0.3)2 + (y-0.7)2. This is a strictly postive function, which trivially takes a minimum value at [x,y] = [0.3,0.7]. We will an initial guess of [x,y] = [0.5,0.5] and take upper and lower bounds within the unit square.
import numpy as np
from mads import mads
# Define objective function
def objective_function(d):
f = (d[0] - 0.3)**2 + (d[1] - 0.7)**2
return f
# Provide the problem configuration
design_variables = np.array([0.23, 0.97]) # Initial design variables
bounds_lower = np.array([0, 0]) # Lower bounds for design variables
bounds_upper = np.array([1, 1]) # Upper bounds for design variables
dp_tol = 1E-6 # Minimum poll size stopping criteria
nitermax = 1000 # Maximum objective function evaluations
dp = 0.1 # Initial poll size as percent of bounds
dm = 0.01 # Initial mesh size as percent of bounds
# Run the optimizer
orthomads(design_variables, bounds_upper, bounds_lower, objective_function, dp, dm, dp_tol, nitermax, True, True)
This should exit with the following results
Optimization Results...
Optimal: 0.0565000000 Parameters: [ 0.2100000000 0.9200000000] Iter/Eval: 1 3
Optimal: 0.0153000000 Parameters: [ 0.2700000000 0.8200000000] Iter/Eval: 2 6
...
Optimal: 0.0000000000 Parameters: [ 0.3000002117 0.7000000651] Iter/Eval: 62 243
References
[1] C. Audet and J. E. Dennis, Mesh Adaptive Direct Search Algorithms for Constrained Optimization, SIAM Journal on Optimization, 2006, 17 (1), 188-217.
[2] M. A. Abramson, C. Audet, J. E. Dennis, and S. Le Digabel, OrthoMADS: A Deterministic MADS Instance with Orthogonal Directions, SIAM Journal on Optimization, 2009, 20 (2), 948-966.
Metadata
Release files for mads 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mads-0.0.4.tar.gz | 11.3 kB | Without provenance | Details for mads-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mads-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for mads-0.0.4-py3-none-any.whl |
Total release size: 16.3 kB
Release files / mads-0.0.4.tar.gz
| Download URL | mads-0.0.4.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
15eefcf3ab1366c1b6074f327416d145663c450692c844c57fae91976367d997
|
|
BLAKE2b-256 checksum How to use checksums |
4a82cc0c411c82af75579ab7a25ce83863133bb728df85d3811e567ce4ba8223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.7
|
Release files / mads-0.0.4-py3-none-any.whl
| Download URL | mads-0.0.4-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3f21b3363f7d11dfdabf321932d7d0da91f211857b07fa2fcaaa803c20cf66c
|
|
BLAKE2b-256 checksum How to use checksums |
ef85a5e53e3468d71c16342b975113656eefe23075f1fb3f30a2d8844e42292e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.7
|
Security for mads 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.