# Implementation of conic quadratic inequality in Matlab

Dear Forum Members,

I am working on robust linear optimization. I use ellipsoid uncertainty. Vector x is the variable. Therefore original linear constraint a_{0}^{T}x<=b becomes a conic quadratic inequality in robust version:

[a_{0}^{T}x+ \omega \sqrt{\sum_{l=1}^{L} ([a^{l}]^{T}x)^{2}} \leq b_{0}.

According to Robust Optimization book by Ben tal et. al, this is convex. My problem is I am having problem with implementing this in Matlab.

Disciplined convex programming error:
** Illegal operation: sqrt( {convex} ).**

This is my code.

omega*sqrt(trace(A*X')) +trace(R*X') <=alpha;


here X is a 2n by 2n variable matrix and A and R are 2n by 2n parameter matrices. trace(R*X’) is equivalent to Frobenius inner product of R and X i.e. sum_{i} sum_{j} R_{ij}X_{ij}. Omega and alpha are constant numbers like 0.01.

I don’t see how that line of code would generate that error message. It should generate an error message, but not that one. That code is on a path to failure for various reasons.

For the first term, you want something along the lines of omega*norm([A(:,1)'*x,A(:,2)'*x,...,A(:,L)'*x])
where I leave it you to fix up the indexing and subscripting of A, x (X) or whatever, and other details, matricize it, etc… if you make the argument of norm into a matrix, then you can use 'fro'. Note that I am starting from the constraint in your text, and make no use of your code, which looks flat out wrong (if it’s not, please tell us why it’s not).

1 Like

Thank you Mark. I will start the implementation with your suggestions and fix the rest.

Best.

Maybe you can use norm(A'*x) for suitably defined A which horizontally stacks the column vectors a_l, and where x is a column vector.