# pablormier/yabox

Yet another black-box optimization library for Python
Switch branches/tags
Nothing to show
pablormier Merge pull request #30 from ELC/MinorChanges
`Minor changes - First 3 commits of #29 (@ELC contribution)`
Latest commit 97fa2c1 Mar 14, 2018
 Failed to load latest commit information. docs/images Aug 9, 2017 notebooks Aug 25, 2017 tests/test-algorithms Aug 22, 2017 yabox Mar 8, 2018 .gitignore Jul 14, 2017 CHANGELOG.md Aug 25, 2017 LICENSE Jul 14, 2017 README.md Aug 10, 2017 setup.cfg Jul 31, 2017 setup.py Aug 25, 2017

Yet another black-box optimization library for Python

## Description

Yabox is a very small library for black-box (derivative free) optimization of functions that only depends on `numpy` and `matplotlib` for visualization. The library includes different stochastic algorithms for minimizing a function `f(X)` that does not need to have an analytical form, where `X = {x1, ..., xN}`. The current version of the library includes the Differential Evolution algorithm and a modified version for parallel evaluation.

Example of minimization of the Ackley function (using Yabox and Differential Evolution):

## Installation

Yabox is in PyPI so you can use the following command to install the latest released version:

`pip install yabox`

## Basic usage

### Pre-defined functions

Yabox includes some default benchmark functions used in black-box optimization, available in the package yabox.problems. These functions also include 2D and 3D plotting capabilities:

```>>> from yabox.problems import Levy
>>> problem = Levy()
>>> problem.plot3d()```

A problem is just a function that can be evaluated for a given X:

```>>> problem(np.array([1,1,1]))
0.80668910823394901```

### Optimization

Simple example minimizing a function of one variable `x` using Differential Evolution, searching between -10 <= x <= 10:

```>>> from yabox import DE
>>> DE(lambda x: sum(x**2), [(-10, 10)]).solve()
(array([ 0.]), 0.0)```

Example using Differential Evolution and showing progress (requires tqdm)