aboutsummaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2011-04-15 14:10:45 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2011-04-15 14:10:45 +0000
commitc52dd845a175f3797d7be211998f71b3ea56cfd0 (patch)
treec51f76771dc1dcccfd1428a4c793c46b8db29a26 /src/transport
parent8bfc7440791842cd2e8aeb1b376b57f77ab29f04 (diff)
downloadgnunet-c52dd845a175f3797d7be211998f71b3ea56cfd0.tar.gz
gnunet-c52dd845a175f3797d7be211998f71b3ea56cfd0.zip
changing default presolver to mlp builtin
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c
index e3d5054b4..89d869f5b 100644
--- a/src/transport/gnunet-service-transport.c
+++ b/src/transport/gnunet-service-transport.c
@@ -1033,6 +1033,11 @@ struct ATS_info
1033 1033
1034 1034
1035 /** 1035 /**
1036 * Use built-in MLP presolver or simplex
1037 */
1038 int builtin_mlp_presolver;
1039
1040 /**
1036 * Maximum number of LP iterations per calculation 1041 * Maximum number of LP iterations per calculation
1037 */ 1042 */
1038 int max_iterations; 1043 int max_iterations;
@@ -6017,7 +6022,7 @@ static int ats_evaluate_results (int result, int solution, char * problem)
6017 } 6022 }
6018return cont; 6023return cont;
6019} 6024}
6020 6025#endif
6021 6026
6022static void ats_solve_problem (unsigned int max_it, unsigned int max_dur, unsigned int c_peers, unsigned int c_mechs, struct ATS_stat *stat) 6027static void ats_solve_problem (unsigned int max_it, unsigned int max_dur, unsigned int c_peers, unsigned int c_mechs, struct ATS_stat *stat)
6023{ 6028{
@@ -6025,27 +6030,26 @@ static void ats_solve_problem (unsigned int max_it, unsigned int max_dur, unsig
6025 int solution; 6030 int solution;
6026 6031
6027 // Solving simplex 6032 // Solving simplex
6028 glp_prob *prob = ats->prob; 6033 if (ats->builtin_mlp_presolver == GNUNET_NO)
6029 6034 {
6030 glp_smcp opt_lp; 6035 glp_smcp opt_lp;
6031 glp_init_smcp(&opt_lp); 6036 glp_init_smcp(&opt_lp);
6032
6033#if VERBOSE_ATS 6037#if VERBOSE_ATS
6034 opt_lp.msg_lev = GLP_MSG_ALL; 6038 opt_lp.msg_lev = GLP_MSG_ALL;
6035#else 6039#else
6036 opt_lp.msg_lev = GLP_MSG_OFF; 6040 opt_lp.msg_lev = GLP_MSG_OFF;
6037#endif 6041#endif
6038 //opt_lp.presolve = GLP_ON; 6042 result = glp_simplex(ats->prob, &opt_lp);
6039 result = glp_simplex(prob, &opt_lp); 6043 solution = glp_get_status (ats->prob);
6040 solution = glp_get_status (prob); 6044 }
6041 6045 if (((ats->builtin_mlp_presolver == GNUNET_NO) && (GNUNET_YES == ats_evaluate_results(result, solution, "LP"))) || (ats->builtin_mlp_presolver == GNUNET_YES))
6042 if (GNUNET_YES == ats_evaluate_results(result, solution, "LP"))
6043 { 6046 {
6044 /* Solving mlp */ 6047 /* Solving mlp */
6045 glp_iocp opt_mlp; 6048 glp_iocp opt_mlp;
6046 glp_init_iocp(&opt_mlp); 6049 glp_init_iocp(&opt_mlp);
6047 /* maximum duration */ 6050 /* maximum duration */
6048 //opt_mlp.presolve = GLP_ON; 6051 if (ats->builtin_mlp_presolver == GNUNET_YES)
6052 opt_mlp.presolve = GLP_ON;
6049 opt_mlp.tm_lim = max_dur; 6053 opt_mlp.tm_lim = max_dur;
6050 /* output level */ 6054 /* output level */
6051#if VERBOSE_ATS 6055#if VERBOSE_ATS
@@ -6053,13 +6057,12 @@ static void ats_solve_problem (unsigned int max_it, unsigned int max_dur, unsig
6053#else 6057#else
6054 opt_mlp.msg_lev = GLP_MSG_OFF; 6058 opt_mlp.msg_lev = GLP_MSG_OFF;
6055#endif 6059#endif
6056 result = glp_intopt (prob, &opt_mlp); 6060 result = glp_intopt (ats->prob, &opt_mlp);
6057 solution = glp_mip_status (prob); 6061 solution = glp_mip_status (ats->prob);
6058 stat->solution = solution; 6062 stat->solution = solution;
6059 stat->valid = GNUNET_NO; 6063 stat->valid = GNUNET_NO;
6060 if (ats_evaluate_results(result, solution, "MLP") == GNUNET_YES) 6064 if (ats_evaluate_results(result, solution, "MLP") == GNUNET_YES)
6061 stat->valid = GNUNET_YES; 6065 stat->valid = GNUNET_YES;
6062 /* done */
6063 } 6066 }
6064 6067
6065 /* 6068 /*
@@ -6108,7 +6111,7 @@ static void ats_solve_problem (unsigned int max_it, unsigned int max_dur, unsig
6108 } 6111 }
6109#endif 6112#endif
6110} 6113}
6111 6114#if HAVE_LIBGLPK
6112static void ats_delete_problem () 6115static void ats_delete_problem ()
6113{ 6116{
6114 int c; 6117 int c;
@@ -6956,6 +6959,12 @@ void ats_init ()
6956 if (GNUNET_CONFIGURATION_have_value(cfg, "transport", "DUMP_SOLUTION")) 6959 if (GNUNET_CONFIGURATION_have_value(cfg, "transport", "DUMP_SOLUTION"))
6957 ats->save_solution = GNUNET_CONFIGURATION_get_value_yesno (cfg, "transport","DUMP_SOLUTION"); 6960 ats->save_solution = GNUNET_CONFIGURATION_get_value_yesno (cfg, "transport","DUMP_SOLUTION");
6958 6961
6962 ats->builtin_mlp_presolver = GNUNET_YES;
6963 if (GNUNET_CONFIGURATION_have_value(cfg, "transport", "BUILTIN_PRESOLVER"))
6964 {
6965 ats->builtin_mlp_presolver = GNUNET_CONFIGURATION_get_value_yesno (cfg, "transport","BUILTIN_PRESOLVER");
6966 }
6967
6959 ats->ats_task = GNUNET_SCHEDULER_add_now(&ats_schedule_calculation, ats); 6968 ats->ats_task = GNUNET_SCHEDULER_add_now(&ats_schedule_calculation, ats);
6960} 6969}
6961 6970