Hello,
The normal Portfolio Optimization problem is when we are given a portfolio
of assets and the only restriction is that the sum of weights assigned to
assets is equal to 1(and of course 0<=w*i*<=1).

But when we put the limit on number of assets to be invested, this problem
becomes a Cardinality Constrained Portfolio Optimization Problem(for e.g. I
have portfolio of 10 assets but at a time I can only invest in 5 assets).
In such case we introduce a binary variable y*i* = {0,1}
y*i* = 0 when no investment is made in asset i and y*i* = 1 when the
investment is made in asset i.

Now, this problem becomes a Mixed Integer Quadratic Programming Problem.
I was trying to solve it using Convex.jl but couldn't succeed. I would be
great if someone could help :)

The problem is in the following lines of the code

#Defining variables
w = Variable(10);
y = Variable(10, :Bin);

#Defining constraints
c1 = sum(w) == 1;
c2 = sum(y) = 5;

c3 = w_lower <= w*y';
*Constraint:*

*<= constraint*
*lhs: 0*
*rhs: AbstractExpr with*
*head: **
*size: (5, 5)*
*sign: Convex.NoSign()*
*vexity: Convex.NotDcp()*

*vexity: Convex.NotDcp()*

c4 = w*y' <= w_upper;



*Yours Sincerely,*
*Ayush Pandey*
*LinkedIn Profile <https://www.linkedin.com/pub/ayush-pandey/66/9/a52>    *
*GitHub <https://github.com/Ayush-iitkgp>*

Reply via email to