Generalising class names
See original GitHub issueWhen defining classes of individuals in the system, their names must be of the form "Class <i>"
where i
is an integer. For example:
>>> import ciw
>>> N = ciw.create_network(
... arrival_distributions={
... "child": [ciw.dists.Exponential(0.2)],
... "adult": [ciw.dists.Exponential(0.3)],
... },
... service_distributions={
... "child": [ciw.dists.Exponential(0.3)],
... "adult": [ciw.dists.Exponential(0.3)],
... },
... number_of_servers=[5],
... )
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-93-0eddbdb2b06e> in <module>
8 "adult": [ciw.dists.Exponential(0.3)],
9 },
---> 10 number_of_servers=[5],
11 )
~/anaconda3/lib/python3.7/site-packages/ciw/import_params.py in create_network(arrival_distributions, baulking_functions, class_change_matrices, number_of_servers, priority_classes, queue_capacities, service_distributions, routing, batching_distributions)
68 params['batching_distributions'] = batching_distributions
69
---> 70 return create_network_from_dictionary(params)
71
72
~/anaconda3/lib/python3.7/site-packages/ciw/import_params.py in create_network_from_dictionary(params_input)
109 """
110 params = fill_out_dictionary(params_input)
--> 111 validify_dictionary(params)
112 # Then make the Network object
113 arrivals = [params['arrival_distributions']['Class ' + str(clss)]
~/anaconda3/lib/python3.7/site-packages/ciw/import_params.py in validify_dictionary(params)
266 set(['Class ' + str(i) for i in range(params['number_of_classes'])]))
267 if not consistant_class_names:
--> 268 raise ValueError('Ensure correct names for customer classes.')
269 if all(isinstance(f, types.FunctionType) for f in params['routing']):
270 num_nodes_count = [
ValueError: Ensure correct names for customer classes.
Is this a necessary condition for ciw
to function as it stands? If not, I don’t see why the class names can’t be recorded when the network is created and then placed when a record is created.
It isn’t a major problem except when you have a number of external classes that you’d like to extract from ciw
.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Generalization, Specialization, and Inheritance - SourceMaking
Generalization is the process of extracting shared characteristics from two or more classes, and combining them into a generalized superclass. Shared ...
Read more >Generalization relationships in UML models and diagrams - IBM
Generalization relationships are used in class, component, deployment, and use-case diagrams to indicate ... Generalization relationships do not have names.
Read more >Generalization
There are several small problems: employees have positions (e.g. "manager", "programmer", "CEO", etc.) which should always be appended to the name. Also, ...
Read more >Java - Generalize different classes, similar methods (without ...
Java - Generalize different classes, similar methods (without changing the subclasses?) ; class AnotherGivenServiceConsumer ; public ...
Read more >Generalization and Specialization in Java - GeeksforGeeks
Example 1: Relatively General Class: Money Relatively Specific Class: Dollar, Euro, Rupees. Example 2: Lemon, Orange are more Specific than ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That would be jolly nice to have both. I suspect that my suggestion would be implemented in a very similar way.
Yes I like this. Shouldn’t be too many changes - and would still be back compatible 👍