Skip to content

Bounds + maxiters breaks BFGS #508

@moble

Description

@moble

The maxiters argument is ignored when also supplying bounds and using BFGS. (I expect that this is also true of other Optim algorithms, but haven't tested.) When bounds are supplied, Optimization automatically uses Fminbox. But the Optim docs point out that there are two different iterations parameters in this case: outer_iterations and iterations. Is there any way to manipulate both options?

Here's an MWE:

using Optimization, ForwardDiff, OptimizationOptimJL

rosenbrock(x, p) = (p[1] - x[1])^2 + p[2] * (x[2] - x[1]^2)^2
x0 = zeros(2)
_p = [1.0, 100.0]

optf = OptimizationFunction(rosenbrock, Optimization.AutoForwardDiff())
prob = OptimizationProblem(optf, x0, _p, lb = [-1.0, -1.0], ub = [0.8, 0.8])
# prob = OptimizationProblem(optf, x0, _p)
println(solve(prob, BFGS(), maxiters=2, progress=true).original)

If you swap which prob is commented, you'll see that the maxiters argument is respected when no bounds are used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions