diff --git a/docs/source/tutorial/chapter6/custom_app.py b/docs/source/tutorial/chapter6/custom_app.py index 5d2ed062..c182a71b 100644 --- a/docs/source/tutorial/chapter6/custom_app.py +++ b/docs/source/tutorial/chapter6/custom_app.py @@ -30,7 +30,7 @@ def start(self): event = Event(now + PERIOD, process) self.node.timeline.schedule(event) - def get_reserve_res(self, reservation: "Reservation", result: bool): + def get_reservation_result(self, reservation: "Reservation", result: bool): if result: print("Reservation approved at time", self.node.timeline.now() * 1e-12) else: @@ -84,13 +84,6 @@ def get_memory(self, info): tl.stop_time = PERIOD * NUM_PERIODS tl.show_progress = False - log.set_logger(__name__, tl, log_filename) - log.set_logger_level('DEBUG') - - modules = ['timeline', 'network_manager', 'resource_manager', 'generation', 'swapping', 'rule_manager'] - for module in modules: - log.track_module(module) - start_node_name = "end1" end_node_name = "end2" node1 = node2 = None @@ -104,7 +97,7 @@ def get_memory(self, info): memory_size = 1 target_fidelity = 0.6 app = PeriodicApp(node1, end_node_name, memory_size, target_fidelity) - reset_app = ResetApp(node2, start_node_name, memory_size, target_fidelity) + reset_app = ResetApp(node2, start_node_name, target_fidelity) tl.init() app.start() diff --git a/sequence/entanglement_management/generation.py b/sequence/entanglement_management/generation.py index a44d2373..dddca736 100644 --- a/sequence/entanglement_management/generation.py +++ b/sequence/entanglement_management/generation.py @@ -177,7 +177,7 @@ def set_others(self, protocol: str, node: str, memories: List[str]) -> None: self.primary = self.owner.name > self.remote_node_name def start(self) -> None: - """Method to start "one round" in the entanglement generation protocol (two rounds in total, double heralded). + """Method to start "one round" in the entanglement generation protocol (there are two rounds in Barrett-Kok). Will start negotiations with other protocol (if primary). diff --git a/sequence/network_management/reservation.py b/sequence/network_management/reservation.py index 7142304f..c70eeba1 100644 --- a/sequence/network_management/reservation.py +++ b/sequence/network_management/reservation.py @@ -335,7 +335,7 @@ def __init__(self, owner: "QuantumRouter", name: str, memory_array_name: str): self.accepted_reservations = [] def push(self, responder: str, start_time: int, end_time: int, memory_size: int, target_fidelity: float, - entanglement_number: int = 1, id: int = 0): + entanglement_number: int = 1, identity: int = 0): """Method to receive reservation requests from higher level protocol. Will evaluate request and determine if node can meet it. @@ -349,12 +349,12 @@ def push(self, responder: str, start_time: int, end_time: int, memory_size: int, memory_size (int): number of memories to be entangled. target_fidelity (float): desired fidelity of entanglement. entanglement_number (int): the number of entanglement the request ask for. - id (int): the ID of the request. + identity (int): the ID of the request. Side Effects: May push/pop to lower/upper attached protocols (or network manager). """ - reservation = Reservation(self.owner.name, responder, start_time, end_time, memory_size, target_fidelity, entanglement_number, id) + reservation = Reservation(self.owner.name, responder, start_time, end_time, memory_size, target_fidelity, entanglement_number, identity) if self.schedule(reservation): msg = ResourceReservationMessage(RSVPMsgType.REQUEST, self.name, reservation) qcap = QCap(self.owner.name) @@ -596,11 +596,11 @@ class Reservation: memory_size (int): number of entangled memory pairs requested. path (list): a list of router names from the source to destination entanglement_number (int): the number of entanglement pair that the request ask for. - id (int): the ID of a request. + identity (int): the ID of a request. """ def __init__(self, initiator: str, responder: str, start_time: int, - end_time: int, memory_size: int, fidelity: float, entanglement_number: int = 1, id: int = 0): + end_time: int, memory_size: int, fidelity: float, entanglement_number: int = 1, identity: int = 0): """Constructor for the reservation class. Args: @@ -611,7 +611,7 @@ def __init__(self, initiator: str, responder: str, start_time: int, memory_size (int): number of entangled memories requested. fidelity (float): desired fidelity of entanglement. entanglement_number (int): the number of entanglement the request ask for. - id (int): the ID of a request + identity (int): the ID of a request """ self.initiator = initiator @@ -621,14 +621,14 @@ def __init__(self, initiator: str, responder: str, start_time: int, self.memory_size = memory_size self.fidelity = fidelity self.entanglement_number = entanglement_number - self.id = id + self.identity = identity self.path = [] assert self.start_time < self.end_time assert self.memory_size > 0 def __str__(self) -> str: - s = "|initiator={}; responder={}; start_time={:,}; end_time={:,}; memory_size={}; target_fidelity={}; entanglement_number={}; id={}|".format( - self.initiator, self.responder, int(self.start_time), int(self.end_time), self.memory_size, self.fidelity, self.entanglement_number, self.id) + s = "|initiator={}; responder={}; start_time={:,}; end_time={:,}; memory_size={}; target_fidelity={}; entanglement_number={}; identity={}|".format( + self.initiator, self.responder, int(self.start_time), int(self.end_time), self.memory_size, self.fidelity, self.entanglement_number, self.identity) return s def __repr__(self) -> str: @@ -646,7 +646,7 @@ def __eq__(self, other: "Reservation") -> bool: other.fidelity == self.fidelity def __lt__(self, other: "Reservation") -> bool: - return self.id < other.id + return self.identity < other.identity def __hash__(self): return hash((self.initiator, self.responder, self.start_time, self.end_time, self.memory_size, self.fidelity))