MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Help with constraints in a optimazation problem?


The problem: I have a portfolio of around 250 equities. And I have daily returns
for both the indivitual equities as well as the whole portfolio from around two
years. And I'd like to replicate the return of the portfolio as closely as
possible by using, say 20 equities.

As a start I thought of using NMinimize to minimize tracking error (ie. sum of
squares of the return difference) between this 20 equity portfolio and the
original portfolio.

So, I have the returns in a matrix so that the first column of the matrix is the
return of the whole portfolio followed by the returns of the individual
equities. Lets call this matrix as "ret". And I have a vector "weights" as the
equity weights of the new portfolio.

So, the function to minimize would be something like:

  func[ret_List, weights_List]:=Plus@@(((weights.Rest[#] - First[#])^2)&/@ret);

subject to constraints:

  weights_i >= 0         ie.   (# ≥ 0)& /@ weights
  Sum[weights] == 1      ie.   Plus@@weights == 1
  Max 20 weights_i > 0   

This last one I don't know how to implement sanely. Surely I could use something

  Plus@@(Boole[# > 0.0001] &/@ weights) ≤ 20

but that's just too inefficient ( and ugly). Can anybody think of a better way
of imposing such a constraint to this optimization promlem?

Thanks in advance,


  • Prev by Date: Re: Simplify Expressions with Non commutative multiplication
  • Next by Date: Using the Notation package in an application
  • Previous by thread: Re: Forums opened on
  • Next by thread: Using the Notation package in an application