0
$\begingroup$

I have an array 4 long, each position can be a value of 1-5, ie [2, 5, 5, 1] is a random such array.

Each of the 4 positions in the array has different weights of 1-6, so for position 1, the probabilities of 1-5 are respectively {1=0.1, 2=0.15, 3=0.05, 4=0.2, 5=0.5}.

For position 2 probs, {0.2, 0.2, 0.05, 0.1, 0.45}

Position 3 probs, {0.05, 0.025, 0.025, 0.3, 0.6}

The final position 4 probs, {0.2, 0.2, 0.3, 0.25, 0.05}.

Four of these arrays will be generated randomly and then placed in order from top to bottom:

[
[2, 5, 5, 1],
[5, 4, 5, 5],
[1, 3, 2, 3],
[5, 4, 4, 5]
]

Now that this has been made, we can rotate it 90 degrees clockwise.

[
[5, 1, 5, 2],
[4, 3, 4, 5],
[4, 2, 5, 5],
[5, 3, 5, 1]
]

If we were to create each of the four arrays again, but this time not be restricted in placing them in order from top to bottom, what is the probability that we can generate the rotated array? So you can generate [4, 2, 5, 5] first (0.2 x 0.2 x 0.6 x 0.05 = 0.0012 = 0.12% chance to generate [4, 2, 5, 5]), and then the other three. But if you generate an array that is not present, then the whole instance is marked as a failure and will need to start again.

$\endgroup$
5
  • 1
    $\begingroup$ I think this question isn't hard, but is quite tedious. I would recommend setting up a Monte Carlo simulation to estimate the probabilities -- that is, simulate generating these arrays many times (say, 50K), and compute the proportion of simulations in which the arrays have the property you want. $\endgroup$ Commented Aug 24, 2022 at 14:41
  • $\begingroup$ @AaronMontgomery I was hoping for a better method than running simulations, because I would want to be able to change the parameters for better insight. $\endgroup$
    – More Senne
    Commented Aug 24, 2022 at 23:41
  • $\begingroup$ Also @AaronMontgomery, I was hoping to be able to calculate this as a probability based on the parameters, not starting arrays. I understand that simulations give a fair approximation, but I definitely want exact answers here so that I can tweak these parameters. $\endgroup$
    – More Senne
    Commented Aug 24, 2022 at 23:45
  • $\begingroup$ I mean, fair enough, but I think the problem is quite long. Do you have an idea of how to start? What have you tried? (Also, I'm not sure what role the starting matrix plays. Do you want a generic answer that takes into account all starting arrays simultaneously?) $\endgroup$ Commented Aug 25, 2022 at 0:00
  • $\begingroup$ Yeah, I tried building a state model of this, but the number of states quickly started blowing up. $\endgroup$
    – More Senne
    Commented Aug 25, 2022 at 2:18

0

You must log in to answer this question.

Browse other questions tagged .