From a3d2a42c1640c043bfa0de4eefc99cdd117812b3 Mon Sep 17 00:00:00 2001 From: Galen Seilis Date: Tue, 24 Oct 2023 19:47:39 -0700 Subject: [PATCH] Update individual.py - NumPy-style docstring - Updated to using f-string for __repr__ --- ciw/individual.py | 81 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 76 insertions(+), 5 deletions(-) diff --git a/ciw/individual.py b/ciw/individual.py index 7b55e24..7720dcd 100644 --- a/ciw/individual.py +++ b/ciw/individual.py @@ -1,6 +1,78 @@ class Individual(object): - """ - Class for an individual. + """A class representing an individual agent in a queueing network simulation. + + An Individual instance models the flow of an agent through a queueing network, tracking its arrival time, service time, priority, and other relevant data. This class provides a framework for simulating and analyzing the behavior of such agents. + + Parameters + ---------- + id_number : int + A unique identifier for the individual. + customer_class : str, optional + The customer class to which the individual belongs (default is 'Customer'). + priority_class : int, optional + The priority class of the individual (default is 0). + simulation : bool, optional + A flag indicating whether the individual is part of a simulation (default is False). + + Attributes + ---------- + arrival_date : bool + Timestamp for the arrival of the individual. + service_start_date : bool + Timestamp for the start of service for the individual. + service_time : bool + Time taken for the service. + service_end_date : bool + Timestamp for the end of service for the individual. + exit_date : bool + Timestamp when the individual exits the system. + id_number : int + Unique identifier for the individual. + data_records : list + A list to store additional data records. + customer_class : str + The customer class to which the individual belongs. + previous_class : str + The previous customer class of the individual. + priority_class : int + The priority class of the individual. + prev_priority_class : int + The previous priority class of the individual. + original_class : str + The original customer class of the individual. + is_blocked : bool + Indicates if the individual is blocked. + server : bool + Indicates whether the individual is assigned to a server. + queue_size_at_arrival : bool + Size of the queue at the time of arrival. + queue_size_at_departure : bool + Size of the queue at the time of departure. + destination : bool + The destination node in the network. + interrupted : bool + Indicates if the individual's service was interrupted. + node : bool + The node in the network where the individual is located. + simulation : bool + A flag indicating whether the individual is part of a simulation. + + Methods + ------- + __repr__() + Returns a string representation of the individual as 'Individual '. + + Usage + ----- + You can create and manipulate instances of the Individual class to simulate and study the behavior of agents within a queueing network. + + Example + ------- + ``` + individual = Individual(id_number=1, customer_class='Gold', priority_class=1, simulation=True) + ``` + + For more details on the attributes and methods, please refer to the class documentation. """ def __init__(self, id_number, customer_class='Customer', priority_class=0, simulation=False): @@ -29,7 +101,6 @@ def __init__(self, id_number, customer_class='Customer', priority_class=0, simul self.simulation = simulation def __repr__(self): + """Represents an Individual instance as a string. """ - Represents an Individual instance as a string. - """ - return "Individual %s" % self.id_number + return f"Individual {self.id_number}"