i am currently running linear optimization and maximizing summation of (weight*score) for each assets.

I am running it on assets that are difficult to trade and the universe is easily about 2000 of them every month. My firm has capacity to trade only about 100 of them..

How do i introduce a max number of trade constraints for the assets ? I am thinking of introducing binary variables to indicate whether to trade for each assets but i am not sure how to link it back to the original objective function

Regards James


This is a class of problems called Mixed-Integer Linear Programming (MILP). You can link the limit on the number of assets (cardinality) back to the objective function through boundary constraints on your weights.

Let $w_i$ be the weights and $s_i$ the scores. Let $w_i^{max}$ and $w_i^{min}$ be the maximum and minimum allowed weight for asset $i$. Introduce the variables $z_i\in{0,1}$ to indicate whether asset $i$ is in the portfolio, and let $K$ be the maximum number of assets in the portfolio.

The maximization objective is $$max(w_i) \sum_i w_is_i$$ under the weight constraint $$ z_iw_i^{min}\leq w_i \leq z_iw_i^{max}$$ and the cardinality constraint $$ \sum_i z_i \leq K$$ The weight constraint guarantees that $w_i$ is zero when $z_i$ is zero. There are several numerical packages available to solve this class of optimizations, for example CVXOPT in Python or intlinprog in Matlab.

| improve this answer | |
  • $\begingroup$ i think this might really work . let me change my optimizer to a mip problem and test it out ! $\endgroup$ – James JianYong Song Apr 5 '17 at 7:49
  • $\begingroup$ Feedback: I have a try and i find it quite unstable. Some solver can solve while others cant solve.. It also takes long time sometimes , due to availability of many corner solution. Did in R using Rglpk $\endgroup$ – James JianYong Song Apr 17 '17 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.