Hello there,
I'd like some help in optimizing the script below.On large scale it's taking a lot of time.
Feasible_Starting_Flow=zeros(size(segments,1),1);
for i=1:size(SR_MinLength_Path,1)
for j=3:size(SR_MinLength_Path,2)1
b1=SR_MinLength_Path(i,j);
b2=SR_MinLength_Path(i,j+1);
for x=1:size(segments,1)
if (segments (x,2)==b1 && segments (x,3)==b2)
Feasible_Starting_Flow(x,1)=Feasible_Starting_Flow(x,1)+Traffic_Generated(SR_MinLength_Path(i,1),SR_MinLength_Path(i,2));
end
end
end
end
Ex: if the first row of the SR_Min_Length_Path entry was like :1 2 1 6 7 3 8 2 0 0 0.34.My script would start by taking the third and fourth entries and put them in b1 and b2 respectively.At the beginning b1=1 and b2=6.The script then checks if the 2 entries are found in the second and third columns of the segments matrix.If so, it will take the value of the Traffic_Generated(SR_MinLength_Path(i,1),SR_MinLength_Path(i,2)) which are basically the Traffic_Generated(1,2) "the first 2 entries in the row and put it in the Feasible_Starting_Flow matrix."It will keep updating the b1 and b2 until all the entries in the row are over and then it moves to the second row and so the same thing until all rows are done.
Mainly what am asking is I want to get rid of the for loops if possible so that processing time get shorter.
Any help is greatly appreciated.
