# A Multi-Agent System in Education Facility Design
## 5 Agents' Grammars
This agent selects the rules of the grammar and the parameters of cuboids on the basis of the requirements concerning a design building, like the number of floors and their areas. **Definition 5**. : _A shape grammar \(G\) is a system \(G=\) (\(M\), \(S\), \(R\), \(I\)), where:_  
1. \(M\) _is a set of markers._
2. \(S\) _is a set of basic shapes called terminal shape elements,_ \(S\cap M=\mathcal{O}\)_._
3. \(R\) _is a finite set of shape rules of the form_ \(\Theta\rightarrow\Psi\)_, where_ \(\Theta\) _and_ \(\Psi\) _are shapes whose components belong to_ \(S\) _or_ \(M\)_, and_ \(\Theta\) _must contain a marker._
4. \(I\) _is an initial shape containing element_ \(\Theta\)_, such that_ \(\exists\ \Theta\rightarrow\Psi\in R\)_._  
Figure 3: Selected rules of an NCE graph grammar generating layouts of a playground. The application of the rule \(r\) to a generated shape \(K\) consists of finding a fragment of \(K\) isomorphic with \(\Theta\) such that \(\exists\)\(r\): \(\Theta\rightarrow\Psi\in R\) (with an exact correspondence between the basic shapes and markers of \(\Theta\) and the replaced fragment), finding a geometric transformation allowing to map \(\Theta\) to the replaced fragment (scaling, rotation, translation, mirror reflection, and their combinations), applying the same transformation to the shape \(\Psi\) of the right side of the rule \(r\), and replacing the part corresponding to \(\Theta\) with the transformed \(\Psi\). In the parametric shape grammar, new shapes are created by assigning specific values to the parameters of basic shapes. Parameters can describe the size, location, and orientation of objects. In parametric rules, some object parameters may not have a specific value, which allows for the definition of many similar rules with one generalised rule. Assigning specified values to the parameters gives a specific rule. Each parameter can have a defined range, relationships can be defined between the parameters, and dependencies between the parameters of shapes of both sides of a rule can be established. Four selected rules of a shape grammar generating 3D forms of kindergarten buildings are shown in Figure 4. The parameters of new shapes added by rules specify that they cannot be longer, wider, or deeper than the shapes of the left-hand sides, the angle of rotation of the new shape relative to the existing one should be in range \([0^{\circ},90^{\circ}]\), and the protrusion should be between zero and half the length of the existing shape. The parameter ranges are shown for rules \(p3\) and \(p4\). In Figure 5, two building forms generated by the specialised agent using the shape grammar from Figure 4 are shown. Once the form of a building is generated, the outlines of its floors are created as the intersection of this form with planes at given heights. Then relations between different floors, which describe the location of stairs and lifts, are specified. The obtained 2D shapes, together with functional aspects of solutions, like the location of stairs, the number and types of rooms, become a starting point for agents generating floor layouts. A visualisation of the layout of the kindergarten facilities shown in Figure 2b is presented in Figure 6a. A 3D view of these grounds with a building form with two floors  
Figure 4: Selected rules of a shape grammar generating 3D forms of kindergarten buildings. S1 denotes shapes of the rule left-hand sides, while s2 and s3 denote shapes of the rule right-hand sides. Figure 5: Two building forms generated by the agent using the shape grammar. generated by the agent using its shape grammar is shown in Figure 6b. One of the possible floor layouts of the ground floor of the kindergarten building, which is generated by the agent specialised for this task (activated by the label _GroundFloor_) with the use of a graph grammar, is shown in Figure 6c. It is composed of an entrance hall, cloakroom, hall, playroom, dining room, kitchen, and a bathroom. A 3D view of this floor is presented in Figure 6d.