# A Multi-Agent System in Education Facility Design
## 5 Agents' Grammars  
All of the design agents, apart from the one generating a building form, are equipped with graph grammars generating graphs representing structures of various education facility areas. These grammars operate on graphs that are not hierarchical. The successive design actions are performed by applying grammar rules chosen by design agents. In this way, the design agents control the design process, driving it towards solutions that are compatible with the design criteria. Let us denote by \(L_{H}\) a set of attributed graphs and define \(\pi\): \(L_{H}\rightarrow\{TRUE, FALSE\}\) as a design predicate. A graph grammar is composed of a set of graph nodes with terminal and non-terminal labels, a set of rules, an embedding transformation, and an axiom being its initial graph. **Definition 4**. : _A graph grammar \(G\) is a system \(G=(\sum\), \(P\), \(C\), \(X)\), where:_  
1. \(\sum=\sum_{N}\cup\sum_{T}\) _is a set of non-terminal and terminal graph labels._
2. \(P\) _is a set of rules of the form_ \(p=(l,r,\pi)\)_, where:_ * _l is an attributed graph containing at least one node with a non-terminal label and_ \(r\) _is an attributed graph._ * \(\pi\) _is a design predicate determining the rule applicability._
3. \(C\) _is an embedding transformation._
4. \(X\) _is an initial graph, called an axiom._  
The application of the rule \(p\) to a graph \(H\) consists of substituting \(r\) for a graph isomorphic with \(l\) and replacing its connections with the edges coming to nodes of \(r\), according to the embedding transformation defined for this rule in \(C\). In our approach, neighborhood-controlled embedding (NCE) graph grammars [34] are used. It means that a graph \(l\) contains only one node and embedding is specified by a binary relation on a set of node labels and a set of nodes of \(r\). For each pair \((x,\mu)\in C\), where \(x\) is a node of \(r\) and \(\mu\) is a node label, an edge \((x,y)\) is added between \(x\) and each node \(y\) labelled by \(\mu\), which is incident with the removed node. An agent can select the grammar rules leading to the design having the required properties by checking the conditions imposed on the values of graph attributes expressed by \(\pi\). During the application of the rule, the values of the attributes of \(r\) are established on the basis of the values of attributes of \(l\). Figure 2: Two layouts of the facility and their graph representations. Six selected rules of an NCE graph grammar generating layouts with various arrangements of playground facilities are presented in Figure 3. Non-terminal labels of nodes start with a capital letter, while terminal labels are written in lower case letters. The area of the spaces and the material used for the different types of beddings are specified by the graph attributes. The rules _p1_ and _p2_ generate arrangements of areas with beddings filled with grass (nodes labelled by _Lawn_), rubber mat (_Rubber_), synthetic grass (_Synthetic_), and areas to be planted with trees (_Trees_). The first rule can be applied when the value of the attribute _area_ of the node \(v1\) is greater than 50 m\({}^{2}\). Rules _p3_ and _p4_ generate arrangements of sandpits, carousels, and outdoor boards located on the synthetic grass, while rules _p5_ and _p6_ generate arrangements of swings, activity towers, and spring rockers located on rubber mats. For clarity, the embedding transformation is depicted only for rules _p3_ and _p4_. The agent designing a recreation area uses a graph grammar generating graphs representing various arrangements of trees, flower beds, shrubs, paths, benches, brooks, bridges, and stones. For a graph representing a recreation area arrangement, which is nested in a node labelled _Recreation_, and a visualisation of this arrangement see Figure 7.  
An agent which generates a building form is equipped with a shape grammar generating 3D forms composed of parameterized cuboids.