When I try to create the constraint, I get following error: MOI.ScalarQuadraticFunction{Float64}-in-MOI.EqualTo{Float64} constraints are not supported and cannot be bridged into supported constrained variables and constraints.
Welcome!
Your constraint is non-linear. Have you tried the macro @NLconstraint instead of @constraint?
The section about non-linear modelling in the JuMP documentation is here. Let me remark my comment is just a guess, because I have never used JuMP for non-linear models.
Thank you, with @NLconstraint it creates the constraint.
The optimization does not work because it is a linear solver (I guess from new error I got), but if I use a non linear solver it works. Thank you
Your problem is that Cbc does not support quadratic constraints.
Since your problem is a non-convex quadratic constraint, your options are Gurobi.jl or Ipopt.jl. In both cases the syntax you have is correct. No need for @NLconstraint.