SimonBlanke / Gradient-Free-Optimizers

Simple and reliable optimization with local, global, population-based and sequential techniques in numerical discrete search spaces.
https://simonblanke.github.io/gradient-free-optimizers-documentation
MIT License
1.21k stars 84 forks source link

API changes for v2 #32

Open SimonBlanke opened 2 years ago

SimonBlanke commented 2 years ago

In this issue the progress for the API-changes for v2 is shown.

The objective-function parameter might make more sense in the optimizer-class instead of the search-method. Parameters in the method should be data you would want to change from one search to the next. It does not make sense to me to change the objective-function but not the search-space. So the new API-design would look like this:

import numpy as np
from gradient_free_optimizers import RandomSearchOptimizer

def parabola_function(para):
    loss = para["x"] * para["x"]
    return -loss

search_space = {"x": np.arange(-10, 10, 0.1)}

opt = RandomSearchOptimizer(parabola_function, search_space)
opt.search(n_iter=100000)
SimonBlanke commented 4 months ago

since there are multiple kinds of "powell's methods", the existing "powell's method" in GFO will be renames to "Powell's Conjugate Direction Method" in v2.0