A CONCEPTUAL FRAMEWORK FOR INDOOR MAPPING BY USING GRAMMARS

Maps are the foundation of indoor location-based services. Many automatic indoor mapping approaches have been proposed, but they rely highly on sensor data, such as point clouds and users’ location traces. To address this issue, this paper presents a conceptual framework to represent the layout principle of research buildings by using grammars. This framework can benefit the indoor mapping process by improving the accuracy of generated maps and by dramatically reducing the volume of the sensor data required by traditional reconstruction approaches. In addition, we try to present more details of partial core modules of the framework. An example using the proposed framework is given to show the generation process of a semantic map. This framework is part of an ongoing research for the development of an approach for reconstructing semantic maps. * Corresponding author


INTRODUCTION
People spend most of their time in indoor environments such as offices, shopping malls, and museums.New indoor mobile applications are being developed at a phenomenal rate, covering a wide range of indoor personal and social scenarios, such as indoor navigation and location-enabled advertisement.An indispensable part for many of these indoor location-based service (LBS) applications is the availability of indoor maps.Currently, one of the most popular approaches of generating indoor maps is analyzing volunteers' traces (Alzantot et al., 2012;Zhang et al., 2014) in targeted indoor environments, which requires a huge amount of traces data to construct a complete and accurate map.Indoor maps can be also constructed by using point clouds (Hong et al., 2015), which is a faster way to build an accurate map.However, the laser equipment costs too much and the construction process is quite complex.Moreover, generated maps mainly contain geometric information, and very few semantic information can be detected with Lidar point clouds.The work in (Philipp et al., 2014) uses split grammars to describe the generation process of rooms.The grammar of one floor can be learned automatically and then be used to derive the layout of the other floors.In this way, less sensor data is needed to construct the indoor map of a building.However, it only defines very simple grammars for splitting the space.
There are different types of public buildings, such as office buildings, airports, hospitals, museums, and research buildings.Each type has its own layout principles or rules, including the components of space types, the geometric constraints of space types, and the typological relations among them.For instance, the entrance of an office building is normally adjacent to foyers or halls; a supermarket consists of many parallel good shelves, and the width of the passage between two shelves is approximate to the width of two shopping carts.Given these geometric, typological, and semantic rules of a certain type of buildings, the reconstruction process can be significantly improved.That is, we can construct accurate semantic maps by using very few sensor data in a short time.
In this paper, we focus on the representation of the layout principle of buildings used for research purpose, which are the most common facilities of universities.Our idea is attributed to the standardization of laboratories all over the world (Charlotte, 2016, page:97-126).That is, laboratories have been globalized or 'uniformed' in the same way that shopping centers look exactly alike no matter where you go (Charlotte, 2016, page:21).Therefore, it is feasible and meaningful to represent the layout rules of research buildings for the mapping task.We propose a conceptual framework to reconstruct the indoor maps of research buildings by using their layout rules, which are represented with grammars.In addition, we try to present more details of partial core modules.However, some parts remain unelaborated because they are just initial ideas and will be developed in our future work.
The remainder of this paper is structured as follows: in section 2, we present the proposed conceptual framework.We give details of several core modules of the framework in sections 3 and 4. In section 5, a test scenario is chosen to show the mapping process by using our proposed grammars.We conclude the paper in section 6.

CONCEPTUAL FRAMEWORK
As illustrated in Figure 1, the reconstruction process consists of five steps.The first step is decomposing the footprint of a building into rectangles with each corresponding to a building unit or room unit.Footprints reflect the outline of maps and their dimension and shape affect the layout of buildings (Shpuza, 2006).For instance, a wide footprint suggests that a central dark area or open space (e.g., hall) might exist in the building.The next step is detecting the symmetry and repetitive features in rectangles that normally reflect a symmetrical or repeated inner layout.

