How to improve scaling values?

Errors Occurred

MOSEK warning 52: A numerically large lower bound value  1.4e+12 is specified for constraint '' (30).
MOSEK warning 53: A numerically large upper bound value  1.4e+12 is specified for constraint '' (30).
MOSEK warning 52: A numerically large lower bound value -1.5e+12 is specified for constraint '' (154).
MOSEK warning 53: A numerically large upper bound value -1.5e+12 is specified for constraint '' (154).
MOSEK warning 52: A numerically large lower bound value  5.1e+12 is specified for constraint '' (155).
MOSEK warning 53: A numerically large upper bound value  5.1e+12 is specified for constraint '' (155).
MOSEK warning 52: A numerically large lower bound value  4.1e+12 is specified for constraint '' (156).
MOSEK warning 53: A numerically large upper bound value  4.1e+12 is specified for constraint '' (156).
MOSEK warning 52: A numerically large lower bound value -4.4e+12 is specified for constraint '' (157).
MOSEK warning 53: A numerically large upper bound value -4.4e+12 is specified for constraint '' (157).
MOSEK warning 52: A numerically large lower bound value  1.5e+11 is specified for constraint '' (158).
MOSEK warning 53: A numerically large upper bound value  1.5e+11 is specified for constraint '' (158).
MOSEK warning 52: A numerically large lower bound value  4.0e+12 is specified for constraint '' (159).
MOSEK warning 53: A numerically large upper bound value  4.0e+12 is specified for constraint '' (159).
MOSEK warning 52: A numerically large lower bound value  7.1e+12 is specified for constraint '' (160).
MOSEK warning 53: A numerically large upper bound value  7.1e+12 is specified for constraint '' (160).
MOSEK warning 52: A numerically large lower bound value -3.5e+12 is specified for constraint '' (161).
MOSEK warning 53: A numerically large upper bound value -3.5e+12 is specified for constraint '' (161).
MOSEK warning 52: A numerically large lower bound value -5.4e+12 is specified for constraint '' (162).
MOSEK warning 53: A numerically large upper bound value -5.4e+12 is specified for constraint '' (162).
Warning number 52 is disabled.
Warning number 53 is disabled.
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 178             
  Cones                  : 99              
  Scalar variables       : 487             
  Matrix variables       : 0               
  Integer variables      : 0               

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 12
Eliminator terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries                  : 2                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.01            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.01    
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 178             
  Cones                  : 99              
  Scalar variables       : 487             
  Matrix variables       : 0               
  Integer variables      : 0               

Optimizer  - threads                : 16              
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 138
Optimizer  - Cones                  : 100
Optimizer  - Scalar variables       : 469               conic                  : 469             
Optimizer  - Semi-definite variables: 0                 scalarized             : 0               
Factor     - setup time             : 0.00              dense det. time        : 0.00            
Factor     - ML order time          : 0.00              GP order time          : 0.00            
Factor     - nonzeros before factor : 5287              after factor           : 5883            
Factor     - dense dim.             : 0                 flops                  : 3.81e+05        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.0e+12  8.9e+01  7.2e+11  0.00e+00   3.726873488e+02   -7.213475205e+11  1.0e+00  0.03  
1   2.6e+11  2.2e+01  3.6e+11  -1.00e+00  6.844847024e+02   -7.212300211e+11  2.5e-01  0.08  
2   9.8e+10  8.5e+00  2.2e+11  -1.00e+00  1.420974739e+03   -7.212000285e+11  9.6e-02  0.08  
3   6.5e+10  5.7e+00  1.8e+11  -1.00e+00  2.131537099e+03   -7.211848752e+11  6.4e-02  0.08  
4   2.5e+10  2.2e+00  1.1e+11  -1.00e+00  5.375691270e+03   -7.211727901e+11  2.5e-02  0.09  
5   6.8e+09  5.9e-01  5.8e+10  -1.00e+00  2.057436471e+04   -7.211774861e+11  6.6e-03  0.09  
6   5.3e+08  4.6e-02  1.6e+10  -1.00e+00  2.654029857e+05   -7.211767505e+11  5.2e-04  0.09  
7   1.5e+04  1.3e-06  8.7e+07  -1.00e+00  9.431575114e+09   -7.129651938e+11  1.5e-08  0.09  
Optimizer terminated. Time: 0.11    


