JuliaSmoothOptimizers / JuliaSmoothOptimizers/NLSProblems.jl

Possible bug in MGH problem 11 (mgh11)

Open Beginner friendly
#96 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Julia
Stars
10
Forks
6
PR merge metrics
No merged PRs in 30d

Description

While testing the mgh11 function, I noticed that evaluating the residuals at the known optimal point does not give a value close to 0 — the residual norm is around 33, when it should be approximately 0.

I believe the issue is in this line:

@NLexpression(model, F[i = 1:m], exp(-abs(y[i] * m * i * x[2])^x[3] / x[1]) - t[i])

According to the original MGH specification (Moré, Garbow & Hillstrom, 1981), problem #11 (Gulf R&D function) should be:

f_i(x) = exp( -|y_i - x2|^x3 / x1 ) - t_i

with t_i = i/100 and y_i = 25 + (-50ln(t_i))^(2/3), and optimal solution x = (50, 25, 1.5).

The current implementation instead computes abs(y[i] * m * i * x[2]), which:

Uses multiplication instead of subtraction between y[i] and x[2].
Introduces the extra factors m and i, which don't belong in the original formula (y[i] already depends on i through t[i]).

Am I right about this? If so, here is a corrected version of the line:

@NLexpression(model, F[i = 1:m], exp(-abs(y[i] - x[2])^x[3] / x[1]) - t[i])

With this change, I confirmed the residual norm at x* = (50, 25, 1.5) is (near) zero, matching the expected optimum.

Thank you for looking into this.

Contributor guide

Open the contributing guide

Research direction

Start at the mgh11 function and inspect the residual expression shown in the issue. Compare it with the original MGH #11 formula, then evaluate the residual norm at x = (50, 25, 1.5); done means the implementation matches the stated formula and the norm is near zero.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.