Code Monkey home page Code Monkey logo

simplers's Introduction

Simple(x) Global Optimization

A Rust implementation of the Simple(x) black-box global optimization algorithm.

This algorithm (which should not be confused with the simplex algorithm) is closest to bayesian optimization. Its strengths, compared to bayesian optimization, are the ability to deal with a large number of sample and high dimension efficiently.

Usage

There are two ways to use the algorithm, either use one of the Optimizer::minimize / Optimizer::maximize functions :

let f = |v:&[f64]| v[0] + v[1] * v[2];
let input_interval = vec![(-10., 10.), (-20., 20.), (0, 5.)];
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 :

let f = |v:&[f64]| v[0] * v[1];
let input_interval = vec![(-10., 10.), (-20., 20.)];
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)
                                       .skip_while(|(value,coordinates)| value > 1. )
                                       .next().unwrap();

println!("min value: {} found in [{}, {}]", min_value, coordinates[0], coordinates[1]);

Divergences from the reference implementation

  • The user defines the search space as an hypercube (which is then mapped to a simplex using this method).

  • The exploration_preference (float) parameter has been replaced by an exploration_depth (unsigned integer) parameter. It represents how many split deep the algorithm can search before requiring higher-level exploration (0 meaning grid-search like exploration, 5 being a good default and large values (10+) being very exploitation/greedy focusses).

  • There are two ways to call the algorithm, either by calling a single function or via an iterator which gives the user full control on the stopping criteria.

Potential future developements

Do not hesitate to ask for improvements. The list of things that could be done but will probably be left undone unless requested includes :

  • Add (optional) serde support to save searches.

  • Add an option to introduce noise in the point generation (?).

  • Let the user suggest some points to speed-up the search (will require the ability to check wether a point is in a simplex or a triangularization algorithm).

  • Let the user explore several points in parallel.

  • Let the user perform the search offline.

  • We could offer to integrate the project into the argmin optimization framework (to make the algorithm more accesible, future-proof and easier to compare with the state of the art).

simplers's People

Contributors

dependabot-preview[bot] avatar nestordemeure avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

simplers's Issues

Optimization Bounds

Hello,

Great crate! I am a bit confused about the operation of the Simple(x) algorithm, and I believe my confusion is in the creation of the simplex from the hypercube. If I pass upper/lower bounds on variables, the algorithm converts that hypercube representation to a simplex? If so, we lose some of the search space? For example, it cannot solve the eggholder optimization problem with 2 variable bounds (-512, 512). The optimal solution is at x=512, y=404.23, opt=-959.64. The best I can achieve is opt_cost=-946.56 @ x=481.18, y=437.23. It appears the search is never performed near x=512. Please help! :)

Feature request: inspection of the surrogate model

This is a larger feature request, just wanted to express the potential value, I don't expect this to be implemented any time soon.

It would be very useful to have an API to access the internal surrogate model that Simple(x) is building, as well as some utilities to plot the value function over the problem space.

It would be valuable to gain an intuition of the impact of each input parameter, especially when doing low-dimensional optimization with hand-engineered features. Actually, Simple(x) could be useful just to efficiently map-out the shape of a search space for gaining a better understanding, besides blind black-box optimization.

image

Is multi-threading supported?

I like that it's a black box.
Does this crate support multi-threading though? I tried but I only get about 40% CPU utilization.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.