Skip to content

Should AlgoInfo have a needs_bounds field? #597

Open
@hamogu

Description

@hamogu

What would you like to enhance and why? Is it related to an issue/problem?

Currently, there is no easy way to find out if an algorithm requires bounds. I can check

>>> om.algos.scipy_differential_evolution.algo_info.supports_bounds
True

but not every algorithm that supports bounds also requires them. For example, scipy_powell supports bounds, but will run without them, while scipy_differential_evolution supports bounds and will raise ValueError: bounds should be a sequence containing finite real valued (min, max) pairs for each value in x is called without bounds.

Describe the solution you'd like

Add a field needs_bounds analogous to needs_hess and needs_jac to the AlgoInfo.

Describe alternatives you've considered

  1. Keep as is and fail if it happens. That's fine for users who directly use optimagic, but might confuse users who use another fitting package that just uses optimagic as a backend. In my case, users never create or even see the optimagic bounds themselves, but the package that they work with will transform their settings there into the right format for optimagic (or other optimizers outside of optimagic), so a message 'bounds should be a sequence containing finite real valued (min, max) pairs for each value in x' is somewhat confusing, which leads to ...
  2. Capture the error and re-raise it with a modified text. However, it's not guaranteed that every algorithm that requires bounds uses the same wording, which makes this a fragile and not future-proof solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions