Skip to content

Commit 20d931e

Browse files
committed
update runners
1 parent b6c88cb commit 20d931e

4 files changed

Lines changed: 35 additions & 36 deletions

File tree

cv.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@
2828
# ------------------------------------------------------------------ #
2929

3030

31-
def _add_shared_args(p: argparse.ArgumentParser) -> None:
31+
def _add_shared_args(
32+
p: argparse.ArgumentParser, *, include_portfolio: bool = True
33+
) -> None:
3234
p.add_argument("name", help="Experiment name (used for output file names)")
33-
p.add_argument(
34-
"-p",
35-
"--portfolio",
36-
nargs="+",
37-
default=["SPSO", "IPSO", "SPSOL"],
38-
help="Sub-optimizer names from the portfolio",
39-
)
35+
if include_portfolio:
36+
p.add_argument(
37+
"-p",
38+
"--portfolio",
39+
nargs="+",
40+
default=["SPSO", "IPSO", "SPSOL"],
41+
help="Sub-optimizer names from the portfolio",
42+
)
4043
p.add_argument(
4144
"--fe-multiplier",
4245
type=int,
@@ -121,7 +124,7 @@ def _parse_args() -> argparse.Namespace:
121124
help="Custom RL-DAS: single-dimension, pure-PyTorch PPO",
122125
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
123126
)
124-
_add_shared_args(rl)
127+
_add_shared_args(rl, include_portfolio=False)
125128
rl.add_argument(
126129
"--dim", type=int, default=10, help="Problem dimension (agent is dim-specific)"
127130
)

rl_das_study.slurm

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,28 @@
1010
#SBATCH -A plgrldas2026-gpu-a100
1111
#SBATCH --array=0-7
1212

13-
# Args: SEED [PORTFOLIO...]
13+
# Args: SEED
1414
SEED=${1:-42}
1515

16-
if [ "$#" -lt 2 ]; then
17-
PORTFOLIO=('SPSO' 'IPSO' 'SPSOL')
18-
else
19-
PORTFOLIO=("${@:2}")
20-
fi
21-
22-
PORTFOLIO_STR=$(IFS="_"; echo "${PORTFOLIO[*]}")
23-
2416
ENV_PATH="$SCRATCH/DynamicAlgorithmSelection2/.venv/bin/activate"
2517
source "$ENV_PATH"
2618
mkdir -p logs
2719

2820
DIMS=(2 3 5 10)
2921

30-
echo "Array job $SLURM_ARRAY_TASK_ID | SEED=$SEED | PORTFOLIO=${PORTFOLIO[*]}"
22+
echo "Array job $SLURM_ARRAY_TASK_ID | SEED=$SEED"
3123

3224
# 0-3: CV-LOIO per dimension
3325
if [[ $SLURM_ARRAY_TASK_ID -ge 0 && $SLURM_ARRAY_TASK_ID -le 3 ]]; then
3426
DIM=${DIMS[$SLURM_ARRAY_TASK_ID]}
3527
echo "RL-DAS | CV-LOIO | dim=$DIM"
36-
python cv.py rl-das ${PORTFOLIO_STR}_RLDAS_LOIO_DIM${DIM}_SEED${SEED} \
37-
-p "${PORTFOLIO[@]}" --dim $DIM --cv-mode LOIO --n-epochs 500 --seed $SEED
28+
python cv.py rl-das NL_SHADE_RSP_MADDE_JDE21_RLDAS_LOIO_DIM${DIM}_SEED${SEED} \
29+
--dim $DIM --cv-mode LOIO --n-epochs 500 --seed $SEED
3830

3931
# 4-7: CV-LOPO per dimension
4032
elif [[ $SLURM_ARRAY_TASK_ID -ge 4 && $SLURM_ARRAY_TASK_ID -le 7 ]]; then
4133
DIM=${DIMS[$((SLURM_ARRAY_TASK_ID - 4))]}
4234
echo "RL-DAS | CV-LOPO | dim=$DIM"
43-
python cv.py rl-das ${PORTFOLIO_STR}_RLDAS_LOPO_DIM${DIM}_SEED${SEED} \
44-
-p "${PORTFOLIO[@]}" --dim $DIM --cv-mode LOPO --n-epochs 500 --seed $SEED
35+
python cv.py rl-das NL_SHADE_RSP_MADDE_JDE21_RLDAS_LOPO_DIM${DIM}_SEED${SEED} \
36+
--dim $DIM --cv-mode LOPO --n-epochs 500 --seed $SEED
4537
fi

runner.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@ PORTFOLIOS=(
99
echo "Starting job submissions..."
1010

1111
for SEED in "${SEEDS[@]}"; do
12+
13+
echo "Submitting RL-DAS study | SEED=$SEED"
14+
sbatch rl_das_study.slurm $SEED
15+
sleep 1
16+
1217
for PORTFOLIO in "${PORTFOLIOS[@]}"; do
1318

1419
echo "Submitting PPO study | SEED=$SEED | PORTFOLIO=$PORTFOLIO"
1520
sbatch ppo_study.slurm $SEED $PORTFOLIO
1621
sleep 1
1722

18-
echo "Submitting RL-DAS study | SEED=$SEED | PORTFOLIO=$PORTFOLIO"
19-
sbatch rl_das_study.slurm $SEED $PORTFOLIO
20-
sleep 1
21-
2223
echo "Submitting Exp-DAS study | SEED=$SEED | PORTFOLIO=$PORTFOLIO"
2324
sbatch exp_das_study.slurm $SEED $PORTFOLIO
2425
sleep 1

train.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,18 @@
4141
# ------------------------------------------------------------------ #
4242

4343

44-
def _add_shared_args(p: argparse.ArgumentParser) -> None:
44+
def _add_shared_args(
45+
p: argparse.ArgumentParser, *, include_portfolio: bool = True
46+
) -> None:
4547
p.add_argument("name", help="Experiment name (used for output file names)")
46-
p.add_argument(
47-
"-p",
48-
"--portfolio",
49-
nargs="+",
50-
default=["SPSO", "IPSO", "SPSOL"],
51-
help="Sub-optimizer names from the portfolio",
52-
)
48+
if include_portfolio:
49+
p.add_argument(
50+
"-p",
51+
"--portfolio",
52+
nargs="+",
53+
default=["SPSO", "IPSO", "SPSOL"],
54+
help="Sub-optimizer names from the portfolio",
55+
)
5356
p.add_argument(
5457
"--mode",
5558
choices=["easy", "hard", "random"],
@@ -131,7 +134,7 @@ def _parse_args() -> argparse.Namespace:
131134
help="Custom RL-DAS: single-dimension, pure-PyTorch PPO",
132135
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
133136
)
134-
_add_shared_args(rl)
137+
_add_shared_args(rl, include_portfolio=False)
135138
rl.add_argument(
136139
"--dim", type=int, default=10, help="Problem dimension (agent is dim-specific)"
137140
)

0 commit comments

Comments
 (0)