Skip to content

nevergrad_pso fails when bounds are not provided #638

@spline2hg

Description

@spline2hg

Description:
I am trying to use the nevergrad_pso optimizer without specifying bounds, as it has needs_bounds=False. However, I encounter a ValueError requiring at least one bound to be specified.

To Reproduce:

import optimagic as om
import numpy as np

def sphere(params):
    return params @ params

res = om.minimize(
    fun=sphere,
    params=np.arange(5),
    algorithm="nevergrad_pso",
)

Error messages:

    140                 raise ValueError(f"Lower bounds {a_min} should be strictly smaller than upper bounds {a_max}")
    141         if self.a_min is None and self.a_max is None:
--> 142             raise ValueError("At least one bound must be specified")
    143         self.shape: tp.Tuple[int, ...] = self.a_min.shape if self.a_min is not None else self.a_max.shape
    144 

ValueError: At least one bound must be specified

I am not very sure if this is a bug ,or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions