Running. Only tested single thread version. Stats are looking nice. Needs more validation
This commit is contained in:
10
src/main.cpp
10
src/main.cpp
@@ -3,6 +3,7 @@
|
||||
#include <cstdlib>
|
||||
#include "genetic.h"
|
||||
#include "rand.h"
|
||||
#include "sync.h"
|
||||
|
||||
using namespace genetic;
|
||||
|
||||
@@ -54,11 +55,11 @@ float fitness(const Array<float> &cell) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
int num_gens = 2000;
|
||||
int num_gens = 1000;
|
||||
Strategy<Array<float>> strat {
|
||||
.num_threads = 1,
|
||||
.batch_size = 1,
|
||||
.num_cells_per_thread = 100000,
|
||||
.stats_print_period_s = 2,
|
||||
.num_cells_per_thread = 10000,
|
||||
.num_generations = num_gens,
|
||||
.test_all = true,
|
||||
.test_chance = 0.0, // doesn't matter
|
||||
@@ -76,7 +77,9 @@ int main(int argc, char **argv) {
|
||||
.fitness=fitness
|
||||
};
|
||||
|
||||
TimeSpan start = now();
|
||||
auto best_cell = run(strat);
|
||||
TimeSpan runtime = now() - start;
|
||||
|
||||
float sum = 0;
|
||||
float product = 1;
|
||||
@@ -90,4 +93,5 @@ int main(int argc, char **argv) {
|
||||
printf("\n");
|
||||
printf("Final Sum: %f\n", sum);
|
||||
printf("Final Product: %f\n", product);
|
||||
printf("Execution Time %d (min) %f (s)\n", static_cast<int>(sync::to_min(runtime)), fmod(to_s(runtime), 60) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user