# Can JuMP.fix be use to fix Array{Float64,1} to Array{VariableRef,1}

**URL:** https://discourse.julialang.org/t/can-jump-fix-be-use-to-fix-array-float64-1-to-array-variableref-1/61640
**Category:** Optimization (Mathematical)
**Created:** [May 22, 2021, 2:47pm UTC](https://discourse.julialang.org/t/can-jump-fix-be-use-to-fix-array-float64-1-to-array-variableref-1/61640 "2021-05-22T14:47:07Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![BYS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bys/32/25384_2.png) [@BYS](https://discourse.julialang.org/u/BYS)
#### Post date: [May 22, 2021, 2:47pm UTC](https://discourse.julialang.org/t/can-jump-fix-be-use-to-fix-array-float64-1-to-array-variableref-1/61640/1 "2021-05-22T14:47:07Z")

</div>

Hi,  
I find if I write

```julia
model=Model();
ep=ones(20);
@variable(model,ep1[1:20]);
JuMP.fix(ep1,ep);

```

I find it cannot be deal with, and do the JuMP.fix need to fix one by one?  
and How can I do it?  
Thanks a lot.

---

<div class="post-metadata">

### Author: ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)
#### Post date: [May 22, 2021, 3:36pm UTC](https://discourse.julialang.org/t/can-jump-fix-be-use-to-fix-array-float64-1-to-array-variableref-1/61640/2 "2021-05-22T15:36:01Z")

</div>

Use the [broadcast notation](https://docs.julialang.org/en/v1/manual/arrays/#Broadcasting):

```julia
JuMP.fix.(ep1, ep);

```

---

<div class="post-metadata">

### Author: ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)
#### Post date: [May 22, 2021, 3:37pm UTC](https://discourse.julialang.org/t/can-jump-fix-be-use-to-fix-array-float64-1-to-array-variableref-1/61640/3 "2021-05-22T15:37:05Z")

</div>

Also, you do not need those semicolons and the default style is to omit them.

---

<div class="post-metadata">

### Author: ![BYS](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bys/32/25384_2.png) [@BYS](https://discourse.julialang.org/u/BYS)
#### Post date: [May 23, 2021, 1:27am UTC](https://discourse.julialang.org/t/can-jump-fix-be-use-to-fix-array-float64-1-to-array-variableref-1/61640/4 "2021-05-23T01:27:12Z")

</div>

Thanks a lot!
