diff --git a/.idea/editor.xml b/.idea/editor.xml
index 1c959fd..bcfc588 100644
--- a/.idea/editor.xml
+++ b/.idea/editor.xml
@@ -242,244 +242,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2c72509..9d17213 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,7 +27,7 @@ macro(compile_options target_name)
sanitizers(${target_name})
endmacro()
-project(blt-gp VERSION 0.5.3)
+project(blt-gp VERSION 0.5.4)
include(CTest)
diff --git a/include/blt/gp/sync.h b/include/blt/gp/sync.h
index cbff1c3..1ef3501 100644
--- a/include/blt/gp/sync.h
+++ b/include/blt/gp/sync.h
@@ -29,7 +29,7 @@ namespace blt::gp
public:
explicit sync_t(gp_program& program, fs::writer_t& writer);
- void trigger(u64 current_time) const;
+ virtual void trigger(u64 current_time) const;
sync_t& with_timer(u64 seconds)
{
diff --git a/src/program.cpp b/src/program.cpp
index 7ac6018..5669dac 100644
--- a/src/program.cpp
+++ b/src/program.cpp
@@ -58,18 +58,40 @@ namespace blt::gp
void gp_program::save_generation(fs::writer_t& writer)
{
+ const auto individuals = current_pop.get_individuals().size();
+ writer.write(&individuals, sizeof(individuals));
+ for (const auto& individual : current_pop.get_individuals())
+ {
+ writer.write(&individual.fitness, sizeof(individual.fitness));
+ individual.tree.to_file(writer);
+ }
}
void gp_program::load_generation(fs::reader_t& reader)
{
+ size_t individuals;
+ reader.read(&individuals, sizeof(individuals));
+ if (current_pop.get_individuals().size() != individuals)
+ {
+ for (size_t i = current_pop.get_individuals().size(); i < individuals; i++)
+ current_pop.get_individuals().emplace_back(tree_t{*this});
+ }
+ for (auto& individual : current_pop.get_individuals())
+ {
+ reader.read(&individual.fitness, sizeof(individual.fitness));
+ individual.tree.clear(*this);
+ individual.tree.from_file(reader);
+ }
}
void gp_program::save_state(fs::writer_t& writer)
{
+
}
void gp_program::load_state(fs::reader_t& reader)
{
+
}
void gp_program::create_threads()