# Question about JuMP?

**URL:** <https://discourse.julialang.org/t/question-about-jump/82432>\
**Category:** Optimization (Mathematical)\
**Tags:** jump\
**Created:** [June 8, 2022, 1:26pm UTC](https://discourse.julialang.org/t/question-about-jump/82432 "2022-06-08T13:26:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raymond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raymond/32/36557_2.png) [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Post date:** [June 8, 2022, 1:26pm UTC](https://discourse.julialang.org/t/question-about-jump/82432/1 "2022-06-08T13:26:13Z")

</div>

What’s wrong with this problem?

```julia
julia> using JuMP 
julia> using Ipopt

julia> model = Model(Ipopt.Optimizer)
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: Ipopt

julia> @variable(model, x > 0)
ERROR: LoadError: At REPL[4]:1: `@variable(model, x > 0)`: Unknown sense >.
Stacktrace:
 [1] error(::String, ::String)
   @ Base ./error.jl:42
 [2] _macro_error(macroname::Symbol, args::Tuple{Symbol, Expr}, source::LineNumberNode, str::String)
   @ JuMP ~/.julia/packages/JuMP/Psd1J/src/macros.jl:1589
 [3] (::JuMP.var"#_error#104"{LineNumberNode})(str::String)
   @ JuMP ~/.julia/packages/JuMP/Psd1J/src/macros.jl:1905
 [4] parse_one_operator_variable(_error::JuMP.var"#_error#104"{LineNumberNode}, infoexpr::JuMP._VariableInfoExpr, #unused#::Val{:>}, value::Int64)
   @ JuMP ~/.julia/packages/JuMP/Psd1J/src/macros.jl:1683
 [5] parse_variable(_error::Function, infoexpr::JuMP._VariableInfoExpr, sense::Symbol, var::Symbol, value::Int64)
   @ JuMP ~/.julia/packages/JuMP/Psd1J/src/macros.jl:1700
 [6] var"@variable"( __source__ ::LineNumberNode, __module__ ::Module, args::Vararg{Any})
   @ JuMP ~/.julia/packages/JuMP/Psd1J/src/macros.jl:1972
in expression starting at REPL[4]:1

```

---

<div class="post-metadata">

**Author:** ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)\
**Post date:** [June 8, 2022, 1:38pm UTC](https://discourse.julialang.org/t/question-about-jump/82432/2 "2022-06-08T13:38:44Z")

</div>

Your constraint is not valid as it has no specific bound, try this

```julia
julia> @variable(model, x >= 1)
x

```

The instructions are perhaps not quite specific enough in this matter

[https://jump.dev/JuMP.jl/stable/reference/variables/](https://jump.dev/JuMP.jl/stable/reference/variables/)

```julia
In addition, the expression can have bounds, such as:

    @variable(model, x >= 0)
    @variable(model, x <= 0)
    @variable(model, x == 0)
    @variable(model, 0 <= x <= 1)

```

It is perhaps easier to understand if one considers the alternative way using keyword arguments

```julia
    lower_bound::Float64: an alternative to x >= lb, sets the value of the variable lower bound.
    upper_bound::Float64: an alternative to x <= ub, sets the value of the variable upper bound.

```

---

<div class="post-metadata">

**Author:** ![Raymond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raymond/32/36557_2.png) [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Post date:** [June 8, 2022, 2:17pm UTC](https://discourse.julialang.org/t/question-about-jump/82432/3 "2022-06-08T14:17:24Z")

</div>

So if I only want x\>0, not x \>= 0, how to write the code?

---

<div class="post-metadata">

**Author:** ![Raymond](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raymond/32/36557_2.png) [@Raymond](https://discourse.julialang.org/u/Raymond)\
**Post date:** [June 8, 2022, 2:21pm UTC](https://discourse.julialang.org/t/question-about-jump/82432/4 "2022-06-08T14:21:52Z")

</div>

I also tried

```julia
julia> @variable(model, x)
x

julia> @constraint(model, x > 0)
ERROR: LoadError: At REPL[7]:1: `@constraint(model, x > 0)`: Unrecognized sense >

```

---

<div class="post-metadata">

**Author:** ![blob](https://avatars.discourse-cdn.com/v4/letter/b/ebca7d/32.png) [@blob](https://discourse.julialang.org/u/blob)\
**Post date:** [June 8, 2022, 2:32pm UTC](https://discourse.julialang.org/t/question-about-jump/82432/5 "2022-06-08T14:32:37Z")

</div>

Does that link help: [How can I make strict constraint in the Julia JuMP software? - Stack Overflow](https://stackoverflow.com/questions/48743136/how-can-i-make-strict-constraint-in-the-julia-jump-software) ?

---

<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:** [June 8, 2022, 2:46pm UTC](https://discourse.julialang.org/t/question-about-jump/82432/6 "2022-06-08T14:46:29Z")

</div>

This is not a JuMP issue, this is a solver issue, solvers often do not accept strict inequality because it does not make sense in context. Solvers often work with 64 bits floating-point numbers. In this representation, the difference between `x` and the first value smaller than `x` is so small that it will basically always be inside your tolerances. You can set your tolerance to zero, but this probably will not do what you want (correct solutions may be disregarded because it is impossible for the solver to reach them without getting the value slightly off).
