r-simmer / simmer

Discrete-Event Simulation for R
https://r-simmer.org
GNU General Public License v2.0
222 stars 42 forks source link

Using scheduling objects and parallelise simmer runs #259

Closed DirkEngelen closed 3 years ago

DirkEngelen commented 3 years ago

Sorry I am new user of simmer so perhaps I implemented it wrong, but I face some problems between scheduling objects and parallelise simmer runs.

When trying to make replications (parallelise via mclapply) in simmer using resources that have a scheduling object set as capacity, it is not continuing after the first run (see below error message). When removing the scheduling object and setting capacity to 1 for example, parallelisation is working properly (but gives wrong results obviously).

The error message: "Error: resource 'Delivery team' was defined, but no schedule was attached " Although the resource is defined by: "add_resource("Delivery team", capacity = delivery_all_schedule, queue_size = Inf, mon = TRUE)"

Is this a known issue or how can I solve this? Thank you, Dirk

Enchufa2 commented 3 years ago

This is because you are not including the simmer() call into your chunk that is being parallelized, and as a result you are defining your resources multiple times. Take a look at this thread. Also, more hints on parallelization can be found here.

Closing this, as this is not a simmer issue. Please, consider responding to the thread above if you have further questions, or, if you are more comfortable on GitHub, consider opening a new question under the Discussions tab.