#!/bin/bash

cd ..

DATA=/drive1/data
DASSL=/home/savertm/Project/Dassl.pytorch



################### leave one domain out setting
DATASET=pacs #office_home_dg #pacs
TRAINER=Vanilla2
#NET=resnet18_dsu_l123
#NET=resnet18_dsu_l123456
#NET=resnet18_gcd_l123456
#NET=resnet50_gcd_l123456
#NET=resnet18_gcd_wodl_l123456
#NET=uresnet50
#NET=resnet18_gcdiv_l123456
#NET=resnet50_gcdiv_l123456
#NET=resnet50_cb_uniform_mix_l12
NET=resnet18_cb_uniform_efdmix_l123
#NET=resnet50_cb_uniform_efdmix_l12
#NET=resnet50_cb_uniform_mix_l12
#NET=resnet18_cb_uniform_dsu_l123456
MIX=random #crossdomain #random

if [ ${DATASET} == pacs ]; then
    D1=art_painting
    D2=cartoon
    D3=photo
    D4=sketch
elif [ ${DATASET} == office_home_dg ]; then
    D1=art
    D2=clipart
    D3=product
    D4=real_world
elif [ ${DATASET} == vlcs ]; then
    D1=caltech
    D2=labelme
    D3=pascal
    D4=sun
fi

GPU_number=7
for SEED in $(seq 1 5) 
do
    for SETUP in $(seq 1 1)
    do
        if [ ${SETUP} == 1 ]; then
            S1=${D2}
            S2=${D3}
            S3=${D4}
            T=${D1}
        elif [ ${SETUP} == 2 ]; then
            S1=${D1}
            S2=${D3}
            S3=${D4}
            T=${D2}
        elif [ ${SETUP} == 3 ]; then
            S1=${D1}
            S2=${D2}
            S3=${D4}
            T=${D3}
        elif [ ${SETUP} == 4 ]; then
            S1=${D1}
            S2=${D2}
            S3=${D3}
            T=${D4}
        fi


        CUDA_VISIBLE_DEVICES=${GPU_number} python train.py \
        --root ${DATA} \
        --seed ${SEED} \
        --trainer ${TRAINER} \
        --source-domains ${S1} ${S2} ${S3}  \
        --target-domains ${T} \
        --dataset-config-file ${DASSL}/configs/datasets/dg/${DATASET}.yaml \
        --config-file configs/trainers/mixstyle/${DATASET}_${MIX}.yaml \
	--output-dir DSU/${DATASET}/${TRAINER}/${NET}_our_code/${MIX}/${T}/seed${SEED} \
	MODEL.BACKBONE.NAME ${NET}
	done
done



#for SEED in $(seq 1 5)
#do
    #for SETUP in $(seq 1 4)
    #do
        #if [ ${SETUP} == 1 ]; then
           #S1=${D2}
           #S2=${D3}
           #S3=${D4}
           #T=${D1}
        #elif [ ${SETUP} == 2 ]; then
            #S1=${D1}
            #S2=${D3}
            #S3=${D4}
            #T=${D2}
        #elif [ ${SETUP} == 3 ]; then
            #S1=${D1}
            #S2=${D2}
            #S3=${D4}
            #T=${D3}
        #elif [ ${SETUP} == 4 ]; then
            #S1=${D1}
            #S2=${D2}
            #S3=${D3}
            #T=${D4}
        #fi

        #python train.py \
        #--root ${DATA} \
        #--seed ${SEED} \
        #--trainer ${TRAINER} \
        #--source-domains ${T}  \
        #--target-domains ${S1} ${S2} ${S3} \
        #--dataset-config-file ${DASSL}/configs/datasets/dg/${DATASET}.yaml \
        #--config-file configs/trainers/mixstyle/${DATASET}_${MIX}.yaml \
        #--output-dir EFDMix/${DATASET}/${TRAINER}_singles/${NET}_nodetach/${MIX}/${T}/seed${SEED} \
        #MODEL.BACKBONE.NAME ${NET}

    #done
#done
