aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFabian Oehlmann <oehlmann@in.tum.de>2013-09-11 17:23:14 +0000
committerFabian Oehlmann <oehlmann@in.tum.de>2013-09-11 17:23:14 +0000
commit5e11dc84e665f1de925336dec1eaf9d4071352dd (patch)
treed36314f22b55882dc4b3644ecdd9d1cd44b9327e /src
parentd6f94672c2e5ce0da942aaff9fab277176027656 (diff)
downloadgnunet-5e11dc84e665f1de925336dec1eaf9d4071352dd.tar.gz
gnunet-5e11dc84e665f1de925336dec1eaf9d4071352dd.zip
ats_ril: solver further continued
Diffstat (limited to 'src')
-rwxr-xr-xsrc/ats/gnunet-service-ats-solver_ril.c350
-rwxr-xr-xsrc/ats/gnunet-service-ats-solver_ril.h2
2 files changed, 266 insertions, 86 deletions
diff --git a/src/ats/gnunet-service-ats-solver_ril.c b/src/ats/gnunet-service-ats-solver_ril.c
index 0bf74af17..f5cb12284 100755
--- a/src/ats/gnunet-service-ats-solver_ril.c
+++ b/src/ats/gnunet-service-ats-solver_ril.c
@@ -50,12 +50,31 @@ enum RIL_Action
50}; 50};
51//TODO add the rest of the actions 51//TODO add the rest of the actions
52 52
53enum RIL_Algorithm
54{
55 RIL_ALGO_SARSA,
56 RIL_ALGO_Q
57};
58
59enum RIL_E_Modification
60{
61 RIL_E_SET,
62 RIL_E_ZERO,
63 RIL_E_ACCUMULATE,
64 RIL_E_REPLACE
65};
66
53/** 67/**
54 * Global learning parameters 68 * Global learning parameters
55 */ 69 */
56struct RIL_Learning_Parameters 70struct RIL_Learning_Parameters
57{ 71{
58 /** 72 /**
73 * The TD-algorithm to use
74 */
75 enum RIL_Algorithm algorithm;
76
77 /**
59 * Learning discount factor in the TD-update 78 * Learning discount factor in the TD-update
60 */ 79 */
61 float gamma; 80 float gamma;
@@ -129,9 +148,9 @@ struct RIL_Peer_Agent
129 int a_old; 148 int a_old;
130 149
131 /** 150 /**
132 * Last eligibility trace vector 151 * Eligibility trace vector
133 */ 152 */
134 double * e_t; 153 double * e;
135 154
136 /** 155 /**
137 * Address in use 156 * Address in use
@@ -303,23 +322,40 @@ agent_estimate_q (struct RIL_Peer_Agent *agent,
303 return result; 322 return result;
304} 323}
305 324
325/**
326 * Decide whether to do exploration (i.e. taking a new action) or exploitation (i.e. taking the
327 * currently estimated best action) in the current step
328 * @param agent agent performing the step
329 * @return yes, if exploring
330 */
331int
332agent_decide_exploration (struct RIL_Peer_Agent *agent)
333{
334 double r = (double) GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX) / (double) UINT32_MAX;
335
336 if (r < RIL_EXPLORE_RATIO)
337 {
338 return GNUNET_YES;
339 }
340 return GNUNET_NO;
341}
342
343/**
344 * Gets the action, with the maximal estimated Q-value (i.e. the one currently estimated to bring the
345 * most reward in the future)
346 * @param agent agent performing the calculation
347 * @param state the state from which to take the action
348 * @return the action promising most future reward
349 */
306int 350int
307agent_choose_action (struct RIL_Peer_Agent *agent, 351agent_get_action_best (struct RIL_Peer_Agent *agent,
308 double *state) 352 double *state)
309{ 353{
310 int i; 354 int i;
311 int max_i = -1; 355 int max_i = -1;
312 double r;
313 double cur_q; 356 double cur_q;
314 double max_q = DBL_MIN; 357 double max_q = DBL_MIN;
315 358
316 r = ((double) GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX) / (double) UINT32_MAX);
317
318 if (r < RIL_EXPLORE_RATIO)
319 {
320 return GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, agent->n);
321 }
322
323 for (i = 0; i < agent->m; i++) 359 for (i = 0; i < agent->m; i++)
324 { 360 {
325 cur_q = agent_estimate_q (agent, state, i); 361 cur_q = agent_estimate_q (agent, state, i);
@@ -335,11 +371,91 @@ agent_choose_action (struct RIL_Peer_Agent *agent,
335 return max_i; 371 return max_i;
336} 372}
337 373
374/**
375 * Gets any action, to explore the action space from that state
376 * @param agent agent performing the calculation
377 * @param state the state from which to take the action
378 * @return any action
379 */
380int
381agent_get_action_explore (struct RIL_Peer_Agent *agent,
382 double *state)
383{
384 return GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, agent->n);
385}
386
387/**
388 * Updates the weights (i.e. coefficients) of the weight vector in matrix W for action a
389 * @param agent the agent performing the update
390 * @param reward the reward received for the last action
391 * @param s_next the new state, the last step got the agent into
392 * @param a_prime the new
393 */
394void
395agent_update_weights (struct RIL_Peer_Agent *agent,
396 double reward,
397 double *s_next,
398 int a_prime)
399{
400 int i;
401 double delta;
402 double *theta = (agent->W)[agent->a_old];
403
404 delta = reward + agent_estimate_q (agent, s_next, a_prime) -
405 agent_estimate_q (agent, agent->s_old, agent->a_old);
406 for (i = 0; i < agent->m; i++)
407 {
408 theta[i] += agent->envi->parameters.alpha * delta * (agent->e)[i];
409 }
410}
411
412/**
413 * Changes the eligibility trace vector e in various manners:
414 * RIL_E_ACCUMULATE - adds 1 to each component as in accumulating eligibility traces
415 * RIL_E_REPLACE - resets each component to 1 as in replacing traces
416 * RIL_E_SET - multiplies e with gamma and lambda as in the update rule
417 * RIL_E_ZERO - sets e to 0 as in Watkin's Q-learning algorithm when exploring and when initializing
418 * @param agent
419 * @param mod
420 */
421void
422agent_modify_eligibility (struct RIL_Peer_Agent *agent,
423 enum RIL_E_Modification mod)
424{
425 int i;
426 double *e = agent->e;
427 double gamma = agent->envi->parameters.gamma;
428 double lambda = agent->envi->parameters.lambda;
429
430 for (i = 0; i < agent->m; i++)
431 {
432 switch (mod)
433 {
434 case RIL_E_ACCUMULATE:
435 e[i] += 1;
436 break;
437 case RIL_E_REPLACE:
438 e[i] = 1;
439 break;
440 case RIL_E_SET:
441 e[i] = gamma * lambda;
442 break;
443 case RIL_E_ZERO:
444 e[i] = 0;
445 break;
446 }
447 }
448}
449
450/**
451 * Allocates a state vector and fills it with the features present
452 * @param solver the solver handle
453 * @return pointer to the state vector
454 */
338double * 455double *
339envi_get_state (void *s) 456envi_get_state (struct GAS_RIL_Handle *solver)
340{ 457{
341 int i; 458 int i;
342 struct GAS_RIL_Handle *solver = s;
343 struct RIL_Network *net; 459 struct RIL_Network *net;
344 double *state = GNUNET_malloc (sizeof (double) * solver->networks_count * 4); 460 double *state = GNUNET_malloc (sizeof (double) * solver->networks_count * 4);
345 461
@@ -355,36 +471,84 @@ envi_get_state (void *s)
355 return state; 471 return state;
356} 472}
357 473
474/**
475 * Gets the reward of the last performed step
476 * @param solver solver handle
477 * @return the reward
478 */
358double 479double
359envi_get_reward () 480envi_get_reward (struct GAS_RIL_Handle *solver)
360{ 481{
361 //TODO implement 482 //TODO implement
362 return (double) GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX) / (double) UINT32_MAX; 483 return (double) GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX) / (double) UINT32_MAX;
363} 484}
364 485
486/**
487 * Puts the action into effect
488 * @param solver solver handle
489 * @param action action to perform by the solver
490 */
491void
492envi_do_action (struct GAS_RIL_Handle *solver,
493 int action)
494{
495
496}
497
498/**
499 * Performs one step of the Markov Decision Process. Other than in the literature the step starts
500 * after having done the last action a_old. It observes the new state s_next and the reward
501 * received. Then the coefficient update is done according to the SARSA or Q-learning method. The
502 * next action is put into effect.
503 * @param agent the agent performing the step
504 */
365void 505void
366agent_step (struct RIL_Peer_Agent *agent) 506agent_step (struct RIL_Peer_Agent *agent)
367{ 507{
368 int a_next; 508 int a_next = -1;
369 double *s_next; 509 double *s_next;
370 double reward; 510 double reward;
371 double delta;
372 double q_next;
373
374 511
375 s_next = envi_get_state(agent->envi); 512 s_next = envi_get_state(agent->envi);
376 reward = envi_get_reward(); 513 reward = envi_get_reward(agent->envi);
377
378 a_next = agent_choose_action (agent, s_next);
379 q_next = agent_estimate_q(agent, s_next, a_next);
380 514
381 if (NULL != agent->s_old) 515 switch (agent->envi->parameters.algorithm)
382 { 516 {
383 delta = reward + 517 case RIL_ALGO_SARSA:
384 (agent->envi->parameters.gamma * q_next) - 518 agent_modify_eligibility (agent, RIL_E_SET);
385 agent_estimate_q(agent, agent->s_old, agent->a_old); 519 if (agent_decide_exploration (agent))
520 {
521 a_next = agent_get_action_explore (agent, s_next);
522 }
523 else
524 {
525 a_next = agent_get_action_best (agent, s_next);
526 }
527 agent_update_weights (agent, reward, s_next, a_next); //update weights with next action
528 break;
529
530 case RIL_ALGO_Q:
531 a_next = agent_get_action_best (agent, s_next); //update weights with best action
532 agent_update_weights (agent, reward, s_next, a_next);
533 if (agent_decide_exploration (agent))
534 {
535 a_next = agent_get_action_explore (agent, s_next);
536 agent_modify_eligibility(agent, RIL_E_ZERO);
537 }
538 else
539 {
540 a_next = agent_get_action_best (agent, s_next);
541 agent_modify_eligibility(agent, RIL_E_SET);
542 }
543 break;
386 } 544 }
387 545
546 GNUNET_assert (-1 != a_next);
547
548 agent_modify_eligibility (agent, RIL_E_ACCUMULATE);
549
550 envi_do_action(agent->envi, a_next);
551
388 GNUNET_free(agent->s_old); 552 GNUNET_free(agent->s_old);
389 agent->s_old = s_next; 553 agent->s_old = s_next;
390 agent->a_old = a_next; 554 agent->a_old = a_next;
@@ -392,14 +556,16 @@ agent_step (struct RIL_Peer_Agent *agent)
392 agent->step_count += 1; 556 agent->step_count += 1;
393} 557}
394 558
559/**
560 * Cycles through all agents and lets the active ones do a step. Schedules the next step.
561 * @param solver the solver handle
562 * @param tc task context for the scheduler
563 */
395void 564void
396ril_periodic_step (void *s, 565ril_periodic_step (void *cls,
397 const struct GNUNET_SCHEDULER_TaskContext *tc) 566 const struct GNUNET_SCHEDULER_TaskContext *tc)
398{ 567{
399 /* 568 struct GAS_RIL_Handle *solver = cls;
400 * iterate over active agents and do a time step
401 */
402 struct GAS_RIL_Handle *solver = s;
403 struct RIL_Peer_Agent *cur; 569 struct RIL_Peer_Agent *cur;
404 570
405 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RIL step number %d\n", solver->step_count); 571 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RIL step number %d\n", solver->step_count);
@@ -427,14 +593,14 @@ ril_periodic_step (void *s,
427 */ 593 */
428struct RIL_Peer_Agent * 594struct RIL_Peer_Agent *
429agent_init (void *s, 595agent_init (void *s,
430 struct GNUNET_PeerIdentity peer) 596 const struct GNUNET_PeerIdentity *peer)
431{ 597{
432 int i; 598 int i;
433 struct GAS_RIL_Handle * solver = s; 599 struct GAS_RIL_Handle * solver = s;
434 struct RIL_Peer_Agent * agent = GNUNET_malloc (sizeof (struct RIL_Peer_Agent)); 600 struct RIL_Peer_Agent * agent = GNUNET_malloc (sizeof (struct RIL_Peer_Agent));
435 601
436 agent->envi = solver; 602 agent->envi = solver;
437 agent->peer = peer; 603 agent->peer = *peer;
438 agent->step_count = 0; 604 agent->step_count = 0;
439 agent->active = GNUNET_NO; 605 agent->active = GNUNET_NO;
440 agent->s_old = NULL; 606 agent->s_old = NULL;
@@ -446,7 +612,8 @@ agent_init (void *s,
446 (agent->W)[i] = (double *) GNUNET_malloc (sizeof (double) * agent->m); 612 (agent->W)[i] = (double *) GNUNET_malloc (sizeof (double) * agent->m);
447 } 613 }
448 agent->a_old = -1; 614 agent->a_old = -1;
449 agent->e_t = NULL; 615 agent->e = (double *) GNUNET_malloc (sizeof (double) * agent->m);
616 agent_modify_eligibility (agent, RIL_E_ZERO);
450 617
451 GNUNET_CONTAINER_DLL_insert (solver->agents_head, solver->agents_tail, agent); 618 GNUNET_CONTAINER_DLL_insert (solver->agents_head, solver->agents_tail, agent);
452 619
@@ -459,10 +626,10 @@ agent_init (void *s,
459 * @param agent the agent to retire 626 * @param agent the agent to retire
460 */ 627 */
461void 628void
462agent_die (void *s, 629agent_die (struct GAS_RIL_Handle *solver,
463 struct RIL_Peer_Agent * agent) 630 struct RIL_Peer_Agent *agent)
464{ 631{
465 632 //TODO implement
466} 633}
467 634
468/** 635/**
@@ -472,15 +639,14 @@ agent_die (void *s,
472 * @return agent 639 * @return agent
473 */ 640 */
474struct RIL_Peer_Agent * 641struct RIL_Peer_Agent *
475ril_get_agent (struct GAS_RIL_Handle * s, 642ril_get_agent (struct GAS_RIL_Handle *solver,
476 struct GNUNET_PeerIdentity peer) 643 const struct GNUNET_PeerIdentity *peer)
477{ 644{
478 struct GAS_RIL_Handle * solver = s; 645 struct RIL_Peer_Agent *cur;
479 struct RIL_Peer_Agent * cur;
480 646
481 for (cur = s->agents_head; NULL != cur; cur = cur->next) 647 for (cur = solver->agents_head; NULL != cur; cur = cur->next)
482 { 648 {
483 if (0 == GNUNET_CRYPTO_hash_cmp (&peer.hashPubKey, &cur->peer.hashPubKey)) 649 if (0 == GNUNET_CRYPTO_hash_cmp (&peer->hashPubKey, &cur->peer.hashPubKey))
484 { 650 {
485 return cur; 651 return cur;
486 } 652 }
@@ -506,7 +672,7 @@ init_agents_it (void *cls,
506 struct ATS_Address *address = value; 672 struct ATS_Address *address = value;
507 struct RIL_Peer_Agent *agent; 673 struct RIL_Peer_Agent *agent;
508 674
509 agent = ril_get_agent (solver, address->peer); 675 agent = ril_get_agent (solver, &address->peer);
510 676
511 GNUNET_assert (agent != NULL); 677 GNUNET_assert (agent != NULL);
512 678
@@ -534,10 +700,10 @@ init_agents_it (void *cls,
534 * @param pref_rel the normalized preference value for this kind over all clients 700 * @param pref_rel the normalized preference value for this kind over all clients
535 */ 701 */
536void 702void
537GAS_ril_address_change_preference (void *solver, 703GAS_ril_address_change_preference (void *s,
538 const struct GNUNET_PeerIdentity *peer, 704 const struct GNUNET_PeerIdentity *peer,
539 enum GNUNET_ATS_PreferenceKind kind, 705 enum GNUNET_ATS_PreferenceKind kind,
540 double pref_rel) 706 double pref_rel)
541{ 707{
542 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 708 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
543 "Preference `%s' for peer `%s' changed to %.2f \n", 709 "Preference `%s' for peer `%s' changed to %.2f \n",
@@ -581,18 +747,18 @@ GAS_ril_address_change_preference (void *solver,
581 */ 747 */
582void * 748void *
583GAS_ril_init (const struct GNUNET_CONFIGURATION_Handle *cfg, 749GAS_ril_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
584 const struct GNUNET_STATISTICS_Handle *stats, 750 const struct GNUNET_STATISTICS_Handle *stats,
585 const struct GNUNET_CONTAINER_MultiHashMap *addresses, 751 const struct GNUNET_CONTAINER_MultiHashMap *addresses,
586 int *network, 752 int *network,
587 unsigned long long *out_quota, 753 unsigned long long *out_quota,
588 unsigned long long *in_quota, 754 unsigned long long *in_quota,
589 int dest_length, 755 int dest_length,
590 GAS_bandwidth_changed_cb bw_changed_cb, 756 GAS_bandwidth_changed_cb bw_changed_cb,
591 void *bw_changed_cb_cls, 757 void *bw_changed_cb_cls,
592 GAS_get_preferences get_preference, 758 GAS_get_preferences get_preference,
593 void *get_preference_cls, 759 void *get_preference_cls,
594 GAS_get_properties get_properties, 760 GAS_get_properties get_properties,
595 void *get_properties_cls) 761 void *get_properties_cls)
596{ 762{
597 //TODO implement 763 //TODO implement
598 int c; 764 int c;
@@ -683,6 +849,9 @@ void
683GAS_ril_done (void * solver) 849GAS_ril_done (void * solver)
684{ 850{
685 //TODO implement 851 //TODO implement
852 /*
853 * dealloc: agents, learning parameters, callbacks
854 */
686 struct GAS_RIL_Handle *s = solver; 855 struct GAS_RIL_Handle *s = solver;
687 856
688 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ril_done() has been called\n"); 857 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ril_done() has been called\n");
@@ -702,8 +871,8 @@ GAS_ril_done (void * solver)
702 */ 871 */
703void 872void
704GAS_ril_address_add (void *solver, 873GAS_ril_address_add (void *solver,
705 struct ATS_Address *address, 874 struct ATS_Address *address,
706 uint32_t network) 875 uint32_t network)
707{ 876{
708 //TODO implement 877 //TODO implement
709 /* 878 /*
@@ -726,8 +895,8 @@ GAS_ril_address_add (void *solver,
726 */ 895 */
727void 896void
728GAS_ril_address_delete (void *solver, 897GAS_ril_address_delete (void *solver,
729 struct ATS_Address *address, 898 struct ATS_Address *address,
730 int session_only) 899 int session_only)
731{ 900{
732 //TODO implement 901 //TODO implement
733 /* 902 /*
@@ -753,10 +922,10 @@ GAS_ril_address_delete (void *solver,
753 */ 922 */
754void 923void
755GAS_ril_address_property_changed (void *solver, 924GAS_ril_address_property_changed (void *solver,
756 struct ATS_Address *address, 925 struct ATS_Address *address,
757 uint32_t type, 926 uint32_t type,
758 uint32_t abs_value, 927 uint32_t abs_value,
759 double rel_value) 928 double rel_value)
760{ 929{
761 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 930 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
762 "Property `%s' for peer `%s' address %p changed to %.2f \n", 931 "Property `%s' for peer `%s' address %p changed to %.2f \n",
@@ -781,9 +950,9 @@ GAS_ril_address_property_changed (void *solver,
781 */ 950 */
782void 951void
783GAS_ril_address_session_changed (void *solver, 952GAS_ril_address_session_changed (void *solver,
784 struct ATS_Address *address, 953 struct ATS_Address *address,
785 uint32_t cur_session, 954 uint32_t cur_session,
786 uint32_t new_session) 955 uint32_t new_session)
787{ 956{
788 //TODO implement 957 //TODO implement
789 /* 958 /*
@@ -804,8 +973,8 @@ GAS_ril_address_session_changed (void *solver,
804 */ 973 */
805void 974void
806GAS_ril_address_inuse_changed (void *solver, 975GAS_ril_address_inuse_changed (void *solver,
807 struct ATS_Address *address, 976 struct ATS_Address *address,
808 int in_use) 977 int in_use)
809{ 978{
810 //TODO implement 979 //TODO implement
811 /** 980 /**
@@ -826,9 +995,9 @@ GAS_ril_address_inuse_changed (void *solver,
826 */ 995 */
827void 996void
828GAS_ril_address_change_network (void *solver, 997GAS_ril_address_change_network (void *solver,
829 struct ATS_Address *address, 998 struct ATS_Address *address,
830 uint32_t current_network, 999 uint32_t current_network,
831 uint32_t new_network) 1000 uint32_t new_network)
832{ 1001{
833 //TODO implement 1002 //TODO implement
834 /* 1003 /*
@@ -849,11 +1018,11 @@ GAS_ril_address_change_network (void *solver,
849 */ 1018 */
850void 1019void
851GAS_ril_address_preference_feedback (void *solver, 1020GAS_ril_address_preference_feedback (void *solver,
852 void *application, 1021 void *application,
853 const struct GNUNET_PeerIdentity *peer, 1022 const struct GNUNET_PeerIdentity *peer,
854 const struct GNUNET_TIME_Relative scope, 1023 const struct GNUNET_TIME_Relative scope,
855 enum GNUNET_ATS_PreferenceKind kind, 1024 enum GNUNET_ATS_PreferenceKind kind,
856 double score) 1025 double score)
857{ 1026{
858 //TODO implement 1027 //TODO implement
859 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ril_address_preference_feedback() has been called\n"); 1028 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ril_address_preference_feedback() has been called\n");
@@ -898,16 +1067,21 @@ GAS_ril_bulk_stop (void *solver)
898 */ 1067 */
899const struct ATS_Address * 1068const struct ATS_Address *
900GAS_ril_get_preferred_address (void *solver, 1069GAS_ril_get_preferred_address (void *solver,
901 const struct GNUNET_PeerIdentity *peer) 1070 const struct GNUNET_PeerIdentity *peer)
902{ 1071{
903 //TODO implement 1072 //TODO implement, gets only the first address for now
1073
904 /* 1074 /*
905 * connect-only for requested peers, move agent to active list 1075 * connect-only for requested peers, move agent to active list
906 */ 1076 */
907 struct GAS_RIL_Handle *s = solver; 1077 struct GAS_RIL_Handle *s = solver;
1078 struct RIL_Peer_Agent *agent;
908 1079
909 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ril_get_preferred_address() has been called\n"); 1080 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ril_get_preferred_address() has been called\n");
910 1081
1082 agent = ril_get_agent(s, peer);
1083 agent->active = GNUNET_YES;
1084
911 if (0 == GNUNET_CONTAINER_multihashmap_contains(s->addresses, &peer->hashPubKey)) 1085 if (0 == GNUNET_CONTAINER_multihashmap_contains(s->addresses, &peer->hashPubKey))
912 { 1086 {
913 return GNUNET_CONTAINER_multihashmap_get(s->addresses, &peer->hashPubKey); 1087 return GNUNET_CONTAINER_multihashmap_get(s->addresses, &peer->hashPubKey);
@@ -925,13 +1099,19 @@ GAS_ril_get_preferred_address (void *solver,
925 */ 1099 */
926void 1100void
927GAS_ril_stop_get_preferred_address (void *solver, 1101GAS_ril_stop_get_preferred_address (void *solver,
928 const struct GNUNET_PeerIdentity *peer) 1102 const struct GNUNET_PeerIdentity *peer)
929{ 1103{
930 //TODO implement 1104 //TODO implement
931 /* 1105 /*
932 * connect-only for requested peers, move agent to paused list 1106 * connect-only for requested peers, move agent to paused list
933 */ 1107 */
1108 struct GAS_RIL_Handle *s = solver;
1109 struct RIL_Peer_Agent *agent;
1110
934 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ril_stop_get_preferred_address() has been called\n"); 1111 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ril_stop_get_preferred_address() has been called\n");
1112
1113 agent = ril_get_agent(s, peer);
1114 agent->active = GNUNET_NO;
935} 1115}
936 1116
937/* end of gnunet-service-ats-solver_reinf.c */ 1117/* end of gnunet-service-ats-solver_ril.c */
diff --git a/src/ats/gnunet-service-ats-solver_ril.h b/src/ats/gnunet-service-ats-solver_ril.h
index b46837e79..132755974 100755
--- a/src/ats/gnunet-service-ats-solver_ril.h
+++ b/src/ats/gnunet-service-ats-solver_ril.h
@@ -245,4 +245,4 @@ const struct ATS_Address *
245GAS_ril_get_preferred_address (void *solver, 245GAS_ril_get_preferred_address (void *solver,
246 const struct GNUNET_PeerIdentity *peer); 246 const struct GNUNET_PeerIdentity *peer);
247 247
248/* end of gnunet-service-ats-solver_reinf.h */ 248/* end of gnunet-service-ats-solver_ril.h */