curves module

class panco.descriptor.curves.RateLatency(rate: float, latency: float)

Bases: object

The RateLatency class encodes the rate-latency class of functions, for minimum service curves, \(\beta(t) = R(t-T)_+\).

Parameters:
  • latency (float) – the latency term \(T\)

  • rate (float) – the service rate term \(R\)

>>> RateLatency(5, 4)
5(t - 4)_+
evaluate(t: float) float

Evaluates the rate-latency function at \(t\): \(\beta(t) = R \max(t-T)_+\).

Parameters:

t (float) – the value which the function is computed

Returns:

\(\beta(t)\)

Return type:

float

class panco.descriptor.curves.TokenBucket(sigma: float, rho: float)

Bases: object

The TokenBucket class encodes the token-bucket class of functions, for arrival curves and maximum service curves, \(\alpha(t) = \sigma + \rho t\).

Parameters:
  • sigma (float) – the burst term \(\sigma\)

  • rho (float) – the maximum arrival/service rate term \(\rho\)

>>> TokenBucket(5, 4)
5 + 4t
delay(delta: float) TokenBucket

Computes the deconvolution with a pure delay curve (dive by the delay parameter \(\delta\)):\(\gamma_{\sigma, \rho} \oslash \Delta_\delta = \gamma_{\sigma + \delta \rho, \rho}\)

Parameters:

delta – the delay parameter (\(\delta\)):

Returns:

the Token Bucket curve \(\gamma_{\sigma, \rho} \oslash \Delta_\delta\)

>>> TokenBucket(3, 2).delay(4)
11 + 2t
evaluate(t: float) float

Evaluates the token-bucket function at \(t\): \(\gamma(t) = \sigma + \rho t\).

Parameters:

t (float) – the value which the function is computed

Returns:

\(\gamma(t)\)

Return type:

float

scale(factor: float) TokenBucket

Scales the token-bucket curve \(\alpha\) by a factor \(f\): the returned token-bucket is then \(f \alpha\).

Parameters:

factor – the value of the factor \(f\)

Returns:

\(f \alpha\)

>>> TokenBucket(2, 3).scale(2)
4 + 6t
panco.descriptor.curves.clean(alpha: List[TokenBucket]) List[TokenBucket]

From a list of token-bucket functions representing the minimum of these function, only keep those that are useful in the representation.

Parameters:

alpha – the list of function

Returns:

the sublist of the useful token-buckets

panco.descriptor.curves.intersection(rl: RateLatency, tb: TokenBucket) Tuple[float, float]

Computes the intersection (not at 0) of a rate-latency function \(\beta_{R, T}\) and a token-bucket curve\(\gamma_{\sigma, \rho}\): Computes \(\tau > 0\) such that \(\gamma_{\sigma, \rho}(\tau) = \beta_{R, T}(\tau)\), that is \(\tau = \frac{\sigma + RT}{R - \rho}\).

Parameters:
Returns:

the value \(\tau\) at which the functions intersect and the value of both function at \(\tau`\).

panco.descriptor.curves.output_arrival_curve(tb: TokenBucket, rl: RateLatency) TokenBucket

Computes the arrival curve of the departure process of a single flow with token bucket arrival curve\(\alpha = \sigma + \rho t\): crossing a single server with rate-latency service curve \(\beta(t) = R(t-T)_+\):\(\alpha_o(t) = \sigma + \rho T + \rho t\) (if \(R\geq \rho\))

Parameters:
  • tb – the arrival curve of the arrival process \(\alpha\)

  • rl – the service curve of the server \(\beta\)

Returns:

token bucket function that is an arrival curve for the departure process: \(\alpha_o\)if \(R\geq \rho\) and \(\infty\) otherwise.

>>> output_arrival_curve(TokenBucket(3, 4), RateLatency(10, 2))
11 + 4t
>>> output_arrival_curve(TokenBucket(3, 4), RateLatency(3, 2))
inf + inft
panco.descriptor.curves.residual_blind(rl: RateLatency, tb: TokenBucket) RateLatency

Computes the residual service curve (blind multiplexing) of a server with rate-latency strict service curve \(\beta(t) = R(t-T)_+\) crossed by a token-bucket arrival curve \(\alpha = \sigma + \rho t\):\(\beta_b(t) = (R-\rho)( t - \frac{TR + \sigma}{R - \rho})_+\)

Parameters:
  • rl – rate-latency service curve \(\beta\)

  • tb – token-bucket arrival curve \(\alpha\)

Returns:

a rate-latency service curve \(\beta_b\)

>>> residual_blind(RateLatency(3, 4), TokenBucket(1, 2))
1(t - 13.0)_+
>>> residual_blind(RateLatency(2, 4), TokenBucket(1, 3))
0(t - inf)_+
>>> residual_blind(RateLatency(5, 4), TokenBucket(np.inf, 3))
0(t - inf)_+
panco.descriptor.curves.residual_fifo(rl: RateLatency, tb: TokenBucket) RateLatency

Computes a residual service curve (fifo multiplexing) of a server with rate-latency strict service curve \(\beta(t) = R(t-T)_+\) crossed by a token-bucket arrival curve \(\alpha = \sigma + \rho t\):\(\beta_f(t) = (R-\rho)( t - \frac{TR + \sigma}{R})_+\)

Parameters:
  • rl – rate-latency service curve \(\beta\)

  • tb – token-bucket arrival curve \(\alpha\)

Returns:

a rate-latency service curve \(\beta_f\)

panco.descriptor.curves.residual_general(beta: List[RateLatency], alpha: List[TokenBucket])

From a service curve represented by a maximum of rate-latency functions and an arrival curve represented by a minimum of token-bucket functions, compute the residual service curve.

Parameters:
  • beta – the servie curve \(\beta = \max_i \beta_{R_i, T_i}\)

  • alpha – the arrival curve \(\alpha = \min_j \gamma_{\sigma_j, \rho_j}\)

Returns:

The residual service curve (blind)

\((\beta-\alpha)_+ = \max+{i, j} \beta_{R_i, T_i}- \gamma_{\sigma_j, \rho_j}\)

panco.descriptor.curves.rl_convolution(list_rl: List[RateLatency]) RateLatency

Computes the (min, plus) convolution of a list of rate-latency functions \(\beta_i(t) = R_i(t-T_i)_+\): \(\beta(t) = \beta_1 * \cdots * \beta_n(t) = (\min_i R_i) (t - \sum_i T_i)\)

Parameters:

list_rl – list of rate latency functions \(\beta_i\)

Returns:

the (min, plus) convolution of these functions \(\beta\)

>>> rl_convolution([RateLatency(3, 4), RateLatency(6, 7), RateLatency(3, 2)])
3(t - 13)_+
>>> rl_convolution([])
inf(t - 0)_+
panco.descriptor.curves.sum_ac(alpha1: List[TokenBucket], alpha2: List[TokenBucket]) List[TokenBucket]

Function that computes the sum of token-bucket functions in to lists. Let \([\alpha_{b_i, r_i}]\) and \([\alpha'_{b_i, r_i}]\) be two lists of the same length, it computes the list of token-bucket functions \([\alpha_{b_i, r_i} +\alpha'_{b_i, r_i}]\).

Parameters:
  • alpha1 – the first list of token-bucket functions

  • alpha2 – the second list of token-bucket functions

Returns:

the list of the sum of the functions

panco.descriptor.curves.sum_ac_list(alpha: List[List[TokenBucket]]) List[TokenBucket]

Compute the by-term sum of lists of token-bucket functions.

Parameters:

alpha – list of token-bucket functions

Returns:

the list of the sum of the functions

panco.descriptor.curves.tb_sum(list_tb: List[TokenBucket]) TokenBucket

Computes the sum of the token-bucket in \(\alpha_i(t) = \sigma_i + \rho_i t\) in list_tb: \(\alpha(t) = \sum_{i=1}^n \alpha_i(t) = \sum_{i=1}^n \sigma_i + (\sum_{i=1}^n \rho_i) t\)

Parameters:

list_tb (List[TokenBuckets]) – a list of token_bucket :math:

Returns:

The sum of the arrival curves in list_tb \(\alpha\).

>>> tb_sum([TokenBucket(1, 2), TokenBucket(3, 4), TokenBucket(5, 6)])
9 + 12t
>>> tb_sum([TokenBucket(np.inf, 2), TokenBucket(3, 4)])
inf + 6t
>>> tb_sum([])
0 + 0t