function [Trip_Scores,A_Scores,C_Scores,W_Scores]= Score_Calculate(Ant_k,Routes) global Waiting_Time_Weight global T_max global Score global Visiting_Time global Distance global Connections global Group_Size global Social_Relationship Trip_Scores = zeros(Group_Size,1); Trip_Total_Time = zeros(Group_Size,1); A_Scores = zeros(Group_Size,1); C_Scores = zeros(Group_Size,1); W_Scores = zeros(Group_Size,1); for user = 1: Group_Size for index = 1: length(Routes.Path{Ant_k,1,user}) A_Scores(user,1) = A_Scores(user,1) + Score(Routes.Path{Ant_k,1,user}(index)) * Visiting_Time(Routes.Path{Ant_k,1,user}(index)); for i = 1 : Group_Size if user == i continue; end if index <= length(Routes.Path{Ant_k,1,i}) if find([Routes.Path{Ant_k,1,user}(index)] == [Routes.Path{Ant_k,1,i}(index)]) A_Scores(user,1) = A_Scores(user,1) + ( Social_Relationship(user,i) * Visiting_Time(Routes.Path{Ant_k,1,user}(index))); end end end end for index = 1: length(Routes.Path{Ant_k,1,user}) - 1 C_Scores(user,1) = C_Scores(user,1) + Connections(Routes.Path{Ant_k,1,user}(index)) * Distance(Routes.Path{Ant_k,1,user}(index),Routes.Path{Ant_k,1,user}(index+1)); for i = 1 : Group_Size if user == i continue; end if index + 1 <= length(Routes.Path{Ant_k,1,i}) if find(Routes.Path{Ant_k,1,user}(index) == Routes.Path{Ant_k,1,i}(index)) if find(Routes.Path{Ant_k,1,user}(index+1) == Routes.Path{Ant_k,1,i}(index+1)) C_Scores(user,1) = C_Scores(user,1) + (Social_Relationship(user,i) * Distance(Routes.Path{Ant_k,1,user}(index),Routes.Path{Ant_k,1,user}(index+1)) ); end end end end Trip_Total_Time(user,1) = Trip_Total_Time(user,1) + Visiting_Time(Routes.Path{Ant_k,1,user}(index)) + Distance(Routes.Path{Ant_k,1,user}(index),Routes.Path{Ant_k,1,user}(index+1)); end W_Scores(user,1) = (T_max - Trip_Total_Time(user,1)) * Waiting_Time_Weight; Trip_Scores(user,1) = A_Scores(user,1) + C_Scores(user,1) + W_Scores(user,1); end end