-
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 #245 from CiwPython/impovements_from_PRs
Impovements from PRs
- Loading branch information
Showing
12 changed files
with
327 additions
and
102 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
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] |
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
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
Oops, something went wrong.