Lesson 3: Engine attributes

Before this engine can do any calculations it requires three attributes:

  • Number of servers

  • Pmf of the number of arrivals

  • Pmf of the service duration

Pmfs are expressed as Python dictionaries, where each key is an integer in the support of the distribution and each value is a probability. For example,

{2: 0.3, 3: 0.7}

assigns probability 0.3 to 2 and probability 0.7 to 3.

Here are the attribute assignments used in this tutorial:

engine.number_of_arrivals_pmf = {2: 0.3, 3: 0.7}
engine.service_duration_pmf = {1: 0.6, 2: 0.3, 3: 0.1}
engine.number_of_servers = 2

By default, this particular engine assumes that the system is initially empty. You can confirm this by asking the engine for the pmf of the number of entities in the system:

print(engine.get_number_of_entities_in_system_pmf())

Here is the output:

{0: 1.0}

This shows that the number of entities in the system is zero with probability one. In other words, the system is initially empty.

Here is the complete code so far:

from qplex import StandardMultiserver

engine = StandardMultiserver()
engine.number_of_arrivals_pmf = {2: 0.3, 3: 0.7}
engine.service_duration_pmf = {1: 0.6, 2: 0.3, 3: 0.1}
engine.number_of_servers = 2

print(engine.get_number_of_entities_in_system_pmf())