gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r15001 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r15001 - gnunet/src/transport
Date: Fri, 15 Apr 2011 16:10:45 +0200

Author: wachs
Date: 2011-04-15 16:10:45 +0200 (Fri, 15 Apr 2011)
New Revision: 15001

Modified:
   gnunet/src/transport/gnunet-service-transport.c
Log:
changing default presolver to mlp builtin


Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-04-15 14:04:48 UTC 
(rev 15000)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-04-15 14:10:45 UTC 
(rev 15001)
@@ -1033,6 +1033,11 @@
 
 
        /**
+        * Use built-in MLP presolver or simplex
+        */
+       int builtin_mlp_presolver;
+
+       /**
         * Maximum number of LP iterations per calculation
         */
        int max_iterations;
@@ -6017,35 +6022,34 @@
        }
 return cont;
 }
+#endif
 
-
 static void ats_solve_problem (unsigned int max_it, unsigned int  max_dur, 
unsigned int c_peers, unsigned int  c_mechs, struct ATS_stat *stat)
 {
        int result;
        int solution;
 
        // Solving simplex
-       glp_prob *prob = ats->prob;
-
-       glp_smcp opt_lp;
-       glp_init_smcp(&opt_lp);
-
+       if (ats->builtin_mlp_presolver == GNUNET_NO)
+       {
+               glp_smcp opt_lp;
+               glp_init_smcp(&opt_lp);
 #if VERBOSE_ATS
        opt_lp.msg_lev = GLP_MSG_ALL;
 #else
        opt_lp.msg_lev = GLP_MSG_OFF;
 #endif
-       //opt_lp.presolve = GLP_ON;
-       result = glp_simplex(prob, &opt_lp);
-       solution =  glp_get_status (prob);
-
-       if (GNUNET_YES == ats_evaluate_results(result, solution, "LP"))
+               result = glp_simplex(ats->prob, &opt_lp);
+               solution =  glp_get_status (ats->prob);
+       }
+       if (((ats->builtin_mlp_presolver == GNUNET_NO) && (GNUNET_YES == 
ats_evaluate_results(result, solution, "LP"))) || (ats->builtin_mlp_presolver 
== GNUNET_YES))
        {
                /* Solving mlp */
                glp_iocp opt_mlp;
                glp_init_iocp(&opt_mlp);
                /* maximum duration */
-               //opt_mlp.presolve = GLP_ON;
+               if (ats->builtin_mlp_presolver == GNUNET_YES)
+                       opt_mlp.presolve = GLP_ON;
                opt_mlp.tm_lim = max_dur;
                /* output level */
 #if VERBOSE_ATS
@@ -6053,13 +6057,12 @@
 #else
                        opt_mlp.msg_lev = GLP_MSG_OFF;
 #endif
-               result = glp_intopt (prob, &opt_mlp);
-               solution =  glp_mip_status (prob);
+               result = glp_intopt (ats->prob, &opt_mlp);
+               solution =  glp_mip_status (ats->prob);
                stat->solution = solution;
                stat->valid = GNUNET_NO;
                if (ats_evaluate_results(result, solution, "MLP") == GNUNET_YES)
                        stat->valid = GNUNET_YES;
-       /* done */
        }
 
        /*
@@ -6108,7 +6111,7 @@
        }
 #endif
 }
-
+#if HAVE_LIBGLPK
 static void ats_delete_problem ()
 {
        int c;
@@ -6956,6 +6959,12 @@
        if (GNUNET_CONFIGURATION_have_value(cfg, "transport", "DUMP_SOLUTION"))
                ats->save_solution = GNUNET_CONFIGURATION_get_value_yesno (cfg, 
"transport","DUMP_SOLUTION");
 
+       ats->builtin_mlp_presolver = GNUNET_YES;
+       if (GNUNET_CONFIGURATION_have_value(cfg, "transport", 
"BUILTIN_PRESOLVER"))
+       {
+               ats->builtin_mlp_presolver = 
GNUNET_CONFIGURATION_get_value_yesno (cfg, "transport","BUILTIN_PRESOLVER");
+       }
+
        ats->ats_task = GNUNET_SCHEDULER_add_now(&ats_schedule_calculation, 
ats);
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]