//*************************************************
// FEEDBACK
// feedback: REW x ACTOLD ---> ACTOLD x REW
//
// As soon as the effect of the last action
// has been recognized by the system
// the system will update the REW value of the classifier
// which was the provider of the action
// as well as n-many predecessors given in ACTDEPTH
// According to the model SUM(i=1,n) partitionated
// according to the proportions 1:2: ... :n
function [ANIMAT, CLASSIF,ACTIONSET]=feedback(CLASSIF, ANIMAT, ACTIONSET,SHOW)
[rows,c]=size(ACTIONSET)
// Amount of REW at ActualFeedback ANIMAT(4)
if (ANIMAT(4) > 0) then REWAMOUNT = amountREW(ANIMAT(9)),
// Update the actions in the ACTIONSET
i=rows
while(i>0)
ACTIONSET(i,4)=sci2exp(evstr(ACTIONSET(i,4))+i/REWAMOUNT),
// if (SHOW==1) then,
printf("feedback: ACTIONSET %s at POS %d with ACTION = %s\n",ACTIONSET(i,4),i,ACTIONSET(i,3)),
// end
i=i-1,
end //while
// Map Update into set of CLASSIF
[rr,cc]=size(CLASSIF)
i=rows
while(i>0)
j=rr
while(j>0)
if ( strcmp(ACTIONSET(i,1), CLASSIF(j,1))==0 & strcmp(ACTIONSET(i,2), CLASSIF(j,2))==0 & strcmp(ACTIONSET(i,3), CLASSIF(j,3))==0) then CLASSIF(j,4) = ACTIONSET(i,4),
// if (SHOW==1) then,
printf("feedback: CLASSIF %s at POS %d with ACTION = %s\n",CLASSIF(j,4),j,CLASSIF(j,3)),
// end
end
j=j-1,
end, // for j CLASSIF
i=i-1,
end// for i MATCHSET
end // IF Update amount
ANIMAT(8)=CLASSIF
ANIMAT(14)=ACTIONSET
endfunction
//********************************************
// AMOUNT OF REWARD
//
function [SUMN]=amountREW(N)
a=0
for i=1:N
a=a+i,
end
SUMN=a
endfunction