By “variable with Rational type”, do you mean “variable
x that should only take rational values” or “I want to pass data to the solver in
For the former, it is neither supported by JuMP nor by solvers in general.
The only exception are a handful of LP solvers, e.g., SoPlex (also see here) that can return exact solutions (using Rational arithmetic) to linear programming and quadratic programming problems. That functionality, however, is not available from Julia.
As @odow already hinted at, the only way to effectively enforce that a variable
x takes rational values is through the use of integer variables. Either declare
x as integer and divide it by a constant, or introduce two integer variables
p, q and add the (non-linear and non-convex) constraint
x = p / q.
For the latter, MathOptInterface.jl and Convex.jl both support arbitrary data types when building a model.