I’m getting the below error while execute the optimisation function with CVX.
Warning: Empty objective.
In cvxprob/newobj (line 45)
In maximize (line 21)
In Virtual_RAN_optimisationnew (line 35)
Warning: Empty cvx model; no action taken.
In cvx_end (line 22)
In Virtual_RAN_optimisationnew (line 44)
{1x30 cell} {1x40 cell} {1x10 cell} {1x20 cell}
{1x30 cell} {1x40 cell} {1x10 cell} {1x20 cell}
{1x30 cell} {1x40 cell} {1x10 cell} {1x20 cell}
Please what’s the suggestion here?
My code is here:
clear all;
clc;
% VRRM effeciency
v=3; % Vno number (GB, BG and BE)
s=4; % Service number per VNO (Voice, Visio, Web and FTP)
Nsrv=v*s;
lambdav_s= [
50 40 30 10;
25 20 15 5;
5 4 3 1]; % the priority of SLA agreement/service for each VNO
Nusr=[30 40 10 20;
30 40 10 20;
30 40 10 20]; % Number of users per service for each VNO
Rcrrm=510; % the total agregated capacity
Rvsservmin=[0.032 2 0.5 1 ;
0.032 2 0.5 1 ;
0 0 0 0]; % Minimum data rate required for each VNO's service
Rvsservmax=[0.064 10 510 510 ;
0.064 10 510 510 ;
0.064 10 510 510]; % Maximum data rate for each VNO's service
Rvnomin=[204 204 0]; % Minimum data rate for each VNO
Rvnomax=[357 510 510];
cvx_begin
Wusr= cell(v,s);
sm=0;
for vs=1:Nsrv
sn=0;
Wusr{vs}=cell(1,Nusr(vs));
for i=1:Nusr(vs)
sn=sn+(Wusr{vs}{i}*(Rvsservmax(vs)/Rcrrm));
end
sm=sm+lambdav_s(vs)*log(sn);
end
maximize(sm)
x=Wusr;
subject to
for vs=1:Nsrv
for i=1:Nusr(vs)
Rvsservmin(vs)<=Wusr{vs}{i};
Wusr{vs}{i}<=Rvsservmax(vs);
end
end
cvx_end
% Results
disp(Wusr);
Your cell commands are creating cell arrays of empty matrices. Therefore, all your subsequent operations create empty matrices. Therefore sm is an empty matrix as of the maximize(sm) statement, hence the error message. You would better see what is going on if you removed the semicolons at the end of statements.
I don’t know what you are trying to do, but perhaps it would be easier using multidimensional variables in CVX. .See mcg’s answer at Cvx sdp mode and cell arrays .
For example variable joeblow(4,6,5)
and here is the code that i’m trying to develop in order to get the result of the optimum values.
clear all;
clc;
% VRRM effeciency
v=3; % Vno number (GB, BG and BE)
s=4; % Service number per VNO (Voice, Visio, Web and FTP)
Nsrv=v*s;
lambdav_s= [
50 40 30 10;
25 20 15 5;
5 4 3 1]; % the priority of SLA agreement/service for each VNO
Nusr=[30 40 10 20;
30 40 10 20;
30 40 10 20]; % Number of users per service for each VNO
Rcrrm=510; % the total agregated capacity
Rvsservmin=[0.032 2 0.5 1 ;
0.032 2 0.5 1 ;
0 0 0 0]; % Minimum data rate required for each VNO’s service
Rvsservmax=[0.064 10 510 510 ;
0.064 10 510 510 ;
0.064 10 510 510]; % Maximum data rate for each VNO’s service
Rvnomin=[204 204 0]; % Minimum data rate for each VNO
Rvnomax=[357 510 510];
cvx_begin
% Optimization function
Wusr= cell(v,s);
sm=0;
for vs=1:Nsrv
sn=0;
Wusr{vs}=cell(1,Nusr(vs));
for i=1:Nusr(vs)
sn=sn+(Wusr{vs}{i}*(Rvsservmax(vs)/Rcrrm));
end
sm=sm+lambdav_s(vs)*log(sn);
end
maximize(sm)
x=Wusr;
subject to
Wusr{vs}{i}<=1;
Wusr{vs}{i}>=0;
% First constraint
for vs=1:Nsrv
for i=1:Nusr(vs)
Rvsservmin(vs)<=Wusr{vs}{i};
Wusr{vs}{i}<=Rvsservmax(vs);
end
end
% Second constraint
sm1=0;
for vs=1:Nsrv
sn1=0;
Wusr{vs}=cell(1,Nusr(vs));
for i=1:Nusr(vs)
sn1=sn1+(Wusr{vs}{i}*(Rvsservmax(vs)));
end
sm1=sm1+sn1;
sm1<=Rvnomax;
sm1>=Rvnomin;
end
% Third constraint
sm2=0;
for vs=1:Nsrv
sn2=0;
Wusr{vs}=cell(1,Nusr(vs));
for i=1:Nusr(vs)
sn2=sn2+(Wusr{vs}{i}*(Rvsservmax(vs)));
end
sm2=sm2+sn2;
end
sm2<=Rcrrm;
The optimization problem in the image has an objective function which is a weighted sum of logarthm of affine (linear) function of the optimization variable. The constraints are affine (linear) in the optimization variable. Therefore, entry into CVX is extremely straightforward, other than care being required to organize and properly index into the various input data. So that is really a matter of MATLAB syntax, not CVX syntax. I don;t feel like trying to figure out what all the indexing of your data is. You could start with a simpler problem, something like
Then build up to the more complicated data structures.
I advise you not to use cells, although I suppose it is possible to correctly enter the program using cells.Try using arrays, to include 3-D arrays as necessary. As I advised you before, remove the semicolons at the end of statements so that you can see the result of each statement, which will help you debug your program. You can also use whos to see the dimensions of various item, which will help debug your program.
I used cell because we have variable size 3d matrix, This matrix has 34n.
Where n is change in each 2d index(1:3,1:4), This is why Because 3d matrix must has fixed size, Not variable size