#!/bin/bash
# Copyright 2021,2022,2023 Sony Group Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

if [ $# -lt 5 ] && [ $# -gt 6 ]; then
    echo "usage: $0 <script_file_name> <gpu_id> <env> <save_dir> <num_seeds> <batch_size>"
    exit 1
fi
RESULTDIR="$4/$3_results"
NUM_SEEDS=$5

if [ $NUM_SEEDS -eq 3 ]; then
    for seed in 1 10 100
    do
        if [ $# -eq 5 ]; then
            python $1 --gpu $2 --seed $seed --env $3 --save-dir $4
        else
            python $1 --gpu $2 --seed $seed --env $3 --save-dir $4 --batch-size $6
        fi
    done
else
    for seed in $(seq 1 $NUM_SEEDS);
    do
        if [ $# -eq 5 ]; then
            python $1 --gpu $2 --seed $seed --env $3 --save-dir $4
        else
            python $1 --gpu $2 --seed $seed --env $3 --save-dir $4 --batch-size $6
        fi
    done
fi