Revision cfff6086

View differences:

topology.c
385 385

  
386 386
int cmp_rtt(const struct nodeID** a, const struct nodeID** b) {
387 387
  double ra, rb;
388
  ra = get_rtt_of(*a);
389
  rb = get_rtt_of(*b);
390
  
391
  double u = rand()/(RAND_MAX + 1.0);
392
  
393
  ra = (1 - alpha_target)*ra + (2*alpha_target) ; 
388
  ra = add_alpha_noise(get_rtt_of(*a));
389
  rb = add_alpha_noise(get_rtt_of(*b));
394 390
  
395 391
  fprintf(stderr, "RTTS: %s %f %s %f\n", node_addr(*a), ra, node_addr(*b), rb );
396 392
  if ((isnan(ra) && isnan(rb)) || ra == rb) return 0;
......
404 400

  
405 401
int cmp_bw(const struct nodeID** a, const struct nodeID** b) {
406 402
  double ra, rb;
407
  ra = -( get_metadata_for_peer(*a).capacity);
408
  rb = -( get_metadata_for_peer(*b).capacity);
403
  ra = -( add_alpha_noise(get_metadata_for_peer(*a).capacity));
404
  rb = -( add_alpha_noise(get_metadata_for_peer(*b).capacity));
409 405

  
410 406
  if ((isnan(ra) && isnan(rb)) || ra == rb) return 0;
411 407
  else if (isnan(rb) || ra < rb) return -1;
......
418 414

  
419 415
int cmp_rtt_bw(const struct nodeID** a, const struct nodeID** b) {
420 416
  double ra, rb;
421
  ra = -( get_metadata_for_peer(*a).capacity * get_rtt_of(*a));
422
  rb = -( get_metadata_for_peer(*b).capacity * get_rtt_of(*b));
417
  ra = -( add_alpha_noise(get_metadata_for_peer(*a).capacity * get_rtt_of(*a)));
418
  rb = -( add_alpha_noise(get_metadata_for_peer(*b).capacity * get_rtt_of(*b)));
423 419

  
424 420
  if ((isnan(ra) && isnan(rb)) || ra == rb) return 0;
425 421
  else if (isnan(rb) || ra < rb) return -1;
......
432 428

  
433 429
int cmp_offers(const struct nodeID** a, const struct nodeID** b) {
434 430
  double ra, rb;
435
  ra = -( get_metadata_for_peer(*a).cps );
436
  rb = -( get_metadata_for_peer(*b).cps );
431
  ra = -( add_alpha_noise(get_metadata_for_peer(*a).cps) );
432
  rb = -( add_alpha_noise(get_metadata_for_peer(*b).cps) );
437 433
  if ((isnan(ra) && isnan(rb)) || ra == rb) return 0;
438 434
  else if (isnan(rb) || ra < rb) return -1;
439 435
  else return 1;
......
445 441

  
446 442
int cmp_rx_bytes_chunks(const struct nodeID** a, const struct nodeID** b) {
447 443
  double ra, rb;
448
  ra = -(get_rx_bytes_chunks_of(*a));
449
  rb = -(get_rx_bytes_chunks_of(*b));
444
  ra = -(add_alpha_noise(get_rx_bytes_chunks_of(*a)));
445
  rb = -(add_alpha_noise(get_rx_bytes_chunks_of(*b)));
450 446
//   fprintf(stderr, "RX_BYTES_CHUNKS: %s %f %s %f\n", node_addr(*a), ra, node_addr(*b), rb );
451 447
  if ((isnan(ra) && isnan(rb)) || ra == rb) 
452 448
	return 0;
......
462 458

  
463 459
int cmp_packet_loss(const struct nodeID** a, const struct nodeID** b) {
464 460
  double ra, rb;
465
  ra = get_transmitter_lossrate(*a);
466
  rb = get_transmitter_lossrate(*b);
461
  ra = add_alpha_noise(get_transmitter_lossrate(*a));
462
  rb = add_alpha_noise(get_transmitter_lossrate(*b));
467 463
//   fprintf(stderr, "PACKET_LOSS: %s %f %s %f\n", node_addr(*a), ra, node_addr(*b), rb );
468 464
  if ((isnan(ra) && isnan(rb)) || ra == rb) 
469 465
	return 0;

Also available in: Unified diff