# How to create a JuMP constraint with coeffs and rhs?

**URL:** <https://discourse.julialang.org/t/how-to-create-a-jump-constraint-with-coeffs-and-rhs/2328>\
**Category:** Optimization (Mathematical)\
**Created:** [February 27, 2017, 1:57am UTC](https://discourse.julialang.org/t/how-to-create-a-jump-constraint-with-coeffs-and-rhs/2328 "2017-02-27T01:57:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbrunaud](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bbrunaud/32/1737_2.png) [@bbrunaud](https://discourse.julialang.org/u/bbrunaud)\
**Post date:** [February 27, 2017, 1:57am UTC](https://discourse.julialang.org/t/how-to-create-a-jump-constraint-with-coeffs-and-rhs/2328/1 "2017-02-27T01:57:22Z")

</div>

Hello.

I’m trying to run an algorithm generating Gomory cuts. I managed to get the right tableau row. Now I would like to add the cut to the JuMP model having a vector of indices, coeffs, sense and rhs. So far I could only do it using the MathProgBase addconstr!

Thanks

Braulio

---

<div class="post-metadata">

**Author:** ![miles.lubin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/miles.lubin/32/279_2.png) [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Post date:** [February 27, 2017, 12:36pm UTC](https://discourse.julialang.org/t/how-to-create-a-jump-constraint-with-coeffs-and-rhs/2328/2 "2017-02-27T12:36:59Z")

</div>

You can convert indices into JuMP variables by using the `Variable(m::Model,idx::Int)` constructor.

---

<div class="post-metadata">

**Author:** ![bbrunaud](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bbrunaud/32/1737_2.png) [@bbrunaud](https://discourse.julialang.org/u/bbrunaud)\
**Post date:** [March 1, 2017, 6:12am UTC](https://discourse.julialang.org/t/how-to-create-a-jump-constraint-with-coeffs-and-rhs/2328/3 "2017-03-01T06:12:20Z")

</div>

Thanks!. That worked!
