# How to change all desion variables from binary to non-negative and vice versa?

**URL:** <https://discourse.julialang.org/t/how-to-change-all-desion-variables-from-binary-to-non-negative-and-vice-versa/97893>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [April 25, 2023, 12:12pm UTC](https://discourse.julialang.org/t/how-to-change-all-desion-variables-from-binary-to-non-negative-and-vice-versa/97893 "2023-04-25T12:12:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Optimization](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/optimization/32/32462_2.png) [@Optimization](https://discourse.julialang.org/u/Optimization)\
**Post date:** [April 25, 2023, 12:12pm UTC](https://discourse.julialang.org/t/how-to-change-all-desion-variables-from-binary-to-non-negative-and-vice-versa/97893/1 "2023-04-25T12:12:17Z")

</div>

Is it possible to define a model via cplex where all the variables are binary like `@variable(model, a, Bin)`, and run this model, then without any manual modification change all varaibles to nonnegative and run it again?

I have a long lits of variables, all binary, at some points I need to relax the binary assumption and run the relaxation but I don’t want to change the code line by line and run the relaxation then again change it binary and repeat the cycle. Is there any automatic command for that?

---

<div class="post-metadata">

**Author:** ![pulsipher](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pulsipher/32/10461_2.png) [@pulsipher](https://discourse.julialang.org/u/pulsipher)\
**Post date:** [April 25, 2023, 3:43pm UTC](https://discourse.julialang.org/t/how-to-change-all-desion-variables-from-binary-to-non-negative-and-vice-versa/97893/2 "2023-04-25T15:43:26Z")

</div>

This should do the trick: [Models · JuMP](https://jump.dev/JuMP.jl/stable/manual/models/#Relax-integrality)