Figure 1. Conceptual framework
The core module of the framework is LabGrammar, which represents the layout rules of laboratories by using shape grammars (Yue et al., 2011) and attribute grammars (Gröger et al., 2010).The LabGrammar can benefit the indoor mapping process by improving the accuracy of generated maps and by dramatically reducing the volume of the sensor data required by traditional reconstruction approaches, such as LiDAR point clouds (Philipp et al., 2014) and users' traces (Alzantot et al., 2012;Zhang et al., 2014).To represent the layout rules of a laboratory, we redefine its spatial structure by using a hierarchical semantic division.For the reconstruction of other building types, the conceptual framework is still applicable by replacing the LabGrammar module with the Grammar of the target building type, such as AirportGrammar.
The shape grammar module is used to represent the topological relationship among building units and room units in a complex building (Yue et al., 2011), reflecting possible layouts of this building.In the step of functional area association, each building unit is associated with a certain function, such as lab centered.At present, this module is incomplete and is the focus of our future work.Specifically, we will investigate the typical functions of a laboratory and the correlation between the combination manners of building units and the type of functions.The next step is using the specific functional area grammar to generate the possible layouts of a building unit.In order to narrow the search space of candidate layouts and refine the generated maps, external sensor data can be used, including users' traces and point clouds.The other data source is an organization's website, from which we can extract the knowledge of a building's component, such as the number of offices, the number of people in a certain office, as well as the number of conference rooms.As we know, the room number of a researcher is normally available from an institute's website.In addition, academic reports are published online in the form of 'a report will be given by someone at a certain conference room', from which we can determine the number of conference rooms.

Figure 2. Semantic division of research buildings
The semantic division of a research building consists of a circulation system, closed spaces, and open spaces, as shown in Figure 2. The circulation system connects closed spaces and open spaces, which can be further divided into horizontal and vertical passages, corresponding to corridors, stairs, and elevators, respectively.Open spaces refer to a lobby and an atrium, which are significant space types by promoting communication among researchers (Watch, 2002).Closed spaces are those surrounded by walls, which can be divided into single rooms by using split grammars (Becker et al, 2015).The three primary spaces in laboratories are labs, lab support spaces, and offices.Space planning in laboratories is traditionally considered in terms of the internal relationships between these main spaces (Cooper, 1994;Yi, 2016).Laboratories have several typical layout manners (Hain, 2003;Watch, 2002), attributing to the idea of LabGrammar.Ancillary spaces assist the primary spaces, supporting research works.
Each type of space has its own geometric and topological characteristics, by which we can define the corresponding production grammar for each type of space.Moreover, the number of different type of space in a building varies.For instance, on one floor of a building, there exist at most one kitchen, one library, and two toilets, but there exist many offices.Thus, we can define a global constraint variable , limiting the number of a certain space type produced in a building.equal the sum of the number of the ancillary academic spaces and of the ancillary life spaces, respectively.We can assign values for this variable based on our prior knowledge about a certain space type (e.g., at most one kitchen and one library in a building) or by analyzing the data from an institute's website.

Shape grammar
Normally, the building footprint is a rectilinear polygon, which can be divided into rectangles.A shape grammar is proposed to describe the composition of building footprints, which consists of seven shape combination rules with each reflecting certain indoor layouts, as shown in Figure 3.The rectangles are categorized into two types according to their size: building unit and room unit.For combination rules 1 to 4, the layout of the combined building equals the combination of the layouts of two building units, plus the extra circulation system connecting them.Five common connection ways are Linear, T, L, H, and Z shape, as shown in Figure 4. Apart from the above-mentioned connection ways, combination rule 4 has another connection way, sharing the main corridor between two building units, as shown in Figure 5. Combination rules 5 and 6 contain room units that are attached to the side of a building unit.In this case, they generally act as a special space, such as ancillary academic spaces, a big office, or the vertical passage and the lobby if it is connected to the entrance of a building, as shown in Figure 6.In combination rule 7, the room unit plays the role of a passage or an open space, connecting the other two building units.Some small ancillary spaces such as storage rooms, print and copy rooms, and toilets can be located in this space if it is large enough.

Functional area allocation
According to the survey in (Charlotte, 2016, page:97-126), primary spaces and ancillary academic spaces occupy nearly 90 percent of the floor area in a research building.Thus, the main reconstruction task is identifying these large spaces.We categorize the function of a building unit into four types according to the composition of large spaces in the building unit: lab centered, office centered, shared space centered, and shared space-office mixed.We use a non-terminal symbol B to denote the initial building unit with only footprint information and assign an attribute to each building unit, representing its function, .We can achieve this by analyzing the combination ways of building units as well as their receptiveness and symmetry features.Lab centered building unit is the most common space in laboratories.It mainly consists of labs, lab support spaces, and offices (Cooper, 1994;Yi, 2016).Office centered building unit is for the research group that conducts theoretical research, consisting mainly of offices and a few academic spaces without labs and lab support spaces.Academic centered building units are used for knowledge sharing, containing mainly academic spaces.For instance, lectures are clustered in a separate building unit to promote teaching.Academic-office mixed building unit consists of both a large number of offices and academic spaces.

Corridor grammar
The horizontal circulation system of a building unit can be categorized into three major types: single-loaded, double-loaded, and triple-loaded (Braun, 2005), according to the number of zones divided by the main corridors that are parallel with the long side of a building unit.In some cases, the main corridor does not reach the end of the building, as shown in Figure 7. Service corridors are perpendicular with the main corridor, connecting main corridors, entrances, exits, or the other building units and room units.We assume that the long side of a building unit is along the yaxis, while the short side or the end is along the x-axis.We define two variables related to corridor production: the interval along the y-axis that the corridor should contain, , and the interval along the x-axis that the central point of the corridor should be located in, [ ] . The first variable is attributed to the fact that a service corridor should be added to connect the main entrance, exits or entrances, building units, and room units that are attached to the long side of a building unit.The second variable rules that the main corridor should directly connect the exits, entrances, building units, and room units that attached to the short side of a building unit.A procedure can be used to determine these two variables before applying the corridor grammar.
(1) This rule adds a single-loaded or double-loaded main corridor in a building unit if the guard pre is true.It splits a building unit into two parts: the main corridor and closed spaces, which are represented by a non-terminal symbol Space .w denotes the width of the corridor with a value between 1.5 m and 2.5 m. .After generating main corridors, service corridors are then produced, which play the rule of connecting main corridor and other building parts, such as entrances and exits.
This rule inserts a service corridor if the guard pre is true.w , 1 loc , and 2 loc denote the width, and the central locations of the two ends of the service corridor, respectively.The precondition is that exits, entrances, or room units exist.Similarly, a procedure is used to recalculate the closed spaces.
A triple-loaded horizontal access system has three variations, a central zone surrounded by two, three or four corridors, respectively, as shown in Figure 8.The end of the corridor in the second and third type can be extended to connect exits or entrances. .The produced zone is assigned an attribute, indicating its location, center on distributi Zone = . .

Zoning
Figure 9. Three types of distribution manners After determining the circulation system, the next step is dividing closed spaces that could be rectilinear polygons into rectangular zones by using the following rule., as shown in Figure 9.

Grammar for central zones
It is normally followed by architects that offices and standard lab modules are positioned at the building core and provided with glazing to receive natural light, humanizing the working condition (Hain, 2003;Braun, 2005).For the lab-support spaces and other ancillary spaces, they can be located in the central zone (Hain, 2003;Braun, 2005).A central zone can be divided into sub-zones, in order to facilitate the circulation.(5) This rule splits a central zone in two new sub-zones by inserting a service corridor if the guard pre holds true.The guard for this rule is that the zone is located in the center, center on distributi Zone == .
. The direction of the split is along either the x-or the y-axis.loc denotes the location of the inserted corridor, and w denotes the width of the corridor.The distribution attribute of 1 Zone and 2 Zone is set as center.In Figure 10, a central zone is divided into three sub-zones by inserting two service corridors.(7) This rule splits an enclosed dark zone into two enclosed dark zones.The direction of the split is either along the x-axis or the y-axis.loc denotes the location of the split.The guard for this rule is that the dark zones can form rooms, satisfying the size constraints.Figure 11 shows the split in a central dark zone.(8) This rule sets an enclosed dark area as an ancillary life space or ancillary academic space.The guard of this rule is that the dark zone satisfies the size constraints of the target ancillary space.After using this rule, the life n or the academic n value is updated, (9) This rule sets an abstract life space as one of the five specified life spaces if the guard pre holds true.The first precondition for this rule is that the n value of the target life space is beyond 1.The second is that the non-terminal space satisfies the size constraints of the targeted life space.After using this rule, the n value of the target life space decreases by 1.
We can notice that Toilet is a non-terminal symbol since it represents the set of a women's toilet and a men's toilet.This is due to the fact that the men's toilet and the women's toilet are mostly deployed together.A split grammar can be used to produce the women's toilet and the men's toilet.
In this rule, r denotes the ratio of the area of two single toilets, which normally equals 0.5.The direction of the split is either along the x-axis or the y-axis.The guard for this rule is that produced single toilets satisfy the size constraint of toilets.(11) This rule sets an abstract academic space as one of the four specified spaces if the guard pre holds true.The preconditions for this rule is same as that of rule 9.

Grammars for lab-centered building unit
Figure 12.Typical layouts of lab-centered building units A lab-centered building unit has several typical layout manners (Hain, 2003;Braun, 2005), as shown in Figure 12.We can use grammars to associate a building unit with one of the layout manners and assign the zones in the building unit with one of the four functions: offices, lab support spaces, labs, and ancillary spaces.

Lab split
According to the design principle in (Watch, 2002;Hain, 2003;Braun et al, 2005), standard labs follow the modular design principle, in order to maintain the highest level of flexibility.A common laboratory module has a width of approximately 3.2 m or a multiple of this width value.Thus, for a lab zone, we can use the following split grammar to produce single labs. .The second one is that 1 ≥ lab n . After using this rule, the lab n value is updated, 1 − = lab lab n n . Figure 13 shows an example of the split of lab zones.

3.6.2
Office split Offices are the main spaces in research buildings and normally clustered to promote the communication among researchers (NRC, 2000).Additionally, minimizing the number of sizes of enclosed offices provides maximum flexibility (NTD, 2003).We assume that a research building has only private offices, with each accommodating a small number of research staffs.We further categorize private offices into three types according to the number of people they can accommodate: small offices for 1-2 persons, medium offices for 3-4 persons, and large offices for 5-6 persons.These three types have an area of from 6 to 12 m 2 , 12 to 23 m 2 , and 23 to 40 m 2 , respectively with each person occupies an area of about 6 to 7 m 2 (NTD, 2003;Occupiers, 2007).Professors need a single large office, and they are assigned a medium or large office.It is more likely that offices in the same office zone have equal size since their split lines have equal length, which represent the walls between offices.Thus, we can rule that there exist at most three office sizes in the same office zone. .The second precondition is that 1 n , 2 n , and 3 n subject to the following constraints:

Grammars for ancillary academic space
Ancillary academic spaces normally have a much larger size than a private office and lab.We can categorize their layout manners in four types: clustered, deployed in an independent room unit, deployed at the end of a building unit, or embedded in the end of an office zone, as shown in Figure 15.We can use rules 15, 16, and 17 to produce academic spaces in the first, second, and third deployment manner, respectively.The academic space in the fourth deployment manner can be generated by using combination rule 5 of the shape grammar.(18) This rule sets a zone as a non-terminal academic space if the guard pre holds true.The precondition is that the zone is located at the end of a building, end on distributi Zone == . .

Grammars for ancillary life space
This rule inserts an ancillary life space in a zone if the guard pre holds true.This might break the zone into two zones if the inserted space is in the center of the zone.loc denotes the central location of the inserted rectangular space, while w and l denote the width and length of the inserted space, respectively.The first precondition for this rule is that the zone is located at the end of the building, . The third precondition is that the produced spaces satisfy the size constraints of academic life spaces.After using this rule, the life n value is updated, (20) This rule splits a zone, denoted by the non-terminal Zone, into a life space, and an office zone, if the guard pre holds true.The direction of the split is along either the x-axis or the y-axis.end denotes the short side of the zone, from which the zone is divided, while w denotes the width of the life space.The first precondition for this rule is that 1 . The second is that w satisfies the size constraints of life spaces.After using this rule, the life n value is updated, 1 − = life life n n .

Grammars for lobby
The typical laboratory building has a clearly defined entry and, usually, a gracious lobby (Watch, 2002).Five typical layouts of lobbies are listed in Figure 17.Types 1 to 4 are inner lobbies, which can be produced with insertion grammars, while type 5 is an outer independent lobby and can be produced with rule 5 of the shape grammar.
) This rule inserts a lobby in a building if the guard pre holds true.loc denotes the central location of the rectangular lobby, while w and l denote the width and length of the lobby, respectively.The first guard for this rule is that the edge of the inserted space connects an entrance, exit or independent vertical passage.The second guard is that the edge of the lobby connects the long side of the building or the edge of the main corridor.A procedure can be used to recalculate the broken closed spaces.

EXAMPLES
We choose a research building in our university as the testbed to present how grammars can be used to produce semantic maps.The true map of this building is shown in Figure 18. Figure 19 (1) shows the footprint of a research building, which is decomposed into 5 rectangles, as shown in Figure 19 (2).The shape grammar is then used to analyze the combination manners of rectangles and predict the possible layouts.The combination of building unit a , denoted by a B , building unit c , denoted by c B , and room unit b corresponds to combination rule 7 of the shape grammar.According to this rule, room unit b can be treated as a passage with toilets as shown in Figure 19 (3).We assume that a B is a lab-centered building unit, , while c B is an office-centered building unit, . The combination of building unit c and room units d and e corresponds to combination rule 5, in which room unit d can be treated as a vertical passage, while e can be treated as a large office.The next step is adding a double-loaded main corridor in building units a and c by using rule R1.Apply R1 ( w =2,  Reconstructed map closely approximates the ground truth except for two small parts.One is the extra service corridor at the left side of building unit a in the true map.For simplicity, we actually ignore a building unit, which is connected with the left side of building unit a. Otherwise, we can insert the extra service corridor to connect this building unit in a Z shape connection way as shown in Figure 4.The other is the three single lab support spaces in building unit a.We assign a large zone for lab support spaces, but do not divide it into single rooms further.We will complete the production rules of lab support spaces in our future work.

CONCLUSIONS
In this paper, we propose a conceptual framework for indoor mapping.The key idea of the framework is the adoption of shape and attribute grammars, which represent the layout principles of research buildings.Furthermore, we try to present the details of partial core modules of the framework, including the production rules of horizontal access systems (e.g., corridors), primary spaces (e.g., offices, labs), and ancillary spaces (e.g., conference rooms, kitchens).Finally, an actual research building is taken as an example to explain how the framework is used to reconstruct indoor maps.Although we focus on research buildings, the reconstruction and representation of other public buildings such as hospitals, museums, and supermarkets can be carried out in a similar way.
The proposed framework is incomplete and would be refined in our future work mainly from the following aspects.First, we will further explore the correlation between the function of a building unit and the combination manner, the symmetry and receptiveness feature of building footprints.Second, the production rules will be improved, such as to complete the size constraints of different space types.Third, observations or sensor data, such as users' traces derived from smartphones will be applied in our framework to reconstruct the indoor maps of research buildings.

Figure
Figure 3. Shape grammar

Figure 4 .
Figure 4. Five kinds of connection ways

Figure 7 .
Figure 7.Typical layout manners of horizontal access systems

1
loc and 2 loc denote the location of the central point of the two ends of the inserted corridor.The first precondition for this rule is that the corridor is not beyond the border of the building.The second one is that the closed spaces satisfy the size constraints.The third is that both the x coordinates of 1 loc and 2 loc are inthe range of [ ] max _ min, _ x x, and the interval of their y coordinates contain the interval of [ ] is used to calculate the produced closed space, which is a rectilinear polygon.The closed space is represented by } p denotes the vertex of the polygon and n denotes the number of the vertexes.In addition, each closed space is assigned an attribute, indicating the type of the circulation system related to it,

Figure
Figure 8. Variations of triple loaded horizontal access system : 3 R } }, { }, {{ : ) , , , , , ( 4 3 2 1 2 1 Zone CS corridor Space pre loc loc loc loc w w B i i this rule is that produced zones are large enough to form rooms.The produced zones inherit the circulation attribute

Figure
Figure 10.Split of central zones

Figure
Figure 11.Split central zones into rooms Figure 13.Split of lab zones : 13 R lab pre Zone → :(13) This rule sets a lab zone as a terminal lab.In this way, we can produce an open lab or end the split activity of the above rule.The first precondition for this rule is that the type of the Zone is an office zone, denoted by the non-terminal Zone, in several offices if the guard pre holds true.The direction of the split is along either the x-axis or the y-axis. 1 n , 2 n , and 3 n represent the number of the three types of offices, respectively.The first precondition is that the type of the Zone is office, office type Zone == .
width of the three types of offices, respectively.l denotes the length of the split line which represents the wall between rooms.a denotes the area of the office zone. 1 a , 2 a , 3 a , and 4 a represent the minimum and maximum value of the area of the three types of offices.After using this rule, the office n shows an example of the split of office zones.

Figure 14 .
Figure 14.Split of office zones

Figure
Figure 15.Four kinds of deployment manners of academic spaces : 15 R

Figure 16 .
Figure 16.Typical layouts of ancillary life spacesAncillary life spaces occupy only about 10% of the area of a building(Charlotte, 2016, page:97-126).In addition, they have a relatively small size compared to the other spaces and are deployed at non-core locations, such as the end of a building, the end of a zone, and the central dark zone, as shown in Figure16.We can use rules 18 and 19 to produce life spaces in the first and second deployment manner, respectively.The life space in the third deployment manner can be generated by using rules 8 and 9. : 18 R

Figure17
Figure17.Typical deployment manners of lobbies : 20 R lobby Space pre l w loc Space , : ) , , ( → e. Apply R20( loc =(18.5, 29), w =4, l =7) to insert a lobby or hall in c Space .Then, R4 is applied to extract rectangular zones from the closed spaces in a Space and c Space .Two and three zones are produced from a Space and c Space , respectively, with each zone assigned the distribution and circulation attributes.According to the layout templates of the lab-centered building, building unit a can be divided into three zones: labs, offices, and lab support, while building c is divided into three offices zones, as shown in Figure 19 (4).R13 is applied to 1 Zone to set this zone as an open lab.R14 ( direction = 'x', 1 n =1, 2 n =1, 3 n =1) is applied to 2 Zone , and three offices with different sizes are produced.Similarly, R14 ( direction = 'x', 1 n =3, 2 n =3, 3 n =0) is applied to 4 Zone , and six offices with two kinds of sizes are produced.R16 ( direction ='x', end ='right', w =6) is applied to 5 Zone , producing a new academic zone denoted by academic Zone .Next, R15 ( direction ='x', n =1) is applied to academic Zone, setting this zone as an academic space.R11 is then applied to this academic space, setting it as a seminar room.R14 ( direction = 'x', 1 n =2, 2 n =1, 3 n =1) is applied to 5 Zone , and four offices with three kinds of sizes are produced.R14 ( direction = 'y', 1 n =3, 2 n =0, 3 n =0) is applied to 6Zone , and three offices with an equal size are produced.The final results are shown in Figure19(5).

Figure 18 .
Figure 18.True map of test building