From 6bd0191186d2a3441b4d258ae57a8523b6bbce85 Mon Sep 17 00:00:00 2001 From: Tomato-in <2544716393@qq.com> Date: Tue, 13 May 2025 13:03:53 +0800 Subject: [PATCH] Fix: Corrected the external archive error in the jSO algorithm Problem Description: In the jSO algorithm, the external archive was storing successful trials, but according to the original paper, it should store eliminated individuals. The external archive is meant to maintain diversity, and storing successful trials fails to achieve this effect. Solution: Modified the jSO algorithm's external archive update to store eliminated individuals. --- include/boost/math/optimization/jso.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/boost/math/optimization/jso.hpp b/include/boost/math/optimization/jso.hpp index 25bc5e8fc..e79229828 100644 --- a/include/boost/math/optimization/jso.hpp +++ b/include/boost/math/optimization/jso.hpp @@ -349,13 +349,14 @@ jso(const Func cost_function, jso_parameters &jso_params, delta_f.push_back(abs(cost[i] - trial_cost)); } // Build the historical archive: + // The historical archive stores inferior solutions for the purpose of maintaining diversity. if (archive.size() < cost.size()) { - archive.push_back(trial_vector); + archive.push_back(population[i]); } else { - // If it's already built, then put the successful trial in a random index: + // If it's already built, then put the eliminated individual in a random index: archive.resize(cost.size()); auto idx = gen() % archive.size(); - archive[idx] = trial_vector; + archive[idx] = population[i]; } cost[i] = trial_cost; population[i] = trial_vector;