Seize and Release vs. EntityProcessor

337 views
Skip to first unread message

charles...@gmail.com

unread,
Apr 25, 2019, 5:28:50 PM4/25/19
to Jaamsim Users Discussion Group
I went through a tutorial where I built a coffee shop with a queue for the cashier and a queue for the baristas.

The first model was built using seize, server, and release objects. I ran the simulation and got the following output:
-Customers generated = 711
-Customers in barista queue at end of sim = 141
-Customers exited = 569
-Average barista queue time = 0.47311 h

I then used save...as... to copy the model and just replaced the seize, server, and release objects with a single EntityProcessor object. I used the same resources and same distribution for service time.
-Customers generated = 711
-Customers in barista queue at end of sim = 141
-Customers exited = 569
-Average barista queue time = 0.854455 h

I don't understand why there would be a difference in average barista queue time as I thought that the EntityProcessor is a direct replacement for seize, server, and release - especially when the exact same number of customers were serviced through each model over the same time horizon.

I'm not a member of the group right now, but will post my models once I'm approved.

Thank you,

Charles

Harry King

unread,
Apr 25, 2019, 5:55:39 PM4/25/19
to Jaamsim Users Discussion Group
Charles,

Without seeing your models, it looks like you may have used the same random seed for distributions used by the EntityGenerator and the Server. Re-using a random seed can have serious unintended consequences!

I will be interested to see your models once you have posted them.

Harry

charles...@gmail.com

unread,
Apr 25, 2019, 7:07:16 PM4/25/19
to Jaamsim Users Discussion Group
Files attached. Thanks.


On Thursday, April 25, 2019 at 5:55:39 PM UTC-4, Harry King wrote: > Charles, > > > Without seeing your models, it looks like you may have used the same random seed for distributions used by the EntityGenerator and the Server. Re-using a random seed can have serious unintended consequences! > > > I will be interested to see your models once you have posted them. > > > Harry
test1.cfg
test2.cfg

Harry King

unread,
Apr 25, 2019, 7:35:18 PM4/25/19
to Jaamsim Users Discussion Group
Charles,

The problem is the design of test1 -- the one that uses the Seize and Release objects. Both the Server and the Seize object are drawing from the same queue, which allows the Server to draw its next entity from the queue before the Resource is released. If you slow the model down, you can see that the third entity is process by the Server while the second entity is still in the queue. It gets even stranger as the model progresses.

There are three ways to fix the problem:
1) Use the Seize and Release objects, but replace the Server with an EntityDelay
2) Remove the Seize and Release objects and let the Server manage the queue on its own
3) Provide a separate queue for the Server. This works correctly, but the extra Seize, Release, and Queue are not necessary.

The test2 model can also be simplified by removing the Resource. It doesn't do any harm, but it is unnecessary because the EntityProcessor acts as its own resource whose capacity is set by the Capacity keyword. The popup description for the ResourceList keyword will be revised to indicate that they are additional resources that must be seized and released by each entity.

Harry


charles...@gmail.com

unread,
Apr 25, 2019, 7:55:46 PM4/25/19
to Jaamsim Users Discussion Group
Makes sense. I modified Test1 to just have a delay between seize and release, but now the barista queue has an average time of 4 hours, meaning that just four customers are served.

Modified test1 is attached.

Thanks,

Charles
test1.cfg

Harry King

unread,
Apr 25, 2019, 8:14:44 PM4/25/19
to Jaamsim Users Discussion Group
Charles,

You connected the EntityDelay directly to the EntitySink instead of to the Release object. The entities exit the model without releasing the resources they had seized. Your test1 model executes correctly once that problem is fixed.

However, I notice that the Barista resource has a Capacity of 4, which means that test2 has a problem because the Capacity input for the EntityProcessor is only 1. This input prevents the EntityProcessor from serving more than 1 customer at a time, when in fact it should serve up to four customers at a time (4 Baristas). The solution is to set the Capacity input for the EntityProcessor to 4. The model works correctly once this change is made, but you should delete the unnecessary resource. I is confusing to enter the number of Baristas in two different places.

Harry
Message has been deleted

Clever Alves

unread,
Sep 26, 2019, 10:11:53 PM9/26/19
to Jaamsim Users Discussion Group
Hi, Harry!

"Re-using a random seed can have serious unintended consequences!" => Could you please elaborate a little bit more on it?

Furthermore, how can I perfectly choose a Random Seed for a pdf?

Thank you for your attention.

Have a nice weekend!

Clever.

Harry King

unread,
Sep 27, 2019, 1:40:58 PM9/27/19
to Jaamsim Users Discussion Group
Clever,

You can choose any non-negative integer for a RandomSeed input. However, you should not use the SAME integer for more than one seed input because it causes the random samples for the two distributions to be correlated.

If you want to see how bad this can be, try setting the random seed for the EntityGenerator and the Server to the same value in a simple Server and Queue model. You will get a very different result than the correct model with unequal seed values.

Harry
Reply all
Reply to author
Forward
0 new messages