gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r31401 - gnunet/src/ats
Date: Mon, 16 Dec 2013 12:10:26 +0100

Author: oehlmann
Date: 2013-12-16 12:10:25 +0100 (Mon, 16 Dec 2013)
New Revision: 31401

Modified:
   gnunet/src/ats/plugin_ats_ril.c
Log:
fix matrix init

Modified: gnunet/src/ats/plugin_ats_ril.c
===================================================================
--- gnunet/src/ats/plugin_ats_ril.c     2013-12-16 10:30:23 UTC (rev 31400)
+++ gnunet/src/ats/plugin_ats_ril.c     2013-12-16 11:10:25 UTC (rev 31401)
@@ -404,7 +404,7 @@
 
   if (isinf(result))
   {
-    return isinf(result) * UINT32_MAX; //TODO! fix
+    return isinf(result) * UINT32_MAX; //TODO! prevent crash when learning 
diverges
   }
   return result;
 }
@@ -541,14 +541,14 @@
   delta += agent->envi->global_discount_variable * agent_estimate_q (agent, 
s_next, a_prime); //discounted future value
   delta -= agent_estimate_q (agent, agent->s_old, agent->a_old); //one step
 
-  LOG(GNUNET_ERROR_TYPE_INFO, "update()   Step# %llu  Q(s,a): %f  a: %f  r: %f 
 y: %f  Q(s+1,a+1) = %f  delta: %f\n",
-      agent->step_count,
-      agent_estimate_q (agent, agent->s_old, agent->a_old),
-      agent->envi->parameters.alpha,
-      reward,
-      agent->envi->global_discount_variable,
-      agent_estimate_q (agent, s_next, a_prime),
-      delta);
+//  LOG(GNUNET_ERROR_TYPE_INFO, "update()   Step# %llu  Q(s,a): %f  a: %f  r: 
%f  y: %f  Q(s+1,a+1) = %f  delta: %f\n",
+//      agent->step_count,
+//      agent_estimate_q (agent, agent->s_old, agent->a_old),
+//      agent->envi->parameters.alpha,
+//      reward,
+//      agent->envi->global_discount_variable,
+//      agent_estimate_q (agent, s_next, a_prime),
+//      delta);
 
   for (i = 0; i < agent->m; i++)
   {
@@ -782,13 +782,13 @@
   {
     state[1] = 0;
   }
-  LOG(GNUNET_ERROR_TYPE_INFO, "get_state()  state[0] = %f\n", state[0]);
-  LOG(GNUNET_ERROR_TYPE_INFO, "get_state()  state[1] = %f\n", state[1]);
+//  LOG(GNUNET_ERROR_TYPE_INFO, "get_state()  state[0] = %f\n", state[0]);
+//  LOG(GNUNET_ERROR_TYPE_INFO, "get_state()  state[1] = %f\n", state[1]);
+//
+//  LOG(GNUNET_ERROR_TYPE_INFO, "get_state()  W / %08.3f %08.3f \\ \n", 
agent->W[0][0], agent->W[1][0]);
+//  LOG(GNUNET_ERROR_TYPE_INFO, "get_state()  W \\ %08.3f %08.3f / \n", 
agent->W[0][1], agent->W[1][1]);
 
-  LOG(GNUNET_ERROR_TYPE_INFO, "get_state()  W / %08.3f %08.3f \\ \n", 
agent->W[0][0], agent->W[1][0]);
-  LOG(GNUNET_ERROR_TYPE_INFO, "get_state()  W \\ %08.3f %08.3f / \n", 
agent->W[0][1], agent->W[1][1]);
 
-
   //get peer features
 //  preferences = solver->plugin_envi->get_preferences 
(solver->plugin_envi->get_preference_cls,
 //        &agent->peer);
@@ -1287,12 +1287,12 @@
 
   agent_modify_eligibility (agent, RIL_E_ACCUMULATE, s_next);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "step()  Step# %llu  R: %f  IN %llu  OUT 
%llu  A: %d\n",
-        agent->step_count,
-        reward,
-        agent->bw_in/1024,
-        agent->bw_out/1024,
-        a_next);
+//  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "step()  Step# %llu  R: %f  IN %llu  
OUT %llu  A: %d\n",
+//        agent->step_count,
+//        reward,
+//        agent->bw_in/1024,
+//        agent->bw_out/1024,
+//        a_next);
 
   envi_do_action (agent->envi, agent, a_next);
 
@@ -1598,7 +1598,7 @@
     for (k = 0; k < agent->m; k++)
     {
       if (0 == count) {
-        agent->W[i][k] = 1;//.1 - ((double) 
GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
UINT32_MAX/5)/(double)UINT32_MAX);
+        agent->W[i][k] = agent->envi->parameters.alpha * (1.0 - 2.0*((double) 
GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, 
UINT32_MAX)/(double)UINT32_MAX));
       }
       else {
         for (other = agent->envi->agents_head; NULL != other; other = 
other->next)




reply via email to

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