CiwPython / Ciw

Ciw is a simulation library for open queueing networks.
http://ciw.readthedocs.io
MIT License
148 stars 42 forks source link

Slotted undocumented #226

Closed galenseilis closed 10 months ago

galenseilis commented 10 months ago

I noticed this class in schedules:

class Slotted(Schedule):
    def __init__(self, slots, slot_sizes, capacitated=False, preemption=False):
        """
        Initialises the instance of the Slotted Schedule object
        """
        if not capacitated:
            if preemption is not False:
                raise ValueError("Pre-emption options not availale for non-capacitated slots.")
        if preemption not in [False, 'resume', 'restart', 'resample']:
            raise ValueError("Pre-emption options should be either 'resume', 'restart', 'resample', or False.")
        self.schedule_type = 'slotted'
        self.slots = slots
        self.slot_sizes = slot_sizes
        self.capacitated = capacitated
        self.preemption = preemption
        self.cyclelength = self.slots[-1]
        self.c = 0

    def initialise(self):
        """
        Initialises the generator object at the beginning of a simulation
        """
        self.schedule_generator = self.get_schedule_generator(self.slots, [self.slot_sizes[-1]] + self.slot_sizes[:-1])
        self.get_next_slot()

    def get_next_slot(self):
        """
        Updates the next slot time and size from the generator
        """
        date, size = next(self.schedule_generator)
        self.next_slot_date = date
        self.slot_size = size

It does not appear in the documentation anywhere.

geraintpalmer commented 10 months ago

The Guide on slotted services is available here: https://ciw.readthedocs.io/en/latest/Guides/slotted.html

galenseilis commented 10 months ago

I missed that! Thanks!