Skip to content

Commit 8ceba33

Browse files
authored
Initialize with the best seed instead of initial seed at population wipeout (#77)
1 parent 0ed7cb3 commit 8ceba33

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ik_memetic.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,9 @@ auto ik_memetic_impl(std::vector<double> const& initial_guess,
254254
return ik.best();
255255
}
256256
if (ik.checkWipeout()) {
257+
// Ensure the first member of the new population is the best so far.
257258
if (print_debug) fmt::print("Population wipeout\n");
258-
ik.initPopulation(robot, cost_fn, initial_guess);
259+
ik.initPopulation(robot, cost_fn, ik.best().genes);
259260
}
260261

261262
// Check termination condition from other threads finding a solution.

0 commit comments

Comments
 (0)