idk what changed but it's still broken
parent
dc49f0b33a
commit
27ecb2b46d
|
@ -27,7 +27,7 @@ macro(compile_options target_name)
|
|||
sanitizers(${target_name})
|
||||
endmacro()
|
||||
|
||||
project(blt-gp VERSION 0.5.14)
|
||||
project(blt-gp VERSION 0.5.15)
|
||||
|
||||
include(CTest)
|
||||
|
||||
|
|
|
@ -82,12 +82,21 @@ namespace blt::gp
|
|||
f32 terminal_chance = 0.1;
|
||||
// use traversal to select point instead of random selection
|
||||
bool traverse = false;
|
||||
|
||||
BLT_MAKE_SETTER_LVALUE(u32, max_crossover_tries);
|
||||
BLT_MAKE_SETTER_LVALUE(u32, max_crossover_iterations);
|
||||
BLT_MAKE_SETTER_LVALUE(u32, min_tree_size);
|
||||
BLT_MAKE_SETTER_LVALUE(f32, depth_multiplier);
|
||||
BLT_MAKE_SETTER_LVALUE(f32, terminal_chance);
|
||||
BLT_MAKE_SETTER_LVALUE(bool, traverse);
|
||||
};
|
||||
|
||||
explicit crossover_t(const config_t& config): config(config)
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool apply(gp_program& program, const tree_t& p1, const tree_t& p2, tree_t& c1, tree_t& c2) = 0;
|
||||
|
||||
[[nodiscard]] const config_t& get_config() const
|
||||
{
|
||||
return config;
|
||||
|
|
2
lib/blt
2
lib/blt
|
@ -1 +1 @@
|
|||
Subproject commit a1bc8cf1c2390e507be6482dde0960daf9f662d8
|
||||
Subproject commit 2bac310e55df06a3e378c932afa2a4c2bc2123e7
|
|
@ -40,7 +40,7 @@ namespace blt::gp
|
|||
// this is largely to not break the tests :3
|
||||
// it's also to allow for quick setup of a gp program if you don't care how crossover or mutation is handled
|
||||
static advanced_mutation_t s_mutator;
|
||||
static crossover_t s_crossover;
|
||||
static subtree_crossover_t s_crossover;
|
||||
static ramped_half_initializer_t s_init;
|
||||
|
||||
prog_config_t::prog_config_t(): mutator(s_mutator), crossover(s_crossover), pop_initializer(s_init)
|
||||
|
|
|
@ -139,9 +139,6 @@ namespace blt::gp
|
|||
// Mating crossover analogs to same species breeding. Only works if tree is mostly similar
|
||||
case 1:
|
||||
{
|
||||
// if fails got to case0
|
||||
if (false)
|
||||
goto case0;
|
||||
}
|
||||
// Subtree crossover, select random points inside trees and swap their subtrees
|
||||
case 2:
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <blt/std/variant.h>
|
||||
#include <filesystem>
|
||||
|
||||
#include "../examples/symbolic_regression.h"
|
||||
|
@ -25,6 +26,60 @@
|
|||
#include <fstream>
|
||||
#include <blt/fs/stream_wrappers.h>
|
||||
|
||||
|
||||
struct no_default
|
||||
{
|
||||
no_default() = delete;
|
||||
|
||||
no_default(int)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct not_copyable
|
||||
{
|
||||
not_copyable() = default;
|
||||
not_copyable(const not_copyable&) = delete;
|
||||
};
|
||||
|
||||
struct copyable
|
||||
{
|
||||
copyable() = default;
|
||||
copyable(const copyable&) = default;
|
||||
};
|
||||
|
||||
struct copyable_nothrow
|
||||
{
|
||||
copyable_nothrow() = default;
|
||||
copyable_nothrow(const copyable_nothrow&) noexcept = default;
|
||||
};
|
||||
|
||||
struct not_movable
|
||||
{
|
||||
not_movable() = default;
|
||||
not_movable(not_movable&&) = delete;
|
||||
};
|
||||
|
||||
struct movable
|
||||
{
|
||||
movable() = default;
|
||||
movable(movable&&) = delete;
|
||||
};
|
||||
|
||||
struct movable_nothrow
|
||||
{
|
||||
movable_nothrow() = default;
|
||||
movable_nothrow(movable_nothrow&&) noexcept = delete;
|
||||
};
|
||||
|
||||
blt::variant_t<no_default> no_default_variant;
|
||||
blt::variant_t<not_copyable> not_copyable_variant;
|
||||
blt::variant_t<copyable> copyable_variant;
|
||||
blt::variant_t<copyable_nothrow> copyable_nothrow_variant;
|
||||
blt::variant_t<not_movable> not_movable_variant;
|
||||
blt::variant_t<movable> movable_variant;
|
||||
blt::variant_t<movable_nothrow> movable_nothrow_variant;
|
||||
|
||||
using namespace blt::gp;
|
||||
|
||||
struct context
|
||||
|
|
Loading…
Reference in New Issue