Comments (8)
Hi @daffidwilde yes currently Ciw needs classes to be called 'Class 0', 'Class 1' etc. in order to force an ordering (unfortunatelt I think ciw's insides rely on this currently). I agree it would be much nicer to define own names, and would be more than happy for this to be changed.
from ciw.
Internally, if the names are just being treated like indices then I imagine the dictionary could be iterated over in another way so ciw is completely class name invariant.
Yes I like this. Shouldn't be too many changes - and would still be back compatible 👍
from ciw.
it could be possible to do this in such a way where you could pass lists without it actually needing special consideration.
That would be jolly nice to have both. I suspect that my suggestion would be implemented in a very similar way.
from ciw.
Remind me @geraintpalmer, is there a purpose to class names?
What about not having names at all and instead of dictionaries you'd just have lists? (Essentially the names just become the indices of the list)
from ciw.
I think lists of lists were the original idea, but became difficult to read. Compare the current (from the tutorial:
>>> import ciw
>>> N = ciw.create_network(
... arrival_distributions={'Class 0': [ciw.dists.Exponential(1.0),
... ciw.dists.NoArrivals(),
... ciw.dists.NoArrivals()],
... 'Class 1': [ciw.dists.Exponential(2.0),
... ciw.dists.NoArrivals(),
... ciw.dists.NoArrivals()]},
... service_distributions={'Class 0': [ciw.dists.Exponential(4.0),
... ciw.dists.Exponential(1.0),
... ciw.dists.Deterministic(0.0)],
... 'Class 1': [ciw.dists.Exponential(6.0),
... ciw.dists.Deterministic(0.0),
... ciw.dists.Exponential(1.0)]},
... routing={'Class 0': [[0.0, 1.0, 0.0],
... [0.0, 0.0, 0.0],
... [0.0, 0.0, 0.0]],
... 'Class 1': [[0.0, 0.0, 1.0],
... [0.0, 0.0, 0.0],
... [0.0, 0.0, 0.0]]},
... number_of_servers=[1, 2, 3],
... )
To the possibility of lists of lists (there may be a better way to present this, but I think it does reduce readability):
>>> import ciw
>>> N = ciw.create_network(
... arrival_distributions=[[ciw.dists.Exponential(1.0),
... ciw.dists.NoArrivals(),
... ciw.dists.NoArrivals()],
... [ciw.dists.Exponential(2.0),
... ciw.dists.NoArrivals(),
... ciw.dists.NoArrivals()]],
... service_distributions=[[ciw.dists.Exponential(4.0),
... ciw.dists.Exponential(1.0),
... ciw.dists.Deterministic(0.0)],
... [ciw.dists.Exponential(6.0),
... ciw.dists.Deterministic(0.0),
... ciw.dists.Exponential(1.0)]],
... routing=[[[0.0, 1.0, 0.0],
... [0.0, 0.0, 0.0],
... [0.0, 0.0, 0.0]],
... [[0.0, 0.0, 1.0],
... [0.0, 0.0, 0.0],
... [0.0, 0.0, 0.0]]],
... number_of_servers=[1, 2, 3],
... )
It also makes setting priority classes more readable:
priority_classes={'Class 0': 0,
'Class 1': 1,
'Class 2': 1}
I think the idea of strings to represent customer classes. I like @daffidwilde's idea of allowing any string to represent a customer class, I think thta would make things much more reabable and meaningful to the user.
What do you both think @daffidwilde? @drvinceknight?
from ciw.
What about not having names at all and instead of dictionaries you'd just have lists? (Essentially the names just become the indices of the list)
I prefer — from a usability perspective — to have a dictionary rather than nested lists.
Internally, if the names are just being treated like indices then I imagine the dictionary could be iterated over in another way so ciw
is completely class name invariant.
from ciw.
Sorry @geraintpalmer, it appears we replied at the same time. I concur with everything you’ve said.
from ciw.
I'm not sure I see the improved readability using dictionaries but:
would still be back compatible
👍
(FYI, depending on how it's implemented given that internally lists are in fact just dictionaries it could be possible to do this in such a way where you could pass lists without it actually needing special consideration.)
from ciw.
Related Issues (20)
- can Ciw set a state-dependent system capacity allocation for simulation? HOT 3
- error rate HOT 4
- Wishlist for Ciw 3.0 HOT 9
- re-entrance customer with dynamic priority HOT 6
- Emulate Simpy's Machine Shop example HOT 5
- Type Annotations HOT 1
- Black Code Formatter HOT 1
- Recommended practices for model configuration storage HOT 1
- How to implement class-selective servers?
- [Question]: What happens when service discipline returns None? HOT 1
- Slotted undocumented HOT 2
- [Feature Request] Failure to start service HOT 2
- [FYI] Are there other types of blocking in queueing networks beyond Type I? HOT 1
- [Feature Request] Time/State-Dependent Baulking HOT 3
- [Media Request] Wikipedia Article HOT 3
- [FYI] Wikipedia Article Draft
- [FYI] Ciw examples of Wikipedia Articles HOT 1
- [Feature Request] Service linger time and batch serving HOT 3
- Consider getting open peer review of package by pyOpenSci HOT 2
- NumPy 2.0 Migration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ciw.