Help modeling probability distribution for number of consecutive totes

Help modeling probability distribution for number of consecutive totes

lambert
Not applicable
74 Views
14 Replies
Message 1 of 15

Help modeling probability distribution for number of consecutive totes

lambert
Not applicable

[ FlexSim 22.1.1 ]

Hi, I am trying to model the induction of totes into a conveyor based on a forecasted probability (weight).

So far I am using the following empirical distribution:

1651748862748.png

Now, I would like to add in variability in terms of the number of consecutive totes for the same arc that go into the conveyor.

In other words, I would like to have parameters that increase/decrease the probability of having more/less consecutive totes for the same arc:

for example:

1-4-6-1-3-1-6 vs 1-1-1-4-6-6-3

does anyone have any ideas on how to model this?

In my head the expected behavior would be something like this:

1651749431440.png

Thank you in advance,

Lambert


0 Likes
Accepted solutions (1)
75 Views
14 Replies
Replies (14)
Message 2 of 15

jason_lightfootVL7B4
Autodesk
Autodesk
Accepted solution
The weight give the increased chance of having two consecutive totes on the same arc if you're sampling for each tote.


If you're sampling for a each slug of totes going to an arc, then you can do that in a seperate lookup but then sample less frequently from the the empirical distribution. That then mean the empirical should represent the spread of consecutave totes and not the total spread of totes, meaning you data should be changed to reflect that (if it's the spread of totes currently).

0 Likes
Message 3 of 15

lambert
Not applicable

Thanks Jason

"The weight give the increased chance of having two consecutive totes on the same arc if you're sampling for each tote. "

This makes sense.


How can I then add some variability to the weights defined in the empirical distribution attached to the source of totes?

for example, for arc 1, 15 plus/minus a random probability distribution

1651755185684.png




0 Likes
Message 4 of 15

lambert
Not applicable
0 Likes
Message 5 of 15

lambert
Not applicable

Hi good morning,

could anyone tell me how to add some variability to a Empirical Distribution?

I'd like that with each replication of the simulation it takes different values.

For example, for Arc 1, instead of a fixed 15 weight, i'd like to use Normal (15, 2) that varies with each replication

1652075124174.png


Thank you in advance,

Lambert

0 Likes
Message 6 of 15

moehlmann_fe
Explorer
Explorer

You could set the distribution weights in the model reset trigger and use a global table to store the respective distributions (make sure to 'Assign FlexScript Data' to the table cells).

1652080276185.png

// Reference to distribution table and source table
treenode distributionBundle = Model.find("Tools/EmpiricalDistributions/EmpiricalDistribution1>variables/data");
Table weightsTable = Table("EmpDistWeights");

// Create array of weights based on table
Array weights = Array(weightsTable.numRows);
double sum = 0;
for(int index = 1; index <= weights.length; index++)
{
    weights[index] = weightsTable[index][1];
    sum += weights[index];
}

// Scale to 100% and assign to distribution
for(int index = 1; index <= weights.length; index++)
{
    weights[index] = weights[index]/sum*100;
    setbundlevalue(distributionBundle, index-1, 1, weights[index]);
}

This will of course only yield different results, if the 'Repeat Random Streams' option is inactive or for different replications of the experimenter.

Variable_EmpDistribution_fm.fsm

Please consider posting a new question the next time, if it doesn't directly relate to the topic of the previous one.

0 Likes
Message 7 of 15

lambert
Not applicable

@Felix Möhlmann

Thank you Felix, it seems to work fine except for some totes that do not get anything assigned (arc remains blank)

1652095848826.png

do you know what can be the reason?

updated: seems to be related with the decimal points.

now when I click in generate samples, i get the following error:

1652096621116.png

exception: FlexScript exception: Invalid row identifier forVIEW:/active/EmpiricalDistributionProperties2700133680/GenerateSamples/popup2699292528/BarChart>variables/dumpData at VIEW:/active/EmpiricalDistributionProperties2700133680/GenerateSamples/popup2699292528/BarChart>eventfunctions/getData c: VIEW:/active/EmpiricalDistributionProperties2700133680/GenerateSamples/popup2699292528/BarChart


thank you

0 Likes
Message 8 of 15

moehlmann_fe
Explorer
Explorer

Looks like a bug. I get the same with a fresh model/distribution when changing the data type around a lot.

It seems like the Variant returned by Empirical().get() is not always interpreted as the correct type when assigning it to the bundle that holds the sample data.

1652115770578.png

If I run the same code but cast the Variant as the respective type (...as(double)) it works consistently.

For now I can only offer the workaround to test the distribution 'manually' by writing sample data to a global table, link that to a calculated table and plot it in a dashboard chart.

0 Likes
Message 9 of 15

lambert
Not applicable
Thank you Felix,


One last question,

if I run the same script through another trigger in the middle of a simulation run, would it dynamically adjust the values for the empirical distribution and the simulation will use the new values mid-run?


thank you

0 Likes
Message 10 of 15

moehlmann_fe
Explorer
Explorer

No, the distribution is 'fixed' on reset. Changing the source table without resetting afterwards will not change the returned values.

You could build your own custom command that returns empirical values based on a global table instead. It might be slower but that shouldn't really be noticeable. This would allow you to change the values in the source table it is based on during the model run and have it affect the distribution immediately. (Emulating the weighted discrete distribution isn't too difficult; the complex function of the empirical distribution tool is to create continuous values based on example values)

Variable_EmpDistribution_fm_1.fsm

0 Likes
Message 11 of 15

lambert
Not applicable
Hi @Felix Möhlmann , is there some way for me to send you a private message?

please let me know, thank you

0 Likes
Message 12 of 15

jason_lightfootVL7B4
Autodesk
Autodesk

Sorry we missed this.

If you comment and then accept an answer as was the case here - it can disappear from our tracking system. While you require follow-up please do not accept the answer after a follow-up question.

0 Likes
Message 13 of 15

lambert
Not applicable
@Felix Möhlmann hi Felix, is there somewhere I can reach out to you privately? thanks
0 Likes
Message 14 of 15

moehlmann_fe
Explorer
Explorer
If you require more in depth support than the forum can provide please contact your local distributor.

You should see the contact information on your FlexSim Account page.

0 Likes
Message 15 of 15

julie_weller
Not applicable

Are you still struggling with this follow up question? If so would you want to post it as a new question? Thanks in advance!

0 Likes