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

test_correct_startpoint_usage[34-nlopt] fails #1511

Closed
dweindl opened this issue Nov 18, 2024 · 2 comments
Closed

test_correct_startpoint_usage[34-nlopt] fails #1511

dweindl opened this issue Nov 18, 2024 · 2 comments

Comments

@dweindl
Copy link
Member

dweindl commented Nov 18, 2024

e.g. https://github.com/ICB-DCM/pyPESTO/actions/runs/11889668047/job/33126701722?pr=1508

Probably related to the recent nlopt release

___________________ test_correct_startpoint_usage[34-nlopt] ____________________

optimizer = ('nlopt', 11)

    def test_correct_startpoint_usage(optimizer):
        """
        Test that the startpoint is correctly used in all optimizers.
        """
        # cma supports x0, but samples from this initial guess, therefore return
        if optimizer == ("cma", ""):
            return
    
        opt = get_optimizer(*optimizer)
        # return if the optimizer knowingly does not support x_guesses
        if not opt.check_x0_support():
            return
    
        # define a problem with an x_guess
        problem = CRProblem(x_guesses=[np.array([0.1, 0.1])]).get_problem()
    
        # run optimization
        result = optimize.minimize(
            problem=problem,
            optimizer=opt,
            n_starts=1,
            progress_bar=False,
            history_options=pypesto.HistoryOptions(trace_record=True),
        )
        # check that the startpoint was used
>       assert problem.x_guesses[0] == pytest.approx(
            result.optimize_result[0].history.get_x_trace(0)
        )
E       assert array([0.1, 0.1]) == approx([0.317...27 ± 3.2e-07])
E         
E         comparison failed. Mismatched elements: 2 / 2:
E         Max absolute difference: 0.2170485381304927
E         Max relative difference: 2.170485381304927
E         Index | Obtained | Expected                    
E         (0,)  | 0.1      | 0.3170485381304927 ± 3.2e-07
E         (1,)  | 0.1      | 0.3170485381304927 ± 3.2e-07

test/optimize/test_optimize.py:668: AssertionError
@dweindl
Copy link
Member Author

dweindl commented Nov 18, 2024

optimizer = ('nlopt', 11)

-> nlopt.LN_PRAXIS

I don't see anything directly related to LN_PRAXIS in stevengj/nlopt@v2.8.0...v2.9.0

There is stevengj/nlopt@6a9fbb0, but the associated issue should have been present in 2.8.0 already.

The most relevant change could be stevengj/nlopt@4fa930c.

@dweindl
Copy link
Member Author

dweindl commented Nov 25, 2024

optimizer = ('nlopt', 11)

-> nlopt.LN_PRAXIS

I don't see anything directly related to LN_PRAXIS in stevengj/[email protected]

The relevant change is more recent. Tags from from nlopt and nlopt-python don't match exactly.

Tracked here: stevengj/nlopt#575

dweindl added a commit to dweindl/pyPESTO that referenced this issue Nov 25, 2024
We want to avoid nlopt-python 2.9.0 because it does not match nlopt v2.9.0 and is affected by stevengj/nlopt#575.

Closes ICB-DCM#1511.
@dweindl dweindl self-assigned this Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants