Random Request

Code for a randomized application

This module defines the RandomRequestApp, which will create random entanglement requests repeatedly. Useful for testing network properties and throughputs.

class src.app.random_request.RandomRequestApp(node: QuantumRouter, others: List[str], seed: int, min_dur: int, max_dur: int, min_size: int, max_size: int, min_fidelity: float, max_fidelity: float)

Code for the random request application.

This application will create a request for entanglement with a random node (and with other random parameters). If the request is accepted, a new request will be made once it has expired. Otherwise, a new request will be made immediately. The responder and fidelity of failed request will be kept in the new request.

The RandomRequestApp class inherits three functions from the RequsetApp class: get_memory(memory_info), get_throughput(), get_other_reservation(reservation). The “get_memory” function consumes the memory when the qualified entanglement is generated. The “get_throughput” function provides the throughput of the serving reservation. The “get_other_reservation” function accepts reservation when node is the responder node.

node

Node that code is attached to.

Type:

QuantumRouter

others

list of names for available other nodes.

Type:

List[str]

rg

random number generator for application.

Type:

numpy.random.default_rng

request_time

simulation time at which current reservation requested.

Type:

int

memory_counter

number of successfully received memories.

Type:

int

wait_time

aggregates times between request and accepted reservation.

Type:

List[int]

all_throughput

aggregates average rate of memory entanglement per reservation.

Type:

List[float]

reserves

aggregates previous reservations.

Type:

List[List[any]]

memo_to_reserve

mapping of memory index to corresponding reservation.

Type:

Dict[int, Reservation]

min_dur

the minimum duration of request (ps).

Type:

int

max_dur

the maximum duration of request (ps).

Type:

int

min_size

the minimum required memory of request.

Type:

int

max_size

the maximum required memory of request.

Type:

int

min_fidelity

the minimum required fidelity of entanglement.

Type:

float

max_fidelity

the maximum required fidelity of entanglement.

Type:

float

get_reserve_res(reservation: Reservation, result: bool) None

Method to receive reservation result from network manager.

Parameters:
  • reservation (Reservation) – reservation that has been completed.

  • result (bool) – result of the request (approved/rejected).

Side Effects:

May schedule a start/retry event based on reservation result.

retry(responder: str, fidelity: float) None

Method to retry a failed request.

Parameters:
  • responder (str) – responder node of failed request.

  • fidelity (float) – fidelity of failed request.

Side Effects:

Will create request for network manager on node.

start()

Method to start the application.

This method will:

  1. Choose a random destination node from the others list.

  2. Choose a start time between 1-2 seconds in the future.

  3. Choose a random duration between min_dur and max_dur to set end_time

  4. Pick a number of memories to request between min_size and max_size

  5. Pick a random fidelity between min_fidelity and max_fidelity.

  6. Use its parent class start function to create request

Side Effects:

Will create request for network manager on node.