#!/bin/bash

# -------------------------------
# Metalauncher for RNN + Attention
# -------------------------------

# Target region with more balanced LAI
REGION="W011"

# Early stopping patience (faster tuning phase)
PATIENCE="5"

# Fixed parameters
CELL_TYPE="rnn"
ATTENTION="True"
TEACHER_FORCING="0.0"
LOG_SCALE="False"
BATCH_SIZE="16384"
CSV_LOG="True"
CSV_FILE="parameter_tuning_RNN.csv"

# Parameter grid
DROPOUT_VALUES=("0.0" "0.25" "0.5")
HIDDEN_SIZE_VALUES=("16" "32" "64" "128")
WEIGHT_DECAY_VALUES=("0.0" "1e-5" "1e-4")

# Loop through combinations
for DROPOUT in "${DROPOUT_VALUES[@]}"; do
  for HIDDEN_SIZE in "${HIDDEN_SIZE_VALUES[@]}"; do
    for WEIGHT_DECAY in "${WEIGHT_DECAY_VALUES[@]}"; do
      echo "Submitting RNN (attn) | hidden=$HIDDEN_SIZE | dropout=$DROPOUT | wd=$WEIGHT_DECAY | tf=$TEACHER_FORCING | log_scale=$LOG_SCALE"
      sbatch -A bsc32 -q acc_bsces launch_training_rnn_multiconfig.sh \
        $CELL_TYPE $ATTENTION $DROPOUT $HIDDEN_SIZE $PATIENCE $REGION $TEACHER_FORCING $LOG_SCALE $WEIGHT_DECAY $BATCH_SIZE $CSV_LOG $CSV_FILE
      sleep 1
    done
  done
done
