#!/usr/bin/env bash

# NOTE: Requires GNU parallel
# USAGE: MAX_PARTICLES=... sp-harness.bash <model> <run_id> <probabilities...>

# Run ID
MODEL="$1"
ID="$2"

shift
shift

ROOT="data/$ID"
mkdir -p "$ROOT"

PROBABILITIES=$@

for i in $PROBABILITIES; do
  mkdir -p "$ROOT/$i"
done

MAX_PARTICLES="${MAX_PARTICLES:=2000}"

SEEDS="${SEEDS:=$(seq 1 100)}"
RUST_BACKTRACE=1 parallel "'$MODEL'" '{1}' $MAX_PARTICLES '{2}' "$ROOT/{2}/{1}.csv" ::: $SEEDS ::: $PROBABILITIES
