You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! I am facing a FAILURE when trying to minimize a function with 62339366 variables using L-BFGS with a box constraint. The issue does not appear when using just one less variable.
The function is $f: \vec x\mapsto \sum_i -50x_i + 300 x_i(\log(x_i) - 1)$ where $\vec x$ is a vector of 62339366 variables $x_i$. The box constraint is that the $x_i$ should be above a fixed SMALL_CONSTANT, for example 0.01, so that $(\vec\nabla f(\vec x))_i = -50 + 300\log(x_i)$ does not diverge. The exact value of SMALL_CONSTANT does not matter here, the same issue occurs using SMALL_CONSTANT = 1e-100.
The numerical solution should be a vector of ω = 1.1813604128656459, since $-50 + 300\log(\omega) \approx 0$. The initial point is a vector of numbers uniformly taken in $[(1-η)ω;\ (1+η)ω]$ where η = 0.001 for instance.
Here is the minimal reproducer (I think it requires having 16GiB RAM):
module TestNLoptLBFGSfailure
using NLopt
import LinearAlgebra: norm
const SMALL_CONSTANT =1e-2const ω =1.1813604128656459const η =1e-3functionobjective(point::Vector{Float64}, gradient::Vector{Float64})
iflength(gradient) >0
gradient .=-50.+300.*log.(point)
end
value =sum(-50*r +300*(r*(log(r) -1)) for r in point)
@show value, norm(gradient)
value
endfunctiontest(n)
opt =Opt(:LD_LBFGS, n)
opt.ftol_rel =1e-10# or 1e-3, it does not matter
opt.lower_bounds =fill(SMALL_CONSTANT, n)
opt.min_objective = objective
init = ω .*rand(1.+ (-η:η), n)
# init = fill(ω, n) # actual target
minf, minx, ret =optimize(opt, init)
ret
endend
And if I set the starting point too close to the target, i.e. $η$ too small, for instance η = 1e-9, then it fails for both cases, but it does not perform the same number of steps:
May be related to #33. The last point (optimization fails if the initial point is too close to the optimum) reflects #33 (comment), but the difference between 62339365 and 62339366 variables is new I think? My real problem is of course more complex and even larger than 62339366 variables.
The text was updated successfully, but these errors were encountered:
Hi! I am facing a
FAILURE
when trying to minimize a function with 62339366 variables using L-BFGS with a box constraint. The issue does not appear when using just one less variable.The function is$f: \vec x\mapsto \sum_i -50x_i + 300 x_i(\log(x_i) - 1)$ where $\vec x$ is a vector of 62339366 variables $x_i$ . The box constraint is that the $x_i$ should be above a fixed $(\vec\nabla f(\vec x))_i = -50 + 300\log(x_i)$ does not diverge. The exact value of
SMALL_CONSTANT
, for example0.01
, so thatSMALL_CONSTANT
does not matter here, the same issue occurs usingSMALL_CONSTANT = 1e-100
.The numerical solution should be a vector of$-50 + 300\log(\omega) \approx 0$ . The initial point is a vector of numbers uniformly taken in $[(1-η)ω;\ (1+η)ω]$ where
ω = 1.1813604128656459
, sinceη = 0.001
for instance.Here is the minimal reproducer (I think it requires having 16GiB RAM):
and the observations:
If I use the target value
ω
directly as initialization (i.e. takingη = 0
), then it works:And if I set the starting point too close to the target, i.e.$η$ too small, for instance
η = 1e-9
, then it fails for both cases, but it does not perform the same number of steps:May be related to #33. The last point (optimization fails if the initial point is too close to the optimum) reflects #33 (comment), but the difference between 62339365 and 62339366 variables is new I think? My real problem is of course more complex and even larger than 62339366 variables.
The text was updated successfully, but these errors were encountered: