I have an objective function representing a weighted sum as follows:
function J = objfcn_cvx(X, L, Mu_d, Sigma_d, Mu_x, Sigma_x)
A1 = (L*X - Mu_d.').';
B1 = reshape(A1,size(A1,1)*size(A1,2),1);
D1 = Sigma_d * B1;
C1 = sum_square_abs(D1); % instead of C = (D'*D) as specified in DCP;
A2 = (X - Mu_x.').';
B2 = reshape(A2, size(X,1)*size(X,2),1);
D2 = Sigma_x * B2;
C2 = sum_square_abs(D2);
J = C1;
end
Here, I am not using C2, however, commenting the second part of the code out will effect the results. Why is that? In other words, the following function has a different output
function J = objfcn_cvx(X, L, Mu_d, Sigma_d, Mu_x, Sigma_x)
A1 = (L*X - Mu_d.').';
B1 = reshape(A1,size(A1,1)*size(A1,2),1);
D1 = Sigma_d * B1;
C1 = sum_square_abs(D1); % instead of C = (D'*D) as specified in DCP;
% A2 = (X - Mu_x.').';
% B2 = reshape(A2, size(X,1)*size(X,2),1);
% D2 = Sigma_x * B2;
% C2 = sum_square_abs(D2);
J = C1;
end
Eventually, I want to use the second objective, but this does not make any sense to me. Am I missing something?
This is how the main code looks like:
f = @(X)objfcn_cvx(X, L, Mu_d, Sigma_d, Mu_x, Sigma_x);
% CVX
cvx_begin
variable sol_x(n);
variable sol_y(n);
minimize(f([sol_x, sol_y]));
subject to
P_*[sol_x, sol_y] == G;
cvx_end
the only difference is the part of the code in left-side objective function that has been commented out, the part that defined C2. Notice that the output of the function is independent from C2 but somehow it is affecting the results. For instance, It can be seen that the pick on the left side has been flattened. Why?