main
Brett 2024-09-06 14:33:23 -04:00
parent a5238bc798
commit 04fe36deb8
4 changed files with 34 additions and 10 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.25)
project(blt-gp VERSION 0.1.52)
project(blt-gp VERSION 0.1.53)
include(CTest)

View File

@ -24,6 +24,7 @@
#include <blt/gp/tree.h>
#include <blt/gp/generators.h>
#include <blt/std/expected.h>
#include <blt/meta/config_generator.h>
namespace blt::gp
{
@ -84,6 +85,9 @@ namespace blt::gp
std::optional<crossover_t::crossover_point_t> get_crossover_point(gp_program& program, const tree_t& c1, const tree_t& c2) const;
std::optional<point_info_t> get_point_traverse(gp_program& program, const tree_t& t, std::optional<type_id> type,
bool scale_per_depth = true) const;
static std::optional<point_info_t> find_place_of_type(gp_program& program, const tree_t& t, type_id type);
/**

@ -1 +1 @@
Subproject commit 56a3c2f836a37258290c2cc43b52df18249b1c0c
Subproject commit cd9ec507d63d5e45f36dd16665f2033b0b5fe5f2

View File

@ -220,6 +220,26 @@ namespace blt::gp
return {};
}
std::optional<crossover_t::point_info_t> crossover_t::get_point_traverse(gp_program& program, const tree_t& t, std::optional<type_id> type,
bool scale_per_depth) const
{
auto& random = program.get_random();
blt::ptrdiff_t point = 0;
while (true)
{
// traverse to a child
if (random.choice())
{
}
if (type)
{
}
}
}
bool mutation_t::apply(gp_program& program, const tree_t&, tree_t& c)
{
mutate_point(program, c, program.get_random().get_size_t(0ul, c.get_operations().size()));