Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 58f2d0b

Browse files
Make number of elites less fragile
At the moment it is too easy to break autotuning by specifying a pop_size that is smaller than the default number of elites. Specifying the number of elites everywhere a small pop_size is required is annoying and unnecessary cognitive overhead. Instead, if one wants to run a short tuning run, default the number of elites to `pop_size/2`, which also works for `3` the minimal size for which a short tuning run makes sense.
1 parent eec8932 commit 58f2d0b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tc/autotuner/genetic_search.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,14 @@ GeneticSearch::GeneticSearch(
161161
size_t populationSize,
162162
uint8_t crossOverRate,
163163
uint8_t mutationRate,
164-
size_t numberElites)
164+
size_t numElites)
165165
: population(),
166166
lastBestConf(confs[0]),
167167
numGenerations(numGenerations),
168168
maxPopulationSize(populationSize),
169169
crossOverRate(crossOverRate),
170170
mutationRate(mutationRate),
171-
numberElites(numberElites),
171+
numberElites(std::min(numElites, populationSize / 2)),
172172
rng{std::random_device{}()} {
173173
restoreRngState(rng);
174174
VALIDATE();

0 commit comments

Comments
 (0)