Quadratic Constraints

Basic definition

The FORCES syntax for defining quadratic constraints is very similar to that of CPLEXQCP. The code

stages(i).ineq.Q = {Q};
stages(i).ineq.l = {l};
stages(i).ineq.r = r;
stages(i).ineq.idx = {I};

defines the quadratic constraint

z_i^T\left(\mathcal{I}\right) Q_{i,j} z_i\left(\mathcal{I}\right) + l_{i,j}^T z_i\left(\mathcal{I}\right) \leq r_{i,j}

where $\mathcal{I}\subset \mathcal{N}$ is an index set, $z_i$ denotes stage variable $i$, $Q_{i,j}\in\mathbb{R}^{|\mathcal{I}|\times|\mathcal{I}|},\ Q\succ 0$ is the Hessian of the quadratic function, $l_{i,j}\in\mathbb{R}^{|\mathcal{I}|}$ is a column vector defining the linear part, and $r_{i,j}$ is a scalar defining the RHS of quadratic constraint $j$ on stage variable $i$.

Multiple quadratic constraints

Note that ineq.q.Q, ineq.q.l and ineq.q.idx have to be defined as cell arrays, which then allows you to define multiple quadratic constraints on the same stage variable $z_i$, but with different dimensions. This is different to the CPLEXQCP interface, where all matrices have to be the dimension of the optimization vector; FORCES supports the selection of certain variables within the stage variable that are quadratically constrained. This speeds up computations a lot if only a few variables are quadratically constrained.


To express the two quadratic constraints

z_{3,3}^2 + 2z_{3,5}^2 - z_{3,5} &\leq 3 \\
5z_{3,1}^2  & \leq 1

on the third stage variable, we first define the index sets of the participating variables:

stages(3).ineq.q.idx = {[3 5], [1]};

The Hessians are given by

stages(3).ineq.q.Q = {[1 0; 0 2], [5]};
stages(3).ineq.q.l = {[0; -1], [0]};

and the right hand sides of the quadratic constraints are collected in a column vector

stages(3).ineq.q.r = [3; 1];