Nonlinear callback cplex

Dear all,

I would like to implement non linear lazy constraint for a cplex model. For instance I would like to implement the following code:

using CPLEX, JuMP
model = Model(CPLEX.Optimizer)
@variable(model, x <= 10, Int)
@objective(model, Max, x)
function my_callback_function(cb_data)
    x_val = callback_value(cb_data, x)
    if x_val > 2 + 1e-6
        con = @build_constraint(x^2 <= 2)
        MOI.submit(model, MOI.LazyConstraint(cb_data), con)
MOI.set(model, MOI.LazyConstraintCallback(), my_callback_function)

But @build_constraint(x^2 <= 2) returns me the following error:

ArgumentError: Submitting (MathOptInterface.ScalarQuadraticFunction{Float64}, MathOptInterface.LessThan{Float64}) for MathOptInterface.LazyConstraint{CPLEX.CallbackContext} is not valid.

Thanks, Luca

CPLEX does not support quadratic lazy constraints, only linear.

1 Like