The Order of Constraints

I want to optimize:

and write as:

cvx_begin
variable Vu(M)
           for i=1:M
                Vu_sum=Vu_sum+k*Vu(i)*Vu(i)*(1-bet0(i))*G(i)
            end
            expressions Vu_n(1,2) pj_n(1,2) Vuk_n(1,2) 
minimize Vu_sum
subject to
                0<=Vu;
                for i=1:M
                      LABLE——bet0(i)*G(i)/Vs+(1-bet0(i))*G(i)/Cth0(i)+(1-  bet0(i))*G(i)*inv_pos(Vu(i))<=Treq
                end
                for j=1:N
                     for i=1:M
                         if n_random(i)==j
                  LABEL—— bet0(i)*G(i)/Vs+(1-bet0(i))*G(i)/Cth0(i)+(1-bet0(i))*G(i)*inv_pos(Vu(i))<=Treq                     
                    pj_n(j)=pj_n(j)+pj0(i);
                    Vu_n(j)=Vu_n(j)+Vu(i);
                   Vuk_n(j)=Vuk_n(j)+k.*pow_p(Vu(j),3);
              end
          end
      end
                  for j=1:N
                       Vu_n(j)<=Vu_max;
                       Vuk_n(j)+pj_n(j)<=pmax;
                 end

cvx_end

(The optimization variable is a matrix of m columns, representing the calculation rate of m users. N is the base station matching m users, and n_random in the code is the matching result)

my problem is :In the constraint, the same statement at the LABLE is placed in different positions, and the number of cycles is the same, but why are the results different? Does the sequence of CVX constraints affect the results?Is it related to the input parameter value?

Is there a double minus sign?
LABLE——bet0(i)
Or maybe this is not displaying properly in your post?

Is n_random a vector of random numbers, and if so, are those random numbers changing (being regenerated) for the different CVX runs you are comparing? If so, you wouldn’t be the first CVX forum poster to have done that.

Beyond that, presuming all CVX expressions (whether declared or not) are defined before use ( I don’t know what the tow different programs you are comparing are, so I can’t say whether that comes into play here), the order of constraints does not affect the theoretical (i.e., if computed exactly) optimal objective value. However,the order of constraints can affect the performance of the solver; but unless the solver is affected by numerical difficulties, the optimal objective value should not change beyond that attributable to solver tolerance; However, if the optimal solution is not unique, the argmin (or argmax) returned by the solver and CVX could change if the order of constraints is changed.

1 Like