update the experiments config

- feat add a template in target-runner to change the problem
- loop over irace runs for each problem
This commit is contained in:
Johann Dreo 2021-01-23 16:34:28 +01:00
commit 2fe6d03c8a
5 changed files with 26 additions and 42 deletions

View file

@ -63,7 +63,7 @@ targetRunner = "./target-runner"
## Maximum number of runs (invocations of targetRunner) that will be
## performed. It determines the maximum budget of experiments for the
## tuning.
maxExperiments = 2000
maxExperiments = 100000
## Maximum total execution time in seconds for the executions of
## targetRunner. targetRunner must return two values: cost and time.

View file

@ -25,7 +25,7 @@ error() {
EXE="./fastga"
LOG_DIR="irace_logs"
FIXED_PARAMS="--problem=0"
FIXED_PARAMS="--problem={{PROBLEM}}"
CONFIG_ID=$1
INSTANCE_ID=$2

View file

@ -8,14 +8,12 @@ runs=50
problems=($(seq 0 18))
# Capture anything passed to the script
algo="$@"
outdir="$1"
algo="${@:2}"
# You most probably want to run on release builds.
exe="./release/fastga"
outdir="results"
mkdir -p ${outdir}
i=1 # Loop counter.
for pb in "${problems[@]}" ; do # Iterate over the problems array.
for seed in $(seq ${runs}) ; do # Iterates over runs/seeds.
@ -25,7 +23,7 @@ for pb in "${problems[@]}" ; do # Iterate over the problems array.
# This is the command to be ran.
cmd="${exe} --problem=${pb} --seed=${seed} ${algo}"
# echo ${cmd} # Print the command.
echo ${cmd} # Print the command.
# Progress print.
echo -n "problem ${pb}, run ${seed}"

View file

@ -1,22 +0,0 @@
#!/bin/bash
algos=(
"--crossover-rate=0 --cross-selector=0 --crossover=0 --mutation-rate=0 --mut-selector=0 --mutation=0 --replacement=0"
"--crossover-rate=1 --cross-selector=0 --crossover=0 --mutation-rate=0 --mut-selector=0 --mutation=0 --replacement=0"
"--crossover-rate=2 --cross-selector=0 --crossover=0 --mutation-rate=0 --mut-selector=0 --mutation=0 --replacement=0"
)
i=1 # Loop counter.
for algo in "${algos[@]}" ; do
echo "${algo}"
name="$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
./run_algo.sh ${algo} &> "expe_${name}.log"
perc=$(echo "scale=2;${i}/${#algos[@]}*100" | bc)
echo -e "${perc}%\n"
i=$((i+1))
done
echo "Done"

View file

@ -1,19 +1,27 @@
#!/bin/bash
if [[ $# != 1 ]] ; then
echo "ERROR: build dir not indicated"
exit 1
fi
outdir="$(date --iso-8601=minutes)_results_irace"
mkdir ${outdir}
cd ${outdir}
cd $1
pwd
for p in $(seq 0 18) ; do
echo -n "Problem ${p}... "
res="results_problem_${p}"
mkdir ${res}
cd ${res}
# Fore some reason, irace absolutely need those files...
cp ../irace-config/example.scen .
cp ../irace-config/target-runner .
cp ../irace-config/default.instances .
# Fore some reason, irace absolutely need those files...
cp ../../irace-config/example.scen .
cp ../../irace-config/default.instances .
cp ../../release/fastga .
cat ../../irace-config/target-runner | sed "s/{{PROBLEM}}/${p}/" > ./target-runner
chmod u+x target-runner
# Generate the parameter list file.
./fastga -h > fastga.param 2>/dev/null
/usr/lib/R/site-library/irace/bin/irace --scenario example.scen 2>&1 | tee irace.log
# Generate the parameter list file.
./fastga -h > fastga.param 2>/dev/null
# /usr/lib/R/site-library/irace/bin/irace --scenario example.scen 2>&1 | tee irace.log
/usr/lib/R/site-library/irace/bin/irace --scenario example.scen &> irace.log
cd ..
echo " done"
done