race condition?
parent
34a3343a89
commit
37e8856348
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(blt-gp VERSION 0.0.81)
|
project(blt-gp VERSION 0.0.82)
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
|
@ -14,7 +14,9 @@ set(CMAKE_CXX_STANDARD 17)
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
add_subdirectory(lib/blt)
|
if (NOT TARGET BLT)
|
||||||
|
add_subdirectory(lib/blt)
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(include/)
|
include_directories(include/)
|
||||||
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
file(GLOB_RECURSE PROJECT_BUILD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
|
||||||
|
|
|
@ -52,7 +52,8 @@ namespace blt::gp
|
||||||
{
|
{
|
||||||
for (blt::size_t i = 0; i < config.elites; i++)
|
for (blt::size_t i = 0; i < config.elites; i++)
|
||||||
{
|
{
|
||||||
//BLT_INFO("%lf >= %lf? // %lf", ind.second.fitness.adjusted_fitness, values[i].second, ind.second.fitness.raw_fitness);
|
BLT_INFO("%lf >= %lf? // %lf (indexes: %ld %ld)", ind.second.fitness.adjusted_fitness, values[i].second,
|
||||||
|
ind.second.fitness.raw_fitness, ind.first, values[i].first);
|
||||||
if (ind.second.fitness.adjusted_fitness >= values[i].second)
|
if (ind.second.fitness.adjusted_fitness >= values[i].second)
|
||||||
{
|
{
|
||||||
bool doesnt_contain = true;
|
bool doesnt_contain = true;
|
||||||
|
@ -141,7 +142,8 @@ namespace blt::gp
|
||||||
while (next_pop.get_individuals().size() < config.population_size)
|
while (next_pop.get_individuals().size() < config.population_size)
|
||||||
{
|
{
|
||||||
int sel = random.get_i32(0, 3);
|
int sel = random.get_i32(0, 3);
|
||||||
switch (sel){
|
switch (sel)
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
// everyone gets a chance once per loop.
|
// everyone gets a chance once per loop.
|
||||||
if (random.choice(config.crossover_chance))
|
if (random.choice(config.crossover_chance))
|
||||||
|
|
|
@ -77,8 +77,8 @@ namespace blt::gp
|
||||||
public:
|
public:
|
||||||
struct config_t
|
struct config_t
|
||||||
{
|
{
|
||||||
blt::size_t replacement_min_depth = 3;
|
blt::size_t replacement_min_depth = 2;
|
||||||
blt::size_t replacement_max_depth = 7;
|
blt::size_t replacement_max_depth = 6;
|
||||||
|
|
||||||
std::reference_wrapper<tree_generator_t> generator;
|
std::reference_wrapper<tree_generator_t> generator;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue