Multistart lsqcurvefit with parallel processing on produces an error

조회 수: 4 (최근 30일)
Felix
Felix 2013년 3월 31일
so I have a lsqcurvefit problem defined with a function and I run it with MultiStart to get a global minimum. Everything works perfectly fine if I have "useparallel" disabled. problem=createOptimProblem('lsqcurvefit','x0',x0,'objective',@myfunction,... 'lb',lb,'ub',ub,'xdata',xdata,'ydata',ydata,'options',options);
However, when I try parallel processing it gives me the error: "Attempted to access x0(1); index out of bounds because numel(x0)=0." x0 contains the parameters of my function to fit (which is a separate .m file). Apparently the input variables of my function are not available in the matlab workers. I tried to make x0 a global variable, but then I have the problem that the local values during fitting keep getting changed back to the global start value...
  댓글 수: 3
Felix
Felix 2013년 3월 31일
I'm sure its not an empty vector (x0 = [0.1 2 3 50];), and its passed into the function to fit as input argument. Since I get nice results with Multistart when I have "useparallel" disabled, I don't think there is any programming error. It's just another curiosity about the parallel processing toolbox, maybe it doesn't accept that I have my fit-function in a separate m-file instead of having it as an anonymous inline function. I could imagine that it gets confused to run the function file multiple times with multiple values for the same variable name x0....
Matt J
Matt J 2013년 3월 31일
I could imagine that it gets confused to run the function file multiple times with multiple values for the same variable name x0
I can't imagine that. It's the whole point of MultiStart. You'll have to show more code or we'll just be guessing.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by