# 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

where is an index set, denotes stage variable , is the Hessian of the quadratic function, is a column vector defining the linear part, and is a scalar defining the RHS of quadratic constraint on stage variable .

## 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 , 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.

## Example

To express the two quadratic constraints

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];