working on main is bad
parent
8b0b0dbefa
commit
2b1f1c92ab
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
project(blt-gp VERSION 0.1.50)
|
||||
project(blt-gp VERSION 0.1.51)
|
||||
|
||||
include(CTest)
|
||||
|
||||
|
|
|
@ -90,8 +90,6 @@ float example_function(float x)
|
|||
return x * x * x * x + x * x * x + x * x + x;
|
||||
}
|
||||
|
||||
BLT_MAKE_CONFIG_TYPE(test, BLT_MAKE_GETTER_AND_SETTER(int, silly) BLT_MAKE_GETTER(int, billy));
|
||||
|
||||
int main()
|
||||
{
|
||||
test t;
|
||||
|
|
|
@ -57,6 +57,10 @@ namespace blt::gp
|
|||
class crossover_t
|
||||
{
|
||||
public:
|
||||
struct point_info_t
|
||||
{
|
||||
type_id return_type;
|
||||
};
|
||||
struct crossover_point_t
|
||||
{
|
||||
blt::ptrdiff_t p1_crossover_point;
|
||||
|
@ -78,7 +82,8 @@ 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<blt::ptrdiff_t> find_place_of_type(gp_program& program, const tree_t& t, type_id type) const;
|
||||
|
||||
static std::optional<blt::ptrdiff_t> find_place_of_type(gp_program& program, const tree_t& t, type_id type);
|
||||
|
||||
/**
|
||||
* child1 and child2 are copies of the parents, the result of selecting a crossover point and performing standard subtree crossover.
|
||||
|
|
2
lib/blt
2
lib/blt
|
@ -1 +1 @@
|
|||
Subproject commit 7410dfe0ff6196e77856a79b4c92b05a90e35880
|
||||
Subproject commit 56a3c2f836a37258290c2cc43b52df18249b1c0c
|
|
@ -211,9 +211,13 @@ namespace blt::gp
|
|||
return crossover_point_t{static_cast<blt::ptrdiff_t>(crossover_point), static_cast<blt::ptrdiff_t>(attempted_point)};
|
||||
}
|
||||
|
||||
std::optional<blt::ptrdiff_t> crossover_t::find_place_of_type(gp_program& program, const tree_t& t, type_id type) const
|
||||
std::optional<blt::ptrdiff_t> crossover_t::find_place_of_type(gp_program& program, const tree_t& t, type_id type)
|
||||
{
|
||||
return std::optional<blt::ptrdiff_t>();
|
||||
auto attempted_point = program.get_random().get_size_t(1ul, t.get_operations().size());
|
||||
auto& attempted_point_type = program.get_operator_info(t.get_operations()[attempted_point].id);
|
||||
if (type == attempted_point_type.return_type)
|
||||
return {attempted_point};
|
||||
return {};
|
||||
}
|
||||
|
||||
bool mutation_t::apply(gp_program& program, const tree_t&, tree_t& c)
|
||||
|
|
Loading…
Reference in New Issue