From 9121d36e27fc07f3045747324d86847560461af7 Mon Sep 17 00:00:00 2001 From: Sebastian Castro Date: Sat, 30 Nov 2024 12:47:36 -0500 Subject: [PATCH] Initialize with the best seed instead of initial seed at population wipeout --- src/ik_memetic.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ik_memetic.cpp b/src/ik_memetic.cpp index d0ce2f8..34cfb60 100644 --- a/src/ik_memetic.cpp +++ b/src/ik_memetic.cpp @@ -254,8 +254,9 @@ auto ik_memetic_impl(std::vector const& initial_guess, return ik.best(); } if (ik.checkWipeout()) { + // Ensure the first member of the new population is the best so far. if (print_debug) fmt::print("Population wipeout\n"); - ik.initPopulation(robot, cost_fn, initial_guess); + ik.initPopulation(robot, cost_fn, ik.best().genes); } // Check termination condition from other threads finding a solution.