# How to define a single anonymous binary variable in JuMP 0.19

**URL:** <https://discourse.julialang.org/t/how-to-define-a-single-anonymous-binary-variable-in-jump-0-19/22966>\
**Category:** Optimization (Mathematical)\
**Created:** [April 9, 2019, 4:18pm UTC](https://discourse.julialang.org/t/how-to-define-a-single-anonymous-binary-variable-in-jump-0-19/22966 "2019-04-09T16:18:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daschw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daschw/32/2926_2.png) [@daschw](https://discourse.julialang.org/u/daschw)\
**Post date:** [April 9, 2019, 4:18pm UTC](https://discourse.julialang.org/t/how-to-define-a-single-anonymous-binary-variable-in-jump-0-19/22966/1 "2019-04-09T16:18:46Z")

</div>

Until JuMP 0.18 I was able to do

```julia
using JuMP
m = Model()
x = @variable(m, category = :Bin)

```

With 0.19 I get:

```julia
julia> using JuMP

julia> m = Model()
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.

julia> x = @variable(m, Bin)
ERROR: LoadError: In `@variable(m, Bin)`: Ambiguous variable name Bin detected. Use the "category" keyword argument to specify a category for an anonymous variable.
Stacktrace:
 [1] error(::String, ::String) at .\error.jl:42
 [2] _macro_error(::Symbol, ::Tuple{Symbol,Symbol}, ::String) at C:\Users\Daniel\.julia\packages\JuMP\jnmGG\src\macros.jl:1086
 [3] (::getfield(JuMP, Symbol("#_error#66")){Tuple{Symbol,Symbol}})(::String) at C:\Users\Daniel\.julia\packages\JuMP\jnmGG\src\macros.jl:1322
 [4] @variable(::LineNumberNode, ::Module, ::Vararg{Any,N} where N) at C:\Users\Daniel\.julia\packages\JuMP\jnmGG\src\macros.jl:1336
in expression starting at REPL[10]:1

julia> x = @variable(m, category = Bin)
ERROR: UndefVarError: Bin not defined
Stacktrace:
 [1] top-level scope at C:\Users\Daniel\.julia\packages\JuMP\jnmGG\src\macros.jl:300

julia> x = @variable(m, category = :Bin)
ERROR: In `@variable(m, category = :Bin)`: Unrecognized keyword argument category
Stacktrace:
 [1] error(::String, ::String) at .\error.jl:42
 [2] _macro_error(::Symbol, ::Tuple{Symbol,Expr}, ::String) at C:\Users\Daniel\.julia\packages\JuMP\jnmGG\src\macros.jl:1086
 [3] (::getfield(JuMP, Symbol("#_error#66")){Tuple{Symbol,Expr}})(::String) at C:\Users\Daniel\.julia\packages\JuMP\jnmGG\src\macros.jl:1322
 [4] #build_variable#58(::Base.Iterators.Pairs{Symbol,Symbol,Tuple{Symbol},NamedTuple{(:category,),Tuple{Symbol}}}, ::Function, ::getfield(JuMP, Symbol("#_error#66")){Tuple{Symbol,Expr}}, ::VariableInfo{Float64,Float64,Float64,Float64}) at C:\Users\Daniel\.julia\packages\JuMP\jnmGG\src\macros.jl:1080
 [5] (::getfield(JuMP, Symbol("#kw##build_variable")))(::NamedTuple{(:category,),Tuple{Symbol}}, ::typeof(build_variable), ::Function, ::VariableInfo{Float64,Float64,Float64,Float64}) at .\none:0
 [6] top-level scope at C:\Users\Daniel\.julia\packages\JuMP\jnmGG\src\macros.jl:300

```

---

<div class="post-metadata">

**Author:** ![ndinsmore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ndinsmore/32/7433_2.png) [@ndinsmore](https://discourse.julialang.org/u/ndinsmore)\
**Post date:** [April 9, 2019, 5:33pm UTC](https://discourse.julialang.org/t/how-to-define-a-single-anonymous-binary-variable-in-jump-0-19/22966/2 "2019-04-09T17:33:15Z")

</div>

`x=@variable(m,binary=true)`

---

<div class="post-metadata">

**Author:** ![daschw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/daschw/32/2926_2.png) [@daschw](https://discourse.julialang.org/u/daschw)\
**Post date:** [April 9, 2019, 6:40pm UTC](https://discourse.julialang.org/t/how-to-define-a-single-anonymous-binary-variable-in-jump-0-19/22966/3 "2019-04-09T18:40:00Z")

</div>

Thanks!
