I was reading a paper from Cremers and Petajisto, called

How Active is Your Fund Manager? A New Measure That Predicts Performance

In the original paper from 2009 they have the following measure for active share

1-sum(min(w_pfo, w_bench))

which they later revised to


where in my understanding, the only difference is basically how you treat underweighting the benchmark, i.e. negative cancels out positive.

So now to my problem, I want to implement this in my portfolio optimisation code and I am struggling how to formulate the constraint in a DCP conform way. How can I get a convex formulation with a lower limit threshold. I basically want to ensure that my portfolio has a minimum % of active positions outside the benchmark. In CVXPY I am trying s.th. like

sum_entries(abs(w_pfo - w_bench))*0.5 >= 0.8  


1-sum_entries(min_elemwise(w_pfo,w_bench)) >= 0.8  

where w_pfo is my solver variable, I know that it will be a convex problem when I flip the inequality to <= 0.8.

Any inputs how to implement this would be great.


2 Answers 2


The problem you are proposing has a non-convex feasible set, so you can't formulate it in a DCP-conforming way. To see this, consider a 2-element benchmark portfolio [1, 1]. You are optimizing over portfolios [x, y] such that |x-1| + |y-1| >= 1.6. Note that [2, 0] and [0, 2] are both feasible portfolios, but the convex combination 0.5[2, 0] + 0.5[0, 2] = [1, 1] is not feasible. Thus, your feasible set is non-convex.

As you note, if you instead constrained portfolios to be sufficiently similar to the benchmark portfolio instead of sufficiently dissimilar, then the problem is convex and it is easy to formulate this in a DCP-conforming way using the exact constraints you listed in your question.


I initially thought that this could be done in R using fPortfolio package, but couldn't figure it out. Then @josliber from SO suggested the following with quadprog package:

df = matrix(rnorm(3*100), 100)

cov.mat = cov(df)
wbench <- c(0.4, 0.5, 0.1)
n <- length(wbench)

cov.mat.exp <- cbind(rbind(cov.mat, matrix(0, n, n)), matrix(0, 2*n, n))
cov.mat.exp <- cov.mat.exp + 1e-8*diag(2*n)  ## make it positive definite

consts <- rbind(rep(c(1, 0), c(n, n)),
                 rep(c(0, 1), c(n, n)),
                 cbind(matrix(0, n, n), -diag(n)),
                 cbind(diag(n), -diag(n)))

rhs <- c(1, 0.7, -w.bench, rep(0, n))

mod <- solve.QP(Dmat = cov.mat.exp,
                dvec = rep(0, 2*n),
                Amat = t(consts),
                bvec = rhs,
                meq = 1)
wpf <- head(mod$solution, n)
y <- tail(mod$solution, n)
  • $\begingroup$ Thanks man I will see if I can understand and port this into my python framework $\endgroup$ Commented Jul 1, 2017 at 13:59
  • $\begingroup$ Note that the question you posed and I answered on Stack Overflow differ from the question asked here by Markuss. Markuss wants portfolios that are sufficiently dissimilar from a benchmark portfolio, but you asked on Stack Overflow about portfolios that are sufficiently similar to a benchmark portfolio. $\endgroup$
    – josliber
    Commented Jul 4, 2017 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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