Make gen_data.sh shuffle patient data and use it for therapists

This commit is contained in:
Sam A. 2023-05-03 17:01:29 +02:00
parent 70c25542b1
commit cbdf6e9e17
Signed by: samsapti
GPG Key ID: CBBBE7371E81C4EA
4 changed files with 21 additions and 23 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/ansible/inventory
/ansible/.vagrant/
/src/out-p?.txt

View File

@ -105,7 +105,7 @@ class Matchmaker:
# Constants
PLAYERS = 3
MATCHING_SIZE = 5
MATCHING_SIZE = 10
p_shares = Matrix(rows=PLAYERS, columns=MATCHING_SIZE, value_type=types.sint)
t_shares = Matrix(rows=PLAYERS, columns=MATCHING_SIZE, value_type=types.sint)
@ -120,7 +120,7 @@ def _(i):
@do_while
def _():
try:
typ = sint.get_input_from(i)
typ = cint.get_input_from(i)
@if_e(typ == -100)
def _():

View File

@ -15,31 +15,27 @@ secret_share() {
share_2="$(( secret - (share_0 + share_1) ))"
}
declare -a p_data_0
declare -a p_data_1
declare -a p_data_2
declare -a t_data_0
declare -a t_data_1
declare -a t_data_2
max_index=5
iter="$1"
for _ in $(seq "$1"); do
for _ in $(seq "$iter"); do
rand="$(( (RANDOM % max_index) + 1 ))"
secret_share "$rand"
p_data_0+=("$(patient_pref $share_0)")
p_data_1+=("$(patient_pref $share_1)")
p_data_2+=("$(patient_pref $share_2)")
p_data_s+=( "$rand" )
p_data_0+=( "$(patient_pref $share_0)" )
p_data_1+=( "$(patient_pref $share_1)" )
p_data_2+=( "$(patient_pref $share_2)" )
done
for _ in $(seq "$1"); do
rand="$(( (RANDOM % max_index) + 1 ))"
secret_share "$rand"
t_data_s=( $(shuf -e "${p_data_s[@]}") )
t_data_0+=("$(therapist_pref $share_0)")
t_data_1+=("$(therapist_pref $share_1)")
t_data_2+=("$(therapist_pref $share_2)")
for i in $(seq 0 "$(( iter - 1 ))"); do
secret_share "${t_data_s[$i]}"
t_data_0+=( "$(therapist_pref $share_0)" )
t_data_1+=( "$(therapist_pref $share_1)" )
t_data_2+=( "$(therapist_pref $share_2)" )
done
for i in $(seq 0 2); do

View File

@ -1,6 +1,7 @@
#!/usr/bin/env sh
#!/usr/bin/env bash
MACHINE="$1"
shift
cd MP-SPDZ
"./$MACHINE" "$@"
for i in $(seq 0 2); do
eval ".//semi-party.x -N 3 -p $i gale_shapley > ../out-p$i.txt 2>&1 &"
done