Ciw icon indicating copy to clipboard operation
Ciw copied to clipboard

TypeError when using infinite servers in conjunction with schedules

Open alcarney opened this issue 8 years ago • 5 comments

If I use the following parameter dictionary:

params = {'Arrival_distributions': {'Class 0': [['Exponential', 3.0]]},
          'Service_distributions': {'Class 0': [['Exponential', 5.0]]},
          'Transition_matrices': {'Class 0': [[0.0]]},
          'Number_of_servers': ['Inf']
}

Ciw works quite happily, however if I use this dictionary:

params = {'Arrival_distributions': {'Class 0': [['Exponential', 3.0]]},
          'Service_distributions': {'Class 0': [['Exponential', 5.0]]},
          'Transition_matrices': {'Class 0': [[0.0]]},
          'schedule': [[5, 'Inf'], [10, 0]],
          'Number_of_servers': ['schedule']
}

then I get the following stack trace:

Traceback (most recent call last):
  File "crossroads-traffic-lights-sim.py", line 38, in <module>
    Q = ciw.Simulation(N)
  File "/home/alex/Blender/Ciw/env2/lib/python2.7/site-packages/ciw/simulation.py", line 48, in __init__
    for i in range(network.number_of_nodes)]
  File "/home/alex/Blender/Ciw/env2/lib/python2.7/site-packages/ciw/node.py", line 36, in __init__
    self.node_capacity = node.queueing_capacity + self.c
TypeError: unsupported operand type(s) for +: 'float' and 'str'

I see the error using both Python 2 and Python 3

alcarney avatar Sep 25 '16 19:09 alcarney

Yes, server schedules and infinite servers are incompatible at the moment sorry! At the moment can't think of a way around this. But will add a note to the documentation to clarify. Apologies for this. Keeping this issue open.

geraintpalmer avatar Sep 25 '16 19:09 geraintpalmer

Perhaps remove the bug label and add a wontfix label?

drvinceknight avatar Apr 01 '17 17:04 drvinceknight

Perhaps remove the bug label and add a wontfix label?

It's wontfix at the moment. But here may be a way of refactoring everything in the future and making this work. This is far from a priority though.

geraintpalmer avatar Apr 02 '17 17:04 geraintpalmer

Yup, but I'd suggest going with a wontfix label for now so that this doesn't look like a long standing bug. (If something is an actual bug it implies that it's broken and needs to be fixed.)

drvinceknight avatar Apr 02 '17 18:04 drvinceknight

👍

geraintpalmer avatar Apr 02 '17 18:04 geraintpalmer