I have written a class which among other things fits my model to my data using a simulated annealing algorithm. I call it multiple times (each time incrementing one of the parameter values) within a loop. There is an outer loop which runs the aforementioned steps multiple times again. Then I take the average over the number of runs.
So the code looks something like this:
parfor k=1:number_of_runs
for j=1:number_of_times_the_parameter_changes
MyObject.RunSimulatedAnnealingAlgorithm();
ParameterEstimates(:,:,j,k) = MyObject.ParameterEstimates;
end
end
The problem is that using parfor does not speed up execution. Any ideas of what may have gone wrong?