# Why there are some negative solutions?

I have constrained variables are non-negative. But the solution contains the negative solutions. Why?
My code is

``````cvx_begin
variable x(N);
expression SINR(N);
expression R(N);
for n=1:N
intra_interf=0;
inter_interf=0;
intra_interf=sum(H_intra(k,:,n).*p(:,n)');
inter_interf=p_cellular(n)*H_inter(k,n);
SINR(n)=x(n)/(eta*(intra_interf+inter_interf+N0));
R(n)=log(1+SINR(n))/log(2);
end
minimize sum(theta.*x);
subject to
sum(R)>=QoS_D2D(k);
x>=0;
cvx_end;``````

Just how negative are they? Very small negative values are to be expected sometimes due to roundoff error.

There are not small. I do not know why. Is that because I use the sentence
for i=1:N_user
for j=1:ch
R_l(i,j)=-rel_entr(B_l(i,j),B_l(i,j)+P_l(i,j)h_l(i,j)/((I_mu(i,j)+N0)10^6));
end
for k=1:WAP
for n=1:ch_u
R_u(i,k,n)=-rel_entr(beta
B_u(i,k,n),beta
B_u(i,k,n)+P_u(i,k,n)h_u(i,k,n)/(N010^6));
end
end
end
Since the objective function include the form of x*log(1+y/x)

Is it working using the
rel_entr(x,x+y) to represent xlog(1+y/x)?
Why the solution is negative, even though I have constraints on x,y, x,y>0?
Is this a bug of cvx?

I’m going to guess a scaling error; the `10^6` value leads me to believe this is the case. CVX simply can’t handle large dynamic ranges of values (this is a limitation of the underlying solvers, really).

But also, as CVX warned you, `rel_entr` relies on the successive approximation method. If it’s not working for you, there’s not a lot that we can do about it. We’re waiting on solvers to be developed that can handle such functions natively.

Thank you for your reply. Do you have any idea which package or software I can use to solve this kind of problem?
Best regards

mcg,

How about SCS http://web.stanford.edu/~boyd/papers/pdf/scs.pdf , for which your advisor is one of the co-authors? Is there hope of getting that into CVX, not only for such things as exponential cone support, but for large-scale problem capabilities which might give an easier to use alternative to TFOCS for certain problems beyond the capacity of CVX’s 2nd order solvers?

Oh, the solvers, and CVX support for such, are definitely coming. In fact I have preliminary support for the new SCS in 3.0 beta, but I’ve recently received enough bug reports there that I’m not ready to start recommending that. ECOS has also recently added support for exponential cones, so I’m looking forward to integrating both at some point. Frankly I’d love nothing better than to jettison the successive approximation support completely.

May I ask if you have solved this problem? I have encountered a similar problem and don’t know how to solve it.