# Active set and list of (NL) constraints in JuMP

**URL:** https://discourse.julialang.org/t/active-set-and-list-of-nl-constraints-in-jump/18186
**Category:** Optimization (Mathematical)
**Tags:** question
**Created:** [November 30, 2018, 3:50pm UTC](https://discourse.julialang.org/t/active-set-and-list-of-nl-constraints-in-jump/18186 "2018-11-30T15:50:38Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jacob-roth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jacob-roth/32/1862_2.png) [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)
#### Post date: [November 30, 2018, 3:50pm UTC](https://discourse.julialang.org/t/active-set-and-list-of-nl-constraints-in-jump/18186/1 "2018-11-30T15:50:38Z")

</div>

Is there a convenient way to access all of the constraints (including `@NLconstraint`) in a JuMP (v0.18.4) model? I’ve tried accessing `model.linconstr` etc, but it doesn’t give the nonlinear constraints. I’d also like to get the list of dual variables for every constraint and have just been using `getdual(model[:constraint_name])`, but this depends on having the name of the constraints, and I’m wondering if there’s an easier way of doing this. Do I have to convert the NL model to another form? Thanks!

---

<div class="post-metadata">

### Author: ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)
#### Post date: [November 30, 2018, 4:10pm UTC](https://discourse.julialang.org/t/active-set-and-list-of-nl-constraints-in-jump/18186/2 "2018-11-30T16:10:22Z")

</div>

Here is where `getdual` is defined for non-linear constraints:  
[https://github.com/JuliaOpt/JuMP.jl/blob/2cab520104c8742a30b99a48075d2d636d6acd64/src/nlp.jl#L55-L64](https://github.com/JuliaOpt/JuMP.jl/blob/2cab520104c8742a30b99a48075d2d636d6acd64/src/nlp.jl#L55-L64)  
You _could_ access `.nlconstrDuals`, but this is pretty fragile so we wouldn’t recommend it.

The proper way to do this would be either to access the constraints from the model dictionary like you’re doing, or to maintain your own datastructure that stores all of the constraint references.
