Fmincon failure in optimizing an objective function which includes determinant of a matrix.

1 view (last 30 days)
Here, fmincon is not working with the below mentioned objective function, and same was working when i was finding the frobenious norm of the matrix. Can someone please help me out in this?
Nr=4;No=1;
N = 4;
h = sqrt(0.5)*(randn(N,N)+1i*randn(N,N));
g = sqrt(0.5)*(randn(N,N)+1i*randn(N,N));
phi0 = zeros(N,1);
lb = zeros(N,1);
ub = 2*pi*ones(N,1);
obj = @(phi)-det(eye(Nr)+((g*diag(exp(1i*phi))*h)*(g*diag(exp(1i*phi))*h)')/No);
[sol,~] = fmincon(obj,phi0,[],[],[],[],lb,ub);
Error using barrier
Objective function is undefined at initial point. Fmincon cannot continue.

Error in fmincon (line 886)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...

Accepted Answer

Bruno Luong
Bruno Luong on 24 Nov 2022
Make sure your objective function returns real numerical output
Nr=4;No=1;
N = 4;
h = sqrt(0.5)*(randn(N,N)+1i*randn(N,N));
g = sqrt(0.5)*(randn(N,N)+1i*randn(N,N));
phi0 = zeros(N,1);
lb = zeros(N,1);
ub = 2*pi*ones(N,1);
obj = @(phi)-det(eye(Nr)+real(((g*diag(exp(1i*phi))*h)*(g*diag(exp(1i*phi))*h)'))/No);
[sol,~] = fmincon(obj,phi0,[],[],[],[],lb,ub);
Local minimum possible. Constraints satisfied. fmincon stopped because the size of the current step is less than the value of the step size tolerance and constraints are satisfied to within the value of the constraint tolerance.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!