Question about JuMP?

What’s wrong with this problem?

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 >.
 [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

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

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

The instructions are perhaps not quite specific enough in this matter

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

    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.

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

I also tried

julia> @variable(model, x)

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

Does that link help: How can I make strict constraint in the Julia JuMP software? - Stack Overflow ?

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).