API

The main algorith offered by the Queuinx is queuinx.RouteNetStep() that operates on queuinx.Network objects.

queuinx.RouteNetStep(update_flow_fn, update_queue_fn, reducers)

Returns a function that applies a step of configured model

Parameters:
  • update_flow_fn (Callable[[RaggedCarry, Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]]], Tuple[RaggedCarry, Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]]]]) – function implementing scan like operation over the queues along a flow

  • update_queue_fn (Callable[[Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]], Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]], Array, Array], Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]]]) – function used to update the queues

  • reducers (Any) – A tree of callable used to reduce the flows

Returns:

A function that applies a step of configured model

Return type:

Callable[[Network], Network]

class queuinx.Network

Class for keeping track of a queuing network.

Parameters:
  • queues – The queues feature e.g. buffer size or service rate. It is a (nested) vector of shape [n_queues] + queue_shape, where n_queues=sum(net.n_queues)

  • flows – The flows features, e.g. traffic properties. It is a (nested) vector of shape [n_flows] + queue_shape, where n_flows=sum(net.n_flows)

  • flow – The indices of the flows

  • step – The position of :ref queue: in the flow :param flow:

  • queue – The indices of the queues

  • n_flows – The number of flows per network. It is a vector of integers of shape [sum(net.n_flows)]

  • max_path_length_mask – The mask of the maximum path lengths. It a boolean matrix of shape [n_graph,max_path_length]. The number of consecutive True encodes the maximum path length for the subnetwork.

  • n_queues – The number of queues per network. It is a vector of integers of shape [n_graph]

  • n_routes – The number of route entries (len(net.flow) per network. It is a vector of integers of shape [n_graphs]

  • interface – Interface the queue belongs that groups queues e.g. for scheduling. It is either None or a vector of shape [sum(n_queue),1]

  • n_interfaces – The number of interfaces per network. It is a vector of integers with shape [n_nets], such that network.n_interfaces[i] is the number of interfaces in the i-th network.

__init__(queues, flows, flow, step, queue, n_flows, max_path_length_mask, n_queues, n_routes, interface=None, n_interfaces=None)
Parameters:
  • queues (Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]]) –

  • flows (Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]]) –

  • flow (Array | ndarray | bool_ | number) –

  • step (Array | ndarray | bool_ | number) –

  • queue (Array | ndarray | bool_ | number) –

  • n_flows (Array | ndarray | bool_ | number) –

  • max_path_length_mask (Array | ndarray | bool_ | number) –

  • n_queues (Array | ndarray | bool_ | number) –

  • n_routes (Array | ndarray | bool_ | number) –

  • interface (Array | ndarray | bool_ | number | None) –

  • n_interfaces (Array | ndarray | bool_ | number | None) –

Return type:

None

property flow_lengths: Array | ndarray | bool_ | number

Dynamic length of each flow in the network

Returns:

An array of flow lengths

On top of this core functionality a rich set of algorithm is built.

A library of RouteNet based models.

class queuinx.models.FiniteFifo

Parameters and state of fine fifo buffer

__init__(b, service_rate, arrivals, pasprob)
Parameters:
  • b (Array | ndarray | bool_ | number) –

  • service_rate (Array | ndarray | bool_ | number) –

  • arrivals (Array | ndarray | bool_ | number) –

  • pasprob (Array | ndarray | bool_ | number) –

Return type:

None

class queuinx.models.PoissonFlow

Parameters and state Poisson arrival flow

__init__(rate)
Parameters:

rate (Array | ndarray | bool_ | number) –

Return type:

None

class queuinx.models.QoS

QoS parameters

Parameters:
  • delay – An expected delay including queuing and service time

  • jitter – Variance of waiting and service time

  • loss – Job loss probability

__init__(delay, jitter, loss)
Parameters:
  • delay (Array | ndarray | bool_ | number) –

  • jitter (Array | ndarray | bool_ | number | None) –

  • loss (Array | ndarray | bool_ | number) –

Return type:

None

queuinx.models.Readout_mm1b(buffer_upper_bound)

Computes delay per path assuming M/M/1/B delay model

Parameters:

buffer_upper_bound (int) –

Returns:

A step function performing computations.

Return type:

Callable[[Network], Network]

queuinx.models.RouteNetStep(update_flow_fn, update_queue_fn, reducers)

Returns a function that applies a step of configured model

Parameters:
  • update_flow_fn (Callable[[RaggedCarry, Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]]], Tuple[RaggedCarry, Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]]]]) – function implementing scan like operation over the queues along a flow

  • update_queue_fn (Callable[[Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]], Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]], Array, Array], Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]]]) – function used to update the queues

  • reducers (Any) – A tree of callable used to reduce the flows

Returns:

A function that applies a step of configured model

Return type:

Callable[[Network], Network]

Queuing theory

For analytical results Queuinx provides set of queuing theory functionalities.

MM1b

Numerical procedures for M/M/1/b system

class queuinx.queuing_theory.mm1b.StationarySystem

A Stationary distribution of system occupancy in M/M/1/b

__init__(rho, b, buffer_upper_bound)
Parameters:
  • rho (Array | ndarray | bool_ | number) – System utilization

  • b (Array | ndarray | bool_ | number) – buffer size

  • buffer_upper_bound (int) – Statically known upper bound on the buffer.

mean()

Calculates the mean.

variance()

Calculates the variance.

queuinx.queuing_theory.mm1b.delay_distribution(a, mu, b, buffer_upper_bound)

Return delay distribution as distrax.Distribution.

Parameters:
  • a (Array | ndarray | bool_ | number) – Arrival rate

  • mu (Array | ndarray | bool_ | number) – Service rate

  • b (Array | ndarray | bool_ | number) – buffer

  • buffer_upper_bound (int) – Static integer bounding all-buffers

Returns:

Delay distribution (including service time)

Return type:

Distribution

MM1

queuinx.queuing_theory.mm1.delay_distribution(a, mu)

Return delay distribution in M/M/1 for customers who arrive and find the queue as a stationary process [1]. This includes both waiting and service time.

Parameters:
  • a (Array | ndarray | bool_ | number) – Arrival rate

  • mu (Array | ndarray | bool_ | number) – Service rate

Returns:

Delay distribution (including service time)

Return type:

Distribution | Distribution

Basic(fluid)

Utilities

Queuinx provides few utility functions mostly for avoiding recompilation due to changing shapes.

class queuinx.utils.RaggedCarry

Carry for variable length sequences. Svan function must be decorated with ragged()

__init__(carry, step, n_step)
Parameters:
  • carry (Array | ndarray | bool_ | number | Iterable[Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]] | Mapping[Any, Array | ndarray | bool_ | number | Iterable[ArrayTree] | Mapping[Any, ArrayTree]]) –

  • step (Array | ndarray | bool_ | number) –

  • n_step (Array | ndarray | bool_ | number) –

Return type:

None

queuinx.utils.batch(nets)

Returns a batched network given a list of networks.

Parameters:

nets (Sequence[Network]) –

Return type:

Network

queuinx.utils.ragged(f)

Decorates scan function to make it compatible with RaggedCarry

Parameters:

f (Callable) – A scan function

Returns:

A function accepting RaggedCarry

queuinx.utils.unbatch(net)

Returns a list of networks given a batched network.

Parameters:

net (Network) – the batched network, which will be unbatched into a list of networks.

Return type:

list[Network]

Experimental

Experimental models models.

queuinx.experimental.models.ApproximateScheduling(n_tos, buffer_upper_bound, interface_upper_bound)

Queuing model with scheduling.

Parameters:
  • n_tos (int) – Maksimum number of types of service per queue group

  • buffer_upper_bound (int) – Statically know limit for all buffers

  • interface_upper_bound (int) – Statically know limit for number of interfaces

Return type:

Callable[[Network], Network]

queuinx.experimental.models.FixedPoint(model, *args, **kwargs)

Wraps model to return a function computing fixed point solution

Parameters:
  • model – Model function i.e. this function should return a single step of routenet

  • args – list of arguments for jaxopt.FixedPointIteration

  • kwargs – dict of arguments for jaxopt.FixedPointIteration

Returns:

A model computing fixed point the given model.

class queuinx.experimental.models.PacketFlow

Flow with information about packet length

__init__(rate, plen, weighted_plen=None)
Parameters:
  • rate (Array | ndarray | bool_ | number) –

  • plen (Array | ndarray | bool_ | number) –

  • weighted_plen (Array | ndarray | bool_ | number | None) –

Return type:

None

class queuinx.experimental.models.PacketQueue

Queue with scheduling

__init__(b, service_rate, arrivals, pasprob, speed, w, priority, bit_buffer, policy=4)
Parameters:
  • b (Array | ndarray | bool_ | number) –

  • service_rate (Array | ndarray | bool_ | number) –

  • arrivals (Array | ndarray | bool_ | number) –

  • pasprob (Array | ndarray | bool_ | number) –

  • speed (Array | ndarray | bool_ | number) –

  • w (Array | ndarray | bool_ | number) –

  • priority (Array | ndarray | bool_ | number) –

  • bit_buffer (Array | ndarray | bool_ | number) –

  • policy (int) –

Return type:

None

queuinx.experimental.models.Readout_mm1()

Calculates QoS based on MM1 approximation

Returns:

RouteNet step callable

Return type:

Callable[[Network], Network]

enum queuinx.experimental.models.SchedulingPolicy(value)

Types of scheduling

Valid values are as follows:

SP = <SchedulingPolicy.SP: 1>
WFQ = <SchedulingPolicy.WFQ: 2>
DRR = <SchedulingPolicy.DRR: 3>
FIFO = <SchedulingPolicy.FIFO: 4>