Add experimental scripts for irace/fastga
This commit is contained in:
parent
c9cbd4ee14
commit
6febf4cceb
22 changed files with 1209 additions and 0 deletions
16
eo/contrib/irace/expe/beta/csv_all_bests.sh
Executable file
16
eo/contrib/irace/expe/beta/csv_all_bests.sh
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
ldata=$1
|
||||
file_py=$2
|
||||
csvdir="csv_FA"
|
||||
ldir=$(echo $(ls ${ldata}))
|
||||
for data in ${ldir[@]} ; do
|
||||
path="${ldata}/${data}"
|
||||
cmd="python3 ${file_py} ${path}"
|
||||
plan_name=$(echo ${data} | sed "s/data//")
|
||||
mexp=$(echo ${data[@]} | cut -d _ -f2)
|
||||
mevals=$(echo ${data[@]} | cut -d _ -f3)
|
||||
ddate=$(echo ${data[@]} | cut -d _ -f4)
|
||||
name="results_irace_plan${plan_name[@]:0:1}_${mexp}_${mevals}_${ddate}"
|
||||
mkdir -p "${csvdir}/csv_plan${plan_name[@]:0:1}"
|
||||
${cmd} > "${csvdir}/csv_plan${plan_name[@]:0:1}/${name}.csv"
|
||||
done
|
||||
22
eo/contrib/irace/expe/beta/fastga_elites_all.sh
Normal file
22
eo/contrib/irace/expe/beta/fastga_elites_all.sh
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
ldata=$1 # eg : ./csv_plan2/ don t forget to end the path with /
|
||||
file_py=$2
|
||||
ldir=$(echo $(ls ${ldata}))
|
||||
fastga_dir="fastga_results_all"
|
||||
mkdir -p /scratchbeta/${USER}/${fatga_dir}
|
||||
#mkdir -p "/home/${USER}/${fastga_dir}/fastga_results_plan1"
|
||||
mkdir -p "/scratchbeta/${USER}/${fastga_dir}/fastga_results_planF"
|
||||
mkdir -p "/scratchbeta/${USER}/${fastga_dir}/fastga_results_planA"
|
||||
|
||||
for data in ${ldir[@]} ; do
|
||||
path_csv="${ldata}${data}"
|
||||
plan_name=$(echo ${data} | sed "s/results_irace_plan//")
|
||||
mexp=$(echo ${data[@]} | cut -d _ -f4)
|
||||
mexp_id=$(echo ${mexp} | cut -d = -f2)
|
||||
mevals=$(echo ${data[@]} | cut -d _ -f5)
|
||||
mevals_id=$(echo ${mevals} | cut -d = -f2)
|
||||
path="/scratchbeta/${USER}/${fastga_dir}/fastga_results_plan${plan_name[@]:0:1}"
|
||||
cmd="bash ${file_py} ${path_csv} ${mexp_id} ${mevals_id} ${path}"
|
||||
name="fastga${plan_name[@]:0:1}_${mexp}_${mevals}_$(date -Iseconds)_results_elites_all"
|
||||
${cmd} &> "${path}/output${plan_name[@]:0:1}_fastga_${mexp}_${mevals}_$(date -Iseconds).txt"
|
||||
done
|
||||
27
eo/contrib/irace/expe/beta/irace_files_pA/default.instances
Executable file
27
eo/contrib/irace/expe/beta/irace_files_pA/default.instances
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
## This is an example of specifying instances with a file.
|
||||
|
||||
# Each line is an instance relative to trainInstancesDir
|
||||
# (see scenario.txt.tmpl) and an optional sequence of instance-specific
|
||||
# parameters that will be passed to target-runnerx when invoked on that
|
||||
# instance.
|
||||
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
|
||||
227
eo/contrib/irace/expe/beta/irace_files_pA/example.scen
Executable file
227
eo/contrib/irace/expe/beta/irace_files_pA/example.scen
Executable file
|
|
@ -0,0 +1,227 @@
|
|||
###################################################### -*- mode: r -*- #####
|
||||
## Scenario setup for Iterated Race (irace).
|
||||
############################################################################
|
||||
|
||||
## To use the default value of a parameter of iRace, simply do not set
|
||||
## the parameter (comment it out in this file, and do not give any
|
||||
## value on the command line).
|
||||
|
||||
## File that contains the description of the parameters of the target
|
||||
## algorithm.
|
||||
parameterFile = "./fastga.param"
|
||||
|
||||
## Directory where the programs will be run.
|
||||
execDir = "."
|
||||
|
||||
## File to save tuning results as an R dataset, either absolute path or
|
||||
## relative to execDir.
|
||||
# logFile = "./irace.Rdata"
|
||||
|
||||
## Previously saved log file to recover the execution of irace, either
|
||||
## absolute path or relative to the current directory. If empty or NULL,
|
||||
## recovery is not performed.
|
||||
# recoveryFile = ""
|
||||
|
||||
## Directory where training instances are located; either absolute path or
|
||||
## relative to current directory. If no trainInstancesFiles is provided,
|
||||
## all the files in trainInstancesDir will be listed as instances.
|
||||
trainInstancesDir = "."
|
||||
|
||||
## File that contains a list of training instances and optionally
|
||||
## additional parameters for them. If trainInstancesDir is provided, irace
|
||||
## will search for the files in this folder.
|
||||
trainInstancesFile = "./default.instances"
|
||||
|
||||
## File that contains a table of initial configurations. If empty or NULL,
|
||||
## all initial configurations are randomly generated.
|
||||
# configurationsFile = ""
|
||||
|
||||
## File that contains a list of logical expressions that cannot be TRUE
|
||||
## for any evaluated configuration. If empty or NULL, do not use forbidden
|
||||
## expressions.
|
||||
forbiddenFile = "./forbidden.txt"
|
||||
|
||||
## Script called for each configuration that executes the target algorithm
|
||||
## to be tuned. See templates.
|
||||
targetRunner = "./target-runner"
|
||||
|
||||
## Number of times to retry a call to targetRunner if the call failed.
|
||||
# targetRunnerRetries = 0
|
||||
|
||||
## Optional data passed to targetRunner. This is ignored by the default
|
||||
## targetRunner function, but it may be used by custom targetRunner
|
||||
## functions to pass persistent data around.
|
||||
# targetRunnerData = ""
|
||||
|
||||
## Optional R function to provide custom parallelization of targetRunner.
|
||||
# targetRunnerParallel = ""
|
||||
|
||||
## Optional script or R function that provides a numeric value for each
|
||||
## configuration. See templates/target-evaluator.tmpl
|
||||
# targetEvaluator = ""
|
||||
|
||||
## Maximum number of runs (invocations of targetRunner) that will be
|
||||
## performed. It determines the maximum budget of experiments for the
|
||||
## tuning.
|
||||
maxExperiments = 0 #100000
|
||||
|
||||
## Maximum total execution time in seconds for the executions of
|
||||
## targetRunner. targetRunner must return two values: cost and time.
|
||||
# maxTime = 60
|
||||
|
||||
## Fraction (smaller than 1) of the budget used to estimate the mean
|
||||
## computation time of a configuration. Only used when maxTime > 0
|
||||
# budgetEstimation = 0.02
|
||||
|
||||
## Maximum number of decimal places that are significant for numerical
|
||||
## (real) parameters.
|
||||
digits = 2
|
||||
|
||||
## Debug level of the output of irace. Set this to 0 to silence all debug
|
||||
## messages. Higher values provide more verbose debug messages.
|
||||
# debugLevel = 0
|
||||
|
||||
## Number of iterations.
|
||||
# nbIterations = 0
|
||||
|
||||
## Number of runs of the target algorithm per iteration.
|
||||
# nbExperimentsPerIteration = 0
|
||||
|
||||
## Randomly sample the training instances or use them in the order given.
|
||||
# sampleInstances = 1
|
||||
|
||||
## Statistical test used for elimination. Default test is always F-test
|
||||
## unless capping is enabled, in which case the default test is t-test.
|
||||
## Valid values are: F-test (Friedman test), t-test (pairwise t-tests with
|
||||
## no correction), t-test-bonferroni (t-test with Bonferroni's correction
|
||||
## for multiple comparisons), t-test-holm (t-test with Holm's correction
|
||||
## for multiple comparisons).
|
||||
# testType = "F-test"
|
||||
|
||||
## Number of instances evaluated before the first elimination test. It
|
||||
## must be a multiple of eachTest.
|
||||
# firstTest = 5
|
||||
|
||||
## Number of instances evaluated between elimination tests.
|
||||
# eachTest = 1
|
||||
|
||||
## Minimum number of configurations needed to continue the execution of
|
||||
## each race (iteration).
|
||||
# minNbSurvival = 0
|
||||
|
||||
## Number of configurations to be sampled and evaluated at each iteration.
|
||||
# nbConfigurations = 0
|
||||
|
||||
## Parameter used to define the number of configurations sampled and
|
||||
## evaluated at each iteration.
|
||||
# mu = 5
|
||||
|
||||
## Confidence level for the elimination test.
|
||||
# confidence = 0.95
|
||||
|
||||
## If the target algorithm is deterministic, configurations will be
|
||||
## evaluated only once per instance.
|
||||
# deterministic = 0
|
||||
|
||||
## Seed of the random number generator (by default, generate a random
|
||||
## seed).
|
||||
# seed = NA
|
||||
|
||||
## Number of calls to targetRunner to execute in parallel. Values 0 or 1
|
||||
## mean no parallelization.
|
||||
# parallel = 0
|
||||
|
||||
## Enable/disable load-balancing when executing experiments in parallel.
|
||||
## Load-balancing makes better use of computing resources, but increases
|
||||
## communication overhead. If this overhead is large, disabling
|
||||
## load-balancing may be faster.
|
||||
# loadBalancing = 1
|
||||
|
||||
## Enable/disable MPI. Use Rmpi to execute targetRunner in parallel
|
||||
## (parameter parallel is the number of slaves).
|
||||
# mpi = 0
|
||||
|
||||
## Specify how irace waits for jobs to finish when targetRunner submits
|
||||
## jobs to a batch cluster: sge, pbs, torque or slurm. targetRunner must
|
||||
## submit jobs to the cluster using, for example, qsub.
|
||||
# batchmode = 0
|
||||
|
||||
## Enable/disable the soft restart strategy that avoids premature
|
||||
## convergence of the probabilistic model.
|
||||
# softRestart = 1
|
||||
|
||||
## Soft restart threshold value for numerical parameters. If NA, NULL or
|
||||
## "", it is computed as 10^-digits.
|
||||
# softRestartThreshold = ""
|
||||
|
||||
## Directory where testing instances are located, either absolute or
|
||||
## relative to current directory.
|
||||
# testInstancesDir = ""
|
||||
|
||||
## File containing a list of test instances and optionally additional
|
||||
## parameters for them.
|
||||
# testInstancesFile = ""
|
||||
|
||||
## Number of elite configurations returned by irace that will be tested if
|
||||
## test instances are provided.
|
||||
# testNbElites = 1
|
||||
|
||||
## Enable/disable testing the elite configurations found at each
|
||||
## iteration.
|
||||
# testIterationElites = 0
|
||||
|
||||
## Enable/disable elitist irace.
|
||||
# elitist = 1
|
||||
|
||||
## Number of instances added to the execution list before previous
|
||||
## instances in elitist irace.
|
||||
# elitistNewInstances = 1
|
||||
|
||||
## In elitist irace, maximum number per race of elimination tests that do
|
||||
## not eliminate a configuration. Use 0 for no limit.
|
||||
# elitistLimit = 2
|
||||
|
||||
## User-defined R function that takes a configuration generated by irace
|
||||
## and repairs it.
|
||||
# repairConfiguration = ""
|
||||
|
||||
## Enable the use of adaptive capping, a technique designed for minimizing
|
||||
## the computation time of configurations. This is only available when
|
||||
## elitist is active.
|
||||
# capping = 0
|
||||
|
||||
## Measure used to obtain the execution bound from the performance of the
|
||||
## elite configurations: median, mean, worst, best.
|
||||
# cappingType = "median"
|
||||
|
||||
## Method to calculate the mean performance of elite configurations:
|
||||
## candidate or instance.
|
||||
# boundType = "candidate"
|
||||
|
||||
## Maximum execution bound for targetRunner. It must be specified when
|
||||
## capping is enabled.
|
||||
# boundMax = 0
|
||||
|
||||
## Precision used for calculating the execution time. It must be specified
|
||||
## when capping is enabled.
|
||||
# boundDigits = 0
|
||||
|
||||
## Penalization constant for timed out executions (executions that reach
|
||||
## boundMax execution time).
|
||||
# boundPar = 1
|
||||
|
||||
## Replace the configuration cost of bounded executions with boundMax.
|
||||
# boundAsTimeout = 1
|
||||
|
||||
## Percentage of the configuration budget used to perform a postselection
|
||||
## race of the best configurations of each iteration after the execution
|
||||
## of irace.
|
||||
# postselection = 0
|
||||
|
||||
## Enable/disable AClib mode. This option enables compatibility with
|
||||
## GenericWrapper4AC as targetRunner script.
|
||||
# aclib = 0
|
||||
|
||||
## END of scenario file
|
||||
############################################################################
|
||||
|
||||
12
eo/contrib/irace/expe/beta/irace_files_pA/fastga.param
Executable file
12
eo/contrib/irace/expe/beta/irace_files_pA/fastga.param
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
# name switch type range
|
||||
# continuator "--continuator=" c (0)
|
||||
crossoverrate "--crossover-rate=" r (0,1)
|
||||
crossselector "--cross-selector=" c (0,1,2,3,4,5,6)
|
||||
# aftercrossselector "--aftercross-selector=" c (0)
|
||||
crossover "--crossover=" c (0,1,2,3,4,5,6,7,8,9)
|
||||
mutationrate "--mutation-rate=" r (0,1)
|
||||
mutselector "--mut-selector=" c (0,1,2,3,4,5,6)
|
||||
mutation "--mutation=" c (0,1,2,3,4,5,6,7,8,9,10)
|
||||
replacement "--replacement=" c (0,1,2,3,4,5,6,7,8,9,10)
|
||||
popsize "--pop-size=" i (1,50)
|
||||
offspringsize "--offspring-size=" i (1,50)
|
||||
89
eo/contrib/irace/expe/beta/irace_files_pA/target-runner
Executable file
89
eo/contrib/irace/expe/beta/irace_files_pA/target-runner
Executable file
|
|
@ -0,0 +1,89 @@
|
|||
#!/bin/bash
|
||||
###############################################################################
|
||||
# This script is the command that is executed every run.
|
||||
# Check the examples in examples/
|
||||
#
|
||||
# This script is run in the execution directory (execDir, --exec-dir).
|
||||
#
|
||||
# PARAMETERS:
|
||||
# $1 is the candidate configuration number
|
||||
# $2 is the instance ID
|
||||
# $3 is the seed
|
||||
# $4 is the instance name
|
||||
# The rest ($* after `shift 4') are parameters to the run
|
||||
#
|
||||
# RETURN VALUE:
|
||||
# This script should print one numerical value: the cost that must be minimized.
|
||||
# Exit with 0 if no error, with 1 in case of error
|
||||
###############################################################################
|
||||
error() {
|
||||
echo "`TZ=UTC date`: $0: error: $@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
EXE="./fastga"
|
||||
LOG_DIR="irace_logs"
|
||||
|
||||
#FIXED_PARAMS="--problem=0"
|
||||
#
|
||||
CONFIG_ID=$1
|
||||
INSTANCE_ID=$2
|
||||
SEED=$3
|
||||
INSTANCE=$(echo $4 | sed 's/\//\n/g'|tail -n 1)
|
||||
CROSSOVER_RATE=$5
|
||||
CROSSOVER_SELECTOR=$6
|
||||
CROSSOVER=$7
|
||||
MUTATION_RATE=$8
|
||||
MUT_SELECTOR=$9
|
||||
MUTATION=${10}
|
||||
REPLACEMENT=${11}
|
||||
POPSIZE=${12}
|
||||
OFFSPRINGSIZE=${13}
|
||||
shift 13 || error "Not enough parameters"
|
||||
|
||||
INSTANCE_PARAMS=$*
|
||||
buckets=0
|
||||
# STDOUT=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stdout
|
||||
# STDERR=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stderr
|
||||
STDOUT="/dev/null"
|
||||
STDERR="/dev/null"
|
||||
|
||||
if [ ! -x "${EXE}" ]; then
|
||||
error "${EXE}: not found or not executable (pwd: $(pwd))"
|
||||
fi
|
||||
|
||||
# If the program just prints a number, we can use 'exec' to avoid
|
||||
# creating another process, but there can be no other commands after exec.
|
||||
#exec $EXE ${FIXED_PARAMS} -i $INSTANCE ${INSTANCE_PARAMS}
|
||||
# exit 1
|
||||
#
|
||||
# Otherwise, save the output to a file, and parse the result from it.
|
||||
# (If you wish to ignore segmentation faults you can use '{}' around
|
||||
# the command.)
|
||||
cmd="$EXE --problem=${INSTANCE} --instance=${INSTANCE} --seed=${SEED} ${CROSSOVER_RATE} ${CROSSOVER_SELECTOR} ${CROSSOVER} ${MUTATION_RATE} ${MUT_SELECTOR} ${MUTATION} ${REPLACEMENT} ${POPSIZE} ${OFFSPRINGSIZE} --max-evals=${buckets}"
|
||||
# NOTE: irace seems to capture both stderr and stdout, so you should not output to stderr
|
||||
echo ${cmd} > ${STDERR}
|
||||
$cmd 2> ${STDERR} | tee ${STDOUT}
|
||||
|
||||
# The following code is useless if the binary only output a single number on stdout.
|
||||
|
||||
# This may be used to introduce a delay if there are filesystem
|
||||
# issues.
|
||||
# SLEEPTIME=1
|
||||
# while [ ! -s "${STDOUT}" ]; do
|
||||
# sleep $SLEEPTIME
|
||||
# let "SLEEPTIME += 1"
|
||||
# done
|
||||
|
||||
# This is an example of reading a number from the output.
|
||||
# It assumes that the objective value is the first number in
|
||||
# the first column of the last line of the output.
|
||||
# if [ -s "${STDOUT}" ]; then
|
||||
# COST=$(tail -n 1 ${STDOUT} | grep -e '^[[:space:]]*[+-]\?[0-9]' | cut -f1)
|
||||
# echo "$COST"
|
||||
# rm -f "${STDOUT}" "${STDERR}"
|
||||
# exit 0
|
||||
# else
|
||||
# error "${STDOUT}: No such file or directory"
|
||||
# fi
|
||||
48
eo/contrib/irace/expe/beta/irace_files_pF/default.instances
Executable file
48
eo/contrib/irace/expe/beta/irace_files_pF/default.instances
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
## This is an example of specifying instances with a file.
|
||||
|
||||
# Each line is an instance relative to trainInstancesDir
|
||||
# (see scenario.txt.tmpl) and an optional sequence of instance-specific
|
||||
# parameters that will be passed to target-runnerx when invoked on that
|
||||
# instance.
|
||||
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
10
|
||||
11
|
||||
12
|
||||
13
|
||||
14
|
||||
15
|
||||
16
|
||||
17
|
||||
18
|
||||
19
|
||||
20
|
||||
21
|
||||
22
|
||||
23
|
||||
24
|
||||
25
|
||||
26
|
||||
27
|
||||
28
|
||||
29
|
||||
30
|
||||
31
|
||||
32
|
||||
33
|
||||
34
|
||||
35
|
||||
36
|
||||
37
|
||||
38
|
||||
39
|
||||
40
|
||||
227
eo/contrib/irace/expe/beta/irace_files_pF/example.scen
Executable file
227
eo/contrib/irace/expe/beta/irace_files_pF/example.scen
Executable file
|
|
@ -0,0 +1,227 @@
|
|||
###################################################### -*- mode: r -*- #####
|
||||
## Scenario setup for Iterated Race (irace).
|
||||
############################################################################
|
||||
|
||||
## To use the default value of a parameter of iRace, simply do not set
|
||||
## the parameter (comment it out in this file, and do not give any
|
||||
## value on the command line).
|
||||
|
||||
## File that contains the description of the parameters of the target
|
||||
## algorithm.
|
||||
parameterFile = "./fastga.param"
|
||||
|
||||
## Directory where the programs will be run.
|
||||
execDir = "."
|
||||
|
||||
## File to save tuning results as an R dataset, either absolute path or
|
||||
## relative to execDir.
|
||||
# logFile = "./irace.Rdata"
|
||||
|
||||
## Previously saved log file to recover the execution of irace, either
|
||||
## absolute path or relative to the current directory. If empty or NULL,
|
||||
## recovery is not performed.
|
||||
# recoveryFile = ""
|
||||
|
||||
## Directory where training instances are located; either absolute path or
|
||||
## relative to current directory. If no trainInstancesFiles is provided,
|
||||
## all the files in trainInstancesDir will be listed as instances.
|
||||
trainInstancesDir = "."
|
||||
|
||||
## File that contains a list of training instances and optionally
|
||||
## additional parameters for them. If trainInstancesDir is provided, irace
|
||||
## will search for the files in this folder.
|
||||
trainInstancesFile = "./default.instances"
|
||||
|
||||
## File that contains a table of initial configurations. If empty or NULL,
|
||||
## all initial configurations are randomly generated.
|
||||
# configurationsFile = ""
|
||||
|
||||
## File that contains a list of logical expressions that cannot be TRUE
|
||||
## for any evaluated configuration. If empty or NULL, do not use forbidden
|
||||
## expressions.
|
||||
forbiddenFile = "./forbidden.txt"
|
||||
|
||||
## Script called for each configuration that executes the target algorithm
|
||||
## to be tuned. See templates.
|
||||
targetRunner = "./target-runner"
|
||||
|
||||
## Number of times to retry a call to targetRunner if the call failed.
|
||||
# targetRunnerRetries = 0
|
||||
|
||||
## Optional data passed to targetRunner. This is ignored by the default
|
||||
## targetRunner function, but it may be used by custom targetRunner
|
||||
## functions to pass persistent data around.
|
||||
# targetRunnerData = ""
|
||||
|
||||
## Optional R function to provide custom parallelization of targetRunner.
|
||||
# targetRunnerParallel = ""
|
||||
|
||||
## Optional script or R function that provides a numeric value for each
|
||||
## configuration. See templates/target-evaluator.tmpl
|
||||
# targetEvaluator = ""
|
||||
|
||||
## Maximum number of runs (invocations of targetRunner) that will be
|
||||
## performed. It determines the maximum budget of experiments for the
|
||||
## tuning.
|
||||
maxExperiments = 0 #100000
|
||||
|
||||
## Maximum total execution time in seconds for the executions of
|
||||
## targetRunner. targetRunner must return two values: cost and time.
|
||||
# maxTime = 60
|
||||
|
||||
## Fraction (smaller than 1) of the budget used to estimate the mean
|
||||
## computation time of a configuration. Only used when maxTime > 0
|
||||
# budgetEstimation = 0.02
|
||||
|
||||
## Maximum number of decimal places that are significant for numerical
|
||||
## (real) parameters.
|
||||
digits = 2
|
||||
|
||||
## Debug level of the output of irace. Set this to 0 to silence all debug
|
||||
## messages. Higher values provide more verbose debug messages.
|
||||
# debugLevel = 0
|
||||
|
||||
## Number of iterations.
|
||||
# nbIterations = 0
|
||||
|
||||
## Number of runs of the target algorithm per iteration.
|
||||
# nbExperimentsPerIteration = 0
|
||||
|
||||
## Randomly sample the training instances or use them in the order given.
|
||||
# sampleInstances = 1
|
||||
|
||||
## Statistical test used for elimination. Default test is always F-test
|
||||
## unless capping is enabled, in which case the default test is t-test.
|
||||
## Valid values are: F-test (Friedman test), t-test (pairwise t-tests with
|
||||
## no correction), t-test-bonferroni (t-test with Bonferroni's correction
|
||||
## for multiple comparisons), t-test-holm (t-test with Holm's correction
|
||||
## for multiple comparisons).
|
||||
# testType = "F-test"
|
||||
|
||||
## Number of instances evaluated before the first elimination test. It
|
||||
## must be a multiple of eachTest.
|
||||
# firstTest = 5
|
||||
|
||||
## Number of instances evaluated between elimination tests.
|
||||
# eachTest = 1
|
||||
|
||||
## Minimum number of configurations needed to continue the execution of
|
||||
## each race (iteration).
|
||||
# minNbSurvival = 0
|
||||
|
||||
## Number of configurations to be sampled and evaluated at each iteration.
|
||||
# nbConfigurations = 0
|
||||
|
||||
## Parameter used to define the number of configurations sampled and
|
||||
## evaluated at each iteration.
|
||||
# mu = 5
|
||||
|
||||
## Confidence level for the elimination test.
|
||||
# confidence = 0.95
|
||||
|
||||
## If the target algorithm is deterministic, configurations will be
|
||||
## evaluated only once per instance.
|
||||
# deterministic = 0
|
||||
|
||||
## Seed of the random number generator (by default, generate a random
|
||||
## seed).
|
||||
# seed = NA
|
||||
|
||||
## Number of calls to targetRunner to execute in parallel. Values 0 or 1
|
||||
## mean no parallelization.
|
||||
# parallel = 0
|
||||
|
||||
## Enable/disable load-balancing when executing experiments in parallel.
|
||||
## Load-balancing makes better use of computing resources, but increases
|
||||
## communication overhead. If this overhead is large, disabling
|
||||
## load-balancing may be faster.
|
||||
# loadBalancing = 1
|
||||
|
||||
## Enable/disable MPI. Use Rmpi to execute targetRunner in parallel
|
||||
## (parameter parallel is the number of slaves).
|
||||
# mpi = 0
|
||||
|
||||
## Specify how irace waits for jobs to finish when targetRunner submits
|
||||
## jobs to a batch cluster: sge, pbs, torque or slurm. targetRunner must
|
||||
## submit jobs to the cluster using, for example, qsub.
|
||||
# batchmode = 0
|
||||
|
||||
## Enable/disable the soft restart strategy that avoids premature
|
||||
## convergence of the probabilistic model.
|
||||
# softRestart = 1
|
||||
|
||||
## Soft restart threshold value for numerical parameters. If NA, NULL or
|
||||
## "", it is computed as 10^-digits.
|
||||
# softRestartThreshold = ""
|
||||
|
||||
## Directory where testing instances are located, either absolute or
|
||||
## relative to current directory.
|
||||
# testInstancesDir = ""
|
||||
|
||||
## File containing a list of test instances and optionally additional
|
||||
## parameters for them.
|
||||
# testInstancesFile = ""
|
||||
|
||||
## Number of elite configurations returned by irace that will be tested if
|
||||
## test instances are provided.
|
||||
# testNbElites = 1
|
||||
|
||||
## Enable/disable testing the elite configurations found at each
|
||||
## iteration.
|
||||
# testIterationElites = 0
|
||||
|
||||
## Enable/disable elitist irace.
|
||||
# elitist = 1
|
||||
|
||||
## Number of instances added to the execution list before previous
|
||||
## instances in elitist irace.
|
||||
# elitistNewInstances = 1
|
||||
|
||||
## In elitist irace, maximum number per race of elimination tests that do
|
||||
## not eliminate a configuration. Use 0 for no limit.
|
||||
# elitistLimit = 2
|
||||
|
||||
## User-defined R function that takes a configuration generated by irace
|
||||
## and repairs it.
|
||||
# repairConfiguration = ""
|
||||
|
||||
## Enable the use of adaptive capping, a technique designed for minimizing
|
||||
## the computation time of configurations. This is only available when
|
||||
## elitist is active.
|
||||
# capping = 0
|
||||
|
||||
## Measure used to obtain the execution bound from the performance of the
|
||||
## elite configurations: median, mean, worst, best.
|
||||
# cappingType = "median"
|
||||
|
||||
## Method to calculate the mean performance of elite configurations:
|
||||
## candidate or instance.
|
||||
# boundType = "candidate"
|
||||
|
||||
## Maximum execution bound for targetRunner. It must be specified when
|
||||
## capping is enabled.
|
||||
# boundMax = 0
|
||||
|
||||
## Precision used for calculating the execution time. It must be specified
|
||||
## when capping is enabled.
|
||||
# boundDigits = 0
|
||||
|
||||
## Penalization constant for timed out executions (executions that reach
|
||||
## boundMax execution time).
|
||||
# boundPar = 1
|
||||
|
||||
## Replace the configuration cost of bounded executions with boundMax.
|
||||
# boundAsTimeout = 1
|
||||
|
||||
## Percentage of the configuration budget used to perform a postselection
|
||||
## race of the best configurations of each iteration after the execution
|
||||
## of irace.
|
||||
# postselection = 0
|
||||
|
||||
## Enable/disable AClib mode. This option enables compatibility with
|
||||
## GenericWrapper4AC as targetRunner script.
|
||||
# aclib = 0
|
||||
|
||||
## END of scenario file
|
||||
############################################################################
|
||||
|
||||
12
eo/contrib/irace/expe/beta/irace_files_pF/fastga.param
Executable file
12
eo/contrib/irace/expe/beta/irace_files_pF/fastga.param
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
# name switch type range
|
||||
# continuator "--continuator=" c (0)
|
||||
crossoverrate "--crossover-rate=" r (0,1)
|
||||
crossselector "--cross-selector=" c (0,1,2,3,4,5,6)
|
||||
# aftercrossselector "--aftercross-selector=" c (0)
|
||||
crossover "--crossover=" c (0,1,2,3,4,5,6,7,8,9)
|
||||
mutationrate "--mutation-rate=" r (0,1)
|
||||
mutselector "--mut-selector=" c (0,1,2,3,4,5,6)
|
||||
mutation "--mutation=" c (0,1,2,3,4,5,6,7,8,9,10)
|
||||
replacement "--replacement=" c (0,1,2,3,4,5,6,7,8,9,10)
|
||||
popsize "--pop-size=" i (1,50)
|
||||
offspringsize "--offspring-size=" i (1,50)
|
||||
96
eo/contrib/irace/expe/beta/irace_files_pF/target-runner
Executable file
96
eo/contrib/irace/expe/beta/irace_files_pF/target-runner
Executable file
|
|
@ -0,0 +1,96 @@
|
|||
#!/bin/bash
|
||||
###############################################################################
|
||||
# This script is the command that is executed every run.
|
||||
# Check the examples in examples/
|
||||
#
|
||||
# This script is run in the execution directory (execDir, --exec-dir).
|
||||
#
|
||||
# PARAMETERS:
|
||||
# $1 is the candidate configuration number
|
||||
# $2 is the instance ID
|
||||
# $3 is the seed
|
||||
# $4 is the instance name
|
||||
# The rest ($* after `shift 4') are parameters to the run
|
||||
#
|
||||
# RETURN VALUE:
|
||||
# This script should print one numerical value: the cost that must be minimized.
|
||||
# Exit with 0 if no error, with 1 in case of error
|
||||
###############################################################################
|
||||
error() {
|
||||
echo "`TZ=UTC date`: $0: error: $@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
EXE="./fastga"
|
||||
LOG_DIR="irace_logs"
|
||||
|
||||
FIXED_PARAMS="--problem=0"
|
||||
#MAX_EVALS=2
|
||||
#
|
||||
CONFIG_ID=$1
|
||||
INSTANCE_ID=$2
|
||||
SEED=$3
|
||||
INSTANCE=$(echo $4 | sed 's/\//\n/g'|tail -n 1)
|
||||
CROSSOVER_RATE=$5
|
||||
CROSSOVER_SELECTOR=$6
|
||||
CROSSOVER=$7
|
||||
MUTATION_RATE=$8
|
||||
MUT_SELECTOR=$9
|
||||
MUTATION=${10}
|
||||
REPLACEMENT=${11}
|
||||
POPSIZE=${12}
|
||||
OFFSPRINGSIZE=${13}
|
||||
shift 13 || error "Not enough parameters"
|
||||
|
||||
INSTANCE_PARAMS=$*
|
||||
|
||||
buckets=0
|
||||
#dim=(20 20 16 48 25 32 128 128 128 50 100 150 128 192 192 192 256 75 150)
|
||||
#size= $( echo $(echo $13 | cut -d'=' -f2))
|
||||
#pb=$(echo $(echo $13 | cut -d'=' -f2))
|
||||
#maxevals=$( echo ${dim[$pb]})
|
||||
# STDOUT=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stdout
|
||||
# STDERR=${LOG_DIR}/c${CONFIG_ID}_i${INSTANCE_ID}_s${SEED}.stderr
|
||||
STDOUT="/dev/null"
|
||||
STDERR="/dev/null"
|
||||
|
||||
if [ ! -x "${EXE}" ]; then
|
||||
error "${EXE}: not found or not executable (pwd: $(pwd))"
|
||||
fi
|
||||
|
||||
# If the program just prints a number, we can use 'exec' to avoid
|
||||
# creating another process, but there can be no other commands after exec.
|
||||
#exec $EXE ${FIXED_PARAMS} -i $INSTANCE ${INSTANCE_PARAMS}
|
||||
# exit 1
|
||||
#
|
||||
# Otherwise, save the output to a file, and parse the result from it.
|
||||
# (If you wish to ignore segmentation faults you can use '{}' around
|
||||
# the command.)
|
||||
|
||||
cmd="$EXE ${FIXED_PARAMS} --instance=${INSTANCE} --seed=${SEED} ${CROSSOVER_RATE} ${CROSSOVER_SELECTOR} ${CROSSOVER} ${MUTATION_RATE} ${MUT_SELECTOR} ${MUTATION} ${REPLACEMENT} ${POPSIZE} ${OFFSPRINGSIZE} --max-evals=${buckets}"
|
||||
# NOTE: irace seems to capture both stderr and stdout, so you should not output to stderr
|
||||
echo ${cmd} > ${STDERR}
|
||||
$cmd 2> ${STDERR} | tee ${STDOUT}
|
||||
|
||||
# The following code is useless if the binary only output a single number on stdout.
|
||||
|
||||
# This may be used to introduce a delay if there are filesystem
|
||||
# issues.
|
||||
# SLEEPTIME=1
|
||||
# while [ ! -s "${STDOUT}" ]; do
|
||||
# sleep $SLEEPTIME
|
||||
# let "SLEEPTIME += 1"
|
||||
# done
|
||||
|
||||
# This is an example of reading a number from the output.
|
||||
# It assumes that the objective value is the first number in
|
||||
# the first column of the last line of the output.
|
||||
# if [ -s "${STDOUT}" ]; then
|
||||
# COST=$(tail -n 1 ${STDOUT} | grep -e '^[[:space:]]*[+-]\?[0-9]' | cut -f1)
|
||||
# echo "$COST"
|
||||
# rm -f "${STDOUT}" "${STDERR}"
|
||||
# exit 0
|
||||
# else
|
||||
# error "${STDOUT}: No such file or directory"
|
||||
# fi
|
||||
31
eo/contrib/irace/expe/beta/parseA_irace_bests.py
Executable file
31
eo/contrib/irace/expe/beta/parseA_irace_bests.py
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env python3
|
||||
#parse data1
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
print("ecdf,id,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement,pop-size,offspring-size")
|
||||
|
||||
|
||||
#give the path of one experiment
|
||||
argv=sys.argv[1]
|
||||
for datadir in os.listdir(argv):
|
||||
#if(os.path.isdir(os.path.join(argv,datadir))): check if argv/datadir is a directory
|
||||
if(datadir.find("results_irace")>=0): #check if the directory is one JOB
|
||||
with open(os.path.join("./",argv,datadir,"irace.log")) as fd:
|
||||
data = fd.readlines()
|
||||
|
||||
# Find the last best configuration
|
||||
bests = [line.strip() for line in data if "Best-so-far" in line]
|
||||
#print(datadir,bests)
|
||||
best = bests[-1].split()
|
||||
best_id, best_perf = best[2], best[5]
|
||||
# print(best_id,best_perf)
|
||||
|
||||
# Filter the config detail
|
||||
configs = [line.strip() for line in data if "--crossover-rate=" in line and best_id in line]
|
||||
# print(configs)
|
||||
# Format as CSV
|
||||
algo = re.sub("\-\-\S*=", ",", configs[0])
|
||||
csv_line = best_perf + "," + algo
|
||||
print(csv_line.replace(" ",""))
|
||||
35
eo/contrib/irace/expe/beta/parseF_irace_bests.py
Executable file
35
eo/contrib/irace/expe/beta/parseF_irace_bests.py
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env python3
|
||||
#parse data1
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
#print("pb,ecdf,id,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement") #plan1
|
||||
print("pb,ecdf,id,crossover-rate,cross-selector,crossover,mutation-rate,mut-selector,mutation,replacement,pop-size,offspring-size")
|
||||
|
||||
|
||||
#give the path of one experiment
|
||||
argv=sys.argv[1]
|
||||
for datadir in os.listdir(argv):
|
||||
#if(os.path.isdir(os.path.join(argv,datadir))): check if argv/datadir is a directory
|
||||
if(datadir.find("results_irace")>=0): #check if the directory is one JOB
|
||||
for pb_dir in os.listdir(os.path.join(argv,datadir)):
|
||||
if "results_problem" in pb_dir:
|
||||
pb_id=pb_dir.replace("results_problem_","")
|
||||
with open(os.path.join("./",argv,datadir,pb_dir,"irace.log")) as fd:
|
||||
data = fd.readlines()
|
||||
|
||||
# Find the last best configuration
|
||||
bests = [line.strip() for line in data if "Best-so-far" in line]
|
||||
#print(datadir,bests)
|
||||
best = bests[-1].split()
|
||||
best_id, best_perf = best[2], best[5]
|
||||
# print(best_id,best_perf)
|
||||
|
||||
# Filter the config detail
|
||||
configs = [line.strip() for line in data if "--crossover-rate=" in line and best_id in line]
|
||||
# print(configs)
|
||||
|
||||
# Format as CSV
|
||||
algo = re.sub("\-\-\S*=", ",", configs[0])
|
||||
csv_line = pb_id + "," + best_perf + "," + algo
|
||||
print(csv_line.replace(" ",""))
|
||||
34
eo/contrib/irace/expe/beta/planA/r_iA.sh
Executable file
34
eo/contrib/irace/expe/beta/planA/r_iA.sh
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
#run once each problem
|
||||
|
||||
echo "-------------------------Start the JOB : $(date --iso-8601=seconds)"
|
||||
. /etc/profile.d/modules.sh
|
||||
export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI
|
||||
module load LLVM/clang-llvm-10.0
|
||||
module load R
|
||||
|
||||
dir=$1
|
||||
run=$2
|
||||
budget_irace=$3
|
||||
buckets=$4
|
||||
myhome=$5
|
||||
cp -r ${myhome}/R .
|
||||
cp -r ${myhome}/irace_files_pA .
|
||||
#cp -r /scratchbeta/zhenga/irace_files .
|
||||
#chmod u+x ./fastga
|
||||
outdir="${run}_$(date --iso-8601=seconds)_results_irace"
|
||||
rundir=${dir}/${outdir}
|
||||
mkdir -p ${rundir}
|
||||
# Fore some reason, irace absolutely need those files...
|
||||
cp ${myhome}/code/paradiseo/eo/contrib/irace/release/fastga ${rundir}
|
||||
cat ./irace_files_pA/example.scen | sed "s%\".%\"${rundir}%g" | sed "s/maxExperiments = 0/maxExperiments=${budget_irace}/" > ${rundir}/example.scen
|
||||
cp ./irace_files_pA/default.instances ${rundir}
|
||||
cp ./irace_files_pA/fastga.param ${rundir}
|
||||
cp ./irace_files_pA/forbidden.txt ${rundir}
|
||||
cat ./irace_files_pA/target-runner | sed "s/buckets=0/buckets=${buckets}/" > ${rundir}/target-runner
|
||||
chmod u+x ${rundir}/target-runner
|
||||
|
||||
echo "---start $(date)"
|
||||
time -p ./R/x86_64-pc-linux-gnu-library/3.6/irace/bin/irace --scenario ${rundir}/example.scen > ${rundir}/irace.log
|
||||
echo "---end $(date)"
|
||||
echo "End the JOB : $(date --iso-8601=seconds)------------------------------"
|
||||
25
eo/contrib/irace/expe/beta/planA/riaA.sh
Executable file
25
eo/contrib/irace/expe/beta/planA/riaA.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bashi
|
||||
myhome=$1
|
||||
scratchpath=$2
|
||||
mexp=$3
|
||||
mevals=$4
|
||||
date -Iseconds
|
||||
echo "STARTS"
|
||||
dir=${scratchpath}/dataFAR/dataA
|
||||
#dir=${HOME}/plan4/${name}
|
||||
#cat ${HOME}/irace_files_pA/example.scen |sed "s/maxExperiments = 0/maxExperiments = ${mexp}/" > ${HOME}/irace_files_pA/example.scen
|
||||
|
||||
mkdir -p ${dir}
|
||||
outdir="${dir}/dataA_maxExp=${mexp}_maxEv=${mevals}_$(date --iso-8601=seconds)"
|
||||
mkdir -p ${outdir}
|
||||
for r in $(seq 2); do
|
||||
echo "Run $r/15";
|
||||
cmd="qsub -N iraceA_maxEv_${r} -q beta -l select=1:ncpus=1 -l walltime=00:30:00 -- ${scratchpath}/planA/r_iA.sh ${outdir} ${r} ${mexp} ${mevals} ${myhome}"
|
||||
#cmd="bash ./r_iA_buckets.sh ${outdir} ${r} ${mexp} ${mevals}"
|
||||
echo $cmd
|
||||
time -p $cmd
|
||||
done
|
||||
echo "DONE"
|
||||
#cat ${HOME}/irace_files_pA/example.scen |sed "s/maxExperiments = ${mexp}/maxExperiments = 0/" > ${HOME}/irace_files_pA/example.scen
|
||||
date -Iseconds
|
||||
|
||||
37
eo/contrib/irace/expe/beta/planF/r_iF.sh
Executable file
37
eo/contrib/irace/expe/beta/planF/r_iF.sh
Executable file
|
|
@ -0,0 +1,37 @@
|
|||
#!/bin/bash
|
||||
#run once each problem
|
||||
dir=$1
|
||||
run=$2
|
||||
budget_irace=$3
|
||||
buckets=$4
|
||||
myhome=$5
|
||||
|
||||
echo "---------------start JOB ${run} $(date --iso-8601=seconds)"
|
||||
. /etc/profile.d/modules.sh
|
||||
export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI
|
||||
module load LLVM/clang-llvm-10.0
|
||||
module load R
|
||||
|
||||
cp -r ${myhome}/R .
|
||||
cp -r ${myhome}/irace_files_pF .
|
||||
#cp -r /scratchbeta/zhenga/irace_files .
|
||||
#chmod u+x ./fastga
|
||||
outdir="${run}_$(date --iso-8601=seconds)_results_irace"
|
||||
for pb in $(seq 0 18) ; do
|
||||
echo "Problem ${pb}... "
|
||||
res="results_problem_${pb}"
|
||||
mkdir -p ${dir}/${outdir}/${res}
|
||||
# Fore some reason, irace absolutely need those files...
|
||||
cp ${myhome}/code/paradiseo/eo/contrib/irace/release/fastga ${dir}/${outdir}/${res}
|
||||
cat ./irace_files_pF/example.scen | sed "s%\".%\"${dir}/${outdir}/${res}%g" | sed "s/maxExperiments = 0/maxExperiments=${budget_irace}/" > ${dir}/${outdir}/${res}/example.scen
|
||||
cp ./irace_files_pF/default.instances ${dir}/${outdir}/${res}
|
||||
cp ./irace_files_pF/fastga.param ${dir}/${outdir}/${res}
|
||||
cp ./irace_files_pF/forbidden.txt ${dir}/${outdir}/${res}
|
||||
cat ./irace_files_pF/target-runner | sed "s/--problem=0/--problem=${p}/" | sed "s/buckets=0/buckets=${buckets}/" > ${dir}/${outdir}/${res}/target-runner
|
||||
chmod u+x ${dir}/${outdir}/${res}/target-runner
|
||||
|
||||
echo "---start $(date)"
|
||||
time -p ./R/x86_64-pc-linux-gnu-library/3.6/irace/bin/irace --scenario ${dir}/${outdir}/${res}/example.scen > ${dir}/${outdir}/${res}/irace.log
|
||||
echo "---end $(date)"
|
||||
done
|
||||
echo "end JOB ${run} $(date --iso-8601=seconds)---------------"
|
||||
28
eo/contrib/irace/expe/beta/planF/riaF.sh
Executable file
28
eo/contrib/irace/expe/beta/planF/riaF.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
date -Iseconds
|
||||
echo "STARTS"
|
||||
myhome=$1
|
||||
scratchpath=$2
|
||||
#dir=${HOME}/plan2/${name}
|
||||
mexp=$3 #budget irace
|
||||
mevals=$4 #budget fastga
|
||||
name="dataF_maxExp=${mexp}_maxEv=${mevals}_$(date --iso-8601=seconds)"
|
||||
dir=${scratchpath}/dataFAR/dataF/${name}
|
||||
mkdir -p ${dir}
|
||||
|
||||
for r in $(seq 2); do
|
||||
echo "Run $r/15";
|
||||
#date -Iseconds
|
||||
#cmd="qsub -N irace_${runs}_${buckets}" -q beta -l select=1:ncpus=1 -l walltime=00:04:00 --${HOME}/run_irace.sh ${dir}
|
||||
cmd="qsub -N iraceF_${mevals}_run=${r} -q beta -l select=1:ncpus=1 -l walltime=00:30:00 -- ${scratchpath}/planF/r_iF.sh ${dir} ${r} ${mexp} ${mevals} ${myhome}"
|
||||
#time -p bash ${HOME}/plan2/run_irace2.sh ${dir} ${r} &> ${dir}/erreur_${r}.txt
|
||||
#bash ${HOME}/test/r_i.sh
|
||||
echo $cmd
|
||||
$cmd
|
||||
#date -Iseconds
|
||||
done
|
||||
|
||||
#echo "DONE"
|
||||
#date -Iseconds
|
||||
#echo $(pwd)
|
||||
61
eo/contrib/irace/expe/beta/run_elites_planA.sh
Executable file
61
eo/contrib/irace/expe/beta/run_elites_planA.sh
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
#!/bin/bash
|
||||
#instance = seed
|
||||
echo "-----------------Start $(date)"
|
||||
. /etc/profile.d/modules.sh
|
||||
export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI
|
||||
module load LLVM/clang-llvm-10.0
|
||||
|
||||
csv_file=$1 #contains all the configs of all the problems of one experiments
|
||||
mexp=$2
|
||||
mevals=$3
|
||||
path=$4
|
||||
# Number of runs (=seeds).
|
||||
runs=50
|
||||
|
||||
# You most probably want to run on release builds.
|
||||
exe="/home/zhenga/fastga"
|
||||
plan=$(echo ${csv_file} | sed "s/results_irace_plan//")
|
||||
outdir="${path}/plan4_maxExp=${mexp}_maxEv=${mevals}_$(date --iso-8601=minutes)_results_elites_all"
|
||||
mkdir -p ${outdir}
|
||||
mkdir -p ${outdir}/raw
|
||||
mkdir -p ${outdir}/raw/data
|
||||
mkdir -p ${outdir}/raw/logs
|
||||
|
||||
n=0
|
||||
algoid=0
|
||||
for line in $(cat ${csv_file}| sed 1,1d | cut -s -d"," -f3-11 ); do
|
||||
a=($(echo $line | sed "s/,/ /g"))
|
||||
algo="--crossover-rate=${a[0]} --cross-selector=${a[1]} --crossover=${a[2]} --mutation-rate=${a[3]} --mut-selector=${a[4]} --mutation=${a[5]} --replacement=${a[6]} --pop-size=${a[7]} --offspring-size=${a[8]}"
|
||||
|
||||
#perc=$(echo "scale=3;${n}/(285)*100.0" | bc)
|
||||
#echo "${perc}% : algo ${algoid}/285"
|
||||
# echo -n "Runs: "
|
||||
for pb in $(seq 0 18) ; do
|
||||
name_dir="pb=${pb}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
|
||||
mkdir -p ${outdir}/raw/data/${name_dir}
|
||||
mkdir -p ${outdir}/raw/logs/${name_dir}
|
||||
for seed in $(seq ${runs}) ; do # Iterates over runs/seeds.
|
||||
# This is the command to be ran.
|
||||
#cmd="${exe} --full-log=1 --problem=${pb} --seed=${seed} ${algo}"
|
||||
cmd="${exe} --problem=${pb} --seed=${seed} --instance=${seed} ${algo}"
|
||||
#echo ${cmd} # Print the command.
|
||||
# Forge a directory/log file name
|
||||
# (remove double dashs and replace spaces with underscore).
|
||||
name_run="pb=${pb}_seed=${seed}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
|
||||
# echo $name_run
|
||||
# Actually start the command.
|
||||
|
||||
${cmd} > "${outdir}/raw/data/${name_dir}/${name_run}.dat" 2> "${outdir}/raw/logs/${name_dir}/${name_run}.log"
|
||||
# Check for the most common problem in the log file.
|
||||
#cat "${outdir}/raw/logs/${name_run}.log" | grep "illogical performance"
|
||||
done # seed
|
||||
n=$(($n+1))
|
||||
done
|
||||
algoid=$(($algoid+1))
|
||||
done
|
||||
|
||||
# Move IOH logs in the results directory.
|
||||
#mv ./FastGA_* ${outdir}
|
||||
|
||||
echo "Done $(date) -----------------------"
|
||||
#date
|
||||
59
eo/contrib/irace/expe/beta/run_elites_planF.sh
Executable file
59
eo/contrib/irace/expe/beta/run_elites_planF.sh
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
#instance = seed
|
||||
echo "-----------------Start $(date)"
|
||||
. /etc/profile.d/modules.sh
|
||||
export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI
|
||||
module load LLVM/clang-llvm-10.0
|
||||
|
||||
csv_file=$1 #contains all the configs of all the problems of one experiments
|
||||
mexp=$2
|
||||
mevals=$3
|
||||
path=$4
|
||||
# Number of runs (=seeds).
|
||||
runs=50
|
||||
|
||||
# You most probably want to run on release builds.
|
||||
exe="/home/${USER}/fastga"
|
||||
plan=$(echo ${csv_file} | cut -d / -f3 | sed "s/results_irace_plan//")
|
||||
outdir="${path}/plan${plan[@]:0:1}_maxExp=${mexp}_maxEv=${mevals}_$(date --iso-8601=minutes)_results_elites_all"
|
||||
mkdir -p ${outdir}
|
||||
mkdir -p ${outdir}/raw
|
||||
mkdir -p ${outdir}/raw/data
|
||||
mkdir -p ${outdir}/raw/logs
|
||||
|
||||
n=0
|
||||
algoid=0
|
||||
for line in $(cat ${csv_file}| sed 1,1d ); do
|
||||
a=($(echo $line | sed "s/,/ /g"))
|
||||
algo="--crossover-rate=${a[3]} --cross-selector=${a[4]} --crossover=${a[5]} --mutation-rate=${a[6]} --mut-selector=${a[7]} --mutation=${a[8]} --replacement=${a[9]} --pop-size=${a[10]} --offspring-size=${a[11]}"
|
||||
|
||||
#perc=$(echo "scale=3;${n}/(285)*100.0" | bc)
|
||||
#echo "${perc}% : algo ${algoid}/285"
|
||||
# echo -n "Runs: "
|
||||
name_dir="pb=${a[0]}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
|
||||
mkdir -p ${outdir}/raw/logs/${name_dir}
|
||||
mkdir -p ${outdir}/raw/data/${name_dir}
|
||||
for seed in $(seq ${runs}) ; do # Iterates over runs/seeds.
|
||||
# This is the command to be ran.
|
||||
#cmd="${exe} --full-log=1 --problem=${pb} --seed=${seed} ${algo}"
|
||||
cmd="${exe} --problem=${a[0]} --seed=${seed} --instance=${seed} ${algo}"
|
||||
#echo ${cmd} # Print the command.
|
||||
# Forge a directory/log file name
|
||||
# (remove double dashs and replace spaces with underscore).
|
||||
name_run="pb=${a[0]}_seed=${seed}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
|
||||
# echo $name_run
|
||||
# Actually start the command.
|
||||
${cmd} > "${outdir}/raw/data/${name_dir}/${name_run}.dat" 2> "${outdir}/raw/logs/${name_dir}/${name_run}.log"
|
||||
# Check for the most common problem in the log file.
|
||||
#cat "${outdir}/raw/logs/${name_run}.log" | grep "illogical performance"
|
||||
done # seed
|
||||
|
||||
n=$(($n+1))
|
||||
algoid=$(($algoid+1))
|
||||
done
|
||||
|
||||
# Move IOH logs in the results directory.
|
||||
#mv ./FastGA_* ${outdir}
|
||||
|
||||
echo "Done $(date) -----------------------"
|
||||
#date
|
||||
12
eo/contrib/irace/expe/beta/run_exp.sh
Normal file
12
eo/contrib/irace/expe/beta/run_exp.sh
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
lexp=(300 600 1000 10000)
|
||||
levals=(100 500 1000)
|
||||
myscratchpath=/scratchbeta/$USER
|
||||
myhome=${HOME}
|
||||
for exp in ${lexp[@]} ; do
|
||||
for evals in ${levals[@]} ; do
|
||||
bash ./planF/riaF.sh ${myhome} ${myscratchpath} ${exp} ${evals}
|
||||
bash ./planA/riaA.sh ${myhome} ${scratchpath} ${exp} ${evals}
|
||||
done
|
||||
done
|
||||
bash testrandom.sh ${myhome} ${scratchpath} ${levals[@]}
|
||||
67
eo/contrib/irace/expe/beta/run_random.sh
Executable file
67
eo/contrib/irace/expe/beta/run_random.sh
Executable file
|
|
@ -0,0 +1,67 @@
|
|||
#!/bin/bash
|
||||
# Number of runs (=seeds).
|
||||
runs=5
|
||||
basename=$1
|
||||
mevals=$2
|
||||
nbAlgo=2
|
||||
echo "Start JOB maxEv= $mevals $(date -Iseconds) ----------------------"
|
||||
. /etc/profile.d/modules.sh
|
||||
export MODULEPATH=${MODULEPATH}${MODULEPATH:+:}/opt/dev/Modules/Anaconda:/opt/dev/Modules/Compilers:/opt/dev/Modules/Frameworks:/opt/dev/Modules/Libraries:/opt/dev/Modules/Tools:/opt/dev/Modules/IDEs:/opt/dev/Modules/MPI
|
||||
module load LLVM/clang-llvm-10.0
|
||||
cp ${HOME}/code/paradiseo/eo/contrib/irace/release/fastga .
|
||||
# You most probably want to run on release builds.
|
||||
exe="./fastga"
|
||||
|
||||
#outdir="/scratchbeta/$USER/$(date --iso-8601=minutes)_results_randoms"
|
||||
outdir="${basename}/maxEv=${mevals}_nbAlgo=${nbAlgo}_$(date --iso-8601=minutes)_results_randoms"
|
||||
mkdir -p ${outdir}
|
||||
n=1
|
||||
algoid=0
|
||||
for algoid in $(seq ${nbAlgo}); do
|
||||
#date
|
||||
r1=$(echo "scale=2 ; ${RANDOM}/32767" | bc)
|
||||
r2=$(echo "scale=2 ; ${RANDOM}/32767" | bc)
|
||||
a=(${r1} $((RANDOM%7)) $((RANDOM%10)) ${r2} $((RANDOM%7)) $((RANDOM%11)) $((RANDOM%11)) $((RANDOM%50 +1)) $((RANDOM%50 +1)) )
|
||||
#condition for value of replacement, pop-size and offspringsize
|
||||
while [[ (1 -lt ${a[6]} && ${a[7]} -lt ${a[8]}) || ( ${a[6]} -eq 1 && ${a[7]} -ne ${a[8]}) ]]
|
||||
do
|
||||
#echo "get in ------------------replacement ${a[6]} popsize ${a[7]} offspringsize ${a[8]}"
|
||||
r1=$(echo "scale=2 ; ${RANDOM}/32767" | bc)
|
||||
r2=$(echo "scale=2 ; ${RANDOM}/32767" | bc)
|
||||
a=(${r1} $((RANDOM%7)) $((RANDOM%10)) ${r2} $((RANDOM%7)) $((RANDOM%11)) $((RANDOM%11)) $((RANDOM%50 +1)) $((RANDOM%50 +1)))
|
||||
done
|
||||
algo="--crossover-rate=${a[0]} --cross-selector=${a[1]} --crossover=${a[2]} --mutation-rate=${a[3]} --mut-selector=${a[4]} --mutation=${a[5]} --replacement=${a[6]} --pop-size=${a[7]} --offspring-size=${a[8]}"
|
||||
echo " start algo ${a}------ $(date --iso-8601=minutes)"
|
||||
algodir="$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
|
||||
for pb in $(seq 0 18) ; do
|
||||
perc=$(echo "scale=3;${n}/(10*18)*10.0" | bc)
|
||||
#echo "${perc}% : algo ${algoid}/100, problem ${pb}/18 $(date --iso-8601=minutes)"
|
||||
# echo -n "Runs: "
|
||||
name_dir="pb=${pb}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
|
||||
|
||||
mkdir -p ${outdir}/${algodir}/data/${name_dir}
|
||||
mkdir -p ${outdir}/${algodir}/logs/${name_dir}
|
||||
|
||||
for seed in $(seq ${runs}) ; do # Iterates over runs/seeds.
|
||||
# This is the command to be ran.
|
||||
cmd="${exe} --problem=${pb} --seed=${seed} --instance=${seed} ${algo} --max-evals=${mevals}"
|
||||
name_run="pb=${pb}_seed=${seed}_$(echo "${algo}" | sed 's/--//g' | sed 's/ /_/g')"
|
||||
# echo $name_run
|
||||
#echo $algo
|
||||
|
||||
${cmd} > ${outdir}/${algodir}/data/${name_dir}/${name_run}.dat 2> ${outdir}/${algodir}/logs/${name_dir}/${name_run}.log
|
||||
# Check for the most common problem in the log file.
|
||||
#cat "${outdir}/raw/logs/${name_run}.log" | grep "illogical performance"
|
||||
done # seed
|
||||
# echo ""
|
||||
|
||||
n=$(($n+1))
|
||||
done # pb
|
||||
echo "end algo $(date -Iseconds) "
|
||||
algoid=$(($algoid+1))
|
||||
done
|
||||
|
||||
|
||||
|
||||
echo "------------------------------------Done $mevals $(date -Iseconds) "
|
||||
|
||||
26
eo/contrib/irace/expe/beta/run_res.sh
Normal file
26
eo/contrib/irace/expe/beta/run_res.sh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/bash
|
||||
|
||||
#get csv file, parse dataF in a csv file
|
||||
dir=/scratchbeta/$USER/dataFAR
|
||||
listdir=$(echo $(ls ${dir}))
|
||||
|
||||
for data in ${listdir[@]} ; do
|
||||
file_py="parse${data: -1}_irace_bests.py"
|
||||
path="${dir}/${data}"
|
||||
cmd="bash ./csv_all_bests.sh ${path} ${file_py}"
|
||||
echo $cmd
|
||||
$cmd
|
||||
done
|
||||
|
||||
#get validation run of each config
|
||||
|
||||
dir=/scratchbeta/$USER/csv_FA
|
||||
listdir=$(echo $(ls ${dir}))
|
||||
echo ${listdir[@]}
|
||||
for csvdir in ${listdir[@]} ; do
|
||||
csvpath="${dir}/${csvdir}"
|
||||
file_py="./run_elites_plan${csvdir: -1}.sh"
|
||||
cmd="bash ./fastga_elites_all.sh ${csvpath} ${file_py}"
|
||||
echo $cmd
|
||||
$cmd
|
||||
done
|
||||
18
eo/contrib/irace/expe/beta/testrandom.sh
Normal file
18
eo/contrib/irace/expe/beta/testrandom.sh
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
#tab=(15000 20000 30000 40000)
|
||||
#tab=(100 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 10000)
|
||||
myhome=$1
|
||||
scratchpath=$2
|
||||
tab=${@:3}
|
||||
#echo ${tab[@]}
|
||||
outdir="/scratchbeta/$USER/fastga_results_all/fastga_results_random"
|
||||
mkdir -p ${outdir} #results of random experiment
|
||||
for evals in ${tab[@]}; do
|
||||
#evalsdir="${name}/maxEv=${evals}"
|
||||
#mkdir -p ${evalsdir}
|
||||
#{ time -p bash /home/$USER/run_random.sh ${name} ${i} 50 ; } &> "${name}/sortie5_${j}_maxExp=${i}.txt"
|
||||
#cmd="qsub -N iraceR_maxEv=${evals} -q beta -l select=1:ncpus=1 -l walltime=00:30:00 -- /scratchbeta/$USER/run_random.sh ${outdir} ${evals}"
|
||||
$cmd
|
||||
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue