Debugged multithreaded version. Now investigating some performance issues (not every thread is being used). This is an interesting version.

This commit is contained in:
2025-09-10 00:46:50 -05:00
parent 5a048bf469
commit f7e804607f
5 changed files with 221 additions and 74 deletions

View File

@@ -41,9 +41,6 @@ void crossover(const Array<Array<float>*> parents, const Array<Array<float> *> o
}
}
// norm_rand can go negative. fix in genetic.cpp
// child stride doesn't make sense. Should always skip over child num
float fitness(const Array<float> &cell) {
float sum = 0;
float product = 1;
@@ -55,12 +52,14 @@ float fitness(const Array<float> &cell) {
}
int main(int argc, char **argv) {
int num_gens = 1000;
int num_gens = 10000;
Strategy<Array<float>> strat {
.num_threads = 1,
.num_threads = atoi(argv[1]),
.stats_print_period_s = 2,
.num_cells_per_thread = 10000,
.num_cells_per_thread = 100000,
.num_generations = num_gens,
.share_breakthroughs=true,
.share_breakthrough_gen_period=10,
.test_all = true,
.test_chance = 0.0, // doesn't matter
.enable_crossover = true,