hi, I am trying to use parallel toolbox to speed up my global SA with Morris method. Basically it averages elementary effects for a specific parameters across the entire parameter space. An elementary effect is calculated as EE = (f(p) - f(p+delta))/delta. For more details see Wentworth et al. J. UNCERTAINTY QUANTIFICATION, Vol. 4, pp. 266–297 (https://projects.ncsu.edu/crsc/reports/ftp/pdf/crsc-tr15-01.pdf). So far I failed with my attempts, such as for this code - here using SimBiology 'sbioselect' and 'sbiosimulate'
clear variables; close all; clc;
format shortG
r = 5;
l = 10; s = 2;
delta = l/(s*(l-1));
disp("Load model & parameter file")
paramsFile = strcat('PARAMETERS/Lotka_parameters.csv');
paramsDF = readtable(paramsFile);
sbioloadproject('SBPROJ/lotka.sbproj','m1')
p = length(paramsDF.parameter);
d = zeros(r,p);
for i = 1:r
f = zeros(1,(p+1));
C = [15 0.085556 15;
15 0.005 15;
15 0.005 9.4444;
9.4444 0.005 9.4444];
for j = 1:(p+1)
for k = 1:size(C,2)
blub = sbioselect(m1, 'Name', paramsDF.parameter(k));
blub.Value = C(j,k);
end
[t,y] = sbiosimulate(m1);
f(j) = y(end,varNo);
end
v = zeros(1,p);
for j = 1:p
Cindex = find(diff(C(:,j)) ~= 0);
v(j) = ((f(Cindex) - f(Cindex+1))/delta;
end
d(i,:) = v;
end
...
Although the code is correct from the syntaxt point of view, at run time I get the error:
Load model & parameter file
Starting parallel pool (parpool) using the 'local' profile ...
connected to 4 workers.
Error using sbiosimulate (line 136)
Expected input number 1, MOBJ, to be one of these types:
SimBiology.Model
Instead its type was double.
Error in test (line 19)
parfor i = 1:r
Any comments would be very appreciated. I attach lotka.sbproj and parametr file as well.
Best, M
0 Comments
Sign in to comment.