@@ -115,7 +115,7 @@ def create_network_from_dictionary(params_input):
115
115
)
116
116
)
117
117
for clss_name in params ['customer_class_names' ]:
118
- if all (isinstance (f , types .FunctionType ) for f in params ["routing" ]):
118
+ if all (isinstance (f , types .FunctionType ) or isinstance ( f , types . MethodType ) for f in params ["routing" ]):
119
119
classes [clss_name ] = CustomerClass (
120
120
params ['arrival_distributions' ][clss_name ],
121
121
params ['service_distributions' ][clss_name ],
@@ -140,7 +140,7 @@ def create_network_from_dictionary(params_input):
140
140
class_change_time_distributions [clss_name ],
141
141
)
142
142
n = Network (nodes , classes )
143
- if all (isinstance (f , types .FunctionType ) for f in params ["routing" ]):
143
+ if all (isinstance (f , types .FunctionType ) or isinstance ( f , types . MethodType ) for f in params ["routing" ]):
144
144
n .process_based = True
145
145
else :
146
146
n .process_based = False
@@ -220,7 +220,7 @@ def validify_dictionary(params):
220
220
Raises errors if there is something wrong with the
221
221
parameters dictionary.
222
222
"""
223
- if all (isinstance (f , types .FunctionType ) for f in params ["routing" ]):
223
+ if all (isinstance (f , types .FunctionType ) or isinstance ( f , types . MethodType ) for f in params ["routing" ]):
224
224
consistant_num_classes = (
225
225
params ["number_of_classes" ]
226
226
== len (params ["arrival_distributions" ])
@@ -241,7 +241,7 @@ def validify_dictionary(params):
241
241
)
242
242
if not consistant_num_classes :
243
243
raise ValueError ("Ensure consistant number of classes is used throughout." )
244
- if all (isinstance (f , types .FunctionType ) for f in params ["routing" ]):
244
+ if all (isinstance (f , types .FunctionType ) or isinstance ( f , types . MethodType ) for f in params ["routing" ]):
245
245
consistant_class_names = (
246
246
set (params ["arrival_distributions" ])
247
247
== set (params ["service_distributions" ])
@@ -266,7 +266,7 @@ def validify_dictionary(params):
266
266
)
267
267
if not consistant_class_names :
268
268
raise ValueError ("Ensure consistant names for customer classes." )
269
- if all (isinstance (f , types .FunctionType ) for f in params ["routing" ]):
269
+ if all (isinstance (f , types .FunctionType ) or isinstance ( f , types . MethodType ) for f in params ["routing" ]):
270
270
num_nodes_count = (
271
271
[params ["number_of_nodes" ]]
272
272
+ [len (obs ) for obs in params ["arrival_distributions" ].values ()]
@@ -296,7 +296,7 @@ def validify_dictionary(params):
296
296
)
297
297
if len (set (num_nodes_count )) != 1 :
298
298
raise ValueError ("Ensure consistant number of nodes is used throughout." )
299
- if not all (isinstance (f , types .FunctionType ) for f in params ["routing" ]):
299
+ if not all (isinstance (f , types .FunctionType ) or isinstance ( f , types . MethodType ) for f in params ["routing" ]):
300
300
for clss in params ["routing" ].values ():
301
301
for row in clss :
302
302
if sum (row ) > 1.0 or min (row ) < 0.0 or max (row ) > 1.0 :
0 commit comments