Skip to content

ParticleSwarm does not respect Optim.Options(iterations=x) #836

@NightMachinery

Description

@NightMachinery
julia> Optim.Options(iterations=10)
                x_abstol = 0.0
                x_reltol = 0.0
                f_abstol = 0.0
                f_reltol = 0.0
                g_abstol = 1.0e-8
                g_reltol = 1.0e-8
          outer_x_abstol = 0.0
          outer_x_reltol = 0.0
          outer_f_abstol = 0.0
          outer_f_reltol = 0.0
          outer_g_abstol = 1.0e-8
          outer_g_reltol = 1.0e-8
           f_calls_limit = 0
           g_calls_limit = 0
           h_calls_limit = 0
       allow_f_increases = false
 allow_outer_f_increases = false
        successive_f_tol = 1
              iterations = 10
        outer_iterations = 1000
             store_trace = false
           trace_simplex = false
              show_trace = false
          extended_trace = false
              show_every = 1
                callback = nothing
              time_limit = NaN


julia> result = optimize(x-> f(x[1],x[2]), [0.0,0.0], ParticleSwarm())
 * Status: failure (reached maximum number of iterations) (line search failed)

 * Candidate solution
    Minimizer: [5.00e+00, -1.00e+00]
    Minimum:   -9.116548e+01

 * Found with
    Algorithm:     Particle Swarm
    Initial Point: [0.00e+00, 0.00e+00]

 * Convergence measures
    |x - x'|               = NaN ≰ 0.0e+00
    |x - x'|/|x'|          = NaN ≰ 0.0e+00
    |f(x) - f(x')|         = NaN ≰ 0.0e+00
    |f(x) - f(x')|/|f(x')| = NaN ≰ 0.0e+00
    |g(x)|                 = NaN ≰ 1.0e-08

 * Work counters
    Seconds run:   28  (vs limit Inf)
    Iterations:    1000
    f(x) calls:    4001
    ∇f(x) calls:   0

julia> Optim.Options(outer_iterations=12)
                x_abstol = 0.0
                x_reltol = 0.0
                f_abstol = 0.0
                f_reltol = 0.0
                g_abstol = 1.0e-8
                g_reltol = 1.0e-8
          outer_x_abstol = 0.0
          outer_x_reltol = 0.0
          outer_f_abstol = 0.0
          outer_f_reltol = 0.0
          outer_g_abstol = 1.0e-8
          outer_g_reltol = 1.0e-8
           f_calls_limit = 0
           g_calls_limit = 0
           h_calls_limit = 0
       allow_f_increases = false
 allow_outer_f_increases = false
        successive_f_tol = 1
              iterations = 1000
        outer_iterations = 12
             store_trace = false
           trace_simplex = false
              show_trace = false
          extended_trace = false
              show_every = 1
                callback = nothing
              time_limit = NaN


julia> result = optimize(x-> f(x[1],x[2]), [0.0,0.0], ParticleSwarm())
 * Status: failure (reached maximum number of iterations) (line search failed)

 * Candidate solution
    Minimizer: [4.99e+00, -9.97e-01]
    Minimum:   -9.114673e+01

 * Found with
    Algorithm:     Particle Swarm
    Initial Point: [0.00e+00, 0.00e+00]

 * Convergence measures
    |x - x'|               = NaN ≰ 0.0e+00
    |x - x'|/|x'|          = NaN ≰ 0.0e+00
    |f(x) - f(x')|         = NaN ≰ 0.0e+00
    |f(x) - f(x')|/|f(x')| = NaN ≰ 0.0e+00
    |g(x)|                 = NaN ≰ 1.0e-08

 * Work counters
    Seconds run:   30  (vs limit Inf)
    Iterations:    1000
    f(x) calls:    4001
    ∇f(x) calls:   0

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