Closed mnips closed 7 years ago
In the v1.0.0, supplying dictionary as parameter to create_network is not working.
import ciw import os import random import numpy as np import pandas as pd def time_dependent_func(t): return np.random.normal(10,2) def my_baulking_function(n): if n<5: return 0.0 return 1.0 params = { 'Arrival_distributions': {'Class 0': [['TimeDependent', lambda t : time_dependent_func(t)], 'NoArrivals', 'NoArrivals', 'NoArrivals']}, 'Number_of_nodes': 4, 'Number_of_servers': [1, 1, 1, 1], 'Queue_capacities': ['Inf', 'Inf', 'Inf','Inf'], 'Number_of_classes': 1, 'Service_distributions': {'Class 0': [['Deterministic', 12.0], ['Deterministic', 6.0 ], ['Lognormal', 15.0,5.0], ['Lognormal', 30.0,4.0]]}, 'Transition_matrices': {'Class 0': [[0.0, 1,0,0], [0, 0.0,1,0],[0,0,0,0.2],[0,0,0,0]]}, 'Baulking_functions': {'Class 0':[my_baulking_function,None,None,None]} } ciw.seed(1) N=ciw.create_network(params) Q=ciw.Simulation(N) Q.simulate_until_max_time(100) recs = Q.get_all_records() df = pd.DataFrame(recs) df.set_index('id_number', inplace=True) df.sort_values(by=['node'], ascending=[True], inplace=True) df.to_csv("output.csv")
My stack trace:-
Traceback (most recent call last): File "C:/Users/ps/Desktop/temp.py", line 28, in N=ciw.create_network(params) TypeError: create_network() takes exactly 0 arguments (1 given)
Ok got it. Had to use :- create_network_from_dictionary(params)
FYI, this would work (it would unpack the dictionary):
ciw.create_network(**params)
In the v1.0.0, supplying dictionary as parameter to create_network is not working.
My stack trace:-
Traceback (most recent call last): File "C:/Users/ps/Desktop/temp.py", line 28, in
N=ciw.create_network(params)
TypeError: create_network() takes exactly 0 arguments (1 given)