# Fixing vs Constraining a variable in JuMP

**URL:** https://discourse.julialang.org/t/fixing-vs-constraining-a-variable-in-jump/27609
**Category:** Optimization (Mathematical)
**Tags:** jump
**Created:** [August 16, 2019, 10:35am UTC](https://discourse.julialang.org/t/fixing-vs-constraining-a-variable-in-jump/27609 "2019-08-16T10:35:23Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [August 16, 2019, 1:24pm UTC](https://discourse.julialang.org/t/fixing-vs-constraining-a-variable-in-jump/27609/2 "2019-08-16T13:24:48Z")

</div>

`fix(x, value)` sets the lower and upper variable bounds of `x` to `value`.

`@constraint(model, x == value)` adds a new linear constraint where the left-hand side is the function `1.0 * x + 0` and the right-hand side is `value`.

In general, it’s better to use `fix`, since it’s one less constraint to deal with and solvers can efficiently use variable bounds.

It’s unusual that Ipopt struggles, but it’s hard to say why without a minimum working example.

What value is `tatm₀`?

---

_[View the full topic](https://discourse.julialang.org/t/fixing-vs-constraining-a-variable-in-jump/27609)._
