A simplex based variation of the LIPO algorithm from Global optimization of Lipschitz functions.
Following the dlib implementation, we could add :
But those require some additional solving in order to estimate the parameters.
There are two ways to use the algorithm, either use one of the Optimizer::minimize
/ Optimizer::maximize
functions :
```rust let f = |v| v[0] + v[1] * v[2]; let inputinterval = vec![(-10., 10.), (-20., 20.), (0, 5.)]; let nbiterations = 100;
let (maxvalue, coordinates) = Optimizer::maximize(f, inputinterval, nbiterations); println!("max value: {} found in [{}, {}, {}]", maxvalue, 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 f = |v| v[0] * v[1]; let inputinterval = vec![(-10., 10.), (-20., 20.)]; let shouldminimize = 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 (minvalue, coordinates) = Optimizer::new(f, inputinterval, shouldminimize)
.setexplorationdepth(10)
.skip(30)
.takewhile(|(value,coordinates)| value > 1. )
.next().unwrap();
println!("min value: {} found in [{}, {}]", min_value, coordinates[0], coordinates[1]); ```