I would need help to implement an algorithm allowing the generation of building plans, that I\'ve recently stumbled on while reading Professor Kostas Terzidis\' latest publicat
The solution I propose to solve this challenge is based on repeating the algorithm several times while recordig valid solutions. As solution is not unique, I expect the algorithm to throw more than 1 solution. Each of them will have a score based on neighbours affinity.
I'll call an 'attempt' to a complete run trying to find a valid plant distribution. Full script run will consist in N
attempts.
Each attempt starts with 2 random (uniform) choices:
Once defined a point and an office, it comes an 'expansion process' trying to fit all the office blocks into the grid.
Each new block is set according to his procedure:
After every office block is placed, another uniform random choice is needed: next office to be placed.
Once picked, you should compute again affinitty for each site, and randomly (weigthed) select the starting point for the new office.
0
affinity offices don't add. Probability factor should be0
for that point in the grid. Affinity function selection is an iteresting part of this problem. You could try with the addition or even the multiplication of adjacent cells factor.
Expansion process takes part again until every block of the office is placed.
So basically, office picking follows a uniform distribution and, after that, the weighted expansion process happens for selected office.
When does an attempt end?, If:
affinity = 0
)Then the attempt is not valid and should be descarded moving to a fully new random attempt.
Otherwise, if all blocks are fit: it's valid.
The point is that offices should stick together. That's the key point of the algorithm, which randomly tries to fit every new office according to affinity but still a random process. If conditions are not met (not valid), the random process starts again choosing a newly random gridpoint and office.
Sorry there's just an algorithm but nothing of code here.
Note: I'm sure the affinity compute process could be improved or even you could try with some different methods. This is just an idea to help you get your solution.
Hope it helps.