[Python] How to define the search space for a simple equation optimization

Discussão em 'Python' iniciado por Stack, Janeiro 28, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to learn skopt, but I'm struggling to get even a simple multivariate minimization to run.

    import skopt

    def black_box_function(some_x, some_y):
    return -some_x + 2 - (some_y - 1) ** 2 + 1

    BOUNDS = [(0, 100.0), (0, 100.0)]

    result = skopt.dummy_minimize(func=black_box_function, dimensions=BOUNDS)


    When I run this, it seems to figure out that I want the search space for some_x to lie between 0 and 100, but it returns this error:

    TypeError: black_box_function() missing 1 required positional argument: 'some_y'.


    How can I define the search space for both some_x and some_y?

    Continue reading...

Compartilhe esta Página