Number of units in a batch

62 views
Skip to first unread message

Richard Kuhlmeijer

unread,
Jun 10, 2021, 10:19:03 a.m.2021-06-10
to simmer-devel

Hello!

I’m modelling shipment consolidation policies in simmer and I want to include a timeout function based on the batch size to simulate the loading time of a truck. I am able to do this for a quantity policy because the batch size is predetermined. However, when modelling a time policy I want to use only the timeout option in the batch function without batch size (batch(timeout=…)). Is there a way to get the number of units in a batch and using this number in a timeout function? The number of units in a batch (and thus the length of the timeout function) would be different for every batch.

Thankyou in advance!

Iñaki Ucar

unread,
Jun 10, 2021, 1:03:12 p.m.2021-06-10
to simmer-devel
Hi,

On Thu, 10 Jun 2021 at 16:19, Richard Kuhlmeijer <r.kuhl...@gmail.com> wrote:

Hello!

I’m modelling shipment consolidation policies in simmer and I want to include a timeout function based on the batch size to simulate the loading time of a truck. I am able to do this for a quantity policy because the batch size is predetermined. However, when modelling a time policy I want to use only the timeout option in the batch function without batch size (batch(timeout=…)). Is there a way to get the number of units in a batch and using this number in a timeout function? The number of units in a batch (and thus the length of the timeout function) would be different for every batch.

I'm not sure if I follow. The timeout option triggers a batch regardless of the batch count, and it's defined by the first arrival for every new batch (so subsequent arrivals in the same batch do not call the timeout function).

So, in other words, the current implementation only allows you to set fixed batch sizes or variable timeouts (variable across batches, but fixed for a given batch). My understanding is that you are trying to define variable batch sizes. This is not currently possible. But given the popularity of such a use case, I'll consider this as a future enhancement.

Meanwhile, as a workaround, you could define multiple trajectories with different batch sizes, and decide which one you follow using a branch().

Iñaki
 

Thankyou in advance!

--
You received this message because you are subscribed to the Google Groups "simmer-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simmer-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/simmer-devel/abc44fc9-a0e9-4461-83a7-974f3dc6a32an%40googlegroups.com.


--
Iñaki Úcar

Richard Kuhlmeijer

unread,
Jun 11, 2021, 9:07:44 a.m.2021-06-11
to simmer-devel

Thankyou for your answer!

To be more clear about my question, I wondered if there is a way to get the batch count of a certain batch after it is triggered by a fixed timeout within the batch function and use this batch count later on in the trajectory to simulate longer loading time for larger batch count. As a results batches would vary in size and larger batches would have longer loading time later on in the system.

I hope my question is more clear now!


Op donderdag 10 juni 2021 om 19:03:12 UTC+2 schreef iu...@fedoraproject.org:

Iñaki Ucar

unread,
Jun 11, 2021, 9:15:48 a.m.2021-06-11
to simmer-devel
On Fri, 11 Jun 2021 at 15:07, Richard Kuhlmeijer <r.kuhl...@gmail.com> wrote:

Thankyou for your answer!

To be more clear about my question, I wondered if there is a way to get the batch count of a certain batch after it is triggered by a fixed timeout within the batch function and use this batch count later on in the trajectory to simulate longer loading time for larger batch count. As a results batches would vary in size and larger batches would have longer loading time later on in the system.

I hope my question is more clear now!

Oh, I see. What about using a global attribute as a counter? Something like

set_global("batch_count", 1, mod="+") %>%
batch(Inf, timeout=function() get_global(env, "timeout")) %>%
set_global(c("batch_count", "timeout"), function() {
  c(0, get_global(env, batch_count))
}) %>%
....

Iñaki
 

Op donderdag 10 juni 2021 om 19:03:12 UTC+2 schreef iu...@fedoraproject.org:
Hi,

On Thu, 10 Jun 2021 at 16:19, Richard Kuhlmeijer <r.kuhl...@gmail.com> wrote:

Hello!

I’m modelling shipment consolidation policies in simmer and I want to include a timeout function based on the batch size to simulate the loading time of a truck. I am able to do this for a quantity policy because the batch size is predetermined. However, when modelling a time policy I want to use only the timeout option in the batch function without batch size (batch(timeout=…)). Is there a way to get the number of units in a batch and using this number in a timeout function? The number of units in a batch (and thus the length of the timeout function) would be different for every batch.

I'm not sure if I follow. The timeout option triggers a batch regardless of the batch count, and it's defined by the first arrival for every new batch (so subsequent arrivals in the same batch do not call the timeout function).

So, in other words, the current implementation only allows you to set fixed batch sizes or variable timeouts (variable across batches, but fixed for a given batch). My understanding is that you are trying to define variable batch sizes. This is not currently possible. But given the popularity of such a use case, I'll consider this as a future enhancement.

Meanwhile, as a workaround, you could define multiple trajectories with different batch sizes, and decide which one you follow using a branch().

Iñaki
 

Thankyou in advance!

--
You received this message because you are subscribed to the Google Groups "simmer-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simmer-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/simmer-devel/abc44fc9-a0e9-4461-83a7-974f3dc6a32an%40googlegroups.com.


--
Iñaki Úcar

--
You received this message because you are subscribed to the Google Groups "simmer-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to simmer-devel...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages