Skip to content
Discussion options

You must be logged in to vote

First-available is what you are looking for, right?

library(simmer)

t_fv <- trajectory() |> 
  select(c("counter2", "counter1"), policy = "first-available")  |>
  seize_selected()  |>             
  log_(function() paste("Selected: ", get_selected(env)))  |> 
  timeout(10) |> 
  release_selected()
  
env <- simmer() |> 
  add_resource("counter1", 1) |>
  add_resource("counter2", 1) |>
  add_generator("dummy", t_fv, at(0))
env |> 
  run() |> 
  invisible()
#> 0: dummy0: Selected:  counter2

vs.

env <- simmer() |> 
  add_resource("counter1", 1) |>
  add_resource("counter2", 0) |> # no room, but Inf queue
  add_generator("dummy", t_fv, at(0))
env |> 
  run() |> 
  invisible()
#> 0: dummy0: S…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@phahn57
Comment options

Answer selected by phahn57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants