@@ -115,7 +115,7 @@ def create_network_from_dictionary(params_input):
115115 )
116116 )
117117 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" ]):
119119 classes [clss_name ] = CustomerClass (
120120 params ['arrival_distributions' ][clss_name ],
121121 params ['service_distributions' ][clss_name ],
@@ -140,7 +140,7 @@ def create_network_from_dictionary(params_input):
140140 class_change_time_distributions [clss_name ],
141141 )
142142 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" ]):
144144 n .process_based = True
145145 else :
146146 n .process_based = False
@@ -220,7 +220,7 @@ def validify_dictionary(params):
220220 Raises errors if there is something wrong with the
221221 parameters dictionary.
222222 """
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" ]):
224224 consistant_num_classes = (
225225 params ["number_of_classes" ]
226226 == len (params ["arrival_distributions" ])
@@ -241,7 +241,7 @@ def validify_dictionary(params):
241241 )
242242 if not consistant_num_classes :
243243 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" ]):
245245 consistant_class_names = (
246246 set (params ["arrival_distributions" ])
247247 == set (params ["service_distributions" ])
@@ -266,7 +266,7 @@ def validify_dictionary(params):
266266 )
267267 if not consistant_class_names :
268268 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" ]):
270270 num_nodes_count = (
271271 [params ["number_of_nodes" ]]
272272 + [len (obs ) for obs in params ["arrival_distributions" ].values ()]
@@ -296,7 +296,7 @@ def validify_dictionary(params):
296296 )
297297 if len (set (num_nodes_count )) != 1 :
298298 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" ]):
300300 for clss in params ["routing" ].values ():
301301 for row in clss :
302302 if sum (row ) > 1.0 or min (row ) < 0.0 or max (row ) > 1.0 :
0 commit comments