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

Ask function outputting repeated points #1570

Open
boyarkin opened this issue Nov 2, 2023 · 0 comments
Open

Ask function outputting repeated points #1570

boyarkin opened this issue Nov 2, 2023 · 0 comments

Comments

@boyarkin
Copy link

boyarkin commented Nov 2, 2023

Hello!
I'm trying to solve black-box optimization task and that task is specific: domain of objective function is quite small, so when suggestion point x is not in domain, f(x) returns nan or any big value like 2.72489e+19 or larger.

My code:

import nevergrad as ng

def obj_function(x):
    return black_box.get_function_value(x.tolist())

def solve():
    initial_point = black_box.get_initial_point()

    # init optimizer
    param = ng.p.Array(shape=(parametrization_val,)).set_standardized_data(initial_point)
    ng_optimizer = ng.optimizers.registry['BFGS'](parametrization=param, budget=1000)

    for _ in range(ng_optimizer.budget):
        x = ng_optimizer.ask()
        obj_v = obj_function(*x.args, **x.kwargs)
        ng_optimizer.tell(x, obj_v)

    recommendation = ng_optimizer.provide_recommendation()
    return recommendation.value

The main problem, that nevergrad optimizer suggest the same point many times until the budget ends. So my log looks like:

Suggestion: 
2.34383, 2.23239, -1.48685, 0.742839, -1.16699, 1.04315, -1.00391, 0.0158264, -0.808701, -0.876145, 0.376727, 0.323922 ...
Cost (R): 2.72489e+19
______________________________
Suggestion: 
2.34383, 2.23239, -1.48685, 0.742839, -1.16699, 1.04315, -1.00391, 0.0158264, -0.808701, -0.876145, 0.376727, 0.323922 ...
Cost (R): 2.72489e+19

.... ~150 repetitions of information above...
______________________________
Suggestion: 
0.784922, -0.0693755, -0.0383782, 0.652343, -0.0737021, 0.119224, 0.627094, 0.904481, 0.53831, -0.528335, 0.29518 ...
Cost (R): 2.72489e+19

.... ~150 repetitions of information above...

and so on.

So it can't fins solution and recommendation just return initial point as the best result. So I can't understand why nevergrad suggest repeated points and how to avoid this?
Thank you

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

No branches or pull requests

1 participant