# How to declare a binary variable in a robust model?

**URL:** https://discourse.julialang.org/t/how-to-declare-a-binary-variable-in-a-robust-model/48367
**Category:** Optimization (Mathematical)
**Tags:** package
**Created:** [October 14, 2020, 2:23pm UTC](https://discourse.julialang.org/t/how-to-declare-a-binary-variable-in-a-robust-model/48367 "2020-10-14T14:23:02Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![RaquelSantos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raquelsantos/32/3668_2.png) [@RaquelSantos](https://discourse.julialang.org/u/RaquelSantos)
#### Post date: [October 14, 2020, 2:23pm UTC](https://discourse.julialang.org/t/how-to-declare-a-binary-variable-in-a-robust-model/48367/1 "2020-10-14T14:23:02Z")

</div>

Why is it that whenever I try to compile a binary variable, Julia returns this error to me?

```julia
 In @variable(ModeloD,b[A],lower_bound = 0,Bin): Unrecognized keyword argument lower_bound

```

Is there a different way of putting the major and minor signs in binary variables in a robust model?

I’ve tried to use all of these and the error continues: `<=,> =,. <=,.> =, Lower_bound = 0, upper bound = 0`

```julia
using JuMP, JuMPeR, GLPKMathProgInterface
ModeloD = RobustModel(solver = GLPKSolverLP())
a = 1:4
A = a
@variable(ModeloD,b[A], lower_bound=0, Bin)

```

---

<div class="post-metadata">

### Author: ![haberdashPI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haberdashpi/32/26337_2.png) [@haberdashPI](https://discourse.julialang.org/u/haberdashPI)
#### Post date: [October 14, 2020, 3:04pm UTC](https://discourse.julialang.org/t/how-to-declare-a-binary-variable-in-a-robust-model/48367/2 "2020-10-14T15:04:10Z")

</div>

I believe that you should just remove the `lower_bound=0` argument. There are only two values, so a lower bound does not make any sense. [The documentation](https://jump.dev/JuMP.jl/v0.21.5/variables) makes no mention of allowing lower bounds for binary values.

---

<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: [October 14, 2020, 8:35pm UTC](https://discourse.julialang.org/t/how-to-declare-a-binary-variable-in-a-robust-model/48367/3 "2020-10-14T20:35:36Z")

</div>

A binary variable has implicit bounds of `[0, 1]`.

However, for future reference, the syntax is

```nohighlight
model = Model()
@variable(model, x, Bin, lower_bound = 0)
# or
@variable(model, y >= 0, Bin)

```

The difference is that @RaquelSantos is using the old version of JuMP, where the syntax is just `@variable(model, y >= 0, Bin)`.

```nohighlight
julia> using JuMP, JuMPeR

julia> model = RobustModel();
julia> @variable(model, x >= 0, Bin)
x

julia> A = 1:4
1:4

julia> @variable(model, y[A], Bin, lowerbound=0)
y[i] ∈ {0,1} ∀ i ∈ {1,2,3,4}

```
