# Simple(x) Global Optimization
A simplex based variation of the [LIPO algorithm](http://blog.dlib.net/2017/12/a-global-optimization-algorithm-worth.html) from [Global optimization of Lipschitz functions](https://arxiv.org/abs/1703.02628).
## Potential improvements
Following the [dlib implementation](http://blog.dlib.net/2017/12/a-global-optimization-algorithm-worth.html), we could add :
- a Lipschitz constant per dimension
- a noise term per point
- a local optimizer
But those require some additional solving in order to estimate the parameters.
## Usage
There are two ways to use the algorithm, either use one of the `Optimizer::minimize` / `Optimizer::maximize` functions :
```rust
let nb_iterations = 100;
let (max_value, coordinates) = Optimizer::maximize(f, input_interval, nb_iterations);
println!("max value: {} found in [{}, {}, {}]", max_value, coordinates[0], coordinates[1], coordinates[2]);
```
Or use an iterator if you want to set `exploration_depth` to an exotic value or to have fine grained control on the stopping criteria :
```rust
let should_minimize = true;
// sets `exploration_depth` to be greedy
// runs the search for 30 iterations
// then waits until we find a point good enough
// finally stores the best value so far
let (min_value, coordinates) = Optimizer::new(f, input_interval, should_minimize)
.set_exploration_depth(10)
.skip(30)
.take_while(|(value,coordinates)| value > 1. )
.next().unwrap();
println!("min value: {} found in [{}, {}]", min_value, coordinates[0], coordinates[1]);
```