Skip to content

Commit 5cb1f58

Browse files
committed
Adjust to a total number of participants of 36 instead of 30
1 parent 6b47c20 commit 5cb1f58

File tree

3 files changed

+57
-29
lines changed

3 files changed

+57
-29
lines changed

live_bargaining/__init__.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@
2525

2626
def creating_session(subsession):
2727
num_active_groups = len(subsession.get_groups())
28-
if num_active_groups == 10:
28+
if num_active_groups <= 12 and num_active_groups % 2 == 0:
2929
subsession_index = subsession.round_number - 1
3030
with open(
3131
"preparation/group_matrices/group_matrices.pkl",
3232
"rb",
3333
) as file:
3434
group_matrices = pickle.load(file)
3535
if subsession_index < len(group_matrices):
36-
subsession.set_group_matrix(group_matrices[subsession_index])
36+
subsession.set_group_matrix(
37+
group_matrices[subsession_index][:num_active_groups]
38+
)
3739
else:
3840
subsession.group_randomly()
3941
else:

preparation/group_matrices/create_group_matrices.ipynb

+53-27
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 60,
6-
"metadata": {},
5+
"execution_count": 1,
6+
"metadata": {
7+
"metadata": {}
8+
},
79
"outputs": [],
810
"source": [
911
"import pickle\n",
@@ -14,19 +16,23 @@
1416
},
1517
{
1618
"cell_type": "code",
17-
"execution_count": 61,
18-
"metadata": {},
19+
"execution_count": 2,
20+
"metadata": {
21+
"metadata": {}
22+
},
1923
"outputs": [],
2024
"source": [
2125
"num_groups = 2 # number of groups per matching group\n",
22-
"num_match_grp = 5\n",
26+
"num_match_grp = 6\n",
2327
"num_rounds = 6"
2428
]
2529
},
2630
{
2731
"cell_type": "code",
28-
"execution_count": 62,
29-
"metadata": {},
32+
"execution_count": 3,
33+
"metadata": {
34+
"metadata": {}
35+
},
3036
"outputs": [],
3137
"source": [
3238
"class Groups:\n",
@@ -61,20 +67,22 @@
6167
},
6268
{
6369
"cell_type": "code",
64-
"execution_count": 63,
65-
"metadata": {},
70+
"execution_count": 4,
71+
"metadata": {
72+
"metadata": {}
73+
},
6674
"outputs": [
6775
{
6876
"name": "stderr",
6977
"output_type": "stream",
7078
"text": [
71-
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_89633/62703243.py:19: UserWarning: Player 3 was first multiple times\n",
79+
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_18948/62703243.py:19: UserWarning: Player 3 was first multiple times\n",
7280
" warnings.warn(f\"Player {first_in_group} was first multiple times\")\n",
73-
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_89633/62703243.py:19: UserWarning: Player 1 was first multiple times\n",
81+
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_18948/62703243.py:19: UserWarning: Player 1 was first multiple times\n",
7482
" warnings.warn(f\"Player {first_in_group} was first multiple times\")\n",
75-
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_89633/62703243.py:19: UserWarning: Player 0 was first multiple times\n",
83+
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_18948/62703243.py:19: UserWarning: Player 0 was first multiple times\n",
7684
" warnings.warn(f\"Player {first_in_group} was first multiple times\")\n",
77-
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_89633/62703243.py:19: UserWarning: Player 2 was first multiple times\n",
85+
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_18948/62703243.py:19: UserWarning: Player 2 was first multiple times\n",
7886
" warnings.warn(f\"Player {first_in_group} was first multiple times\")\n"
7987
]
8088
}
@@ -94,8 +102,10 @@
94102
},
95103
{
96104
"cell_type": "code",
97-
"execution_count": 64,
98-
"metadata": {},
105+
"execution_count": 5,
106+
"metadata": {
107+
"metadata": {}
108+
},
99109
"outputs": [
100110
{
101111
"data": {
@@ -108,7 +118,7 @@
108118
" [[1, 2, 4], [3, 5, 6]]]"
109119
]
110120
},
111-
"execution_count": 64,
121+
"execution_count": 5,
112122
"metadata": {},
113123
"output_type": "execute_result"
114124
}
@@ -119,8 +129,10 @@
119129
},
120130
{
121131
"cell_type": "code",
122-
"execution_count": 65,
123-
"metadata": {},
132+
"execution_count": 6,
133+
"metadata": {
134+
"metadata": {}
135+
},
124136
"outputs": [
125137
{
126138
"data": {
@@ -134,7 +146,9 @@
134146
" [23, 21, 19],\n",
135147
" [24, 22, 20],\n",
136148
" [29, 27, 25],\n",
137-
" [30, 28, 26]],\n",
149+
" [30, 28, 26],\n",
150+
" [35, 33, 31],\n",
151+
" [36, 34, 32]],\n",
138152
" [[6, 5, 1],\n",
139153
" [4, 3, 2],\n",
140154
" [12, 11, 7],\n",
@@ -144,7 +158,9 @@
144158
" [24, 23, 19],\n",
145159
" [22, 21, 20],\n",
146160
" [30, 29, 25],\n",
147-
" [28, 27, 26]],\n",
161+
" [28, 27, 26],\n",
162+
" [36, 35, 31],\n",
163+
" [34, 33, 32]],\n",
148164
" [[5, 3, 4],\n",
149165
" [2, 1, 6],\n",
150166
" [11, 9, 10],\n",
@@ -154,7 +170,9 @@
154170
" [23, 21, 22],\n",
155171
" [20, 19, 24],\n",
156172
" [29, 27, 28],\n",
157-
" [26, 25, 30]],\n",
173+
" [26, 25, 30],\n",
174+
" [35, 33, 34],\n",
175+
" [32, 31, 36]],\n",
158176
" [[4, 5, 6],\n",
159177
" [3, 1, 2],\n",
160178
" [10, 11, 12],\n",
@@ -164,7 +182,9 @@
164182
" [22, 23, 24],\n",
165183
" [21, 19, 20],\n",
166184
" [28, 29, 30],\n",
167-
" [27, 25, 26]],\n",
185+
" [27, 25, 26],\n",
186+
" [34, 35, 36],\n",
187+
" [33, 31, 32]],\n",
168188
" [[2, 3, 6],\n",
169189
" [1, 4, 5],\n",
170190
" [8, 9, 12],\n",
@@ -174,7 +194,9 @@
174194
" [20, 21, 24],\n",
175195
" [19, 22, 23],\n",
176196
" [26, 27, 30],\n",
177-
" [25, 28, 29]],\n",
197+
" [25, 28, 29],\n",
198+
" [32, 33, 36],\n",
199+
" [31, 34, 35]],\n",
178200
" [[1, 2, 4],\n",
179201
" [3, 5, 6],\n",
180202
" [7, 8, 10],\n",
@@ -184,10 +206,12 @@
184206
" [19, 20, 22],\n",
185207
" [21, 23, 24],\n",
186208
" [25, 26, 28],\n",
187-
" [27, 29, 30]]]"
209+
" [27, 29, 30],\n",
210+
" [31, 32, 34],\n",
211+
" [33, 35, 36]]]"
188212
]
189213
},
190-
"execution_count": 65,
214+
"execution_count": 6,
191215
"metadata": {},
192216
"output_type": "execute_result"
193217
}
@@ -203,8 +227,10 @@
203227
},
204228
{
205229
"cell_type": "code",
206-
"execution_count": 67,
207-
"metadata": {},
230+
"execution_count": 7,
231+
"metadata": {
232+
"metadata": {}
233+
},
208234
"outputs": [],
209235
"source": [
210236
"with open(\"group_matrices.pkl\", \"wb\") as f:\n",
120 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)