main
Brett 2024-08-09 14:00:16 -04:00
parent 22bb4d0981
commit f8c641c9ee
3 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25) cmake_minimum_required(VERSION 3.25)
project(image-gp-6 VERSION 0.0.26) project(image-gp-6 VERSION 0.0.27)
include(FetchContent) include(FetchContent)

View File

@ -34,7 +34,7 @@ inline constexpr blt::size_t POP_SIZE = 64;
inline constexpr blt::size_t CHANNELS = 3; inline constexpr blt::size_t CHANNELS = 3;
inline constexpr blt::u64 u64_size_min = 1; inline constexpr blt::u64 u64_size_min = 1;
inline constexpr blt::u64 u64_size_max = 9; inline constexpr blt::u64 u64_size_max = 9;
inline constexpr float THRESHOLD = 0.3; inline constexpr float THRESHOLD = 0.5;
inline constexpr auto load_image = "../GSab4SWWcAA1TNR.png"; inline constexpr auto load_image = "../GSab4SWWcAA1TNR.png";
inline blt::gp::image_crossover_t image_crossover; inline blt::gp::image_crossover_t image_crossover;

View File

@ -236,7 +236,12 @@ constexpr auto create_fitness_function()
{ {
fitness.raw_fitness = 0; fitness.raw_fitness = 0;
for (blt::size_t i = 0; i < DATA_CHANNELS_SIZE; i++) for (blt::size_t i = 0; i < DATA_CHANNELS_SIZE; i++)
fitness.raw_fitness += compare_values(v.rgb_data[i], base_image.rgb_data[i]); {
auto diff = compare_values(v.rgb_data[i], base_image.rgb_data[i]);
fitness.raw_fitness += diff;
if (diff < 0.01)
fitness.raw_fitness -= fitness.raw_fitness * 0.02;
}
fitness.raw_fitness /= (IMAGE_SIZE * IMAGE_SIZE); fitness.raw_fitness /= (IMAGE_SIZE * IMAGE_SIZE);
auto raw = get_fractal_value(v); auto raw = get_fractal_value(v);