CVX (solver: MOSEK) solved my GP problem but returns infeasible solution

Here is a copy of my code:::

const = 40;
cvx_begin gp 
variables b(n,1) epsilon
M = diag(b)*A + d;
Mhat = M;
for k = 1: r-1
    Mhat = Mhat*M;
S2 = sum(Mhat,2);
maximize epsilon
subject to
    S2 + epsilon*ones(n,1) <= const*ones(n,1);
    sum(1/b2)<= 100; 
    b_lower*ones(n,1) <= b2 <= b_upper*ones(n,1);

It shows that my problem is solved, but the solution is infeasible. I checked it by plugging in the returned optimal b into M, and the first constraint is violated.

There’s not much we can offer you here since it is impossible to reproduce your results without the data.

Wait, are you talking about M = diag(b)*A +d? That’s not a constraint, that’s an assignment. Use == instead of =.