The question I have for you is: What is your definition of stability?
If each unit of a stock is independent from the next then the volatility of the portfolio of those stocks will be linear. The variance of the sum of stocks with variance sigma^2 is n*sigma^2.
Now with this in mind, you have to decide specifically what your constraints are and what specific mathematical attribute you are trying to find.
To minimize volatility you have to basically sell off your stock but I'm guessing that you have some kind of criteria for minimization which relates profit to the volatility.
So I would need to ask you how you calculate your profit and what the asset models you are going to use to get closer to a solution.