A "quadratic constraint" is a constraint of the form $f(x) \leq 0$, where $f(x)$ is a quadratic function, i.e., as you wrote,
$$
f(x) = \frac{1}{2}x^{T}Hx + q^{T}x + b
$$
for some square matrix $H \in \mathbb{R}^{n \times n}$, vector $q \in \mathbb{R}^{n}$, and some scalar $b \in \mathbb{R}$.
In JuMP, you can declare such quadratic constraints with the @constraint
syntax directly. The @NLconstraint
macro is designed for more general nonlinear that require special handling of function evaluation and derivatives. For instance, if your constraints have high-order polynomial functions ($x^{3}$ and above), or terms like sin
, cos
, log
or exp
, you should use @NLconstraint
.
You can have a look at the quadratic portfolio optimization and quadratically constrained programming examples from the JuMP documentation.
PS: there is more JuMP-centric traffic on the Julia Discourse forum. You are more likely to get expert feedback there, especially on code-related questions.
1/2 x * H * x
is just a fancy way to write $\sum_{j_1} \sum_{j_2} h_{j_1,j_2} x_{j_1} x_{j_2}$ $\endgroup$