Skip to content
Nelder-Mead method implementation by Python
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
examples fix axis Oct 24, 2018
neldermead
tests add tests Oct 25, 2018
.gitignore fix x structure to (dim, 1) Oct 16, 2018
LICENSE initial commit Oct 15, 2018
README.md
requirements.txt add requirements.txt Oct 25, 2018
setup.py

README.md

neldermead

Nelder-Mead implementation

CircleCI

Getting Started

Prerequisites

You need only NumPy that is the package for scientific computing.

Installing

Please run the following command.

$ pip install neldermead

Example

This is a simple example that objective function is sphere function.

import numpy as np
from neldermead import NelderMead

dim = 3
f = lambda x: np.sum(x**2)
simplex = np.zeros([dim, dim + 1])
for i in range(dim + 1):
    simplex[:, i] = np.array([np.random.rand() for _ in range(dim)])
nm = NelderMead(dim, f, simplex)

x_best, f_best = nm.optimize(100)
print("x_best:{}, f_best:{}".format(x_best, f_best))
#x_best:[[-1.48045204e-08]
# [-1.80962770e-08]
# [ 5.08040874e-08]], f_best:3.1277043680572982e-15

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE file for details

You can’t perform that action at this time.