### Spatial distribution in buildings through Genetic Algorithm, micro scale

Usually architects spend a lot of hours trying fit rooms and corridors into the building boundaries. There are many strategies to deal with this problem, i. e. define the corridors first and then fits the areas around them. Other alternative consist in trial and error method to getting closer step by step to the best result. No matter which strategies being used, some areas will be more important than others, and the architect will give priority to these spaces. For example in a house the living room and the dinner room will be more important than a storage or service bathroom. In this sense we can said that the living room has more “weight” than the bathroom.

This is a very complex problem to solve. The aim of this experiment consist in use a GA to spatially organize room, depending on their areas and their location within the building perimeter. The process is based on a Voronoi diagram that subdivides the space and the GA fits to set the different areas within the premises plan.

This type of problem is complex for at least two main issues:

1_ Is a problem weight because each area has different requirements in the room spaces. i.e. orientation, ventilation, square meter.

2_ Is a multi-objective optimization, because the complete list of rooms are in some way fighting each other for the best position, the best view, the best ventilation. You can’t privilege one or a set of rooms with out to decrease others.

The problem is based on a Voronoi Diagram (VD). The area of each cell of the VD is used to fit the rooms. Usually VD are used to analyze space problems. There is a lot literature about VD.

## Video

## Genetic Algorithm parameters

Objective Function: Difference.

Codification: Jagged array type, points and polygons area.

Type of problem: Multy-Objective

Number of generations: 50

Size of population: 20 ind.

Natural selection: Tournament selection, adjustable pressure in the selection.

Crossover: Uniform crossover.

Mutation: Multiply a coordinate by random value, 0.1%

## Genetic Algorithm Structure:

## chromosome Type

The chromosome of the individuals consist in the list of VD points. One thing to consider: If the red point is moved (see the picture) in order to fit his cell area, this will affect all the tangents cells area. So if for one side we are trying to achieve the fitness, In the other hand probably we can lost the obtained aptitude .

The chromosome is expressed as a jagged array, in the top list we have points and polygons (Voronoi cells)

## Fitness Function

the fitness is expressed by the function in Rhinoscript. This function evaluate each of the cell area in the VD. If the difference of area minus objective area is less than the width the gen is awarded by 1 else with 0. but we are interesting in generate a fitness with big value so the final result is divided by 10 to obtain decimals and precision in the fitness values. Is not a good idea have integers in a fitness value, because we expect have all the flavours in the optimization process. Lucky for me I never got a 0 division!.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Function fitnessEvaluation(individual, arrAreaGoal, arrPrecision) Dim i Dim count : count = 0 Dim area, resta Dim reward For i = 0 To UBound(individual) area = Rhino.CurveArea(individual(i)(1))(0) resta = Abs(area - arrAreaGoal(i)) If(resta <= arrPrecision(i)) Then reward = arrPrecision(i) Else reward = 1 End If count = (count + resta) / reward Next fitnessEvaluation = 10/count End Function |

## Natural Selection

tournament selection, with a pressure = 8. I tried the roulette wheel before but the results do not persuade me. So I decide to wrote a tournament selection and the results were much better. With tournament selection is possible to control the pressure during the optimization. this is very useful when de difference of the individuals is minimum. The algorithm operate selecting a group of individuals into the population. The individual with the highest fitness won the competition and it is selected for the next generation (crossover and mutation).

## Crossover type

For this GA I implemented two different crossover algorithms: Single point and uniform. the best results were obtained with the single point crossover.

offSpring = SinglePtCrossOver(cleanRW(indexDad),cleanRW(indexMom))

offspring = UniformCrossOver(cleanRW(indexDad),cleanRW(indexMom))

## Mutation

The mutation consist in move one point in the chromosome in a random direction. The displacement must be really small because in this type of exercise is really important don not loose the data that came from the parents.

## Results:

The table show in the first column the real area of the VD, second column is the objective area, third column: the width and fourth column the final area after the optimization. The white cells means that the GA was no able to fit this areas into the limits.

The plans layout before and after the optimization.

Optimization curve of the first plant. Each of this experiment were executed only 50 generations.

For further information, please visit A.I. IN DESIGN section.