Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
MichaelBarmann opened this issue Jan 27, 2021 · 1 comment

Comments

@MichaelBarmann
Copy link

(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?)

@MichaelBarmann MichaelBarmann changed the title Trying to use NewtonTrustRegion with constraints produces StackOverFlow error Trying to use NewtonTrustRegion with inequality constraints produces StackOverFlow error Jan 27, 2021
@pkofod
Copy link
Member

pkofod commented Feb 11, 2021

Thanks, I'll look into it. This is a good place to discuss documentation. Just open an issue with suggestions! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants