MLopez-Ibanez / irace

Iterated Racing for Automatic Algorithm Configuration
https://mlopez-ibanez.github.io/irace/
GNU General Public License v2.0
58 stars 14 forks source link

Document how to define parameters that depend on instance features #37

Open MLopez-Ibanez opened 2 years ago

MLopez-Ibanez commented 2 years ago

A first draft is given below:

If you want that the parameter alpha depends on the number of nodes "n" in the graph associated with an instance in parameter.txt, then define a dummy parameter in parameters.txt, for example:

alpha_factor "--alpha-factor " r (1,10)

Then, calculate alpha = alpha_factor n or alpha = int(alpha_factor n) if you want alpha to be an integer, within target-runner.

To get the value of "n", either:

  1. Within target-runner, calculate "n" given the instance file.

  2. Alternatively, define the instances in a file "train-instances.txt" such as:

instance-file-1.txt --n 12 instance-file-2.txt --n 15 instance-file-3.txt --n 19 ...

and set

trainInstancesFile="train-instances.txt"

in scenario.txt. Now target-runner will receive an additional parameter "--n" with the value that corresponds to each instance. You'll need to handle that extra parameter.

The first approach is probably simpler in your case. The second approach is better when the instance feature takes long to compute (so it is better to precompute it and save its value in train-instances.txt) or it cannot be computed just from the instance data available in the input file.