Question about requested features in a JuMP model

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Question about requested features in a JuMP model

Dominique Orban
Hi,

Something's not clear to me about the features you can request from a JuMP model (:Grad, :Jac, etc.). I'm looking at the example at

http://www.juliaopt.org/JuMP.jl/0.14/nlp.html#querying-derivatives-from-a-jump-model

where only :Grad is requested. My understanding is that that means other features are simply not available, e.g., evaluating the Jacobian or Hessian. That seems to be correct regarding the Hessian:

julia> MathProgBase.hesslag_structure(d)
ERROR
: Hessian computations were not requested on the call to MathProgBase.initialize.
 
in hesslag_structure(::JuMP.NLPEvaluator) at /Users/dpo/.julia/v0.5/JuMP/src/nlp.jl:977


but JuMP seems happy trying to set up the Jacobian structure:

julia> MathProgBase.jac_structure(d)
 
(Int64[],Int64[])

(the problem I link to above doesn't have constraints but the same happens with a constrained problem). In fact:

 julia> MathProgBase.features_available(d)
5-element Array{Symbol,1}:
 
:Grad    
 
:Jac      
 
:ExprGraph
 
:Hess    
 
:HessVec


What am I missing?

Thanks!

--
You received this message because you are subscribed to the Google Groups "julia-opt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question about requested features in a JuMP model

Miles Lubin
It's not a bug if a feature is available even when you don't ask for it, it's just behavior that you shouldn't rely on. features_available is meant to be called before initialize to find out which features you're allowed to request. See the example in Ipopt: https://github.com/JuliaOpt/Ipopt.jl/blob/41b1e7010a2ed92e1f21cec7df6195b581d5707a/src/IpoptSolverInterface.jl#L38.

On Saturday, October 22, 2016 at 7:30:21 PM UTC-4, Dominique Orban wrote:
Hi,

Something's not clear to me about the features you can request from a JuMP model (:Grad, :Jac, etc.). I'm looking at the example at

<a href="http://www.juliaopt.org/JuMP.jl/0.14/nlp.html#querying-derivatives-from-a-jump-model" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.juliaopt.org%2FJuMP.jl%2F0.14%2Fnlp.html%23querying-derivatives-from-a-jump-model\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFM6bgCMYNjTL8bhOQJHWloqgN6-g&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.juliaopt.org%2FJuMP.jl%2F0.14%2Fnlp.html%23querying-derivatives-from-a-jump-model\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFM6bgCMYNjTL8bhOQJHWloqgN6-g&#39;;return true;">http://www.juliaopt.org/JuMP.jl/0.14/nlp.html#querying-derivatives-from-a-jump-model

where only :Grad is requested. My understanding is that that means other features are simply not available, e.g., evaluating the Jacobian or Hessian. That seems to be correct regarding the Hessian:

julia> MathProgBase.hesslag_structure(d)
ERROR
: Hessian computations were not requested on the call to MathProgBase.initialize.
 
in hesslag_structure(::JuMP.NLPEvaluator) at /Users/dpo/.julia/v0.5/JuMP/src/nlp.jl:977


but JuMP seems happy trying to set up the Jacobian structure:

julia> MathProgBase.jac_structure(d)
 
(Int64[],Int64[])

(the problem I link to above doesn't have constraints but the same happens with a constrained problem). In fact:

 julia> MathProgBase.features_available(d)
5-element Array{Symbol,1}:
 
:Grad    
 
:Jac      
 
:ExprGraph
 
:Hess    
 
:HessVec


What am I missing?

Thanks!

--
You received this message because you are subscribed to the Google Groups "julia-opt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question about requested features in a JuMP model

Dominique Orban
Thanks. I can see the logic behind the IPOPT example. I was interested in using the features the other way around. The model

https://github.com/JuliaSmoothOptimizers/OptimizationProblems.jl/blob/master/src/penalty2.jl

takes ages to "build" for large values of n (e.g., n=5000) if :Hess is in requested_features, but goes pretty fast if I only request :HessVec. I now realize that was not the intended purpose of the features?! If not, is there any interest in supporting such usage? It seems quite crucial to very large scale models that can't realistically be solved by factorization-based methods.

On Saturday, October 22, 2016 at 8:37:33 PM UTC-4, Miles Lubin wrote:
It's not a bug if a feature is available even when you don't ask for it, it's just behavior that you shouldn't rely on. features_available is meant to be called before initialize to find out which features you're allowed to request. See the example in Ipopt: <a href="https://github.com/JuliaOpt/Ipopt.jl/blob/41b1e7010a2ed92e1f21cec7df6195b581d5707a/src/IpoptSolverInterface.jl#L38" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaOpt%2FIpopt.jl%2Fblob%2F41b1e7010a2ed92e1f21cec7df6195b581d5707a%2Fsrc%2FIpoptSolverInterface.jl%23L38\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHc9ciO1phoX73IwFHLjoEBH4vQEA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaOpt%2FIpopt.jl%2Fblob%2F41b1e7010a2ed92e1f21cec7df6195b581d5707a%2Fsrc%2FIpoptSolverInterface.jl%23L38\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHc9ciO1phoX73IwFHLjoEBH4vQEA&#39;;return true;">https://github.com/JuliaOpt/Ipopt.jl/blob/41b1e7010a2ed92e1f21cec7df6195b581d5707a/src/IpoptSolverInterface.jl#L38.

On Saturday, October 22, 2016 at 7:30:21 PM UTC-4, Dominique Orban wrote:
Hi,

Something's not clear to me about the features you can request from a JuMP model (:Grad, :Jac, etc.). I'm looking at the example at

<a href="http://www.juliaopt.org/JuMP.jl/0.14/nlp.html#querying-derivatives-from-a-jump-model" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.juliaopt.org%2FJuMP.jl%2F0.14%2Fnlp.html%23querying-derivatives-from-a-jump-model\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFM6bgCMYNjTL8bhOQJHWloqgN6-g&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.juliaopt.org%2FJuMP.jl%2F0.14%2Fnlp.html%23querying-derivatives-from-a-jump-model\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFM6bgCMYNjTL8bhOQJHWloqgN6-g&#39;;return true;">http://www.juliaopt.org/JuMP.jl/0.14/nlp.html#querying-derivatives-from-a-jump-model

where only :Grad is requested. My understanding is that that means other features are simply not available, e.g., evaluating the Jacobian or Hessian. That seems to be correct regarding the Hessian:

julia> MathProgBase.hesslag_structure(d)
ERROR
: Hessian computations were not requested on the call to MathProgBase.initialize.
 
in hesslag_structure(::JuMP.NLPEvaluator) at /Users/dpo/.julia/v0.5/JuMP/src/nlp.jl:977


but JuMP seems happy trying to set up the Jacobian structure:

julia> MathProgBase.jac_structure(d)
 
(Int64[],Int64[])

(the problem I link to above doesn't have constraints but the same happens with a constrained problem). In fact:

 julia> MathProgBase.features_available(d)
5-element Array{Symbol,1}:
 
:Grad    
 
:Jac      
 
:ExprGraph
 
:Hess    
 
:HessVec


What am I missing?

Thanks!

--
You received this message because you are subscribed to the Google Groups "julia-opt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question about requested features in a JuMP model

Miles Lubin
You can certainly avoid asking for Hess if you know that it's slow for a particular model. It looks like that model has a fully dense hessian, which JuMP hasn't been optimized for (we could skip the coloring step). (As an experiment you might try computing the full hessian by doing the n HessVec products.) We've had some discussions about being able to estimate the time it might take to compute a hessian with different methods, but at the moment there's no way for you to query a JuMP model to ask how expensive the hessian might be.

On Saturday, October 22, 2016 at 9:08:28 PM UTC-4, Dominique Orban wrote:
Thanks. I can see the logic behind the IPOPT example. I was interested in using the features the other way around. The model

<a href="https://github.com/JuliaSmoothOptimizers/OptimizationProblems.jl/blob/master/src/penalty2.jl" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaSmoothOptimizers%2FOptimizationProblems.jl%2Fblob%2Fmaster%2Fsrc%2Fpenalty2.jl\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGX1wFnvzMjz0mkK0_8wtyQzzgnbA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaSmoothOptimizers%2FOptimizationProblems.jl%2Fblob%2Fmaster%2Fsrc%2Fpenalty2.jl\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGX1wFnvzMjz0mkK0_8wtyQzzgnbA&#39;;return true;">https://github.com/JuliaSmoothOptimizers/OptimizationProblems.jl/blob/master/src/penalty2.jl

takes ages to "build" for large values of n (e.g., n=5000) if :Hess is in requested_features, but goes pretty fast if I only request :HessVec. I now realize that was not the intended purpose of the features?! If not, is there any interest in supporting such usage? It seems quite crucial to very large scale models that can't realistically be solved by factorization-based methods.

On Saturday, October 22, 2016 at 8:37:33 PM UTC-4, Miles Lubin wrote:
It's not a bug if a feature is available even when you don't ask for it, it's just behavior that you shouldn't rely on. features_available is meant to be called before initialize to find out which features you're allowed to request. See the example in Ipopt: <a href="https://github.com/JuliaOpt/Ipopt.jl/blob/41b1e7010a2ed92e1f21cec7df6195b581d5707a/src/IpoptSolverInterface.jl#L38" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaOpt%2FIpopt.jl%2Fblob%2F41b1e7010a2ed92e1f21cec7df6195b581d5707a%2Fsrc%2FIpoptSolverInterface.jl%23L38\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHc9ciO1phoX73IwFHLjoEBH4vQEA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaOpt%2FIpopt.jl%2Fblob%2F41b1e7010a2ed92e1f21cec7df6195b581d5707a%2Fsrc%2FIpoptSolverInterface.jl%23L38\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHc9ciO1phoX73IwFHLjoEBH4vQEA&#39;;return true;">https://github.com/JuliaOpt/Ipopt.jl/blob/41b1e7010a2ed92e1f21cec7df6195b581d5707a/src/IpoptSolverInterface.jl#L38.

On Saturday, October 22, 2016 at 7:30:21 PM UTC-4, Dominique Orban wrote:
Hi,

Something's not clear to me about the features you can request from a JuMP model (:Grad, :Jac, etc.). I'm looking at the example at

<a href="http://www.juliaopt.org/JuMP.jl/0.14/nlp.html#querying-derivatives-from-a-jump-model" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.juliaopt.org%2FJuMP.jl%2F0.14%2Fnlp.html%23querying-derivatives-from-a-jump-model\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFM6bgCMYNjTL8bhOQJHWloqgN6-g&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.juliaopt.org%2FJuMP.jl%2F0.14%2Fnlp.html%23querying-derivatives-from-a-jump-model\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFM6bgCMYNjTL8bhOQJHWloqgN6-g&#39;;return true;">http://www.juliaopt.org/JuMP.jl/0.14/nlp.html#querying-derivatives-from-a-jump-model

where only :Grad is requested. My understanding is that that means other features are simply not available, e.g., evaluating the Jacobian or Hessian. That seems to be correct regarding the Hessian:

julia> MathProgBase.hesslag_structure(d)
ERROR
: Hessian computations were not requested on the call to MathProgBase.initialize.
 
in hesslag_structure(::JuMP.NLPEvaluator) at /Users/dpo/.julia/v0.5/JuMP/src/nlp.jl:977


but JuMP seems happy trying to set up the Jacobian structure:

julia> MathProgBase.jac_structure(d)
 
(Int64[],Int64[])

(the problem I link to above doesn't have constraints but the same happens with a constrained problem). In fact:

 julia> MathProgBase.features_available(d)
5-element Array{Symbol,1}:
 
:Grad    
 
:Jac      
 
:ExprGraph
 
:Hess    
 
:HessVec


What am I missing?

Thanks!

--
You received this message because you are subscribed to the Google Groups "julia-opt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question about requested features in a JuMP model

Dominique Orban
In fact I don't need the Hessian, only Hessian-vector products. So I'm happy if the Hessian coloring is skipped if I leave :Hess out of the requested features. Thanks.

On Saturday, October 22, 2016 at 9:34:29 PM UTC-4, Miles Lubin wrote:
You can certainly avoid asking for Hess if you know that it's slow for a particular model. It looks like that model has a fully dense hessian, which JuMP hasn't been optimized for (we could skip the coloring step). (As an experiment you might try computing the full hessian by doing the n HessVec products.) We've had some discussions about being able to estimate the time it might take to compute a hessian with different methods, but at the moment there's no way for you to query a JuMP model to ask how expensive the hessian might be.

On Saturday, October 22, 2016 at 9:08:28 PM UTC-4, Dominique Orban wrote:
Thanks. I can see the logic behind the IPOPT example. I was interested in using the features the other way around. The model

<a href="https://github.com/JuliaSmoothOptimizers/OptimizationProblems.jl/blob/master/src/penalty2.jl" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaSmoothOptimizers%2FOptimizationProblems.jl%2Fblob%2Fmaster%2Fsrc%2Fpenalty2.jl\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGX1wFnvzMjz0mkK0_8wtyQzzgnbA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaSmoothOptimizers%2FOptimizationProblems.jl%2Fblob%2Fmaster%2Fsrc%2Fpenalty2.jl\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGX1wFnvzMjz0mkK0_8wtyQzzgnbA&#39;;return true;">https://github.com/JuliaSmoothOptimizers/OptimizationProblems.jl/blob/master/src/penalty2.jl

takes ages to "build" for large values of n (e.g., n=5000) if :Hess is in requested_features, but goes pretty fast if I only request :HessVec. I now realize that was not the intended purpose of the features?! If not, is there any interest in supporting such usage? It seems quite crucial to very large scale models that can't realistically be solved by factorization-based methods.

On Saturday, October 22, 2016 at 8:37:33 PM UTC-4, Miles Lubin wrote:
It's not a bug if a feature is available even when you don't ask for it, it's just behavior that you shouldn't rely on. features_available is meant to be called before initialize to find out which features you're allowed to request. See the example in Ipopt: <a href="https://github.com/JuliaOpt/Ipopt.jl/blob/41b1e7010a2ed92e1f21cec7df6195b581d5707a/src/IpoptSolverInterface.jl#L38" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaOpt%2FIpopt.jl%2Fblob%2F41b1e7010a2ed92e1f21cec7df6195b581d5707a%2Fsrc%2FIpoptSolverInterface.jl%23L38\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHc9ciO1phoX73IwFHLjoEBH4vQEA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2FJuliaOpt%2FIpopt.jl%2Fblob%2F41b1e7010a2ed92e1f21cec7df6195b581d5707a%2Fsrc%2FIpoptSolverInterface.jl%23L38\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHc9ciO1phoX73IwFHLjoEBH4vQEA&#39;;return true;">https://github.com/JuliaOpt/Ipopt.jl/blob/41b1e7010a2ed92e1f21cec7df6195b581d5707a/src/IpoptSolverInterface.jl#L38.

On Saturday, October 22, 2016 at 7:30:21 PM UTC-4, Dominique Orban wrote:
Hi,

Something's not clear to me about the features you can request from a JuMP model (:Grad, :Jac, etc.). I'm looking at the example at

<a href="http://www.juliaopt.org/JuMP.jl/0.14/nlp.html#querying-derivatives-from-a-jump-model" rel="nofollow" target="_blank" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.juliaopt.org%2FJuMP.jl%2F0.14%2Fnlp.html%23querying-derivatives-from-a-jump-model\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFM6bgCMYNjTL8bhOQJHWloqgN6-g&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.juliaopt.org%2FJuMP.jl%2F0.14%2Fnlp.html%23querying-derivatives-from-a-jump-model\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFM6bgCMYNjTL8bhOQJHWloqgN6-g&#39;;return true;">http://www.juliaopt.org/JuMP.jl/0.14/nlp.html#querying-derivatives-from-a-jump-model

where only :Grad is requested. My understanding is that that means other features are simply not available, e.g., evaluating the Jacobian or Hessian. That seems to be correct regarding the Hessian:

julia> MathProgBase.hesslag_structure(d)
ERROR
: Hessian computations were not requested on the call to MathProgBase.initialize.
 
in hesslag_structure(::JuMP.NLPEvaluator) at /Users/dpo/.julia/v0.5/JuMP/src/nlp.jl:977


but JuMP seems happy trying to set up the Jacobian structure:

julia> MathProgBase.jac_structure(d)
 
(Int64[],Int64[])

(the problem I link to above doesn't have constraints but the same happens with a constrained problem). In fact:

 julia> MathProgBase.features_available(d)
5-element Array{Symbol,1}:
 
:Grad    
 
:Jac      
 
:ExprGraph
 
:Hess    
 
:HessVec


What am I missing?

Thanks!

--
You received this message because you are subscribed to the Google Groups "julia-opt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Question about requested features in a JuMP model

Miles Lubin
So I'm happy if the Hessian coloring is skipped if I leave :Hess out of the requested features.

You may assume that is the case.

--
You received this message because you are subscribed to the Google Groups "julia-opt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
Visit this group at https://groups.google.com/group/julia-opt.
For more options, visit https://groups.google.com/d/optout.
Loading...