aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ats/perf_ats_solver.c266
-rw-r--r--src/ats/perf_ats_solver.conf31
-rw-r--r--src/ats/plugin_ats_mlp.c90
-rw-r--r--src/ats/plugin_ats_mlp.h7
4 files changed, 112 insertions, 282 deletions
diff --git a/src/ats/perf_ats_solver.c b/src/ats/perf_ats_solver.c
index 197414a6d..3f0c3e49d 100644
--- a/src/ats/perf_ats_solver.c
+++ b/src/ats/perf_ats_solver.c
@@ -75,16 +75,6 @@ struct PerfHandle
75 struct Iteration *iterations_results; 75 struct Iteration *iterations_results;
76 76
77 /** 77 /**
78 * Array to store averaged full solution result with length #peers
79 */
80 struct Result *averaged_full_result;
81
82 /**
83 * Array to store averaged updated solution result with length #peers
84 */
85 struct Result *averaged_update_result;
86
87 /**
88 * The current result 78 * The current result
89 */ 79 */
90 struct Result *current_result; 80 struct Result *current_result;
@@ -171,15 +161,7 @@ struct PerfHandle
171struct Iteration 161struct Iteration
172{ 162{
173 struct Result **results_array; 163 struct Result **results_array;
174 /**
175 * Head of the linked list
176 */
177 struct Result *result_head;
178 164
179 /**
180 * Tail of the linked list
181 */
182 struct Result *result_tail;
183}; 165};
184 166
185 167
@@ -337,8 +319,6 @@ end_now (int res)
337 319
338 GNUNET_free_non_null (ph.peers); 320 GNUNET_free_non_null (ph.peers);
339 GNUNET_free_non_null (ph.iterations_results); 321 GNUNET_free_non_null (ph.iterations_results);
340 GNUNET_free_non_null (ph.averaged_full_result);
341 GNUNET_free_non_null (ph.averaged_update_result);
342 322
343 GAS_normalization_stop (); 323 GAS_normalization_stop ();
344 ret = res; 324 ret = res;
@@ -380,7 +360,7 @@ perf_update_address (struct ATS_Address *cur)
380 abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100); 360 abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 100);
381 rel_val = (100 + (double) abs_val) / 100; 361 rel_val = (100 + (double) abs_val) / 100;
382 362
383 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 363 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
384 "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n", 364 "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n",
385 GNUNET_i2s (&cur->peer), cur, 365 GNUNET_i2s (&cur->peer), cur,
386 "GNUNET_ATS_QUALITY_NET_DELAY", 366 "GNUNET_ATS_QUALITY_NET_DELAY",
@@ -393,7 +373,7 @@ perf_update_address (struct ATS_Address *cur)
393 abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10); 373 abs_val = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 10);
394 rel_val = (100 + (double) abs_val) / 100; 374 rel_val = (100 + (double) abs_val) / 100;
395 375
396 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 376 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
397 "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n", 377 "Updating peer `%s' address %p type %s abs val %u rel val %.3f\n",
398 GNUNET_i2s (&cur->peer), cur, "GNUNET_ATS_QUALITY_NET_DISTANCE", 378 GNUNET_i2s (&cur->peer), cur, "GNUNET_ATS_QUALITY_NET_DISTANCE",
399 abs_val, rel_val); 379 abs_val, rel_val);
@@ -603,9 +583,10 @@ solver_info_cb (void *cls,
603 /* Create new result */ 583 /* Create new result */
604 tmp = GNUNET_new (struct Result); 584 tmp = GNUNET_new (struct Result);
605 ph.current_result = tmp; 585 ph.current_result = tmp;
606 ph.iterations_results[ph.current_iteration-1].results_array[ph.current_p -1] = tmp; 586 ph.iterations_results[ph.current_iteration-1].results_array[ph.current_p] = tmp;
587 /*
607 GNUNET_CONTAINER_DLL_insert_tail(ph.iterations_results[ph.current_iteration-1].result_head, 588 GNUNET_CONTAINER_DLL_insert_tail(ph.iterations_results[ph.current_iteration-1].result_head,
608 ph.iterations_results[ph.current_iteration-1].result_tail, tmp); 589 ph.iterations_results[ph.current_iteration-1].result_tail, tmp);*/
609 ph.current_result->addresses = ph.current_a; 590 ph.current_result->addresses = ph.current_a;
610 ph.current_result->peers = ph.current_p; 591 ph.current_result->peers = ph.current_p;
611 ph.current_result->s_total = GNUNET_TIME_absolute_get(); 592 ph.current_result->s_total = GNUNET_TIME_absolute_get();
@@ -792,113 +773,17 @@ solver_info_cb (void *cls,
792static void 773static void
793evaluate (int iteration) 774evaluate (int iteration)
794{ 775{
795 struct GNUNET_DISK_FileHandle *f_full;
796 struct GNUNET_DISK_FileHandle *f_update;
797 char * data_fn_full;
798 char * data_fn_update;
799 char * data;
800 struct Result *cur; 776 struct Result *cur;
801 struct Result *next; 777 int cp;
802 struct Result *cur_res;
803 char * str_d_total;
804 char * str_d_setup;
805 char * str_d_lp;
806 char * str_d_mlp;
807 char * iter_text;
808
809 f_full = NULL;
810 f_update = NULL;
811
812 data_fn_full = NULL;
813
814 if (ph.create_datafile)
815 {
816 if (-1 == iteration)
817 GNUNET_asprintf (&iter_text, "%s", "avg");
818 else
819 GNUNET_asprintf (&iter_text, "%u", iteration);
820 GNUNET_asprintf (&data_fn_full,
821 "perf_%s_full_%s_%u_%u_%u.data",
822 ph.ats_string,
823 iter_text,
824 ph.N_peers_start,
825 ph.N_peers_end,
826 ph.N_address);
827 GNUNET_free (iter_text);
828 f_full = GNUNET_DISK_file_open (data_fn_full,
829 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
830 GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
831 if (NULL == f_full)
832 {
833 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
834 "Cannot open gnuplot file `%s'\n",
835 data_fn_full);
836 GNUNET_free (data_fn_full);
837 return;
838 }
839 data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n";
840 if (GNUNET_SYSERR == GNUNET_DISK_file_write(f_full, data, strlen(data)))
841 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
842 "Cannot write data to log file `%s'\n",
843 data_fn_full);
844 }
845
846 data_fn_update = NULL;
847 if ((ph.create_datafile) && (GNUNET_YES == ph.measure_updates))
848 {
849 if (-1 == iteration)
850 GNUNET_asprintf (&iter_text, "%s", "avg");
851 else
852 GNUNET_asprintf (&iter_text, "%u", iteration);
853 GNUNET_asprintf (&data_fn_update, "perf_%s_update_i%u_%u_%u_%u.data",
854 ph.ats_string,
855 iter_text,
856 ph.N_peers_start,
857 ph.N_peers_end,
858 ph.N_address);
859 GNUNET_free (iter_text);
860 f_update = GNUNET_DISK_file_open (data_fn_update,
861 GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
862 GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE);
863 if (NULL == f_update)
864 {
865 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
866 "Cannot open gnuplot file `%s'\n", data_fn_update);
867 GNUNET_free (data_fn_update);
868 if (NULL != f_full)
869 GNUNET_DISK_file_close (f_full);
870 GNUNET_free (data_fn_full);
871 return;
872 }
873 data = "#peers;addresses;time total in us;#time setup in us;#time lp in us;#time mlp in us;\n";
874 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen(data)))
875 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
876 "Cannot write data to log file `%s'\n",
877 data_fn_update);
878 }
879 778
880 next = ph.iterations_results[ph.current_iteration -1].result_head; 779 for (cp = ph.N_peers_start; cp <= ph.N_peers_end; cp ++)
881 while (NULL != (cur = next))
882 { 780 {
883 next = cur->next; 781 cur = ph.iterations_results[ph.current_iteration-1].results_array[cp];
884 str_d_total = NULL; 782 if (0 == cp)
885 str_d_setup = NULL; 783 continue;
886 str_d_lp = NULL; 784 if (NULL == cur)
887 str_d_mlp = NULL; 785 GNUNET_break (0);
888
889 /* Print log */
890 if (GNUNET_NO == cur->update)
891 {
892 cur_res = &ph.averaged_full_result[cur->peers - ph.N_peers_start];
893 }
894 else
895 {
896 cur_res = &ph.averaged_update_result[cur->peers - ph.N_peers_start];
897 }
898 786
899 cur_res->peers = cur->peers;
900 cur_res->addresses = cur->addresses;
901 cur_res->update = cur->update;
902 787
903 if (GNUNET_NO == cur->valid) 788 if (GNUNET_NO == cur->valid)
904 { 789 {
@@ -908,131 +793,54 @@ evaluate (int iteration)
908 cur->peers, cur->addresses, "Failed to solve!"); 793 cur->peers, cur->addresses, "Failed to solve!");
909 continue; 794 continue;
910 } 795 }
911 else 796
912 cur_res->valid ++;
913 797
914 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_total.rel_value_us) 798 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_total.rel_value_us)
915 { 799 {
916 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_total.rel_value_us) 800 fprintf (stderr,
917 cur_res->d_total.rel_value_us = 0;
918 if (GNUNET_YES == cur->valid)
919 cur_res->d_total.rel_value_us += cur->d_total.rel_value_us;
920 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
921 "Total time to solve %s for %u peers %u addresses: %llu us\n", 801 "Total time to solve %s for %u peers %u addresses: %llu us\n",
922 (GNUNET_YES == cur->update) ? "updated" : "full", 802 (GNUNET_YES == cur->update) ? "updated" : "full",
923 cur->peers, cur->addresses, 803 cur->peers, cur->addresses,
924 (unsigned long long) cur->d_total.rel_value_us); 804 (unsigned long long) cur->d_total.rel_value_us);
925 GNUNET_asprintf(&str_d_total,
926 "%llu", (unsigned long long) cur->d_total.rel_value_us);
927 } 805 }
928 else 806
929 GNUNET_asprintf(&str_d_total, "-1"); 807
930 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_setup.rel_value_us) 808 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_setup.rel_value_us)
931 { 809 {
932 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_setup.rel_value_us)
933 cur_res->d_setup.rel_value_us = 0;
934 if (GNUNET_YES == cur->valid)
935 cur_res->d_setup.rel_value_us += cur->d_setup.rel_value_us;
936 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 810 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
937 "Total time to setup %s %u peers %u addresses: %llu us\n", 811 "Total time to setup %s %u peers %u addresses: %llu us\n",
938 (GNUNET_YES == cur->update) ? "updated" : "full", 812 (GNUNET_YES == cur->update) ? "updated" : "full",
939 cur->peers, cur->addresses, 813 cur->peers, cur->addresses,
940 (unsigned long long) cur->d_setup.rel_value_us); 814 (unsigned long long) cur->d_setup.rel_value_us);
941 GNUNET_asprintf(&str_d_setup, "%llu",
942 (unsigned long long )cur->d_setup.rel_value_us);
943 } 815 }
944 else
945 GNUNET_asprintf(&str_d_setup, "-1");
946 816
947 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_lp.rel_value_us) 817 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_lp.rel_value_us)
948 { 818 {
949 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_lp.rel_value_us)
950 cur_res->d_lp.rel_value_us = 0;
951 if (GNUNET_YES == cur->valid)
952 cur_res->d_lp.rel_value_us += cur->d_lp.rel_value_us;
953 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 819 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
954 "Total time to solve %s LP for %u peers %u addresses: %llu us\n", 820 "Total time to solve %s LP for %u peers %u addresses: %llu us\n",
955 (GNUNET_YES == cur->update) ? "updated" : "full", 821 (GNUNET_YES == cur->update) ? "updated" : "full",
956 cur->peers, 822 cur->peers,
957 cur->addresses, 823 cur->addresses,
958 (unsigned long long )cur->d_lp.rel_value_us); 824 (unsigned long long )cur->d_lp.rel_value_us);
959 GNUNET_asprintf (&str_d_lp,
960 "%llu", (unsigned long long )cur->d_lp.rel_value_us);
961 } 825 }
962 else
963 GNUNET_asprintf (&str_d_lp, "-1");
964 826
965 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_mlp.rel_value_us) 827 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != cur->d_mlp.rel_value_us)
966 { 828 {
967 if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == cur_res->d_mlp.rel_value_us)
968 cur_res->d_mlp.rel_value_us = 0;
969 if (GNUNET_YES == cur->valid)
970 cur_res->d_mlp.rel_value_us += cur->d_mlp.rel_value_us;
971
972 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 829 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
973 "Total time to solve %s MLP for %u peers %u addresses: %llu us\n", 830 "Total time to solve %s MLP for %u peers %u addresses: %llu us\n",
974 (GNUNET_YES == cur->update) ? "updated" : "full", 831 (GNUNET_YES == cur->update) ? "updated" : "full",
975 cur->peers, cur->addresses, 832 cur->peers, cur->addresses,
976 (unsigned long long )cur->d_mlp.rel_value_us); 833 (unsigned long long )cur->d_mlp.rel_value_us);
977 GNUNET_asprintf (&str_d_mlp,
978 "%llu", (unsigned long long )cur->d_mlp.rel_value_us);
979 }
980 else
981 GNUNET_asprintf (&str_d_mlp, "-1");
982
983 data = NULL;
984 if (GNUNET_YES == ph.create_datafile)
985 {
986
987 GNUNET_asprintf (&data,
988 "%u;%u;%s;%s;%s;%s\n",
989 cur->peers, cur->addresses,
990 str_d_total,
991 str_d_setup,
992 str_d_lp,
993 str_d_mlp);
994 if (cur->update == GNUNET_NO)
995 {
996 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_full, data, strlen(data)))
997 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
998 "Cannot write data to log file `%s'\n",
999 data_fn_full);
1000 }
1001 if ((cur->update == GNUNET_YES) && (NULL != f_update))
1002 {
1003 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_update, data, strlen(data)))
1004 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1005 "Cannot write data to log file `%s'\n",
1006 data_fn_update);
1007 }
1008 GNUNET_free (data);
1009 } 834 }
1010 GNUNET_free_non_null (str_d_total);
1011 GNUNET_free_non_null (str_d_setup);
1012 GNUNET_free_non_null (str_d_lp);
1013 GNUNET_free_non_null (str_d_mlp);
1014
1015 GNUNET_CONTAINER_DLL_remove (ph.iterations_results[ph.current_iteration-1].result_head,
1016 ph.iterations_results[ph.current_iteration-1].result_tail, cur);
1017 //GNUNET_free (cur);
1018 } 835 }
1019 836
1020 if ((NULL != f_full) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_full)))
1021 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
1022 data_fn_full);
1023 GNUNET_free_non_null (data_fn_full);
1024
1025 if ((NULL != f_update) && (GNUNET_SYSERR == GNUNET_DISK_file_close (f_update)))
1026 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
1027 data_fn_update);
1028 GNUNET_free_non_null (data_fn_update);
1029} 837}
1030 838
1031/** 839/**
1032 * Evaluate average results for all iterations 840 * Evaluate average results for all iterations
1033 */ 841 */
1034static void 842static void
1035evaluate_average (void) 843write_all_iterations (void)
1036{ 844{
1037 int c_iteration; 845 int c_iteration;
1038 int c_peer; 846 int c_peer;
@@ -1133,10 +941,14 @@ evaluate_average (void)
1133 struct Result *cur_res; 941 struct Result *cur_res;
1134 942
1135 //fprintf (stderr, "P: %u I: %u == %p \n", c_peer, c_iteration, cur_res); 943 //fprintf (stderr, "P: %u I: %u == %p \n", c_peer, c_iteration, cur_res);
1136 cur_res = ph.iterations_results[c_iteration].results_array[c_peer -1]; 944 cur_res = ph.iterations_results[c_iteration].results_array[c_peer];
945 if (c_peer == 0)
946 continue;
947 if (NULL == cur_res)
948 continue;
949
1137 //fprintf (stderr, "P: %u I: %u: P %i A %i\n", c_peer, c_iteration, cur_res->peers, cur_res->addresses); 950 //fprintf (stderr, "P: %u I: %u: P %i A %i\n", c_peer, c_iteration, cur_res->peers, cur_res->addresses);
1138 fprintf (stderr, "D total: %llu\n", (long long unsigned int) cur_res->d_total.rel_value_us); 951 //fprintf (stderr, "D total: %llu\n", (long long unsigned int) cur_res->d_total.rel_value_us);
1139 fprintf (stderr, "D total: %llu\n", (long long unsigned int) cur_res->d_total.rel_value_us);
1140 952
1141 data_tmp = GNUNET_strdup (data_str); 953 data_tmp = GNUNET_strdup (data_str);
1142 GNUNET_free (data_str); 954 GNUNET_free (data_str);
@@ -1149,7 +961,8 @@ evaluate_average (void)
1149 GNUNET_free (data_tmp); 961 GNUNET_free (data_tmp);
1150 962
1151 fprintf (stderr, "Result: %s\n", data_str); 963 fprintf (stderr, "Result: %s\n", data_str);
1152 GNUNET_DISK_file_write (f_full, data_str, strlen(data_str)); 964 if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_full, data_str, strlen(data_str)))
965 GNUNET_break (0);
1153 GNUNET_free (data_str); 966 GNUNET_free (data_str);
1154 } 967 }
1155 968
@@ -1180,7 +993,7 @@ perf_run_iteration (void)
1180 struct ATS_Address * cur_addr; 993 struct ATS_Address * cur_addr;
1181 uint32_t net; 994 uint32_t net;
1182 995
1183 ph.iterations_results[ph.current_iteration-1].results_array = GNUNET_malloc ((count_p) * sizeof (struct Result *)); 996 ph.iterations_results[ph.current_iteration-1].results_array = GNUNET_malloc ((count_p + 1) * sizeof (struct Result *));
1184 ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer)); 997 ph.peers = GNUNET_malloc ((count_p) * sizeof (struct PerfPeer));
1185 for (cp = 0; cp < count_p; cp++) 998 for (cp = 0; cp < count_p; cp++)
1186 perf_create_peer (cp); 999 perf_create_peer (cp);
@@ -1364,6 +1177,7 @@ run (void *cls, char * const *args, const char *cfgfile,
1364 if (0 == ph.N_address) 1177 if (0 == ph.N_address)
1365 ph.N_address = DEFAULT_ADDRESSES; 1178 ph.N_address = DEFAULT_ADDRESSES;
1366 1179
1180
1367 if (ph.N_peers_start != ph.N_peers_end) 1181 if (ph.N_peers_start != ph.N_peers_end)
1368 fprintf (stderr, "Benchmarking solver `%s' with %u to %u peers and %u addresses in %u iterations\n", 1182 fprintf (stderr, "Benchmarking solver `%s' with %u to %u peers and %u addresses in %u iterations\n",
1369 ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address, ph.total_iterations); 1183 ph.ats_string, ph.N_peers_start, ph.N_peers_end, ph.N_address, ph.total_iterations);
@@ -1392,22 +1206,6 @@ run (void *cls, char * const *args, const char *cfgfile,
1392 1206
1393 /* Create array of DLL to store results for iterations */ 1207 /* Create array of DLL to store results for iterations */
1394 ph.iterations_results = GNUNET_malloc (sizeof (struct Iteration) * ph.total_iterations); 1208 ph.iterations_results = GNUNET_malloc (sizeof (struct Iteration) * ph.total_iterations);
1395 ph.averaged_full_result = GNUNET_malloc (sizeof (struct Result) * ((ph.N_peers_end + 1) - ph.N_peers_start));
1396 for (c = 0; c <= ph.N_peers_end - ph.N_peers_start; c++)
1397 {
1398 ph.averaged_full_result[c].d_setup = GNUNET_TIME_UNIT_FOREVER_REL;
1399 ph.averaged_full_result[c].d_total = GNUNET_TIME_UNIT_FOREVER_REL;
1400 ph.averaged_full_result[c].d_lp = GNUNET_TIME_UNIT_FOREVER_REL;
1401 ph.averaged_full_result[c].d_mlp = GNUNET_TIME_UNIT_FOREVER_REL;
1402 }
1403 ph.averaged_update_result = GNUNET_malloc (sizeof (struct Result) * ((ph.N_peers_end + 1) - ph.N_peers_start));
1404 for (c = 0; c <= ph.N_peers_end - ph.N_peers_start; c++)
1405 {
1406 ph.averaged_update_result[c].d_setup = GNUNET_TIME_UNIT_FOREVER_REL;
1407 ph.averaged_update_result[c].d_total = GNUNET_TIME_UNIT_FOREVER_REL;
1408 ph.averaged_update_result[c].d_lp = GNUNET_TIME_UNIT_FOREVER_REL;
1409 ph.averaged_update_result[c].d_mlp = GNUNET_TIME_UNIT_FOREVER_REL;
1410 }
1411 1209
1412 /* Load solver */ 1210 /* Load solver */
1413 ph.env.cfg = solver_cfg; 1211 ph.env.cfg = solver_cfg;
@@ -1452,7 +1250,8 @@ run (void *cls, char * const *args, const char *cfgfile,
1452 evaluate (ph.current_iteration); 1250 evaluate (ph.current_iteration);
1453 fprintf (stderr, "Iteration %u of %u done\n", ph.current_iteration, ph.total_iterations); 1251 fprintf (stderr, "Iteration %u of %u done\n", ph.current_iteration, ph.total_iterations);
1454 } 1252 }
1455 evaluate_average (); 1253 if (ph.create_datafile)
1254 write_all_iterations ();
1456 1255
1457 /* Unload solver*/ 1256 /* Unload solver*/
1458 GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Unloading solver `%s'\n"), ph.ats_string); 1257 GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Unloading solver `%s'\n"), ph.ats_string);
@@ -1462,14 +1261,15 @@ run (void *cls, char * const *args, const char *cfgfile,
1462 { 1261 {
1463 for (c2 = ph.N_peers_start; c2 < ph.N_peers_end; c2++ ) 1262 for (c2 = ph.N_peers_start; c2 < ph.N_peers_end; c2++ )
1464 { 1263 {
1264 if (0 == c2)
1265 continue;
1465 GNUNET_free (ph.iterations_results[c].results_array[c2]); 1266 GNUNET_free (ph.iterations_results[c].results_array[c2]);
1466 } 1267 }
1467 GNUNET_free(ph.iterations_results[c].results_array); 1268 GNUNET_free(ph.iterations_results[c].results_array);
1468 1269
1469 } 1270 }
1470 GNUNET_free (ph.iterations_results); 1271 GNUNET_free (ph.iterations_results);
1471 GNUNET_free (ph.averaged_full_result); 1272
1472 GNUNET_free (ph.averaged_update_result);
1473 GNUNET_CONFIGURATION_destroy (solver_cfg); 1273 GNUNET_CONFIGURATION_destroy (solver_cfg);
1474 GNUNET_STATISTICS_destroy (ph.stat, GNUNET_NO); 1274 GNUNET_STATISTICS_destroy (ph.stat, GNUNET_NO);
1475 ph.solver = NULL; 1275 ph.solver = NULL;
diff --git a/src/ats/perf_ats_solver.conf b/src/ats/perf_ats_solver.conf
index 2cdb6cfae..a48bae909 100644
--- a/src/ats/perf_ats_solver.conf
+++ b/src/ats/perf_ats_solver.conf
@@ -1,22 +1,22 @@
1[ats] 1[ats]
2# Network specific inbound/outbound quotas 2# Network specific inbound/outbound quotas
3UNSPECIFIED_QUOTA_IN = 1000 3UNSPECIFIED_QUOTA_IN = 10000
4UNSPECIFIED_QUOTA_OUT = 1000 4UNSPECIFIED_QUOTA_OUT = 10000
5# LOOPBACK 5# LOOPBACK
6LOOPBACK_QUOTA_IN = 1000 6LOOPBACK_QUOTA_IN = 10000
7LOOPBACK_QUOTA_OUT = 1000 7LOOPBACK_QUOTA_OUT = 10000
8# LAN 8# LAN
9LAN_QUOTA_IN = 1000 9LAN_QUOTA_IN = 10000
10LAN_QUOTA_OUT = 1000 10LAN_QUOTA_OUT = 10000
11# WAN 11# WAN
12WAN_QUOTA_IN = 1000 12WAN_QUOTA_IN = 10000
13WAN_QUOTA_OUT = 1000 13WAN_QUOTA_OUT = 10000
14# WLAN 14# WLAN
15WLAN_QUOTA_IN = 1000 15WLAN_QUOTA_IN = 10000
16WLAN_QUOTA_OUT = 1000 16WLAN_QUOTA_OUT = 10000
17# BLUETOOTH 17# BLUETOOTH
18BLUETOOTH_QUOTA_IN = 1000 18BLUETOOTH_QUOTA_IN = 10000
19BLUETOOTH_QUOTA_OUT = 1000 19BLUETOOTH_QUOTA_OUT = 10000
20 20
21# Proportional specific settings 21# Proportional specific settings
22# How proportional to preferences is bandwidth distribution in a network 22# How proportional to preferences is bandwidth distribution in a network
@@ -38,8 +38,12 @@ PROP_STABILITY_FACTOR = 125
38# MLP_COEFFICIENT_D = 1.0 38# MLP_COEFFICIENT_D = 1.0
39# MLP_COEFFICIENT_U = 1.0 39# MLP_COEFFICIENT_U = 1.0
40# MLP_COEFFICIENT_R = 1.0 40# MLP_COEFFICIENT_R = 1.0
41MLP_MIN_BANDWIDTH = 1 41MLP_MIN_BANDWIDTH = 10
42# MLP_MIN_CONNECTIONS = 4 42# MLP_MIN_CONNECTIONS = 4
43MLP_DBG_FEASIBILITY_ONLY = NO
44MLP_DBG_AUTOSCALE_PROBLEM = YES
45# MLP_DBG_INTOPT_PRESOLVE = YES
46#MLP_DBG_GLPK_VERBOSE = YES
43 47
44# MLP Log settings 48# MLP Log settings
45# Dump all problems to disk 49# Dump all problems to disk
@@ -47,4 +51,3 @@ MLP_DUMP_PROBLEM_ALL = NO
47# Dump all solution to disk 51# Dump all solution to disk
48MLP_DUMP_SOLUTION_ALL = NO 52MLP_DUMP_SOLUTION_ALL = NO
49# Print GLPK output 53# Print GLPK output
50MLP_GLPK_VERBOSE = NO
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c
index 07d9b9ea9..251283781 100644
--- a/src/ats/plugin_ats_mlp.c
+++ b/src/ats/plugin_ats_mlp.c
@@ -1177,48 +1177,61 @@ GAS_mlp_solve_problem (void *solver)
1177 return GNUNET_OK; 1177 return GNUNET_OK;
1178 } 1178 }
1179 if (GNUNET_YES == mlp->stat_mlp_prob_changed) 1179 if (GNUNET_YES == mlp->stat_mlp_prob_changed)
1180 {
1181 LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n");
1182 notify(mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS, GAS_INFO_FULL);
1183 mlp_delete_problem(mlp);
1184 if (GNUNET_SYSERR == mlp_create_problem(mlp))
1185 {
1186 notify(mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_FAIL, GAS_INFO_FULL);
1187 return GNUNET_SYSERR;
1188 }
1189 notify(mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_SUCCESS, GAS_INFO_FULL);
1190 if (GNUNET_NO == mlp->opt_dbg_intopt_presolver)
1180 { 1191 {
1181 LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n"); 1192 mlp->control_param_lp.presolve = GLP_YES; /* LP presolver, we need lp solution */
1182 notify(mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS, GAS_INFO_FULL); 1193 mlp->control_param_mlp.presolve = GNUNET_NO; /* No presolver, we have LP solution */
1183 mlp_delete_problem(mlp);
1184 if (GNUNET_SYSERR == mlp_create_problem(mlp))
1185 {
1186 notify(mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_FAIL, GAS_INFO_FULL);
1187 return GNUNET_SYSERR;
1188 }
1189 notify(mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_SUCCESS, GAS_INFO_FULL);
1190 mlp->control_param_lp.presolve = GLP_YES; /* LP presolver, we need lp solution */
1191 mlp->control_param_mlp.presolve = GNUNET_NO; /* No presolver, we have LP solution */
1192 } 1194 }
1193 else 1195 else
1194 { 1196 {
1195 LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n"); 1197 mlp->control_param_lp.presolve = GNUNET_NO; /* LP presolver, we need lp solution */
1198 mlp->control_param_mlp.presolve = GLP_YES; /* No presolver, we have LP solution */
1199 dur_lp = GNUNET_TIME_UNIT_ZERO;
1196 } 1200 }
1201 }
1202 else
1203 {
1204 LOG(GNUNET_ERROR_TYPE_DEBUG, "Problem was updated, resolving\n");
1205 }
1197 1206
1198 dur_setup = GNUNET_TIME_absolute_get_duration (start_total); 1207 dur_setup = GNUNET_TIME_absolute_get_duration (start_total);
1199 1208
1200 /* Run LP solver */ 1209 /* Run LP solver */
1201 notify(mlp, GAS_OP_SOLVE_MLP_LP_START, GAS_STAT_SUCCESS, 1210 if (GNUNET_NO == mlp->opt_dbg_intopt_presolver)
1202 (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED); 1211 {
1203 LOG(GNUNET_ERROR_TYPE_DEBUG, 1212 notify(mlp, GAS_OP_SOLVE_MLP_LP_START, GAS_STAT_SUCCESS,
1204 "Running LP solver %s\n", 1213 (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
1205 (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver"); 1214 LOG(GNUNET_ERROR_TYPE_DEBUG,
1206 start_cur_op = GNUNET_TIME_absolute_get(); 1215 "Running LP solver %s\n",
1207 1216 (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without presolver");
1208 /* Solve LP */ 1217 start_cur_op = GNUNET_TIME_absolute_get();
1209 /* Only for debugging, always use LP presolver: 1218
1210 * mlp->control_param_lp.presolve = GLP_YES; */ 1219 /* Solve LP */
1211 res_lp = mlp_solve_lp_problem(mlp); 1220 /* Only for debugging, always use LP presolver:
1212 1221 * mlp->control_param_lp.presolve = GLP_YES; */
1213 dur_lp = GNUNET_TIME_absolute_get_duration (start_cur_op); 1222 res_lp = mlp_solve_lp_problem(mlp);
1214 notify(mlp, GAS_OP_SOLVE_MLP_LP_STOP,
1215 (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
1216 (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
1217 1223
1218 res_lp = GNUNET_OK; 1224 dur_lp = GNUNET_TIME_absolute_get_duration (start_cur_op);
1225 notify(mlp, GAS_OP_SOLVE_MLP_LP_STOP,
1226 (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
1227 (GNUNET_YES == mlp->stat_mlp_prob_changed) ? GAS_INFO_FULL : GAS_INFO_UPDATED);
1228 }
1229
1230 if (GNUNET_YES == mlp->opt_dbg_intopt_presolver)
1231 res_lp = GNUNET_OK;
1219 1232
1220 /* Run MLP solver */ 1233 /* Run MLP solver */
1221 if (GNUNET_OK == res_lp) 1234 if ((GNUNET_OK == res_lp) || (GNUNET_YES == mlp->opt_dbg_intopt_presolver))
1222 { 1235 {
1223 LOG(GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n"); 1236 LOG(GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n");
1224 notify(mlp, GAS_OP_SOLVE_MLP_MLP_START, GAS_STAT_SUCCESS, 1237 notify(mlp, GAS_OP_SOLVE_MLP_MLP_START, GAS_STAT_SUCCESS,
@@ -1226,8 +1239,9 @@ GAS_mlp_solve_problem (void *solver)
1226 start_cur_op = GNUNET_TIME_absolute_get(); 1239 start_cur_op = GNUNET_TIME_absolute_get();
1227 1240
1228 /* Solve MIP */ 1241 /* Solve MIP */
1229 /* Only for debugging, always use MLP presolver: 1242 /* Only for debugging, always use MLP presolver */
1230 * mlp->control_param_mlp.presolve = GNUNET_YES; */ 1243 if (GNUNET_YES == mlp->opt_dbg_intopt_presolver)
1244 mlp->control_param_mlp.presolve = GNUNET_YES;
1231 res_mip = mlp_solve_mlp_problem(mlp); 1245 res_mip = mlp_solve_mlp_problem(mlp);
1232 1246
1233 dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op); 1247 dur_mlp = GNUNET_TIME_absolute_get_duration (start_cur_op);
@@ -2038,7 +2052,7 @@ libgnunet_plugin_ats_mlp_init (void *cls)
2038 mlp->opt_dump_solution_on_fail = GNUNET_NO; 2052 mlp->opt_dump_solution_on_fail = GNUNET_NO;
2039 2053
2040 mlp->opt_dbg_glpk_verbose = GNUNET_CONFIGURATION_get_value_yesno (env->cfg, 2054 mlp->opt_dbg_glpk_verbose = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
2041 "ats", "MLP_GLPK_VERBOSE"); 2055 "ats", "MLP_DBG_GLPK_VERBOSE");
2042 if (GNUNET_SYSERR == mlp->opt_dbg_glpk_verbose) 2056 if (GNUNET_SYSERR == mlp->opt_dbg_glpk_verbose)
2043 mlp->opt_dbg_glpk_verbose = GNUNET_NO; 2057 mlp->opt_dbg_glpk_verbose = GNUNET_NO;
2044 2058
@@ -2058,6 +2072,14 @@ libgnunet_plugin_ats_mlp_init (void *cls)
2058 LOG (GNUNET_ERROR_TYPE_WARNING, 2072 LOG (GNUNET_ERROR_TYPE_WARNING,
2059 "MLP solver is configured automatically scale the problem!\n"); 2073 "MLP solver is configured automatically scale the problem!\n");
2060 2074
2075 mlp->opt_dbg_intopt_presolver = GNUNET_CONFIGURATION_get_value_yesno (env->cfg,
2076 "ats", "MLP_DBG_INTOPT_PRESOLVE");
2077 if (GNUNET_SYSERR == mlp->opt_dbg_intopt_presolver)
2078 mlp->opt_dbg_intopt_presolver = GNUNET_NO;
2079 if (GNUNET_YES == mlp->opt_dbg_intopt_presolver)
2080 LOG (GNUNET_ERROR_TYPE_WARNING,
2081 "MLP solver is configured use the mlp presolver\n");
2082
2061 mlp->pv.BIG_M = (double) BIG_M_VALUE; 2083 mlp->pv.BIG_M = (double) BIG_M_VALUE;
2062 2084
2063 /* Get timeout for iterations */ 2085 /* Get timeout for iterations */
diff --git a/src/ats/plugin_ats_mlp.h b/src/ats/plugin_ats_mlp.h
index 8b15eb76c..28a5d05c8 100644
--- a/src/ats/plugin_ats_mlp.h
+++ b/src/ats/plugin_ats_mlp.h
@@ -342,11 +342,16 @@ struct GAS_MLP_Handle
342 int opt_dbg_feasibility_only; 342 int opt_dbg_feasibility_only;
343 343
344 /** 344 /**
345 * solve feasibility only 345 * solve autoscale the problem
346 */ 346 */
347 int opt_dbg_autoscale_problem; 347 int opt_dbg_autoscale_problem;
348 348
349 /** 349 /**
350 * use the intopt presolver instead of simplex
351 */
352 int opt_dbg_intopt_presolver;
353
354 /**
350 * Print GLPK output 355 * Print GLPK output
351 */ 356 */
352 int opt_dbg_glpk_verbose; 357 int opt_dbg_glpk_verbose;