aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ats/plugin_ats_ril.c41
-rw-r--r--src/transport/plugin_transport_http_client.c4
-rw-r--r--src/transport/plugin_transport_tcp.c1
3 files changed, 26 insertions, 20 deletions
diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c
index 88120d517..f9c44c9cf 100755
--- a/src/ats/plugin_ats_ril.c
+++ b/src/ats/plugin_ats_ril.c
@@ -380,6 +380,7 @@ struct GAS_RIL_Handle
380static int 380static int
381ril_count_agents(struct GAS_RIL_Handle * solver); 381ril_count_agents(struct GAS_RIL_Handle * solver);
382 382
383
383/** 384/**
384 * Estimate the current action-value for state s and action a 385 * Estimate the current action-value for state s and action a
385 * 386 *
@@ -405,10 +406,10 @@ agent_estimate_q (struct RIL_Peer_Agent *agent, double *state, int action)
405 { 406 {
406 return isinf(result) * UINT32_MAX; //TODO! fix 407 return isinf(result) * UINT32_MAX; //TODO! fix
407 } 408 }
408
409 return result; 409 return result;
410} 410}
411 411
412
412/** 413/**
413 * Decide whether to do exploration (i.e. taking a new action) or exploitation (i.e. taking the 414 * Decide whether to do exploration (i.e. taking a new action) or exploitation (i.e. taking the
414 * currently estimated best action) in the current step 415 * currently estimated best action) in the current step
@@ -430,13 +431,14 @@ agent_decide_exploration (struct RIL_Peer_Agent *agent)
430 return GNUNET_NO; 431 return GNUNET_NO;
431} 432}
432 433
433 /** 434
434 * Get the index of the address in the agent's list. 435/**
435 * 436 * Get the index of the address in the agent's list.
436 * @param agent agent handle 437 *
437 * @param address address handle 438 * @param agent agent handle
438 * @return the index, starting with zero 439 * @param address address handle
439 */ 440 * @return the index, starting with zero
441 */
440static int 442static int
441agent_address_get_index (struct RIL_Peer_Agent *agent, struct ATS_Address *address) 443agent_address_get_index (struct RIL_Peer_Agent *agent, struct ATS_Address *address)
442{ 444{
@@ -448,14 +450,12 @@ agent_address_get_index (struct RIL_Peer_Agent *agent, struct ATS_Address *addre
448 { 450 {
449 i++; 451 i++;
450 if (cur->address_naked == address) 452 if (cur->address_naked == address)
451 {
452 return i; 453 return i;
453 }
454 } 454 }
455
456 return i; 455 return i;
457} 456}
458 457
458
459/** 459/**
460 * Gets the wrapped address from the agent's list 460 * Gets the wrapped address from the agent's list
461 * 461 *
@@ -469,16 +469,12 @@ agent_address_get (struct RIL_Peer_Agent *agent, struct ATS_Address *address)
469 struct RIL_Address_Wrapped *cur; 469 struct RIL_Address_Wrapped *cur;
470 470
471 for (cur = agent->addresses_head; NULL != cur; cur = cur->next) 471 for (cur = agent->addresses_head; NULL != cur; cur = cur->next)
472 {
473 if (cur->address_naked == address) 472 if (cur->address_naked == address)
474 {
475 return cur; 473 return cur;
476 } 474 return NULL;
477 }
478
479 return NULL ;
480} 475}
481 476
477
482/** 478/**
483 * Gets the action, with the maximal estimated Q-value (i.e. the one currently estimated to bring the 479 * Gets the action, with the maximal estimated Q-value (i.e. the one currently estimated to bring the
484 * most reward in the future) 480 * most reward in the future)
@@ -510,6 +506,7 @@ agent_get_action_best (struct RIL_Peer_Agent *agent, double *state)
510 return max_i; 506 return max_i;
511} 507}
512 508
509
513/** 510/**
514 * Gets any action, to explore the action space from that state 511 * Gets any action, to explore the action space from that state
515 * 512 *
@@ -524,6 +521,7 @@ agent_get_action_explore (struct RIL_Peer_Agent *agent, double *state)
524 return GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, agent->n); 521 return GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, agent->n);
525} 522}
526 523
524
527/** 525/**
528 * Updates the weights (i.e. coefficients) of the weight vector in matrix W for action a 526 * Updates the weights (i.e. coefficients) of the weight vector in matrix W for action a
529 * 527 *
@@ -563,10 +561,11 @@ agent_update_weights (struct RIL_Peer_Agent *agent, double reward, double *s_nex
563 } 561 }
564} 562}
565 563
564
566/** 565/**
567 * Changes the eligibility trace vector e in various manners: 566 * Changes the eligibility trace vector e in various manners:
568 * #RIL_E_ACCUMULATE - adds @a f to each component as in accumulating eligibility traces 567 * #RIL_E_ACCUMULATE - adds @a f to each component as in accumulating eligibility traces
569 * #RIL_E_REPLACE - resets each component to @f as in replacing traces 568 * #RIL_E_REPLACE - resets each component to @a f as in replacing traces
570 * #RIL_E_SET - multiplies e with discount factor and lambda as in the update rule 569 * #RIL_E_SET - multiplies e with discount factor and lambda as in the update rule
571 * #RIL_E_ZERO - sets e to 0 as in Watkin's Q-learning algorithm when exploring and when initializing 570 * #RIL_E_ZERO - sets e to 0 as in Watkin's Q-learning algorithm when exploring and when initializing
572 * 571 *
@@ -575,7 +574,9 @@ agent_update_weights (struct RIL_Peer_Agent *agent, double reward, double *s_nex
575 * @param f how much to change 574 * @param f how much to change
576 */ 575 */
577static void 576static void
578agent_modify_eligibility (struct RIL_Peer_Agent *agent, enum RIL_E_Modification mod, double *f) 577agent_modify_eligibility (struct RIL_Peer_Agent *agent,
578 enum RIL_E_Modification mod,
579 double *f)
579{ 580{
580 int i; 581 int i;
581 double *e = agent->e; 582 double *e = agent->e;
@@ -610,6 +611,7 @@ ril_inform (struct GAS_RIL_Handle *solver,
610 solver->plugin_envi->info_cb (solver->plugin_envi->info_cb_cls, op, stat, GAS_INFO_NONE); 611 solver->plugin_envi->info_cb (solver->plugin_envi->info_cb_cls, op, stat, GAS_INFO_NONE);
611} 612}
612 613
614
613/** 615/**
614 * Changes the active assignment suggestion of the handler and invokes the bw_changed callback to 616 * Changes the active assignment suggestion of the handler and invokes the bw_changed callback to
615 * notify ATS of its new decision 617 * notify ATS of its new decision
@@ -699,6 +701,7 @@ envi_set_active_suggestion (struct GAS_RIL_Handle *solver,
699 agent->address_inuse = new_address; 701 agent->address_inuse = new_address;
700} 702}
701 703
704
702static unsigned long long 705static unsigned long long
703ril_network_get_assigned (struct GAS_RIL_Handle *solver, enum GNUNET_ATS_Network_Type type, int direction_in) 706ril_network_get_assigned (struct GAS_RIL_Handle *solver, enum GNUNET_ATS_Network_Type type, int direction_in)
704{ 707{
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 07a0de2ac..772c2e1e7 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -622,13 +622,15 @@ client_delete_session (struct Session *s)
622/** 622/**
623 * Disconnect a session 623 * Disconnect a session
624 * 624 *
625 * @param cls the `struct HTTP_Client_Plugin`
625 * @param s session 626 * @param s session
626 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 627 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
627 */ 628 */
628static int 629static int
629http_client_session_disconnect (struct HTTP_Client_Plugin *plugin, 630http_client_session_disconnect (void *cls,
630 struct Session *s) 631 struct Session *s)
631{ 632{
633 struct HTTP_Client_Plugin *plugin = cls;
632 struct HTTP_Message *msg; 634 struct HTTP_Message *msg;
633 struct HTTP_Message *t; 635 struct HTTP_Message *t;
634 int res = GNUNET_OK; 636 int res = GNUNET_OK;
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 72ac5b2b8..a6e46ccae 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -1017,6 +1017,7 @@ process_pending_messages (struct Session *session)
1017 * to close a session due to a disconnect or failure to 1017 * to close a session due to a disconnect or failure to
1018 * establish a connection. 1018 * establish a connection.
1019 * 1019 *
1020 * @param cls the `struct Plugin`
1020 * @param session session to close down 1021 * @param session session to close down
1021 * @return #GNUNET_OK on success 1022 * @return #GNUNET_OK on success
1022 */ 1023 */