Fitting Sparsed Constrained regression with non-negative coefficients adding to 1

I see a similar problem in How do I fit a constrained regression in R so that coefficients total = 1?

Specifically, my model is $$Y_i= \pi_1 X_1+\pi_2 X_2 +...+ \pi_K X_K +\epsilon_i$$ with $$\pi_k \ge 0$$ and $$\sum_k \pi_k =1$$ . That is $$\pi$$'s are probabilities. and I need to minimize $$\sum_i(Y_i -\pi_1 X_{i1}-\pi_2 X_{i2} -...- \pi_K X_{iK})^2$$. However, the number of observations $$n$$ are few, $$n<. The question is how do I minimize so that only a few of $$\pi_k$$ are $$\gt 0$$. The answer based on quadratic programming don't take sparseness into account. Do I need to do some sort of regularization?

New contributor
Siddhartha R Dalal is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• How do you define "a few of [the] $\pi_k$"? Could the number of non-zero coefficient estimates be equal to $n$? May 14 at 1:43
• It should be $n$ or less. May 14 at 3:53