tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

utility_function.h (3193B)


      1 /*
      2 *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #ifndef MODULES_CONGESTION_CONTROLLER_PCC_UTILITY_FUNCTION_H_
     12 #define MODULES_CONGESTION_CONTROLLER_PCC_UTILITY_FUNCTION_H_
     13 
     14 #include "modules/congestion_controller/pcc/monitor_interval.h"
     15 
     16 namespace webrtc {
     17 namespace pcc {
     18 
     19 // Utility function is used by PCC to transform the performance statistics
     20 // (sending rate, loss rate, packets latency) gathered at one monitor interval
     21 // into a numerical value.
     22 // https://www.usenix.org/conference/nsdi18/presentation/dong
     23 class PccUtilityFunctionInterface {
     24 public:
     25  virtual double Compute(const PccMonitorInterval& monitor_interval) const = 0;
     26  virtual ~PccUtilityFunctionInterface() = default;
     27 };
     28 
     29 // Vivace utility function were suggested in the paper "PCC Vivace:
     30 // Online-Learning Congestion Control", Mo Dong et all.
     31 class VivaceUtilityFunction : public PccUtilityFunctionInterface {
     32 public:
     33  VivaceUtilityFunction(double delay_gradient_coefficient,
     34                        double loss_coefficient,
     35                        double throughput_coefficient,
     36                        double throughput_power,
     37                        double delay_gradient_threshold,
     38                        double delay_gradient_negative_bound);
     39  double Compute(const PccMonitorInterval& monitor_interval) const override;
     40  ~VivaceUtilityFunction() override;
     41 
     42 private:
     43  const double delay_gradient_coefficient_;
     44  const double loss_coefficient_;
     45  const double throughput_power_;
     46  const double throughput_coefficient_;
     47  const double delay_gradient_threshold_;
     48  const double delay_gradient_negative_bound_;
     49 };
     50 
     51 // This utility function were obtained by tuning Vivace utility function.
     52 // The main difference is that gradient of modified utilify funtion (as well as
     53 // rate updates) scales proportionally to the sending rate which leads to
     54 // better performance in case of single sender.
     55 class ModifiedVivaceUtilityFunction : public PccUtilityFunctionInterface {
     56 public:
     57  ModifiedVivaceUtilityFunction(double delay_gradient_coefficient,
     58                                double loss_coefficient,
     59                                double throughput_coefficient,
     60                                double throughput_power,
     61                                double delay_gradient_threshold,
     62                                double delay_gradient_negative_bound);
     63  double Compute(const PccMonitorInterval& monitor_interval) const override;
     64  ~ModifiedVivaceUtilityFunction() override;
     65 
     66 private:
     67  const double delay_gradient_coefficient_;
     68  const double loss_coefficient_;
     69  const double throughput_power_;
     70  const double throughput_coefficient_;
     71  const double delay_gradient_threshold_;
     72  const double delay_gradient_negative_bound_;
     73 };
     74 
     75 }  // namespace pcc
     76 }  // namespace webrtc
     77 
     78 #endif  // MODULES_CONGESTION_CONTROLLER_PCC_UTILITY_FUNCTION_H_