-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from galenseilis/patch-7
NumPy docstrings and type hints in disciplines.py
- Loading branch information
Showing
1 changed file
with
34 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,49 @@ | ||
from typing import List | ||
|
||
from ciw.individual import Individual | ||
from ciw.auxiliary import random_choice | ||
|
||
|
||
def FIFO(individuals): | ||
def FIFO(individuals: List[Individual]) -> Individual: | ||
""" | ||
FIFO: First in first out / First come first served | ||
Returns the individual at the head of the queue | ||
FIFO: First In, First Out (FIFO) | ||
Returns the individual at the head of the queue. | ||
Parameters: | ||
- individuals (List[Individual]): List of individuals in the queue. | ||
Returns: | ||
- Individual: The individual at the head of the queue. | ||
""" | ||
return individuals[0] | ||
|
||
|
||
def SIRO(individuals): | ||
def SIRO(individuals: List[Individual]) -> Individual: | ||
""" | ||
SIRO: Service in random order | ||
Returns a random individual from the queue | ||
SIRO: Service In Random Order (SIRO) | ||
Returns a random individual from the queue. | ||
Parameters: | ||
- individuals (List[Individual]): List of individuals in the queue. | ||
Returns: | ||
- Individual: A randomly selected individual from the queue. | ||
""" | ||
return random_choice(individuals) | ||
|
||
|
||
def LIFO(individuals): | ||
def LIFO(individuals: List[Individual]) -> Individual: | ||
""" | ||
LIFO: Last in first out / Last come first served | ||
Returns the individual who joined the queue most recently | ||
LIFO: Last In, First Out (LIFO) | ||
Returns the individual who joined the queue most recently. | ||
Parameters: | ||
- individuals (List[Individual]): List of individuals in the queue. | ||
Returns: | ||
- Individual: The individual who joined the queue most recently. | ||
""" | ||
return individuals[-1] | ||
return individuals[-1] |