Skip to content

Trying to use NewtonTrustRegion with inequality constraints produces StackOverFlow error #903

@MichaelBarmann

Description

@MichaelBarmann

(Just a note that I am new to this issue reporting thing; I'm writing this at the suggestion of @odow:https://discourse.julialang.org/t/how-to-properly-specify-jacobian-hessian-functions-of-inequality-constraints-optim/53870/3.

While testing out a constrained optimization problem with inequality constraints using IPNewton(), I noticed that changing the method to NewtonTrustRegion() caused it to throw the following error:

StackOverflowError:

Stacktrace:
 [1] optimize(::TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::TwiceDifferentiableConstraints{var"#con_c!#89",var"#con_jacobian!#90",var"#con_hess!#91",Float64}, ::Array{Float64,1}, ::NewtonTrustRegion{Float64}, ::Optim.Options{Float64,Nothing}; inplace::Bool, autodiff::Symbol) at C:\Users\Michael\.julia\packages\Optim\CK6Dn\src\multivariate\optimize\interface.jl:148
 [2] optimize(::TwiceDifferentiable{Float64,Array{Float64,1},Array{Float64,2},Array{Float64,1}}, ::TwiceDifferentiableConstraints{var"#con_c!#89",var"#con_jacobian!#90",var"#con_hess!#91",Float64}, ::Array{Float64,1}, ::NewtonTrustRegion{Float64}, ::Optim.Options{Float64,Nothing}) at C:\Users\Michael\.julia\packages\Optim\CK6Dn\src\multivariate\optimize\interface.jl:147
 ... (the last 2 lines are repeated 28980 more times)
 [57963] ModelFit(; ODE_model::Function, ODE_vars::Array{String,1}, vars_to_fit::Array{String,1}, paramIC_dict::Dict{Symbol,Any}, data_dict::Dict{Symbol,String}, f_calc_ICs::typeof(f_ICs), N0::Int64, fit_range::Array{String,1}, date_obs_last::String, forecast_until::String, date_format::String, norm::typeof(mean_abs_rel_error), norm_weights::Array{Int64,1}, norm_scale::Int64, integrator_options::Dict{Symbol,Any}, optimizer_options::Dict{Symbol,Any}) at .\In[60]:317
 [57964] top-level scope at In[61]:15

Removing the inequality constraints made it it work, so it seems to be that NewtonTrustRegion doesn't support inequality constraints (is this true?). If so, it would be helpful to have a better error message, e.g.NewtonTrustRegion() doesn't support inequality constraints.

(On a somewhat tangential note, the Optim.jl documentation isn't quite clear about which methods support inequality, box constraints, and which do not. I know it has some examples, but it seems incomplete...Is this forum the place to post suggestions for the documentation? Or is there some other forum dedicated to that?)

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