Error in performing integration


(Vishavjeet Singh) #1
e=xlsread('D:\Cabaza\matlab\monthlymeanSeries.csv','B2:AO2') % 1 * matrix %;
n = length(e);
%e = u(1:n);
sigma=xlsread('D:\Cabaza\matlab\monthlyvarianceSeries.csv','B2:AO41');  % 50 * 50 matrix %
W=1000000; % Initial total wealth to invest %
b = 1000000; % atleast b wealth with probability 'alpha' after return %
alpha=0.1;
zalpha = norminv(1-alpha,0,1);
T = cholcov(sigma); %cholesky like decomposition s.t. sigma = T * T.'%
cvx_begin
    variable x(n)
    maximize( e*x )    % maximize expected return %
    subject to
        sum(x)== W               % total wealth %
        _b - e*x + ((zalpha*normcdf(zalpha)-int(@(x) normcdf(x),x,-Inf, zalpha)) * norm((T.' * x),2)) <= 0_
        x >= zeros(n, 1)             
cvx_end

This is one of the constraint in my optimization problem -

b - ex + ((zalphanormcdf(zalpha)-int(@(x) normcdf(x),x,-Inf, zalpha)) * norm((T.’ * x),2)) <= 0

and this constraint is giving me the error -

Undefined function ‘int’ for input arguments of type ‘cvx’.

How do I resolve this error ?


(Mark L. Stone) #2

Are you trying to use the symbolic toolbox int? That’s not allowed in CVX. Why isn’t CVX accepting my model? READ THIS FIRST!

Are you really trying to integrate normcdf, or do you want to integrate normpdf? Either way, I think you’re out of luck, unless you can get a CVX-legal series representation of that multiplied with the norm term. There is a CVX approximation, log_norm_cdf to the log of normcdf, but then you’d have a log(norm) term which would not be accepted by CVX.

So the bottom line is I think you need a series representation of -int(@(x) normcdf(x),x,-Inf, zalpha)) * norm((T.' * x),2)) which is convex and follows CVX’s rules. I am not saying any such series exists, or that would be a good enough approximation. Potentially, you could do series expansion about an initial point, solve the CVX problem, then expand about the CVX solution, re-solve in CVX, etc. BUt you’re probably better off solving it with a general nonlinear programming solver (not using CVX).

Or perhaps your model formulation can be changed. But fi so, that is for you to do.


(Vishavjeet Singh) #3

Thank you. I want to integrate normcdf.
I am actually trying to impose a CVAR constraint.


(Mark L. Stone) #4

Have you looked at https://arxiv.org/pdf/1511.00140.pdf ? A simulation approach was used with CVX.