diff --git a/eo/contrib/irace/irace-config/example.scen b/eo/contrib/irace/irace-config/example.scen index 6c7abb972..4a407e06a 100644 --- a/eo/contrib/irace/irace-config/example.scen +++ b/eo/contrib/irace/irace-config/example.scen @@ -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. diff --git a/eo/contrib/irace/irace-config/target-runner b/eo/contrib/irace/irace-config/target-runner index 6d6e39dd7..87cf07e91 100755 --- a/eo/contrib/irace/irace-config/target-runner +++ b/eo/contrib/irace/irace-config/target-runner @@ -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 diff --git a/eo/contrib/irace/run_algo.sh b/eo/contrib/irace/run_algo.sh index 32e8f9218..3dcd0da07 100755 --- a/eo/contrib/irace/run_algo.sh +++ b/eo/contrib/irace/run_algo.sh @@ -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}" diff --git a/eo/contrib/irace/run_expe.sh b/eo/contrib/irace/run_expe.sh deleted file mode 100755 index b864cf36e..000000000 --- a/eo/contrib/irace/run_expe.sh +++ /dev/null @@ -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" diff --git a/eo/contrib/irace/run_irace.sh b/eo/contrib/irace/run_irace.sh index 17c79e88d..1e0cd7a1d 100755 --- a/eo/contrib/irace/run_irace.sh +++ b/eo/contrib/irace/run_irace.sh @@ -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