From 73e978b894f32ff9a844135031fdf748c635ebac Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 20 Sep 2011 15:57:19 +0200 Subject: [PATCH 1/1] Short documentation for makhoul3, and reindentation. --- ALGORITHMS | 6 ++++++ loba_makhoul3.cpp | 8 ++++---- options.cpp | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ALGORITHMS b/ALGORITHMS index d73b675..53fe1f3 100644 --- a/ALGORITHMS +++ b/ALGORITHMS @@ -89,6 +89,12 @@ Références: cf. MAKHOUL.txt +makhoul3 +======== +Comme makhoul mais, dans le ratio 1/(N+1), N correspond au nombre de +voisins moins chargés. + + none ==== Aucun équilibrage. Peut-être utile pour tester/déboguer le code. diff --git a/loba_makhoul3.cpp b/loba_makhoul3.cpp index 9517002..fd06d22 100644 --- a/loba_makhoul3.cpp +++ b/loba_makhoul3.cpp @@ -9,10 +9,10 @@ void loba_makhoul3::load_balance() pneigh_sort_by_load(std::less()); print_loads_p(false, xbt_log_priority_debug); - int nb_less_loaded=0; - for (unsigned i = 0 ; i < pneigh.size() ; ++i) { - nb_less_loaded+=(pneigh[i]->get_load()<=get_load()); - } + int nb_less_loaded = 0; + for (unsigned i = 0 ; i < pneigh.size() ; ++i) { + nb_less_loaded += (pneigh[i]->get_load() <= get_load()); + } double alpha = 1.0 / (nb_less_loaded ); double my_load = get_load(); diff --git a/options.cpp b/options.cpp index 482d486..908a797 100644 --- a/options.cpp +++ b/options.cpp @@ -97,7 +97,7 @@ namespace opt { loba_makhoul); NOL_INSERT("makhoul2", "balance with Makhoul's source code", loba_makhoul2); - NOL_INSERT("makhoul3", "describe your algorithm here...", + NOL_INSERT("makhoul3", "variation on Makhoul's algorithm", loba_makhoul3); NOL_INSERT("none", "no load-balancing (for testing only)", process); -- 2.39.5