# Changing the lower bound of a JuMp Model

**URL:** <https://discourse.julialang.org/t/changing-the-lower-bound-of-a-jump-model/32395>\
**Category:** General Usage\
**Created:** [December 17, 2019, 5:54pm UTC](https://discourse.julialang.org/t/changing-the-lower-bound-of-a-jump-model/32395 "2019-12-17T17:54:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marouane1994](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Post date:** [December 17, 2019, 5:54pm UTC](https://discourse.julialang.org/t/changing-the-lower-bound-of-a-jump-model/32395/1 "2019-12-17T17:54:54Z")

</div>

i want to change the lower bound of a model from a zero array to take the value of the elements of another array here’s the function that i’m having

```julia
using JuMP
using Clp
function scan_maker(A)
    m = JuMP.Model(solver=ClpSolver(PrimalTolerance=1e-3, DualTolerance=1e-3, InfeasibleReturn=1, PresolveType=1))
   
    level = size(A, 2)
    v = zeros(Int, level)
    ub = zeros(Int, level)
    lb = zeros(Int, level)

    @variable(m, x[1:level])
    @constraint(m, con, A*x.>=0)

    function setc(c)
        for i = 1:size(A, 1)
            m.linconstr[i].lb = float(c[i])
        end
    end
end

```

now this function looks totally fine but when i type and run line by line for example if `A=[1 2;1 1;2 2]`and `c=[1,2,1]` the lower bound will always stay the same `[0,0]` it’s close from something like this :

```julia
function low(c)
    for i=1:size(A,1)
        m.linconstr[i].lb = float(c[i])
        println(lb)
    end
    
end
low([1,2,3])

```

and the output is this:  
1.0  
1.0  
1.0  
which is not true in this case, it shoud be `1.0 , 2.0 , 3.0`  
I don’t know what to do

---

<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:** [December 17, 2019, 7:25pm UTC](https://discourse.julialang.org/t/changing-the-lower-bound-of-a-jump-model/32395/2 "2019-12-17T19:25:16Z")

</div>

Hi there. It looks like you’re using an old version of JuMP.

First, you should update to the most recent version: [Introduction · JuMP](https://www.juliaopt.org/JuMP.jl/v0.20.0/)

Then, you’re looking for the function `set_normalized_rhs`: [Constraints · JuMP](https://www.juliaopt.org/JuMP.jl/v0.20.0/constraints/#Modifying-a-constant-term-1)

The code you’re looking for is something like:

```nohighlight
using JuMP
using Clp
model = Model(with_optimizer(Clp.Optimizer))
@variable(model, x[1:2])
A = rand(2, 2)
@constraint(model, con, A * x .>= 0)
set_normalized_rhs.(con, [1, 2])

```

---

<div class="post-metadata">

**Author:** ![marouane1994](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Post date:** [December 18, 2019, 1:37pm UTC](https://discourse.julialang.org/t/changing-the-lower-bound-of-a-jump-model/32395/3 "2019-12-18T13:37:10Z")

</div>

but i guess Clp doesn’t support the last version of JuMP!!

---

<div class="post-metadata">

**Author:** ![marouane1994](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@marouane1994](https://discourse.julialang.org/u/marouane1994)\
**Post date:** [December 25, 2019, 10:25am UTC](https://discourse.julialang.org/t/changing-the-lower-bound-of-a-jump-model/32395/4 "2019-12-25T10:25:11Z")

</div>

what if i want to do it in `JuMP 0.19`

---

<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:** [December 26, 2019, 6:39pm UTC](https://discourse.julialang.org/t/changing-the-lower-bound-of-a-jump-model/32395/5 "2019-12-26T18:39:46Z")

</div>

> but i guess Clp doesn’t support the last version of JuMP!!

Clp does support the latest version of JuMP.

> what if i want to do it in `JuMP 0.19`

You should really update to JuMP 0.20.
