From: yoav on
Hello,

I am using portopt to perform portfolio optimization.

The function returns the weights of the different assets, as requested.

So far so good.

Now, i have two problems with the solution this function returns, and i was wondering if there is a way to constraint the solution to meet my additional requirments:

1. The number of assets that this function allocates weights to is unconstrainted. That is, the solution can allocate weights to 2,10 or 50 assets. I don't have any control over the number of assets that will be included in the output portfolio, and i want to constraint it.

2. The weights of some assets can be very low (0.0001 and even lower...). How do i constraint the solution to have a minimum of 5% of weights? I dont mean add a regular constraint on the minimum of the weights, because then i will get a solution where all of the assets are allocated with 5% or more... i want that assets will be allocated with either zero weight or with 5% or more..

Thank you so much!

Ben