How do I solve the error "Error using barrier Finite difference derivatives at initial point contain Inf, NaN, or complex values. Fmincon cannot continue."
Ältere Kommentare anzeigen
I am using R2020a and I ran into the following error when using fmincon function:
"Error using barrier Finite difference derivatives at initial point contain Inf, NaN, or complex values. Fmincon cannot continue.
Error in fmincon (line 834) [X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] = barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ..."
I am very confused because earlier the function ran well. The only change I make is I try to use the parallel computing to speed up the optimization.
"options = optimoptions('fmincon','UseParallel',true)"
Before I added the UseParallel function, the fmincon ran well and there was no this error. In my understanding, the finite difference derivatives at initial point shouldn't be effected by using parallel or not?
I do not really know how to solve this problem. I tried to use diff function to find an initial point where the derivative is a finite real number. But diff(fun(x)) always returns [ ], which I confuses me more.
4 Kommentare
Torsten
am 23 Mai 2021
Do you use global variables in funfcn ? This should be avoided if using the parallel processing functionality.
Churui Li
am 23 Mai 2021
Walter Roberson
am 23 Mai 2021
Is there any way to use global variables and parallel processing functionality at the same time?
No. The closest you could get would be if you had a limited number of places where you change the variable, and you put in logic at each of the places to send the new value of the variable back to the controller, which would then send the value to each of the workers.
Churui Li
am 24 Mai 2021
Antworten (0)
Kategorien
Mehr zu Parallel Computing Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!