I am trying to make a simulator of incoming messages to output ports. I am given the number of input ports (N) and the number of output ports (M) and a flattened matrix of probabilities of N*M (mat). I am also given the number of incoming messages as an array (in_freq). I figured that in order to direct each message from an input port o an output one I should use numpy.random.choice, but didn't manage to make it work.
what I tried is:
for k in range (N):
enqueue = np.random.choice(M, in_freq[k], p=[(mat[k*N:k*N+M-1])])
when enqueue is an array of the destinations of the messages.
But encountered the message:
ValueError: object too deep for desired array
Aucun commentaire:
Enregistrer un commentaire