# Constrained Optimization and Constraints with more than one variable

**URL:** <https://discourse.julialang.org/t/constrained-optimization-and-constraints-with-more-than-one-variable/79482>\
**Category:** General Usage\
**Created:** [April 14, 2022, 10:49am UTC](https://discourse.julialang.org/t/constrained-optimization-and-constraints-with-more-than-one-variable/79482 "2022-04-14T10:49:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![IljaK91](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iljak91/32/44301_2.png) [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Post date:** [April 14, 2022, 10:49am UTC](https://discourse.julialang.org/t/constrained-optimization-and-constraints-with-more-than-one-variable/79482/1 "2022-04-14T10:49:51Z")

</div>

Hello everyone,

I want to use `Optim.jl` to solve a constrained optimization problem. As far as I understand, Optim.jl offers constraints of the form `(lower_bound_i <= x_i <= upper_bound_i)`. However, for my problem I need constraints that include multiple variables, for example: `(lower_bound <= x_1 + x_2 <= upper_bound)`. A classical example is budget constraints in economics/finance where multiple forms of expenditure need to satisfy a single total resource constraint. If that information helps, the problem is otherwise non-linear.

Grateful for any links and suggestions 🙂

Best regards,

Ilja

---

<div class="post-metadata">

**Author:** ![Gummala\_Navneeth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gummala_navneeth/32/35311_2.png) [@Gummala\_Navneeth](https://discourse.julialang.org/u/Gummala_Navneeth)\
**Post date:** [April 14, 2022, 11:27am UTC](https://discourse.julialang.org/t/constrained-optimization-and-constraints-with-more-than-one-variable/79482/2 "2022-04-14T11:27:59Z")

</div>

Have a look at this [Youtube video link – [Basic Optimization Usage (Julia) - YouTube](https://www.youtube.com/watch?v=qf6VwbMAEZY&t=584s)] (start time —\> 9:44 ). This might help you.

---

<div class="post-metadata">

**Author:** ![IljaK91](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iljak91/32/44301_2.png) [@IljaK91](https://discourse.julialang.org/u/IljaK91)\
**Post date:** [April 14, 2022, 12:27pm UTC](https://discourse.julialang.org/t/constrained-optimization-and-constraints-with-more-than-one-variable/79482/3 "2022-04-14T12:27:09Z")

</div>

Seems like your link is broken ☹

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [April 14, 2022, 12:58pm UTC](https://discourse.julialang.org/t/constrained-optimization-and-constraints-with-more-than-one-variable/79482/4 "2022-04-14T12:58:38Z")

</div>

I think you are looking for something more general than Optim.jl, typically [JuMP.jl](https://jump.dev/JuMP.jl/stable/) or [Convex.jl](https://jump.dev/Convex.jl/stable/) depending on the kind of problems you face

---

<div class="post-metadata">

**Author:** ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)\
**Post date:** [April 14, 2022, 1:00pm UTC](https://discourse.julialang.org/t/constrained-optimization-and-constraints-with-more-than-one-variable/79482/5 "2022-04-14T13:00:42Z")

</div>

Check [Survey of Non-Linear Optimization Modeling Layers in Julia](https://discourse.julialang.org/t/survey-of-non-linear-optimization-modeling-layers-in-julia/78168)
