Code Monkey home page Code Monkey logo

Comments (5)

Bart6114 avatar Bart6114 commented on June 2, 2024

+1

Simple shortcut off the top of my head; save the seized number as an attribute with an uncommon prefix. In the first example above set e.g. an attribute ___seized__dummy with value 3 (in the background of-course). This can then be easily retrieved to release the correct amount. This does however incur an overhead (if you want to increment the seized amount you have to pass the attributes to the R side). Depending on the overhead incurred by monitoring the seized amount (in this shortcut style or by a robust c++ implementation), maybe only allow this from a given monitoring level.

In terms of syntax, it might require a different command like release_all(resource). As seize(resource) defaults to an amount of 1 it isn't unlogical that release(resource) also defaults to an amount of 1.

from simmer.

Enchufa2 avatar Enchufa2 commented on June 2, 2024

I have plans for this. 😉 It should be managed by the resource itself. So I think it is best to reimplement the resource's server as a map of arrivals.

from simmer.

Bart6114 avatar Bart6114 commented on June 2, 2024

Any educated guesses on how this would impact the run-time of larger simulations?

from simmer.

Enchufa2 avatar Enchufa2 commented on June 2, 2024

It should be minimal because a map is similar to a hash table. It will be even smaller when we use an unordered_map from Boost or C++11 (this is in the TODO list).

from simmer.

Enchufa2 avatar Enchufa2 commented on June 2, 2024

This is a good time to reopen this, because the enhancements implemented in the last year provide the required infrastructure to address it trivially.

Instead of changing release("resource") and release_selected()'s default amount, one solution would be to create another couple of verbs, release_all("resource") and release_selected_all(). But maybe release_all() is more intuitive for releasing the whole amount in every resource seized, which would be a nice addition too. For instance:

traj <- trajectory() %>%
  seize("dummy1", 3) %>%
  seize("dummy2") %>%
  timeout(1) %>%
  release_all()

Feelings, @Bart6114?

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.