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

NLopt returns BoundsError even though model is properly defined as MathProgBase model #101

Closed
jomi2801 opened this issue Feb 3, 2018 · 3 comments

Comments

@jomi2801
Copy link

jomi2801 commented Feb 3, 2018

I have run the code

using NLopt

include(joinpath(Pkg.dir("MathProgBase"),"test","nlp.jl"))
convexnlptest(NLoptSolver(algorithm=:LD_SLSQP))

resulting in the output

ERROR: BoundsError
Stacktrace:
 [1] optimize!(::NLopt.Opt, ::Array{Float64,1}) at /home/jomi/.julia/v0.6/NLopt/src/NLopt.jl:523
 [2] optimize!(::NLopt.NLoptMathProgModel) at /home/jomi/.julia/v0.6/NLopt/src/NLoptSolverInterface.jl:203
 [3] convexnlptest(::NLopt.NLoptSolver) at /home/jomi/.julia/v0.6/MathProgBase/test/nlp.jl:245

The code

using NLopt

include(joinpath(Pkg.dir("MathProgBase"),"test","nlp.jl"))
nlptest(NLoptSolver(algorithm=:LD_SLSQP))

The test set called by convexnlptest is in MathProgBase syntax and part of the test set of MathProgBase.

@jomi2801
Copy link
Author

jomi2801 commented Feb 3, 2018

I have compared the functions convexnlptest and nlptest and have observed that nlptest runs MathProgBase.setwarmstart! whereas convexnlptest does not. If the optimization variable say x is initialized by an array of the proper length before calling optimize!, the error does not occur.

@mlubin
Copy link
Member

mlubin commented Feb 4, 2018

I believe you must provide a starting point to NLopt, but I agree the error message could be more helpful.

@odow
Copy link
Member

odow commented Jan 25, 2023

Closing as won't fix. The MathProgBase interface is deprecated and will be removed in a future release.

@odow odow closed this as completed Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants