Git Product home page Git Product logo

Comments (8)

geraintpalmer avatar geraintpalmer commented on August 11, 2024 1

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.

geraintpalmer avatar geraintpalmer commented on August 11, 2024 1

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.

daffidwilde avatar daffidwilde commented on August 11, 2024 1

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.

drvinceknight avatar drvinceknight commented on August 11, 2024

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.

geraintpalmer avatar geraintpalmer commented on August 11, 2024

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.

daffidwilde avatar daffidwilde commented on August 11, 2024

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.

daffidwilde avatar daffidwilde commented on August 11, 2024

Sorry @geraintpalmer, it appears we replied at the same time. I concur with everything you’ve said.

from ciw.

drvinceknight avatar drvinceknight commented on August 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.