From 8ceba33d939deef5f512ee9cd327befa00de264a Mon Sep 17 00:00:00 2001 From: Sebastian Castro <4603398+sea-bass@users.noreply.github.com> Date: Sat, 30 Nov 2024 13:01:09 -0500 Subject: [PATCH] Initialize with the best seed instead of initial seed at population wipeout (#77) --- 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.