From 6972a30696f211159b52739541264125ac73e342 Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Mon, 22 Jul 2024 21:59:05 -0400 Subject: [PATCH] finish symbolic regression example --- CMakeLists.txt | 2 +- examples/symbolic_regression.cpp | 13 +++++++------ test_perf.sh | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1201438..a4f7b59 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.25) -project(blt-gp VERSION 0.0.101) +project(blt-gp VERSION 0.0.103) include(CTest) diff --git a/examples/symbolic_regression.cpp b/examples/symbolic_regression.cpp index de19f13..f17969d 100644 --- a/examples/symbolic_regression.cpp +++ b/examples/symbolic_regression.cpp @@ -34,7 +34,7 @@ std::array fitness_cases; blt::gp::prog_config_t config = blt::gp::prog_config_t() .set_initial_min_tree_size(2) .set_initial_max_tree_size(6) - .set_elite_count(10) + .set_elite_count(2) .set_crossover_chance(0.9) .set_mutation_chance(0.1) .set_reproduction_chance(0.1) @@ -106,10 +106,10 @@ int main() builder.add_operator(sub); builder.add_operator(mul); builder.add_operator(pro_div); - //builder.add_operator(op_sin); - //builder.add_operator(op_cos); - //builder.add_operator(op_exp); - //builder.add_operator(op_log); + builder.add_operator(op_sin); + builder.add_operator(op_cos); + builder.add_operator(op_exp); + builder.add_operator(op_log); builder.add_operator(lit, true); builder.add_operator(op_x); @@ -124,7 +124,8 @@ int main() { BLT_TRACE("------------{Begin Generation %ld}------------", program.get_current_generation()); BLT_START_INTERVAL("Symbolic Regression", "Gen"); - program.create_next_generation(blt::gp::select_fitness_proportionate_t{}, blt::gp::select_fitness_proportionate_t{}, blt::gp::select_fitness_proportionate_t{}); + auto sel = blt::gp::select_fitness_proportionate_t{}; + program.create_next_generation(sel, sel, sel); BLT_END_INTERVAL("Symbolic Regression", "Gen"); BLT_TRACE("Move to next generation"); BLT_START_INTERVAL("Symbolic Regression", "Fitness"); diff --git a/test_perf.sh b/test_perf.sh index 7ace957..ae120c8 100755 --- a/test_perf.sh +++ b/test_perf.sh @@ -1 +1 @@ -perf stat -d -d -d -r 30 -e branches,branch-misses,cache-misses,cache-references,cycles,instructions,alignment-faults,cgroup-switches,faults,duration_time,user_time,system_time,L1-dcache-loads,L1-dcache-load-misses,L1-dcache-prefetches,L1-icache-loads,L1-icache-load-misses,dTLB-loads,dTLB-load-misses,iTLB-loads,iTLB-load-misses,l2_request_g1.all_no_prefetch,page-faults,page-faults:u,page-faults:k ./cmake-build-release/blt-SR-playground-example +perf stat -d -d -d -r 30 -e branches,branch-misses,cache-misses,cache-references,cycles,instructions,alignment-faults,cgroup-switches,faults,duration_time,user_time,system_time,L1-dcache-loads,L1-dcache-load-misses,L1-dcache-prefetches,L1-icache-loads,L1-icache-load-misses,dTLB-loads,dTLB-load-misses,iTLB-loads,iTLB-load-misses,l2_request_g1.all_no_prefetch,page-faults,page-faults:u,page-faults:k ./cmake-build-release/blt-symbolic-regression-example