I'm using Multistart and Lsqnonlin to do curve fitting and get parameters.
A quick overveiw of the problem: I have a Numerical DiffEq solver (in the form of a mex file) that is operated through MATLAB, a function blackboxfunction(A,t, X). The DiffEq solver provides my 'model' data (from theory).
We perform experients with known experimental values 'A' and for a known time from 0 to t.
X are parameters that are unknown, but can be obtained by inverse fitting the 'model' data to the 'experimental' data. Both experimental and model data are plotted in the form of curves.
This is essentially a non-convex optimization problem: What are the parameters (X) such that the function @(X)blackboxfunction(A,t,X) – y_experimental(t) is minimized.
In other words – what parameters 'X' gets the experimental and model curves to overlap perfectly?
I have a system with 16 nodes.
%% An excerpt of my code:_________________
% Function definition
fun = @(X)blackboxfunction( ... A, ... time_start,time_stop, ... X) ... -Experimental;% Set up Lsqnonlin options
options = optimoptions(@lsqnonlin,... 'Algorithm','trust-region-reflective', ... 'Display', 'iter', ... 'UseParallel', false, ... 'StepTolerance', 5e-6, ... Step-size stopping criterion 'FunctionTolerance', 1e-6, ... Function stoppping criterion 'TypicalX', TypicalX, ... 'FiniteDifferenceStepSize', 1e-4, ... % This seems to work fine, and faster 'DiffMinChange', 1e-6); %, ...
% Create optimization problem
problem = createOptimProblem('lsqnonlin', ... 'objective', fun, ... 'x0', initial, ... 'lb', lowlimit, ... 'ub', uplimit, ... 'options', options);% Create and run MultiStart object
ms = MultiStart('FunctionTolerance',2e-4,'XTolerance',5e-3,... 'StartPointsToRun','bounds-ineqs', 'Display', 'iter', 'UseParallel', true);[ms_params,ms_fval,ms_eflag,ms_output,ms_manymins] = run(ms, problem, 10)
My questions are:
- UseParallel should be 'true' for MultiStart alone, or both for MultiStart and the optimoptions object?
- Neither options above seem to be making the parallelization work. I don't have tic/toc data right now, but it's going no faster than when I did lsqnonlin for a single starting point. Is MultiStart with 'n' start points supposed to take as much time as n*lsqnonlin runs with one start point? (I suppose that makes sense, but I thought I'd still ask)
- What is the meaning of the error below:
[Error: idasErrorHandler::183] In function 'IDASolve' of module 'IDAS', error code 'IDA_ILL_INPUT':At t = 14.3214, , mxstep steps taken before reaching tout.[Error: integrate::1378] IDASolve returned IDA_TOO_MUCH_WORK at t = 14.3214
Best Answer