Interior-point solution summary
  Problem status  : UNKNOWN
  Solution status : UNKNOWN
  Primal.  obj: 9.4315751140e+09    nrm: 7e+12    Viol.  con: 7e+12    var: 0e+00    cones: 0e+00  
  Dual.    obj: -7.1942241712e+11   nrm: 5e+07    Viol.  con: 0e+00    var: 9e+01    cones: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.11    
    Interior-point          - iterations : 8         time: 0.09    
      Basis identification  -                        time: 0.00    
        Primal              - iterations : 0         time: 0.00    
        Dual                - iterations : 0         time: 0.00    
        Clean primal        - iterations : 0         time: 0.00    
        Clean dual          - iterations : 0         time: 0.00    
    Simplex                 -                        time: 0.00    
      Primal simplex        - iterations : 0         time: 0.00    
      Dual simplex          - iterations : 0         time: 0.00    
    Mixed integer           - relaxations: 0         time: 0.00    

------------------------------------------------------------
Status: Failed
Optimal value (cvx_optval): NaN

My Code

cvx_begin 
cvx_solver mosek
cvx_save_prefs
    variable w(M,K) complex
    expressions RR(K-1,K);
     for k=1:K
        w_temp1=0;w_temp2=0;w_temp5=0;
        for i=k+1:K
            w_temp1=w_temp1+pow_abs(h_k(k,:)*w_t(:,i),2);
            w_temp2=w_temp2+pow_abs(h_k(k,:)*w(:,i),2);         
            w_temp5=w_temp5+2*real(h_k(k,:)*w_t(:,i)*w(:,i)'*h_k(k,:)')...
                -(h_k(k,:)*w_t(:,i)*w_t(:,i)'*h_k(k,:)');
        end
        w_temp3=pow_abs(h_k(k,:)*w_t(:,k),2);
        w_temp4=pow_abs(h_k(k,:)*w(:,k),2);
        R_up(k)=log((w_temp1/noise+1+w_temp3/noise)/(w_temp1/noise+1))/log(2)+(quad_over_lin(h_k(k,:)*w(:,k),real(w_temp5)+noise)...
                -(w_temp3/noise)/(w_temp1/noise+1))/((log(2)*(w_temp1/noise+1)+w_temp3*log(2)/noise)/(w_temp1/noise+1));
        R_lp(k)=log(1+(w_temp3)/(w_temp1+noise))/log(2)+2*real(h_k(k,:)*w_t(:,k)*...
        (h_k(k,:)*w(:,k)-h_k(k,:)*w_t(:,k)))/((w_temp1+noise)*log(2))...
         -(w_temp3)*(w_temp2+noise+w_temp4)/((w_temp1+noise)*((w_temp1+noise)+w_temp3)*log(2))+w_temp3/((w_temp1+noise)*log(2));
  end
  for k=1:K-1
      for i=k+1:K
          w_temp6=0;w_temp7=0;
          for j=k+1:K
              w_temp6=w_temp6+pow_abs(h_k(i,:)*w_t(:,j),2);
              w_temp7=w_temp7+pow_abs(h_k(i,:)*w(:,j),2);
          end
          w_temp8=pow_abs(h_k(i,:)*w_t(:,k),2);
          w_temp9=pow_abs(h_k(i,:)*w(:,k),2);
          RR(k,i)=log((w_temp6/noise+w_temp8/noise)/(w_temp6/noise+1))/log(2)+2*real(h_k(i,:)*w_t(:,k)*(h_k(i,:)*w(:,k)...
              -h_k(i,:)*w_t(:,k))/noise)/((w_temp6/noise+1)*log(2))-(w_temp8/noise)*(w_temp7/noise+1+w_temp9/noise)...
              /((w_temp6/noise+1)*((w_temp6/noise+1)+w_temp8/noise)*log(2))+(w_temp8/noise)/((w_temp6/noise+1)*log(2));
      end
  end
