Reappraisal_Evl (U0, U1, breadth) |
(1) #U0: utility before the stressful event happened |
(2) #U1: utility after the stressful event and before reappraisal |
(3) #breadth: number of goals to be considered when evaluating an event |
(4) |
(5) #recovertime: the number of attempts needed before utility recovered |
(6) #worse: the number of times the agent feels worse than before the stressful event |
(7) recovertimes = [ ]; #an array of results over multiple tests |
(8) worses = [ ]; #an array of results over multiple tests |
(9) for in range (100): #test for 100 times |
(10) found = false; |
(11) worse = 0; |
(12) |
(13) #reinitialize the agent’s state to right after the stressful event |
(14) reinit (); |
(15) for in range (100): #allow the agent to maximally reevaluate the event 100 times |
(16) if found: |
(17) recovertime = recovertime + [i]; |
(18) break; |
(19) else: |
(20) Uti = reappraisal (breadth); |
(21) #in case reappraisal recovered original utility |
(22) if Uti ≥ U0: |
(23) found = true; |
(24) #reappraisal results in even lower utility |
(25) elif Uti < U1: |
(26) worse = worse + 1; |
(27) worses = worses + [worse]; |
(28) return recovertimes, worses; |
(29) |
(30) reappraisal (breadth): returns the agent’s utility after evaluating the impact of an event/thought that randomly affects |
breadth number of goals, and at a random level for each goal |