Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update individual.py #215

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 76 additions & 5 deletions ciw/individual.py
Original file line number Diff line number Diff line change
@@ -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 <id_number>'.
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):
Expand Down Expand Up @@ -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}"
Loading