Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to maximize and minimize objective-function #39

Open
SimonBlanke opened this issue Mar 27, 2023 · 1 comment
Open

add support to maximize and minimize objective-function #39

SimonBlanke opened this issue Mar 27, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@SimonBlanke
Copy link
Owner

No description provided.

@SimonBlanke SimonBlanke added the enhancement New feature or request label Mar 27, 2023
@SimonBlanke SimonBlanke self-assigned this Mar 27, 2023
@SimonBlanke
Copy link
Owner Author

This new parameter would determine if the optimum the algorithm is searching for is the minimum or maximum of the objective-function. The API for this could look as follows:

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(search_space, optimum="minimum")
opt.search(parabola_function, n_iter=100000)

opt = RandomSearchOptimizer(search_space, optimum="maximum")
opt.search(parabola_function, n_iter=100000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant