-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathobserve_strategies.py
26 lines (21 loc) · 1.04 KB
/
observe_strategies.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Copyright (c) 2012 Stellenbosch University, 2012
# This source code is released under the Academic Free License 3.0
# See https://github.com/gvrooyen/SocialLearning/blob/master/LICENSE for the full text of the license.
# Author: G-J van Rooyen <[email protected]>
"""
Definition of the various observe_who() strategies for agents.
"""
# This function MUST return the given list of tuples, exploiterData, sorted by preference for copying.
# Data given for each agent are (index in this list,age,total accrued payoff,number of times copied,number of offpsring)
# All values except index have error applied.
# AGE = 1
# TOTAL_PAY = 2
# TIMES_COPIED = 3
# N_OFFSPRING = 4
strategy = [
" return sorted(exploiterData,key=lambda x:x[AGE],reverse=True)\n",
" return sorted(exploiterData,key=lambda x:x[TOTAL_PAY],reverse=True)\n",
" return sorted(exploiterData,key=lambda x:x[TIMES_COPIED],reverse=True)\n",
" return sorted(exploiterData,key=lambda x:x[N_OFFSPRING],reverse=True)\n",
" random.shuffle(exploiterData)\n return exploiterData\n"
]