I want to use sedumi to solve a linear optimization problem, where Sk is the optimization variable, and it requires a value between 0 and 1.So, i write like this

cvx_begin
variable Sk(K,M) nonnegative;
minimize sum(sum(Ttotal(:,:)))
subject to
for k=1:K
for m=1:M
Sk(k,m)<=1;
end
end
cvx_end

It turns out that Sk is only less than 1, but it’s not greater than or equal to zero. Even if I add the “Sk(k,m)>=0” constraint, Sk will still be negative sometimes, how do I solve this?

If the value of Sk has elements which are slightly negative, such as -1e-8, but you really need Sk to be nonnegative, you can either

Add the statement Sk = max(Sk,0);
after cvx _end

or use

variable Sk(K,M)
S >= small_positive_number

where small_positive_number is perhaps 1e-5 or 1e-6. If this constraint is 'violated" by an amount up io the solver feasibility tolerance, the value of Sk will b still be nonnegative.

Is there some part of your program which you did not include in your post? You don’t show where Ttotal is computed. If Ttotal is a MATLAB variable set to some numerical value prior to the CVX program, then CVX would consider it to be input data; so the objective function would be minimize a constant. That is the same as a feasibility problem. That means the solver and CVX can return any value of Sk they “want to”, presuming it satisfies the constraints to within solver feasibility tolerance. If this is not the case, perhaps we can provide more assistance if you show u s the code as to how Tttotal is computed, and how it relates to the CVX (optimization) variables. If Ttotal is an expression, that expression must be provided before the objective function; because if it is provided after the objective function, the expression will have the default value of zero for use in the objective function, which will make it a feasibility problem, contrary to what you wanted.

I use the method 1, which means I add the statement
Sk = max(Sk,0);
after cvx _end
as you say.

There is actually some part of program which i did not include in my post? As for Ttotal, this is an expression containing the variable Sk and some constants that I declared after cvx_begin as “expression Ttotal(K,M) ;”. And I provid it before the objective function as
for k=1:K
for m=1:M
Ttotal(k,m)=gamac*(1-Sk(k,m))LkCkf_gitf_git+P1Sk(k,m)Lkinv_pos(Blog(1+P1Hlb(k,m)inv_pos(N0))inv_pos(log(2)))+gamacSk(k,m)LkCkf_uavf_uav;
end
end

Hello mark, I have another problem. I use the sedumi to solve two convex optimization problems by alternately. I first minimized Ttotal by optimizing Sk. And then substituted the optimized Sk as a constant into another convex optimization problem. And also try to minimize Ttotal by optimizing the variable Q(2,M). But it shows like this

Successive approximation method to be employed.
For improved efficiency, SeDuMi is solving the dual problem.
SeDuMi will be called several times to refine the solution.
Original size: 8149 variables, 2596 equality constraints
900 exponentials add 7200 variables, 4500 equality constraints

We don’t know what your input data is. You should rescale the data (variables) if not all non-zero input data are within a small number of orders of magnitude of one.