# Linear parameter

**URL:** <https://discourse.julialang.org/t/linear-parameter/2112>\
**Category:** Optimization (Mathematical)\
**Created:** [February 15, 2017, 4:42am UTC](https://discourse.julialang.org/t/linear-parameter/2112 "2017-02-15T04:42:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yankai\_Cao](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yankai\_Cao](https://discourse.julialang.org/u/Yankai_Cao)\
**Post date:** [February 15, 2017, 4:42am UTC](https://discourse.julialang.org/t/linear-parameter/2112/1 "2017-02-15T04:42:26Z")

</div>

I want to define a parameter so that the model will change if I set a different value for the parameter. The following is an example, while the real problem is much more complicated.

using JuMP  
model = Model()  
@variable(model, x1 \>= 0)  
@variable(model, x2 \>= 0)  
@constraint(model, a\*x + y\>= 1.33)  
@constraint(model, x + y \<= a )

I want to solve a bunch of problems for different values of a. I don’t like to declare a as fixed variable because it will treat this LP as NLP.

Thanks.

---

<div class="post-metadata">

**Author:** ![NickNack](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nicknack/32/1792_2.png) [@NickNack](https://discourse.julialang.org/u/NickNack)\
**Post date:** [February 15, 2017, 11:37am UTC](https://discourse.julialang.org/t/linear-parameter/2112/2 "2017-02-15T11:37:05Z")

</div>

Just define `a` as an ordinary Julia (non-JuMP) variable, i.e. don’t declare it with `@variable`:

```julia
using JuMP
a = 2.0
model = Model()
@variable(model, x >= 0)
@variable(model, y >= 0)
@constraint(model, a*x + y>= 1.33)
@constraint(model, x + y <= a )

```

EDIT: Remember that JuMP is just an extension to the Julia programming language. If you plan to build models in JuMP it’s worth spending an hour or two going through [some basic Julia tutorials](http://julialang.org/learning/).

---

<div class="post-metadata">

**Author:** ![FransdR](https://avatars.discourse-cdn.com/v4/letter/f/d2c977/32.png) [@FransdR](https://discourse.julialang.org/u/FransdR)\
**Post date:** [February 15, 2017, 1:49pm UTC](https://discourse.julialang.org/t/linear-parameter/2112/3 "2017-02-15T13:49:49Z")

</div>

Modifying constraint coefficients is currently not supported [as written here](http://jump.readthedocs.io/en/latest/probmod.html#modifying-constraints). You have to rebuild the model every time you change the parameter a.
