Error message: Invalid quadratic form(s): not a square

I am trying to run the following program:

N = 100; x = [0:N];
m = 0.01;
alph = 1/50;
beta = 1;
gamma = 3;
rho = 0.5;
kappa = 1 - exp(-x.*alph);

variables p(N+1,1)
maximize( m*(x*p) - (beta^rho)*((kappa*p)^(rho*gamma))*((kappa.^rho)*p) )
subject to
    sum(p) <= 1;
    p >= 0;

However I get an error message “Disciplined convex programming error:
Invalid quadratic form(s): not a square.”

This program is concave in that the Hessian is negative semidefinite, but I suspect the way I have written it is what’s causing the error. Can anyone help me rewrite it in a solvable format please?

if it really is concave, perhaps there is some rearrangement such that p only appears once in (beta^rho)*((kappa*p)^(rho*gamma))*((kappa.^rho)*p) Then CVX would accept tit.

1 Like