maximise sum(R_lp)
    subject to
    for k=1:K-1
        for i=k+1:K
            RR(k,i)>=R_up(k);
        end
    end
    pow_pos(norm(w,'fro'),2)<=P_max;
cvx_end


I tried to normalize the noise, but it didn’t work
Initial value


I don’t know how to zoom in or out, but the solution failed, but R_ There is a value for lp, but the last value is particularly large. I saw in the forum that the value obtained from the failed solution is meaningless. Is it informative?

I would also like to ask, is there a conflict in taking both the upper and lower bounds for the same function in optimization problems?
Thank you very much for your answers. There are many things that beginners may not understand about CVX

I will defer to a Mosek person to say why Mosek Problem and Solution status is UNKNOWN, as opposed to knowing that the optimization failed.The Primal and Dual Objectives are huge values of opposite sign, and there is a huge primal constraint violation, so that looks to me to be a clear cut failure. But, I defer to Mosek personnel to explain.

Perhaps there are some cases in which Mosek reports Sttaus UNKNOWN, CVX status is Failed, and CVX populates the solution (not with NaN), and for which the solution might be meaningful and maybe “correct”. That happens in YALMIP. But CVX at least sometimes (always?) populates variable values with NaN rather than numerical values if Mosek reports Status UNKNOWN.

That being said, the scaling of your problem is horrible, as indicated by the Mosek warnings. After the scaling is fixed, perhaps Mosek will successfully solve the problem. Try to change the units of the input data so that the non-zero input data is within a small number of orders of magnitude of one. Numbers such as + or - e11 or e12 are not within a small number of orders of magnitude of one.

An example of change in units is to use GHz instead of Hz. Or gigawatts instead of watts.

Existence of log might complicate things a little, but all that matters is what is crunched down and presented to CVX. For example log2(1e12) is o.k., because MATLAB crunches it down to 39.86 before it is ever “received” by CVX. But log2(x+1e12) where x is a CVX variable or expression is not good, because CVX is “subjected” to 1e12 and there is already difficulty when CVX adds 1e12 to x, which can result in badly scaled numbers being provided as input data to the solver (Mosek).

Regarding “I would also like to ask, is there a conflict in taking both the upper and lower bounds for the same function in optimization problems?” Optimization problems can have lower and upper bounds on the same variable or expression, provided both bound constraints satisfy CVX"s DCP rules. For example, 1 <= x <= 5can be specified in CVX ifx` is a CVX variable or real affine expression. That would be non-convex, and would not be allowed by CVX if x were a non-affine (i…e., nonlinear) convex or concave expression, because only one of the two inequality constraints would be convex, and the other of the inequalities would be a not allowed non-convex inequality constraint. If this does not answer your question “I would also like to ask, is there a conflict in taking both the upper and lower bounds for the same function in optimization problems?”, please explain that question more clearly.

Status UNKNOWN means the solver stopped without being able to reach any of the stopping criteria for any of OPTIMAL/INFEASIBLE/DUAL INFEASIBLE. In this case the solution vector is whatever vector the solver had when it stopped and it can be anything from an almost-perfect optimum to complete rubbish (like here).

As far as I can see CVX says “failed” at the end, so all is as it should be (?). I think CVX always translates Mosek’s UNKNOWN to failed.

For example, using the following two formula transformations, for the same function f (x) in optimization problems, perform the lower bound treatment in f (x) - h (x), and perform the upper bound treatment in g (x) - f (x)


2

If all the inequalities are convex constraints and follow CVX’s DCP rules, they are allowed in CVX. if not, they are not allowed in CVX.

As to whether having those constraints is appropriate for your optimization problem, that is for you to decide. It’s your optimization problem, not the optimization problem of the CVX forum readers.

Okay, thank you very much for your answer