“Why doesn’t CVX accept log2”?
Because the CVX developer did not include support for log2
.
However, you can formulate as log2(x) = log(x)/log(2), which CVX will accept if x is a concave expression following CVX’;s rules. Or if it is the only term in the objective, you can just leave out the /log(2)
, and the argmax will be the same.
But in your case, additional reformulation is needed to deal with the argument of log, which is basically 1 + the harmonic mean There are solutions in Harmonic mean in cvx and How can I express this concave function in CVX, the latter of which reference https://docs.mosek.com/modeling-cookbook/cqo.html#harmonic-mean .