# How to get the fractional solution of a node in a MIP model using JuMP package?

I'm coding in Julia and use the JuMP package. My IP solver stops by a fixed node limitation. I noticed that I can only get the feasible primal and dual solution if has any, however I would like to get the fractional solution who gives the best lower bound so far. Is there a way to get the fractional solution (and objective value) of a node in a b&c tree ?

In general, JuMP does not support querying the best fractional solution of a branch and bound tree.

However, if you are using CPLEX or Gurobi, you can write a solver-specific callback to do what you want.

Since you tagged CPLEX, use something like this:

using JuMP, CPLEX
model = direct_model(CPLEX.Optimizer())
# This is very, very important!!! Only use callbacks in single-threaded mode.
@variable(model, x[1:100], Bin)
@constraint(model, rand(100)' * x <= 10)
@objective(model, Max, rand(100)' * x)
best_value, best_solution = Inf, fill(NaN, num_variables(model))
function my_callback_function(cb_data, context_id)
if callback_node_status(cb_data, model) == MOI.CALLBACK_NODE_STATUS_FRACTIONAL
valueP = Ref{Cdouble}()
CPXcallbackgetrelaxationpoint(cb_data, C_NULL, 0, -1, valueP)
if valueP[] < best_value
global best_value = valueP[]