Hello all,

I am trying trying to solve the following MIP with the Xpress solver (and I’ve also tried it with the GLPK solver) with lazy constraint. Variables of interest are x and y (non-integer), integer variable z is only added in order to force the solver to solve a MIP, since, for what I understand, for LPs lazy constraints are ignored.

I have tried to solve it in a variety of different ways and formulations, but the solver seems to freeze (as it appears on its log file) when adding the lazy constraint. Does anyone know how this issue can be resolved?

Thank you in advance for the help,

using Pkg

Pkg.instantiate()

Pkg.activate(“.”)

Pkg.resolve()

using JuMP

using Xpress

using MathOptInterface

model = Model(()->Xpress.Optimizer(THREADS = 2))

variable(model, x >= 0)

variable(model, y >= 0)

variable(model, z >= 0, Int)

variable(model, FO >= 0)

constraint(model, FO == x + y )

constraint(model, x <= 1 )

constraint(model, y <= 1 )

objective(model, Max, FO)

function lazy_flow_constraints(cb_data)

x_val = callback_value(cb_data,x)

y_val = callback_value(cb_data,y)

if x_val + y_val > 1

con = build_constraint( (x + y)/sqrt(2) <= 1 )

MOI.submit(model, MOI.LazyConstraint(cb_data), con)

end

end

MOI.set(model, MOI.LazyConstraintCallback(), lazy_flow_constraints)

set_optimizer_attributes(model, “HEURSTRATEGY” => 0)

set_optimizer_attributes(model, “MIPDUALREDUCTIONS” => 0)

optimize!(model)

info(" Execution is " * string(termination_status(model)))

println(“x=”,JuMP.value(x))

println(“y=”,JuMP.value(y))