0001 function r=Reward(RM,a,s)
0002 % Evaluates the reward function.
0003 %
0004 % Returns the value of the reward function for a given state 's' and
0005 % action 'a'.
0006
0007 r=sum(RM.w.*cellfun(@(g)(Value(g,a)),RM.gA).*cellfun(@(g)(Value(g,s)),RM.gS));
0008