Skip to content

BOBYQA violates bounds constraints by roundoff error #625

@JasmineTC

Description

@JasmineTC

What happened?

Hi, I'm using LN_BOBYQA to minimise a function inside a loop and feeding result of the previous minimisation into the next iteration. Overwhelming this works fine. However in one case the results of the minimisation is a floating point* amount out of bounds and so I get a "nlopt.nlopt.invalid_argument" error.

I can probably just bypass this problem by rounding the result (e.g. numpy.rint) but this leads to precision loss and overhead for a rare edge case.

*bound is 1e-4, result is 9.999999999999999e-05

How to reproduce the issue?

Unfortunately code too complicated to distil into useful MWE.

Version

NLOPT: 2.9.1
Python: 3.13.5
Numpy: 2.2.6

Operating System

Linux

Installation media

pip

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions