gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r35128 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r35128 - gnunet/src/ats
Date: Sat, 7 Feb 2015 13:52:52 +0100

Author: grothoff
Date: 2015-02-07 13:52:52 +0100 (Sat, 07 Feb 2015)
New Revision: 35128

Modified:
   gnunet/src/ats/gnunet-service-ats_plugins.c
   gnunet/src/ats/gnunet-service-ats_plugins.h
Log:
simplify logic: just use string directly for the plugin name

Modified: gnunet/src/ats/gnunet-service-ats_plugins.c
===================================================================
--- gnunet/src/ats/gnunet-service-ats_plugins.c 2015-02-07 12:49:58 UTC (rev 
35127)
+++ gnunet/src/ats/gnunet-service-ats_plugins.c 2015-02-07 12:52:52 UTC (rev 
35128)
@@ -35,11 +35,6 @@
 
 
 /**
- * Configured ATS solver
- */
-static int ats_mode;
-
-/**
  * Solver handle.
  */
 static struct GNUNET_ATS_SolverFunctions *sf;
@@ -416,45 +411,16 @@
   unsigned long long quotas_in[GNUNET_ATS_NetworkTypeCount];
   unsigned long long quotas_out[GNUNET_ATS_NetworkTypeCount];
   char *mode_str;
-  char *plugin_short;
-  int c;
+  unsigned int c;
 
   /* Figure out configured solution method */
   if (GNUNET_SYSERR ==
       GNUNET_CONFIGURATION_get_value_string (cfg, "ats", "MODE", &mode_str))
   {
-    GNUNET_log(GNUNET_ERROR_TYPE_WARNING,
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                "No resource assignment method configured, using proportional 
approach\n");
-    ats_mode = MODE_PROPORTIONAL;
+    mode_str = GNUNET_strdup ("proportional");
   }
-  else
-  {
-    for (c = 0; c < strlen (mode_str); c++)
-      mode_str[c] = toupper (mode_str[c]);
-    if (0 == strcmp (mode_str, "PROPORTIONAL"))
-      ats_mode = MODE_PROPORTIONAL;
-    else if (0 == strcmp (mode_str, "MLP"))
-    {
-      ats_mode = MODE_MLP;
-#if !HAVE_LIBGLPK
-      GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-                 "Assignment method `%s' configured, but GLPK is not 
available, please install \n",
-                 mode_str);
-      ats_mode = MODE_PROPORTIONAL;
-#endif
-    }
-    else if (0 == strcmp (mode_str, "RIL"))
-      ats_mode = MODE_RIL;
-    else
-    {
-      GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
-                 "Invalid resource assignment method `%s' configured, using 
proportional approach\n",
-                 mode_str);
-      ats_mode = MODE_PROPORTIONAL;
-    }
-    GNUNET_free(mode_str);
-  }
-
   load_quotas (cfg,
                quotas_out,
                quotas_in,
@@ -474,27 +440,13 @@
     env.in_quota[c] = quotas_in[c];
   }
 
-  switch (ats_mode) {
-    case MODE_PROPORTIONAL:
-      plugin_short = "proportional";
-      break;
-    case MODE_MLP:
-      plugin_short = "mlp";
-      break;
-    case MODE_RIL:
-      plugin_short = "ril";
-      break;
-    default:
-      plugin_short = NULL;
-      break;
-  }
   GNUNET_asprintf (&plugin,
                    "libgnunet_plugin_ats_%s",
-                   plugin_short);
+                   mode_str);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Initializing solver `%s '`%s'\n",
-              plugin_short,
-              plugin);
+              "Initializing solver `%s'\n",
+              mode_str);
+  GNUNET_free (mode_str);
   if (NULL == (sf = GNUNET_PLUGIN_load (plugin, &env)))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,

Modified: gnunet/src/ats/gnunet-service-ats_plugins.h
===================================================================
--- gnunet/src/ats/gnunet-service-ats_plugins.h 2015-02-07 12:49:58 UTC (rev 
35127)
+++ gnunet/src/ats/gnunet-service-ats_plugins.h 2015-02-07 12:52:52 UTC (rev 
35128)
@@ -31,37 +31,6 @@
 
 
 /**
- * Available ressource assignment modes
- */
-enum ATS_Mode
-{
-  /**
-   * proportional mode:
-   *
-   * Assign each peer an equal amount of bandwidth (bw)
-   *
-   * bw_per_peer = bw_total / #active addresses
-   */
-  MODE_PROPORTIONAL,
-
-  /**
-   * MLP mode:
-   *
-   * Solve ressource assignment as an optimization problem
-   * Uses an mixed integer programming solver
-   */
-  MODE_MLP,
-
-  /**
-   * Reinforcement Learning mode:
-   *
-   * Solve resource assignment using a learning agent
-   */
-  MODE_RIL
-};
-
-
-/**
  * Initialize address subsystem. The addresses subsystem manages the addresses
  * known and current performance information. It has a solver component
  * responsible for the resource allocation. It tells the solver about changes




reply via email to

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