Sorted List scheduler

The Sorted List scheduler is the simplest scheduler available, though it has extremely bad performance in several situations.

It simply keeps a list of all models, which is sorted on time_next. No operations have any influence on this heap itself, as there is no real internal representation. As soon as the imminent models are requested, this list is sorted again and the first elements are returned.

class schedulers.schedulerSL.SchedulerSL(models, epsilon, totalModels)[source]

Scheduler class itself

__init__(models, epsilon, totalModels)[source]

Constructor

Parameters:models – all models in the simulation
getImminent(time)[source]

Returns a list of all models that transition at the provided time, with the specified epsilon deviation allowed.

Parameters:time – timestamp to check for models

Warning

For efficiency, this method only checks the first elements, so trying to invoke this function with a timestamp higher than the value provided with the readFirst method, will always return an empty set.

massReschedule(reschedule_set)[source]

Reschedule all models provided. Equivalent to calling unschedule(model); schedule(model) on every element in the iterable.

Parameters:reschedule_set – iterable containing all models to reschedule
readFirst()[source]

Returns the time of the first model that has to transition

Returns:timestamp of the first model
schedule(model)[source]

Schedule a model

Parameters:model – the model to schedule
unschedule(model)[source]

Unschedule a model

Parameters:model – model to unschedule