silly
parent
a5238bc798
commit
04fe36deb8
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.25)
|
||||||
project(blt-gp VERSION 0.1.52)
|
project(blt-gp VERSION 0.1.53)
|
||||||
|
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <blt/gp/tree.h>
|
#include <blt/gp/tree.h>
|
||||||
#include <blt/gp/generators.h>
|
#include <blt/gp/generators.h>
|
||||||
#include <blt/std/expected.h>
|
#include <blt/std/expected.h>
|
||||||
|
#include <blt/meta/config_generator.h>
|
||||||
|
|
||||||
namespace blt::gp
|
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<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);
|
static std::optional<point_info_t> find_place_of_type(gp_program& program, const tree_t& t, type_id type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
2
lib/blt
2
lib/blt
|
@ -1 +1 @@
|
||||||
Subproject commit 56a3c2f836a37258290c2cc43b52df18249b1c0c
|
Subproject commit cd9ec507d63d5e45f36dd16665f2033b0b5fe5f2
|
|
@ -220,6 +220,26 @@ namespace blt::gp
|
||||||
return {};
|
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)
|
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()));
|
mutate_point(program, c, program.get_random().get_size_t(0ul, c.get_operations().size()));
|
||||||
|
|
Loading…
Reference in New Issue