export CUDA_VISIBLE_DEVICES=$1
cd ../pymarl
ego_run_name=$2
llm_tm_index=$3
t_max=$4
reg_coef=$5
env_idx=$6
env=$7
tm_model_paths=$8
last_ego_model_path=$9
if [[ $env == *"lbf"* ]]; then
    j=$((llm_tm_index+4))
    nohup python3 src/main.py --continual --config=vdn --env-config=lbf4 --seed=1 --name=$ego_run_name --runner=episode_xp --save_model_interval=50000 --t_max=$t_max --reg_coef=$reg_coef with env_args.key="lbforaging:Foraging-8x8-2p-4f-r$j-v1" checkpoint_path_tm_lst=[$tm_model_paths] last_ego_model_path=$last_ego_model_path > $ego_run_name.out 2>&1 &
elif [[ $env == *"pp"* ]]; then
    nohup python3 src/main.py --continual --config=vdn --env-config=pp --seed=1 --name=$ego_run_name --runner=episode_xp --save_model_interval=50000 --t_max=$t_max --reg_coef=$reg_coef with env_args.key="mpe:SimpleTag-$env_idx-$llm_tm_index-v0" checkpoint_path_tm_lst=[$tm_model_paths] last_ego_model_path=$last_ego_model_path > $ego_run_name.out 2>&1 &
elif [[ $env == *"sc2"* ]]; then
    nohup python3 src/main.py --continual --config=vdn --env-config=sc2_v2 --seed=1 --name=$ego_run_name --runner=episode_xp --save_model_interval=100000 --t_max=$t_max --reg_coef=$reg_coef with env_args.env_id=$env_idx env_args.additional_reward_id=$llm_tm_index checkpoint_path_tm_lst=[$tm_model_paths] last_ego_model_path=$last_ego_model_path > $ego_run_name.out 2>&1 &
else
    echo "No matching pattern found in the name."
fi
