I am now diving into another interesting Julia 0.6.2 area—nonlinear nonquadratic (unconstrained) optimization with JuMP 0.18.1. The documentation is partly nice and easy, partly difficult. This is because the different optimizers are external—and there are many of them, so I am not even sure which one I am supposed to chase down. Beginner’s help appreciated.

Logically, why does
getvalue
not require the model’s name? 
What packages are recommended for noderivatives simplex, steepestdescent, conjugate priors, and NewtonRaphson (which seem to be the standard workhorses). I would like to start with the dumbest, slowest, most robust optimizers first, and then work my way up.

I think there is something wrong with KNITRO 0.4.0 under macOS. despite successful
Pkg.add("KNITRO")
, I get ERROR: LoadError: error compiling loadproblem!: error compiling Type: could not load library “libknitro” dlopen(libknitro.dylib, 1): image not found 
I have had better luck with Ipopt. At least I could get it to run! Alas, I could not figure out a method that would allow autodiff=FALSE. In the simple example below, because my function (
nearneghyperbola
) has two kinks, IPopt probably gets confused. more worrisome, it does not seem to recognize that it has gotten it wrong—I think it claims to have found a minimum, which it has not. A check around the optimum should tell it this.
using JuMP, Ipopt
nearneghyperbola( a... ) = prod( 1.0./(abs.( collect(a) .+ 3) + 1e2) )
function learn_nl_jump(userfun, n)
mymdl = JuMP.Model( solver=Ipopt.IpoptSolver() )
JuMP.register( mymdl, :userfun, n, userfun, autodiff=true )
@JuMP.variable( mymdl, 100 <= x[1:n] <= 100 )
JuMP.setNLobjective( mymdl, :Min, Expr(:call, :userfun, [x[i] for i=1:n]...) )
JuMP.solve( mymdl )
return [ getvalue(x[i]) for i=1:n ] ## why does getvalue not refer to mymdl??
end
xopt= learn_nl_jump(nearneghyperbola, 3)
println( "x^* =: ", xopt, "\n")
println( "minimum f(x^*)= ", nearneghyperbola(xopt...) )
println( "f(neg 3s)= ", nearneghyperbola(3, 3, 3) )
output on my machine is
...
EXIT: Solved To Acceptable Level.
x^* =: [99.9897, 99.9897, 94.0]
minimum f(x^*)= 1.0955764466765225e6
f(neg 3s)= 1.0e6