diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-04-24 15:02:58 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-04-24 15:02:58 +0000 |
commit | 14d01112b0b9aec9671cca79b003f3ea845f84b3 (patch) | |
tree | eceb479ec1556fc4897aeeea6b5d9ba043276f6c /src/ats | |
parent | 6200062845497ece25c28d92ae85c5f8aaee47a4 (diff) | |
download | gnunet-14d01112b0b9aec9671cca79b003f3ea845f84b3.tar.gz gnunet-14d01112b0b9aec9671cca79b003f3ea845f84b3.zip |
- minor fixes while checking implementation
Diffstat (limited to 'src/ats')
-rw-r--r-- | src/ats/gnunet-service-ats_addresses_mlp.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/ats/gnunet-service-ats_addresses_mlp.c b/src/ats/gnunet-service-ats_addresses_mlp.c index 0648f24ae..043f89770 100644 --- a/src/ats/gnunet-service-ats_addresses_mlp.c +++ b/src/ats/gnunet-service-ats_addresses_mlp.c | |||
@@ -505,7 +505,9 @@ mlp_add_constraints_all_addresses (struct GAS_MLP_Handle *mlp, struct GNUNET_CON | |||
505 | * c 10) obey network specific quota | 505 | * c 10) obey network specific quota |
506 | */ | 506 | */ |
507 | 507 | ||
508 | /* Row for c4) minimum connection */ | ||
508 | int min = mlp->n_min; | 509 | int min = mlp->n_min; |
510 | /* Number of minimum connections is min(|Peers|, n_min) */ | ||
509 | if (mlp->n_min > mlp->c_p) | 511 | if (mlp->n_min > mlp->c_p) |
510 | min = mlp->c_p; | 512 | min = mlp->c_p; |
511 | 513 | ||
@@ -565,6 +567,7 @@ mlp_add_constraints_all_addresses (struct GAS_MLP_Handle *mlp, struct GNUNET_CON | |||
565 | mlp->ci++; | 567 | mlp->ci++; |
566 | 568 | ||
567 | struct ATS_Peer * peer = mlp->peer_head; | 569 | struct ATS_Peer * peer = mlp->peer_head; |
570 | /* For all peers */ | ||
568 | while (peer != NULL) | 571 | while (peer != NULL) |
569 | { | 572 | { |
570 | struct ATS_Address *addr = peer->head; | 573 | struct ATS_Address *addr = peer->head; |
@@ -593,13 +596,12 @@ mlp_add_constraints_all_addresses (struct GAS_MLP_Handle *mlp, struct GNUNET_CON | |||
593 | ar[mlp->ci] = -1; | 596 | ar[mlp->ci] = -1; |
594 | mlp->ci++; | 597 | mlp->ci++; |
595 | #endif | 598 | #endif |
596 | 599 | /* For all addresses of this peer */ | |
597 | while (addr != NULL) | 600 | while (addr != NULL) |
598 | { | 601 | { |
599 | mlpi = (struct MLP_information *) addr->mlp_information; | 602 | mlpi = (struct MLP_information *) addr->mlp_information; |
600 | 603 | ||
601 | /* coefficient for c 2) */ | 604 | /* coefficient for c 2) */ |
602 | |||
603 | ia[mlp->ci] = peer->r_c2; | 605 | ia[mlp->ci] = peer->r_c2; |
604 | ja[mlp->ci] = mlpi->c_n; | 606 | ja[mlp->ci] = mlpi->c_n; |
605 | ar[mlp->ci] = 1; | 607 | ar[mlp->ci] = 1; |
@@ -625,8 +627,6 @@ mlp_add_constraints_all_addresses (struct GAS_MLP_Handle *mlp, struct GNUNET_CON | |||
625 | } | 627 | } |
626 | 628 | ||
627 | /* c 7) For all quality metrics */ | 629 | /* c 7) For all quality metrics */ |
628 | |||
629 | |||
630 | for (c = 0; c < mlp->m_q; c++) | 630 | for (c = 0; c < mlp->m_q; c++) |
631 | { | 631 | { |
632 | struct ATS_Peer *tp; | 632 | struct ATS_Peer *tp; |
@@ -640,7 +640,7 @@ mlp_add_constraints_all_addresses (struct GAS_MLP_Handle *mlp, struct GNUNET_CON | |||
640 | glp_set_row_name (mlp->prob, mlp->r_q[c], name); | 640 | glp_set_row_name (mlp->prob, mlp->r_q[c], name); |
641 | GNUNET_free (name); | 641 | GNUNET_free (name); |
642 | /* Set row bound == 0 */ | 642 | /* Set row bound == 0 */ |
643 | glp_set_row_bnds (mlp->prob, mlp->r_q[c], GLP_LO, 0.0, 0.0); | 643 | glp_set_row_bnds (mlp->prob, mlp->r_q[c], GLP_FX, 0.0, 0.0); |
644 | 644 | ||
645 | ia[mlp->ci] = mlp->r_q[c]; | 645 | ia[mlp->ci] = mlp->r_q[c]; |
646 | ja[mlp->ci] = mlp->c_q[c]; | 646 | ja[mlp->ci] = mlp->c_q[c]; |
@@ -657,7 +657,7 @@ mlp_add_constraints_all_addresses (struct GAS_MLP_Handle *mlp, struct GNUNET_CON | |||
657 | 657 | ||
658 | ia[mlp->ci] = mlp->r_q[c]; | 658 | ia[mlp->ci] = mlp->r_q[c]; |
659 | ja[mlp->ci] = mlpi->c_b; | 659 | ja[mlp->ci] = mlpi->c_b; |
660 | ar[mlp->ci] = tp->f * value; | 660 | ar[mlp->ci] = tp->f_q[c] * value; |
661 | mlp->ci++; | 661 | mlp->ci++; |
662 | } | 662 | } |
663 | } | 663 | } |
@@ -747,7 +747,6 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_MultiHas | |||
747 | /* Adding invariant columns */ | 747 | /* Adding invariant columns */ |
748 | 748 | ||
749 | /* Diversity d column */ | 749 | /* Diversity d column */ |
750 | |||
751 | col = glp_add_cols (mlp->prob, 1); | 750 | col = glp_add_cols (mlp->prob, 1); |
752 | mlp->c_d = col; | 751 | mlp->c_d = col; |
753 | /* Column name */ | 752 | /* Column name */ |
@@ -758,7 +757,6 @@ mlp_create_problem (struct GAS_MLP_Handle *mlp, struct GNUNET_CONTAINER_MultiHas | |||
758 | glp_set_col_bnds (mlp->prob, col, GLP_LO, 0.0, 0.0); | 757 | glp_set_col_bnds (mlp->prob, col, GLP_LO, 0.0, 0.0); |
759 | 758 | ||
760 | /* Utilization u column */ | 759 | /* Utilization u column */ |
761 | |||
762 | col = glp_add_cols (mlp->prob, 1); | 760 | col = glp_add_cols (mlp->prob, 1); |
763 | mlp->c_u = col; | 761 | mlp->c_u = col; |
764 | /* Column name */ | 762 | /* Column name */ |