Skip to content

Commit

Permalink
Adjust to a total number of participants of 36 instead of 30
Browse files Browse the repository at this point in the history
  • Loading branch information
miawlu committed May 6, 2024
1 parent 6b47c20 commit 5cb1f58
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 29 deletions.
6 changes: 4 additions & 2 deletions live_bargaining/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,17 @@

def creating_session(subsession):
num_active_groups = len(subsession.get_groups())
if num_active_groups == 10:
if num_active_groups <= 12 and num_active_groups % 2 == 0:
subsession_index = subsession.round_number - 1
with open(
"preparation/group_matrices/group_matrices.pkl",
"rb",
) as file:
group_matrices = pickle.load(file)
if subsession_index < len(group_matrices):
subsession.set_group_matrix(group_matrices[subsession_index])
subsession.set_group_matrix(
group_matrices[subsession_index][:num_active_groups]
)
else:
subsession.group_randomly()
else:
Expand Down
80 changes: 53 additions & 27 deletions preparation/group_matrices/create_group_matrices.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
"cells": [
{
"cell_type": "code",
"execution_count": 60,
"metadata": {},
"execution_count": 1,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"import pickle\n",
Expand All @@ -14,19 +16,23 @@
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"execution_count": 2,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"num_groups = 2 # number of groups per matching group\n",
"num_match_grp = 5\n",
"num_match_grp = 6\n",
"num_rounds = 6"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"execution_count": 3,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"class Groups:\n",
Expand Down Expand Up @@ -61,20 +67,22 @@
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"execution_count": 4,
"metadata": {
"metadata": {}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_89633/62703243.py:19: UserWarning: Player 3 was first multiple times\n",
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_18948/62703243.py:19: UserWarning: Player 3 was first multiple times\n",
" warnings.warn(f\"Player {first_in_group} was first multiple times\")\n",
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_89633/62703243.py:19: UserWarning: Player 1 was first multiple times\n",
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_18948/62703243.py:19: UserWarning: Player 1 was first multiple times\n",
" warnings.warn(f\"Player {first_in_group} was first multiple times\")\n",
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_89633/62703243.py:19: UserWarning: Player 0 was first multiple times\n",
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_18948/62703243.py:19: UserWarning: Player 0 was first multiple times\n",
" warnings.warn(f\"Player {first_in_group} was first multiple times\")\n",
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_89633/62703243.py:19: UserWarning: Player 2 was first multiple times\n",
"/var/folders/ml/b6fb3hq91m70wjn5hjgyky58kdcssc/T/ipykernel_18948/62703243.py:19: UserWarning: Player 2 was first multiple times\n",
" warnings.warn(f\"Player {first_in_group} was first multiple times\")\n"
]
}
Expand All @@ -94,8 +102,10 @@
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"execution_count": 5,
"metadata": {
"metadata": {}
},
"outputs": [
{
"data": {
Expand All @@ -108,7 +118,7 @@
" [[1, 2, 4], [3, 5, 6]]]"
]
},
"execution_count": 64,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -119,8 +129,10 @@
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"execution_count": 6,
"metadata": {
"metadata": {}
},
"outputs": [
{
"data": {
Expand All @@ -134,7 +146,9 @@
" [23, 21, 19],\n",
" [24, 22, 20],\n",
" [29, 27, 25],\n",
" [30, 28, 26]],\n",
" [30, 28, 26],\n",
" [35, 33, 31],\n",
" [36, 34, 32]],\n",
" [[6, 5, 1],\n",
" [4, 3, 2],\n",
" [12, 11, 7],\n",
Expand All @@ -144,7 +158,9 @@
" [24, 23, 19],\n",
" [22, 21, 20],\n",
" [30, 29, 25],\n",
" [28, 27, 26]],\n",
" [28, 27, 26],\n",
" [36, 35, 31],\n",
" [34, 33, 32]],\n",
" [[5, 3, 4],\n",
" [2, 1, 6],\n",
" [11, 9, 10],\n",
Expand All @@ -154,7 +170,9 @@
" [23, 21, 22],\n",
" [20, 19, 24],\n",
" [29, 27, 28],\n",
" [26, 25, 30]],\n",
" [26, 25, 30],\n",
" [35, 33, 34],\n",
" [32, 31, 36]],\n",
" [[4, 5, 6],\n",
" [3, 1, 2],\n",
" [10, 11, 12],\n",
Expand All @@ -164,7 +182,9 @@
" [22, 23, 24],\n",
" [21, 19, 20],\n",
" [28, 29, 30],\n",
" [27, 25, 26]],\n",
" [27, 25, 26],\n",
" [34, 35, 36],\n",
" [33, 31, 32]],\n",
" [[2, 3, 6],\n",
" [1, 4, 5],\n",
" [8, 9, 12],\n",
Expand All @@ -174,7 +194,9 @@
" [20, 21, 24],\n",
" [19, 22, 23],\n",
" [26, 27, 30],\n",
" [25, 28, 29]],\n",
" [25, 28, 29],\n",
" [32, 33, 36],\n",
" [31, 34, 35]],\n",
" [[1, 2, 4],\n",
" [3, 5, 6],\n",
" [7, 8, 10],\n",
Expand All @@ -184,10 +206,12 @@
" [19, 20, 22],\n",
" [21, 23, 24],\n",
" [25, 26, 28],\n",
" [27, 29, 30]]]"
" [27, 29, 30],\n",
" [31, 32, 34],\n",
" [33, 35, 36]]]"
]
},
"execution_count": 65,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -203,8 +227,10 @@
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"execution_count": 7,
"metadata": {
"metadata": {}
},
"outputs": [],
"source": [
"with open(\"group_matrices.pkl\", \"wb\") as f:\n",
Expand Down
Binary file modified preparation/group_matrices/group_matrices.pkl
Binary file not shown.

0 comments on commit 5cb1f58

Please sign in to comment.