• ### Performance parcour creator help

Hi Pd friends,

I have the following problem:
I am part of an Installation for 200 people. I need to calculate the audiance flow. The installation has 19 places/stages where a different amount of people will fit in (from 1 to 25). And there are 10 time slots. Now i want to hand every person a card which place at what time they have to visit. There are different atributes each stage has. Some stages can be visited only once, some can be visited twice, but not at timeslots 1 + 2 but 1 + 4 for example. And some other atributes, like you should not be together in a stage with the same audiance member twice (this is a very weak attribute - meaning it is not too bad if it has to happen).
How can this be calculated? I have the feeling it is finally time to learn data structures for me!
I was thinking every person get a structure of a template [struct audiance float person nr array time-slots slot] and than the the rooms need to be an abstraction of some kind, which can have different arguments. and than there needs to be a recursive method to distribute the audiance. Somehow i had to think of the autoroot funktion in Eagle to find pathes for electrical wires on a circuit board. Is the challange understandable? What do you think?
best, Jonas

• Posts 15 | Views 4795
• @Johnny Mauser I am not good in mathematics but i would start with a timetable/stage x/y matrix.
and then you can calculate the individual timetable with an expression like: go randomly to a stage at the allowed timeblock that has less visitors than its capacity if not visited already more often than possible and if visitor b is not there...
and i think you need kind of a list for each visitor which stages he how often already visited.

edit: i think the total capacity needs to be bigger than 200 otherwise it can get complicated. would be funny to see this as a pd patch.
maybe data structures are the way to go but perhaps you can instead use the [text] object.

• @Jona if i understand you correct i had thought of a similar logic you discribe. You mean the [text] object to hold all the information? do you know data structures? i had thought of each audiance member getting an array of time slots and than if he/she/it visits a stage (randomly with [urn] for example) he gets compared against 1) if she has been there, 2) the capacity 3) other audiance members and where they have been. and if she is not allowed to stay she has to knock at the next rooms door. And if the round has no solution the round has to go for another random starting point.
And do you mean with the "timetable/stage x/y matrix" that this matrix has a third dimension for the audiance members? This 3 dimensional matrix could / should be able to discribe the whole show!? It would be interesting to see this visualized as well.
Is it possible to do it with KI ( [ann] objects ??) also?

• @Johnny Mauser i think each visitor needs a list with which place he visited how often.
and each position of the timetable / stage matrix needs a list of the current visitors (the length of the list is the number of visitors).
or each slot of the timetable has an array(the stages) and those elements are arrays too (the visitor list).
yes, that could be doable with data structures, i used them, but not the array in an array feature - you can use arrays as elements of an array with data structures.

Theoretically you can train a neural network with this data (or you can simulate the event a thousend times for the training data), and the network can give you a result.
But i think just conditional logic makes more sense in this case, because you still would need the conditional logic for the training data...
There is actually a neural network for planning / scheduling film productions, and they said it is much faster than before: https://medium.com/rivetai/data-science-and-ai-in-film-production-8918ea654670

• @Johnny Mauser here is an attempt. The "collsion detection" is not implemented yet. I think for that you will need a list for each stageSlot with every individual visitor so that you can compare them to the new visitor (perhapps another [text] object?). You could also make an abstraction from this with parameters as arguments. You have to play with them to find a good solution.
Perhaps you can even create some musical structures with it
timetableCalculator.pd

You could do the whole thing with data structures instead of [text] too, but I would say it is a bit more complicated.
Another way to calculate the timetable with Pure Data would be to use a Lua script (Ofelia).

• Yeah!! Just saw the reply. Will look into it tomorrow.

• @Jona, thank you for the patch! It seems to work. Only seems, because it is a little time consuming for me to follow your calculations. It is stuck in my head to try it with data structures 'cause i also think i could visualize it that way. Right now i am struggeling with nested arrays there, so i will make a new thread for the technical questions, and post here if i have an attempt of a solution. If i will not get anywhere, i will study your patch more closely, with the goal to abstractify it for general use.

• I have a working version now. Maybe i should have posted a version where it was not that messy yet. Too late. Here is what i have and use till now: open-hide-GUI.zip
The grafical representation is not working yet. Actually i don't need it, but i would be nice to visualize the audiance flow. therefor i would need to draw the data of the arrays, not with [plot] but with filledpolygone or drawnumber. Is it posible to send messages to drawnumber to change its creation arguments?
EDIT: Update, little better performace, actual usable

• @Johnny-Mauser wow, that looks kind of complex... nice if it is working, but i am not sure how to test it.
yes, would be interesting to see a data structure visualisation.
you could also use [text] with data structures: https://forum.pdpatchrepo.info/topic/8836/dictionary-object-in-pd-extended/27
i made kind of an abstraction from my attempt (and removed some bugs), perhaps something is useful for your patch:
timetableCalculator.pd

yes, you can change drawnumber with set. here is an example (if I understand you right): https://forum.pdpatchrepo.info/topic/10876/lissajous-midi-sequencer/5
here i tried to map the abstraction to midi notes (does not work too well, but it was worth a try):

• @jona i updated the patch above a little, so it becomes a little more usable. Open hide-GUI.pd set the tick in the [tgl] and presse the bang. Than it should random retry till it found a solution. The solution you can look at in the data window right clicking properties you can see the data. The first (0) entry in each array is the audiance nr (person nr) and than there are stages to visit in each time slot. I can see problems in my patch: i will start with room 1 and if that is full it is sending the "asking person" to the next room. And if the person finds a home there it will stay. Thats must result in a priority by the first rooms. and i am not sure yet whether i like that. I will also look at your attempt!

• @Johnny-Mauser nice, so the nested data structure arrays seem to work. did you also implement the collision detection (do not go to a stage if person x is already there)? Another Idea, you could reduce the probability for going to a smaller stage. On the other hand, collision detection also would kind of do that. Also in my attempt the first visitor has the most freedom because all stages are still empty. But you could choose the order of visitors for every timeslot randomly.

• @jona no, i didn't implement that collision (hehe) detection. It is not so important, as the main goal was to not have the audiance walk through the evening with their peer group. This is allready ensured through the random drawing of [urn]. But the more the thing is juicing arround the more questions come:

1. our both solutions have very different ERROR numbers with the same settings. i didn't understand your path yet, so it might be due to design differences.
2. my "app" doesn't give the suspected answer: I have 200 people in 19 stages with total 213 seats, so should it not be possible to find a solution where nobody is twice at a given stage? my programm does not find an answer yet. (maybe i have to make it faster, so it can check out more possibilities in less time)
3. i send the people through all stages one after another. That must lead to a structure where in the early time-slots the last stages are not used at all (given 200 people and 213 seats)
-> my recursion is only that if there is an ERROR the hole process starts again, in theory it should be possilbe to make "smaller" recursions to same computing time. And the order of stages should alter, so that the last one does not get depreciated like it is now.
Does your programm have different approaches?
• @Johnny-Mauser

1. my error number is the number of slots that are missing so that every visitor could visit a stage every timeslot.
2. as soon as you have a stage with a very small capacity lets say 3, 200 visitors and 10 timeslots you have 170 visitors that cannot visit this stage and, because of that, need to visit another stage again. so, with a condition like that, it is impossible.
3. I send all visitors randomly through the first timeslot, then the second, etc., the stage is choosen randomly under the given condition.
And the randomness is weighted, the probability to go to a stage with a capacity of 50 is 50 times bigger than to go to a stage with a capacity of 1.
And this version simulates your case, I think it should work, at least if you can choose the size of the stages or the repetitions, there is also some data structure visualisation: example.pd
• I tried to make a MIDI sequencer interface for the data with data structures
(actually only the visualisation is made with data structures):
exampleSequencerA.pd
exampleSequencerB.pd

• @jona thx for your answers, inputs and solutions! testing and refining has to wait a little till i have time from my main tasks

Posts 15 | Views 4795
Internal error.

Oops! Looks like something went wrong!