Code Monkey home page Code Monkey logo

Comments (8)

Enchufa2 avatar Enchufa2 commented on June 8, 2024 1

+1 for queue_size_strict.

The preempted arrival is inserted in the normal queue, which handles the situation. So it may be rejected, or maybe another one with lower priority.

from simmer.

Enchufa2 avatar Enchufa2 commented on June 8, 2024

This behaviour is deliberate. Think about an emergency service where some patients are being attended, and the waiting room is full. Then, an extremely urgent case arrives and several patients need to be preempted. You simply cannot throw out anybody.

We can discuss the convenience of a new option to avoid exceeding the maximum capacity and how to implement it (should we reject the preempted ones or those waiting in queue?), but first we need use cases.

from simmer.

nacnudus avatar nacnudus commented on June 8, 2024

I think your hospital example is a good case for explicitly modelling the queueing space required to accommodate preempted patients, rather than hiding it in the background, but a more concrete example is routing phone calls through the exchange during high demand (e.g. national emergency), when urgent calls must cause other calls to be dropped altogether -- electronics can't be compressed to accommodate more calls in a finite space!

from simmer.

Enchufa2 avatar Enchufa2 commented on June 8, 2024

As for the hospital example, your metric should be the percentage of time in which the total capacity exceeds certain threshold. So you are not hiding anything, but making it explicit!

As for the phone call service, it seems a reasonable use case. But I'm not sure whether there is preemption (or even priorities) in such a case... I mean, if the system is saturated, you have no circuits available, nor for normal calls nor for urgent ones.

from simmer.

nacnudus avatar nacnudus commented on June 8, 2024

I think this might be touching on similar matters to the reneging issue. The seize step is handling two events, entry to the queue and entry to the server, which makes preemption and reneging difficult to express.

You're correct that, if the system is saturated, you have no circuits available even for urgent calls, but a high-priority arrival could be allowed preemption into the queue just as they are allowed preemption into the server. It would mean ejecting a lower-priority arrival from the queue, just as they can be ejected from the server. In the telephone exchange example, that would mean dropping someone's call and playing them the dial tone.

from simmer.

Enchufa2 avatar Enchufa2 commented on June 8, 2024

The seize step is handling two events, entry to the queue and entry to the server

That's not correct according to simmer's architecture. Queue and server are integral parts of a resource, and seize handles only one event: the entry to the resource. If it's successful, the resource manages the arrival, putting it either in the queue or in the server. If it's not, it means that the resource is full (server + queue, if exists), and the arrival is rejected. An ifseize would cover that cases in which you want to do something else if the seize fails.

a high-priority arrival could be allowed preemption into the queue just as they are allowed preemption into the server.

Again, we are starting from different definitions. For me (and in the literature about simulation in general I think), preemption refers to postpone a task already being served. A queue may have priorities (in fact, all queues are priority queues in simmer), but that's not preemption. SimPy adopts the same nomenclature, since you have priority customers with and without preemption.

Following the discussion above, the telephone exchange case is the typical example in which there is no queue. In fact, it is modelled traditionally as an M/M/c/c system (Erlang-B and all that stuff). So there are calls being served or no calls at all. And, if the system is saturated, there is no circuits available to even start a new call.

Don't get me wrong: I see the point of avoid exceeding the maximum capacity. But I need clear use cases, because preemption is hard, and I don't want to waste my time in something never used, you know... 😉

Moreover, if you perform a quick search, you only got simulators that don't drop preempted customers. Here one example, another and another.

from simmer.

Enchufa2 avatar Enchufa2 commented on June 8, 2024

I've taken a look at this issue and I think it should be more or less easy to implement this option to keep the queue size limit. But I have to pick a good name for it. For instance:

add_resource("name", capacity=1, queue_size=1, preemptive=TRUE, queue_hard_limit=TRUE)

More ideas are welcome.

from simmer.

nacnudus avatar nacnudus commented on June 8, 2024

Looks good to me. Maybe queue_size_strict = TRUE would be more intuitive, as it's associated with queue_size.

What is the implementation? To drop pre-empted arrivals, or not to serve priority arrivals until there is room in the queue?

from simmer.

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.