UNIVERSIDADE FEDERAL DE SANTA CATARINA DEPARTAMENTO DE ENGENHARIA MECÂNICA

Anelize Zomkowski Salvi

ENUMERATING AND ASSEMBLING CONFIGURATIONS WITH MODULAR ROBOTS.

Florianópolis

2018

Anelize Zomkowski Salvi

ENUMERATING AND ASSEMBLING CONFIGURATIONS WITH MODULAR ROBOTS.

Tese submetida ao Programa de Pós- Graduação em Engenharia Mecânica para a obtenção do grau de Doutor em Engenharia Mecânica. Orientador: Henrique Simas, PhD Coorientador: Roberto Simoni, PhD

Florianópolis

2018 Ficha de identificação da obra elaborada pelo autor, através do Programa de Geração Automática da Biblioteca Universitária da UFSC.

Salvi, Anelize Zomkowski Enumerating and assembling configurations with modular robots / Anelize Zomkowski Salvi ; orientador, Henrique Simas, coorientador, Roberto Simoni, 2018. 224 p.

Tese (doutorado) - Universidade Federal de Santa Catarina, Centro Tecnológico, Programa de Pós Graduação em Engenharia Mecânica, Florianópolis, 2018.

Inclui referências.

1. Engenharia Mecânica. 2. enumeration. 3. modular robots. 4. assemble sequence planning. 5. metamorphic robots. I. Simas, Henrique . II. Simoni, Roberto . III. Universidade Federal de Santa Catarina. Programa de Pós-Graduação em Engenharia Mecânica. IV. Título. Anelize Zomkowski Salvi

ENUMERATING AND ASSEMBLING CONFIGURATIONS WITH MODULAR ROBOTS.

Esta Tese foi julgada aprovada para a obtenção do Título de “Doutor em Engenharia Mecânica”, e aprovada em sua forma final pelo Programa de Pós-Graduação em Engenharia Mecânica.

Florianópolis, 07 de Maio 2018.

Jonny Carlos da Silva, PhD Coordenador do Curso

Roberto Simoni, PhD Coorientador

Banca Examinadora:

Henrique Simas, PhD Presidente

Tarcisio Antonio Hess Coelho, PhD Relator

Clovis Sperb De Barcellos, PhD

Fábio Baldissera, PhD

Luís Paulo Laus, PhD

Marcelo Sobottka, PhD

To my husband.

AGRADECIMENTOS

I would like to thank my supervisor, Prof. Henrique Simas, and my co-supervisor, Prof. Roberto Simoni, for the patient guidance, en- couragement, advice and friendship throughout all my time as a stu- dent. They have been crucial to this work and to my formation as a scientist. Special thanks to my committee, Prof. Tarcisio Antonio Hess Coelho, Prof. Clovis Sperb De Barcellos, Prof. Fábio Baldissera, Prof. Luís Paulo Laus and Prof. Marcelo Sobottka for their guidance and suggestions which have strongly contributed to this work. All colleagues of UFSC, for their support, encouragement and friendship. I am grateful to institutions that have supported my work: UFSC (Federal University of Santa Catarina); CAPES (Coordenação de Aper- feiçoamento de Pessoal de Nível Superior) and CNPQ (National Coun- sel of Technological and Scientific Development). I wish to thank my family, my mother, brother, stepfather and parents in law, for their support and encouragement throughout all these years. I am specially thankful to my husband, Andrea Piga Car- boni, whose love and encouragement cannot be measured. You are my life.

Wisdom begins in wonder. Socrates

RESUMO

Esta tese apresenta novas contribuições para dois problemas forte- mente relacionados: a enumeração e o sequenciamento da montagem de configurações (Assembly Sequence Planning - ASP) constituídas por robôs modulares. Ferramentas matemáticas, mais especificamente, fer- ramentas de Teoria dos Grafos, são largamente empregadas no trata- mento desses dois problemas. Em sua primeira parte, a tese aborda o problema de enumeração, fornecendo um novo método que permite enumerar as configurações não-isomórficas de robôs modulares com mó- dulos cúbicos. Este método é baseado em trabalhos anteriores do autor para robôs modulares com módulos planares. O método foi imple- mentado em C++, fornecendo a enumeração de configurações com até 10 módulos cúbicos. Este resultado constitui um avanço em relação ao número de módulos alcançados na literatura. Em sua segunda parte, a tese introduz três novos ASP para robôs modulares que tratam classes de configurações em aberto na literatura. Esta tese é o primeiro tra- balho a resolver os seguintes problemas: Como montar configurações compostas por sistemas de robôs modulares; como montar configura- ções com corredores estreitos; como montar configurações com furos internos; como montar configurações sem furos internos nem corredores estreitos, mas escolhendo o ponto de partida do ASP e como montar estruturas planares verticais. Todos os ASP obedecem a condição de acessibilidade, ou seja, nenhum módulo pode passar por um corredor entre dois robôs que estejam na estrutura, se este corredor for tão es- treito quanto o lado de um módulo. Como resultado complementar, esta tese apresenta novas contribuições ao ASP para estrutura maríti- mas de Seo, Yim e Kumar. Palavras-chave: enumeração, robôs modulares, robôs metamórficos, sequência de montagem (ASP).

RESUMO EXPANDIDO

Introdução

Robôs modulares reconfiguráveis são robôs constituídos de módulos independentes que podem ser homogêneos ou heterogêneos em suas formas e funcionalidades. Cada módulo possui atuadores, sensores, processadores de energia, memória, além de maneiras de se comunicar e de se conectar a outros módulos. Se um robô modular reconfigurável pode mudar de forma autônoma as conexões de seus módulos, o robô é chamado de robô modular auto-reconfigurável (MSR). Em outras palavras, um MSR é capaz de modificar de maneira autônoma o seu formato rearranjando as conexões entre seus módulos. Um MSR pode modificar seu formato para efetuar determinada tarefa, seja ela transpor um buraco, rolar adotando a forma de um aro, cons- truir uma forma complexa com muitos braços ou ainda utilizar a re- configuração para locomoção. O crescente interesse neste tipo de robôs deve-se justamente à capacidade de auto-reconfiguração, pois esta ca- racterística confere aos robôs adaptabilidade a novas circunstâncias e tarefas, bem como a capacidade de recuperação de falhas mecânicas, como, por exemplo, a perda da funcionalidade de um módulo. Visto que é a capacidade de assumir diferentes configurações que torna estes robôs versáteis, é necessário que eles possam ser operados no maior número de configurações diversas. Portanto, é importante conhecer as configurações que um dado conjunto de módulos pode assumir, assim como determinar uma sequência correta de montagem para cada con- figuração. A enumeração de configurações e a montagem de configurações são pro- blemas fortemente relacionados. De fato, para que uma configuração seja montada, é necessário escolhê-la do conjunto de todas as configura- ções possíveis para um dado número de módulos. Além disto, escolhida a configuração desejada, é importante determinar que sequência de ope- rações leva à correta montagem da configuração. Estes dois problemas são tratados nesta tese que apresenta um novo método de enumeração para configurações não-isomórficas de robôs modulares com módulos cúbicos e novas estratégias de montagem para configurações planares compostas por módulos retangulares ou cúbicos. Objetivos gerais

Os objetivos gerais desta tese são desenvolver métodos de enumera- ção e de montagem para configurações de robôs modulares.

Objetivos específicos: problema de enumeração

Os objetivos específicos relativos à enumeração de configurações para robôs modulares são: desenvolver um método de enumeração para con- figurações compostas por módulos cúbicos e desenvolver um método simples para capturar as simetrias deste tipo de configuração.

Objetivos específicos: problema de montagem

O objetivo específico relativo à montagem de configurações para robôs modulares é atingir classes de configurações não tratadas na literatura, como por exemplo: estruturas compostas de substruturas previamente montadas e estruturas que apresentem corredores estreitos, i.e. espaços que são demasiado estreitos para que um módulo possa atravessá-los ou ainda estruturas planares verticais.

Metodologia

A tese trata o problema de enumeração e de montagem em capítu- los distintos. Porém, ferramentas de teoria dos grafos são largamente utilizadas no tratamento de ambos os problemas e fornecem uma base comum para o desenvolvimento da tese.

Metodologia: problema de enumeração

Em trabalhos anteriores [15–17], o autor propôs técnicas de enume- ração para robôs modulares. Uma destas técnicas, chamada Método Orbital [16, 17], foi desenvolvida para robôs com módulos quadrados. A tese estende o Método Orbital para configurações compostas por módulos cúbicos. Para efetuar esta extensão, ferramentas de teoria dos grafos e dos gru- pos são largamente empregadas e uma nova modelagem que permite detectar as simetrias das configurações é apresentada. Além disto, dois resultados apresentados pelo autor [15] para robôs com módulos qua- drados são estendidos para o caso cúbico. Assim, um método completo para enumeração de configurações não-isomórficas compostas de mó- dulos cúbicos e um teste para checagem de simetrias deste tipo de configuração são obtidos e são melhor discutidos na seção Resultados e Discussão.

Metodologia: problema de montagem

Para atingir diferentes classes de configurações, a tese introduz três novos ASP. Estes ASP são baseados em teoria dos grafos, mais especi- ficamente em algoritmos de busca em grafos. Além disso estes ASP são modelados para obedecer a condição de aces- sibilidade proposta por Paulos et al.[2]: “Qualquer módulo retangular não pode passar por um espaço entre dois módulos da estrutura final, se este espaço for tão pequeno quanto o lado do módulo.” Nos ASP propostos, a estrutura é modelada por um grafo não direci- onado, apresentado na forma de sua lista de adjacência. Estes ASP são estruturados com um algoritmo principal que apresenta uma estru- tura recursiva semelhante a uma busca em profundidade num grafo e contam com dois processos auxiliares. Inicialmente, mostra-se como aplicar estes ASP para configurações com- postas por módulos quadrados, então, estes ASP são estendidos para outros tipos de módulos retangulares. A maior diferença entre o caso quadrado e os outros casos são em como os módulos estão conectados a seus vizinhos. Primeiramente a estratégia de dividir a estrutura em substruturas pre- viamente montadas é adotada e, então, a montagem convencional, isto é, módulo a módulo é considerada. Todos os ASP foram implementados em C++ e os resultados são dis- cutidos na próxima seção.

Resultados e Discussão

O método de enumeração para robôs com módulos cúbicos foi imple- mentado em C ++, fornecendo a enumeração de configurações não- isomórficas com até 10 módulos. Este resultado constitui um avanço em relação ao número de módulos alcançados na literatura. Além disto, a tese introduz três novos ASP para robôs modulares que tratam classes de configurações em aberto na literatura. Esta tese é o primeiro tra- balho a resolver os seguintes problemas: Como montar configurações compostas por sistemas de robôs modulares; como montar configura- ções com corredores estreitos; como montar configurações com furos internos; como montar configurações sem furos internos nem corredo- res estreitos, mas escolhendo o ponto de partida do ASP; como montar estruturas planares verticais. Todos os ASP obedecem a condição de acessibilidade, i.e. nenhum módulo pode passar por um corredor entre dois robôs que estejam na estrutura, se este corredor for tão estreito quanto o lado de um módulo. Como resultado complementar, esta tese apresenta novas contribuições ao ASP para estruturas marítimas de Seo, Yim.

Considerações Finais

A tese aborda os problemas de enumeração e de montagem para robôs modulares, como trabalhos futuros prevê-se: extensão do método de enumeração para outros tipos de módulos, enumeração de configura- ções compostas por módulos não-homogêneos, análise das classes de equivalência obtidas da enumeração, cobrindo características como mo- bilidade, estabilidade e distribuição de massa, extensão dos ASP para outros tipos de módulos e de restrições mecânicas, bem como a extensão dos ASP para o caso tridimensional. Palavras-chave: Enumeração, robôs modulares, robôs metamórficos, sequência de montagem, ASP. ABSTRACT

This thesis presents novel contributions to two strongly related prob- lems: the enumeration and the assembly sequence planning (ASP) for modular robots. Mathematical tools, more specifically graph theory tools, are extensively employed in the treatment of both problems. First, this thesis deals with the enumeration problem, providing a com- plete and original method which allows enumerating the nonisomorphic configurations of cubic modular robots. The proposed method is based on author’s previous works for planar modular robots. This method was implemented in C++ providing the enumeration of configurations up to 10 cubic modules which constitutes an advance compared to the number of modules achieved in literature. Then, three novel ASP for modular robots are introduced in this thesis. These ASP cover classes of target structures not solved in literature. To the best of the author’s knowledge, the thesis is the first work that solves the following prob- lems: assembling target structures composed by shape heterogeneous modular robots systems; assembling planar target structures with nar- row corridors, i.e. corridors which are too narrow for a robot to traverse; assembling configurations without narrow corridors, and choosing the ASP starting point; assembling planar vertical structures. All the ASP herein proposed satisfies the accessibility condition, i.e. any module cannot pass through a gap only as large as a side of a module between two physical robots already assembled in the structure. As a comple- mentary result, this thesis presents novel contributions to the ASP for maritime structures of Seo, Yim and Kumar. Palavras-chave: enumeration, modular robots, metamorphic robots, assembly sequence planning (ASP).

LIST OF FIGURES

Figure 1 (a) A M-Tran robot during reconfiguration [1]. (b) A landing platform autonomously assembled with robotic boats [2]. (c) A configuration of the Distributed Flight Array in flight [3]...... 35 Figure 2 A set of four isomorphic configurations (a), and a set of two distinct configurations (b)...... 45 Figure 3 Two isomorphic configurations composed by a prism with one revolute and one helicoidal joint [4]...... 47 Figure 4 A modular robot (a) and its graph representation (b) [4]. 48 Figure 5 Distinct constructions of a 3-link robot [4]...... 49 Figure 6 Two standard type of modules of planar metamorphic robots...... 50 Figure 7 (a) Kinematic chain of a single module, (b) Kin- ematic chain of a single hexagonal module...... 50 Figure 8 (a) A metamorphic robot composed by two hexagonal modules, Pamecha et al.[5]; (b,c) are respectively the kinematic chain and the graph obtained by Martins e Simoni[6]...... 51 Figure 9 Actions of σ1 , σ2, σ3 and σ4 , respectively, on the graph in Figure 8c, Martins e Simoni[6]...... 53 Figure 10 Two isomorphic configurations obtained by connect a new module to links in the same orbit...... 54 Figure 11 Flowchart of the method proposed by Martins e Simoni [6] outlining the role of the group theory tools for enu- meration configurations of the metamorphic robot. The dashed are the representatives of the binary or- bits...... 55 Figure 12 (a) A configuration and its coordinate system; (b) ID Matrix...... 56 Figure 13 (a) Configuration circumscribed by a non-regular rect- angle; (b) Configuration circumscribed by in a square, i.e. regular rectangle...... 57 Figure 14 Configuration symmetrical with respect to the Ox axes. 58 Figure 15 Example of a configuration symmetric over Oy...... 59 Figure 16 Isomorphic free generation with the results of Theorem 2 and Proposition 2. The dashed squares are the ones on the addition region, which is determined by the pro- positions introduced in [7]...... 60 Figure 17 Isomorphism test structure, proposed by Salvi et al.[7]...... 62 Figure 18 (b) vertices for the configuration in (a)...... 65 Figure 19 Configuration that exemplifies how the Mgrafo matrix is obtained...... 66 Figure 20 (b) Graph I associated to the configuration in (a). . . . . 67 Figure 21 Graph II associated to the configuration in 20 (a)...... 67 Figure 22 (a) Graph I associated to the configuration in (b). . . . . 68 Figure 23 Flowchart of the enumeration method proposed by Salvi et al.[8]...... 69 Figure 24 (a) Sides a and a0 are symmetric in relation to v; (b) and (c) are isomorphic configurations obtained by adding a new module to the sides a and a0of the square in (a), respectively...... 72 Figure 25 The configurations obtaining by adding a new module to a and to a0 are related by a reflection on v...... 72 Figure 26 (a) Sides a and a0 are symmetric by a 90° rotation around K; (b) shows that by adding a novel module to a and then applying a 90° rotation around K, the configuration where a novel module is added to a0 in (a) is obtained.. 75 Figure 27 (a) A configuration composed by cubic modular robots; (b) the configuration’s three-dimensional ID matrix.. . . 77 Figure 28 (a) The cubical graph; (b) A graph...... 78 Figure 29 (a) The face-centered cubic cell lattice.; (b) Graph rep- resentation of a cubic modular robot using the cell lattice in (a)...... 79 Figure 30 Part of the corresponding to one facet (red node) and its neighboring facets (blue node) [9]...... 81 Figure 31 A cubic modular robot and its graph representation. . . . 82 Figure 32 For each module, vertices labeling follows the north- west, front-back convention and each vertex is labeled just once...... 84 Figure 33 (a) A configuration composed by cubic modular robots; (b) the configuration’s four-dimensional Mgrafo matrix. 85 Figure 34 Possible edges types between vertices belonging to dif- ferent modules...... 88 Figure 35 Configurations constituted only by ones in the ID rep- resentation can be forbidden of generating a child during the enumeration process...... 89 Figure 36 (a) A set of robotic boats or modules (b) A bridge com- posed by 33 modules, Paulos et al.[2]...... 99 Figure 37 (a) Robotic boats docking mechanism, Paulos et al.[2]. (b) A configuration composed by four robotic boats. . . 99 Figure 38 Example of target structures. Configuration in (a) can be assembled by the both ASP of Seo, Yim e Kumar[10,11] and Paulos et al.[2]. Configuration in (b) can only be assembled by the ASP of Paulos et al.[2]...... 100 Figure 39 Graphs C for: (a) configuration in Figure 38a; (b) con- figuration in Figure 38b...... 101 Figure 40 (a) A target structure. Each rectangle represents a site to be occupied. (b) The points represent the centroids of the sites. The orange whose edge length δ is three times as large to the edges of the lattice units can transverse the configuration, thus the configuration has no narrow corridor Seo, Yim e Kumar[11]...... 102 Figure 41 In each of the cases, the modules a and b are forming a narrow corridor. (a), (b) A narrow corridor may be a local issue in terms of the site between a and b. (c) However, it can also be a nonlocal issue in terms of a site far from them Seo, Yim e Kumar[11]...... 103 Figure 42 (a) A target structure. (b) The goal shape has been decomposed into cells, i.e. collections of consecutive sites parallel to the x-axis...... 105 Figure 43 Graph C0 for the configuration in Figure 42a...... 105 Figure 44 (a) Colored rectangles correspond to the chosen seed for each cell in Figure 44a. (b) The red colored vertex cor- responds to the cell to which s, the initial seed, belongs to...... 106 Figure 45 The colored rectangles correspond to the seeds chosen for each cell in Figure 44a. The initial seed s corresponds to the red rectangle, numbered as 11...... 107 Figure 46 Topological sort of graph GA in Figure 45...... 107 Figure 47 (a) A target structure. Each rectangle represents a site to be occupied. (b) Graph C for the configuration in (a), Seo, Yim e Kumar[11]...... 108 Figure 48 Graph ∂C for the configuration in Figure 47b, Seo, Yim e Kumar[11]...... 109 Figure 49 ∂C in Figure 48 has two blocks that are cycles, denoted as β1and β2. Each red vertex is a cut-vertex of ∂C that belongs to β1 or β2, Seo, Yim e Kumar[11]...... 111 Figure 50 If β1 is chosen, si, sj , and sk can potentially be dis- assembled from the structure both in (a) and (b); C will then be updated as shown in (c) and (d), respect- ively. If β2 is chosen, (e) si can be disassembled from the structure; (f) because sk is the cut-vertex, the sequence si, sj, sk will not be returned; (g) represents the update of graph C for this case, Seo, Yim e Kumar[11]...... 113 Figure 51 Algorithm3 can be extended to the six patterns in the figure. The red are the lattice units of the patterns, Seo, Yim e Kumar[11]...... 114 Figure 52 (a) A target structure. (b) Graph C for the configuration in (a). (c) and (d) A rhombus whose edge length is three times as large to the edges of the lattice units can translate along the frontier of each graph C’s faces, f1 and f2: Thus, the configuration has no narrow corridor.119 Figure 53 (a) A target structure. (b) Graph C for the configuration in (a). (c) A rhombus whose edge length is three times as large to the edges of the lattice units can translate along the frontier of the unique graph C’s face, f1: Thus, the configuration is free from narrow corridors...... 120 Figure 54 Another counter example for Algorithm3...... 121 Figure 55 A configuration composed by 12 shape heterogeneous modular robot systems...... 124 Figure 56 Due to the accessibility condition, robot systems F , E and C cannot be joined in the F → E → C order. More precisely, module (2, 3) ∈ C cannot be added to the structure without violating the accessibility condition. . 125 Figure 57 Adjacency list for the graph representing the neighbor- hood relations between the robot systems in Figure 55...... 126 Figure 58 If the algorithms places F → E → G and then, in Step 3, E tries to add robot system C, an incorrect ASP is en- countered because C cannot be added to the growing structure...... 129 Figure 59 Following steps of the assembly sequence for the example in Figure 58a. (a) Step 4: G is deleted by function deleteBranch(G,E). Step 5: robot system E is deleted by the condition in Line 11 of Algorithm4. (b) Steps 6 − 8: the correct assembly sequence F → C → E → G is encountered...... 130 Figure 60 (a) Sub-structure of the configuration in Figure 55 used to explain Lines 16-20 of Algorithm4. Due to the access- ibility issue, robot system L and K cannot be added to the growing structure in cases (b) and (c), respectively. 131 Figure 61 (a) Robot system J is added to the configuration com- posed only by robot system K, thus edge K → J is cre- ated. (b) Robot system L is added, thus edges K → L and J → L are created...... 132 Figure 62 (a) A target structure. (b) Robot system D cannot be added to the growing structure without passing through a narrow corridor...... 134 Figure 63 Accessibility issue detection...... 136 Figure 64 Module A forms a narrow corridor with any of the mod- ules from B to Q...... 137 Figure 65 Detection of the narrow corridors between module A and modules D, H, L and P ...... 138 Figure 66 Conditions for obtain a narrow corridor...... 139 Figure 67 Conditions for obtain a narrow corridor...... 139 Figure 68 Conditions for obtain a narrow corridor...... 140 Figure 69 (a) A target structure. (b) An ASP for the configuration in (a). In Step 8 of the ASP, robot system H cannot be added to the growing structure due to the accessibility condition. Thus, the ASP tree branch B − H is not created. Also, all branches of the ASP tree starting at H’s parent, robot system B, will be deleted by function deleteBranch(G,B), i.e. branches B − C − G, B − D − E − F will be deleted...... 143 Figure 70 (a) Robot system H cannot be added to the growing structure, thus deleteBranch(G,B) is called. (b-h) Se- quence of operations performed in G.T ree by function deleteBranch(G,B)...... 144 Figure 71 ASP for the configuration in Figure 55 with robot system F as starting point...... 147 Figure 72 (a) A target structure with an internal hole. (b) If the internal hole is modeled as a robot system h1, then, the target structure can be assembled with the proposed ASP...... 151 Figure 73 Consider the configuration in Figure 72b and the as- (1) (2) (3) (4) sembly order A −−→ B −−→ h1 −−→ C −−→ D. (a,b) By letting robot system A add robot system C at Step 3, the auxiliary structure h1 can be eliminated from the original ASP. (c) Thus, the correct ASP, without the auxiliary structure h1, is obtained...... 153 Figure 74 Consider the configuration in Figure 72b and the as- (1) (2) (3) (4) sembly order A −−→ C −−→ h1 −−→ B −−→ D. (a) By letting robot system A add robot system B at Step 3, the auxiliary structure h1 can be eliminated from the original ASP. (b) Thus, the correct ASP, without the auxiliary structure, h1 is obtained...... 153 Figure 75 (a) A target structure with an internal hole. (b) If the internal hole is modeled as a singular robot system h1, the target structure cannot be assembled. In fact, robot system C cannot be assembled in C → h1 or h1 → C order. As shown respectively in (d) and (e), robot system C induces conflicting edges in h1 and vice versa...... 155 Figure 76 The internal hole in Figure 75a can be modeled as three continuous robot systems parallel respectively to the x or y axis, as shown in (a) and (b), respectively...... 156 Figure 77 This figure shows an application of Rule 2. When the target configuration is assembled in the order shown by the arrows, hole h2 does not connect with any robot system already in the structure. In fact, h2 only connects with h1, which is another hole...... 156 Figure 78 ASP for the configuration in (a) with robot system A as starting point...... 160 Figure 79 (a) A target structure constituted by modules arranged in the pmm pattern. (b) Each module in the pmm pattern is surrounded by four others, thus, the edges constructed by function AddEdge are equivalent to the square case. 162 Figure 80 A target structure in p4g can be viewed as a target struc- ture in pmm if each meta module is considered as a new module, Paulos et al.[2]...... 163 Figure 81 (a) A target structure constituted by modules arranged in the cmm pattern. (b) Each module in the cmm pattern is surrounded by six others, thus, the edges constructed by function AddEdge must consider all these surround- ing modules...... 163 Figure 82 Robot systems A, B and C cannot be assembled in A → B → C order. In fact, edges created as in Figure 81b are able to capture this issue because there are north-south and east-west edges. Thus, function AddEdge will not allow this assembly order...... 164 Figure 83 Configuration with modules arranged in : (a) cmm pat- tern. (b) pmg pattern. (c) pgg pattern...... 165 Figure 84 These configurations can be assembled with the proposed ASP without violating the accessibility condition. These configurations cannot be assembled with the ASP of Seo, Yim e Kumar[11]...... 168 Figure 85 The configurations in the first three cases can be as- sembled with the proposed ASP, without violating the accessibility condition. Also, the proposed ASP is able to detect that the configuration in the fourth case cannot be assembled without violating the accessibility condition. 169 Figure 86 An example of the ASP in Section 7.2 with the new rule for modular construction...... 170 Figure 87 A further example of the novel ASP for modular con- struction ...... 173 Figure 88 If the floor is represented by a robot system, configura- tions in (a,b) can be assembled by the proposed ASP in a bottom-up manner...... 176 Figure 89 The configurations can be assembled bottom-up by the proposed ASP, if the floor is represented by a robot sys- tem...... 177 Figure 90 Adjacency lists for the graph representing the configura- tions in Figures 88a and 88b, respectively...... 178 Figure 91 The backrest of a chair being assembled with the pro- posed ASP...... 179 Figure 92 In the melt-grow technique of Fitch, Butler e Rus[12], configurations are constructed in a continuous path and not in a bottom-up manner...... 180 Figure 93 Examples of orbits by the action of the SO(2) group over π (0, 1). (a) Orbit of (1, 0) by an angle 2 ; (b) by an angle π 6 ...... 205 Figure 94 Examples of graphs, subgraphs trees and graph’s com- ponents...... 206 Figure 95 (a) An undirected graph, (b) a directed graph...... 208 Figure 96 A family of trees with six vertices...... 208 Figure 97 Two isomorphic graphs labeled in order to evidence the isomorphism between them...... 209 Figure 98 All possible automorphisms of the graph in (a)...... 210 Figure 99 Action of the automorphism group on the Stephenson graph...... 212 Figure 100Figure (b) represents the DFS procedure, with vertex A as root, for the graph in (a)...... 213 Figure 101Figure (b) represents the DFS procedure, with vertex A as root, for the graph in (a)...... 215 LIST OF TABLES

Table 1 Number of nonisomorphic configurations with n square modules...... 64 Table 2 Number of nonisomorphic configurations with n cubic modules...... 94 Table 3 ASP computational time for configurations composed by robot systems...... 183 Table 4 ASP computational time for the examples with narrow corridors...... 184 Table 5 ASP computational time for the vertical examples...... 185 Table 6 Operation table for the automorphism group of the graph in Figure 98a...... 210

LIST OF ABBREVIATIONS AND ACRONYMS

ASP Assembly Sequence Planning ISO International Standards Organization MSR Modular self-reconfigurable robot BFS Breadth-First Search DFS Depth-First Search

NOMENCLATURE

ID Matrix representation of a modular robot configuration. Mgrafo Matrix that contains the graph label associ- ated to a modular robot configuration. cmm A pattern in Figure 51. p2 A pattern in Figure 51. pmg A pattern in Figure 51. pgg A pattern in Figure 51. pmm A pattern in Figure 51. p4g A pattern in Figure 51.

CONTENTS

1 INTRODUCTION...... 35 1.1 GOALS...... 38 1.1.1 Enumeration problem: specific goals ...... 38 1.1.2 Assembly sequence planning: specific goals 38 1.2 METHODOLOGY...... 39 1.2.1 Enumeration problem: methodology ...... 39 1.2.2 Assembly sequence planning: methodology 39 1.3 ORIGINAL CONTRIBUTIONS OF THIS THESIS . . . . . 40 1.3.1 Contributions to the enumeration of mod- ular robot configurations ...... 40 1.3.2 Contributions to the Assembly Sequence Planning for modular robots ...... 41 1.4 THESIS OUTLINE ...... 42 2 LITERATURE REVIEW: ENUMERATION OF MODULAR ROBOTS’ CONFIGURATIONS . . . . . 45 2.1 CONTRIBUTIONS OF CHEN AND BURDICK ...... 47 2.2 CONTRIBUTIONS OF MARTINS AND SIMONI...... 48 2.3 CONTRIBUTIONS OF SALVI ET. AL...... 56 2.3.1 Symmetry Method ...... 56 2.3.1.1 Symmetry detection...... 57 2.3.1.2 New modules addition...... 58 2.3.1.3 Two results about the enumeration of square modular robots...... 59 2.3.1.4 Isomorphism Test...... 60 2.3.1.5 Outlines of the Symmetry Method . . . 61 2.3.2 Orbital Method ...... 63 2.3.2.1 Graph representations for square mod- ular robots...... 65 2.3.2.2 Outlines of the Orbital Method ...... 68 3 NOVEL CONTRIBUTIONS TO THE ORBITAL METHOD ...... 71 4 NOVEL ENUMERATION METHOD FOR CU- BIC MODULAR ROBOTS...... 77 4.1 NOVEL GRAPH REPRESENTATION FOR CUBIC MOD- ULAR ROBOTS...... 78 4.2 ISOMORPHISM AVOIDANCE...... 89 4.3 ENUMERATING CUBIC MODULAR ROBOTS ...... 90 4.4 ORBITAL METHOD OVERALL DISCUSSION ...... 90 4.4.1 Termination ...... 90 4.4.2 Soundness ...... 91 4.4.3 Completeness ...... 92 4.4.4 Complexity ...... 93 4.5 RESULTS ...... 93 4.6 CONCLUSIONS...... 95 5 LITERATURE REVIEW: ASSEMBLY SEQUENCE PLANNING ...... 97 5.1 CONTRIBUTIONS OF SEO ET AL. AND PAULUS ET AL...... 98 5.1.1 Common definitions for the ASP of Seo et al. and Paulus et al...... 100 5.1.2 Configurations without internal holes ..... 103 5.1.3 Configurations with internal holes ...... 107 6 NOVEL CONTRIBUTION TO THE ASP OF SEO, YIM AND KUMAR ...... 115 6.1 CONCLUSIONS...... 118 7 TWO NOVEL ASP FOR SHAPE HETEROGEN- EOUS MODULAR ROBOT SYSTEMS ...... 123 7.1 NOVEL ALGORITHMS FOR CONFIGURATIONS WITHOUT INTERNAL HOLES ...... 125 7.1.1 Conditions for adding a new robot system to the target structure ...... 131 7.1.1.1 Termination of Algorithm5 ...... 135 7.1.1.2 Soundness of Algorithm5 ...... 135 7.1.1.3 Complexity of Algorithm5...... 140 7.1.2 Deleting a branch from the structure ..... 141 7.1.2.1 Termination of Algorithm6 ...... 144 7.1.2.2 Soundness of Algorithm6 ...... 145 7.1.2.3 Complexity of Algorithm6...... 145 7.1.3 Applying the novel algorithms for config- urations without internal holes ...... 145 7.1.4 Properties of Algorithm4 ...... 146 7.1.4.1 Termination of Algorithm4 ...... 146 7.1.4.2 Soundness of Algorithm4 ...... 146 7.1.4.3 Completeness of Algorithm4 ...... 150 7.1.4.4 Complexity of Algorithm4...... 150 7.2 NOVEL ALGORITHMS FOR CONFIGURATIONS WITH INTERNAL HOLES ...... 150 7.2.1 Applying the novel algorithms for config- urations with internal holes ...... 157 7.2.2 Properties of Algorithm7 ...... 159 7.2.2.1 Termination of Algorithm7 ...... 159 7.2.2.2 Soundness of Algorithm7 ...... 159 7.2.2.3 Completeness of Algorithm7 ...... 161 7.2.2.4 Complexity of Algorithm7 ...... 161 7.3 EXTENSION TO GENERAL RECTANGULAR MOD- ULES ...... 161 7.4 CONCLUSIONS...... 165 8 NOVEL ASP FOR MODULAR CONSTRUCTION167 8.1 NOVEL ALGORITHM FOR MODULAR CONSTRUC- TION ...... 170 8.1.1 Properties of Algorithm8 ...... 173 8.1.1.1 Termination of Algorithm8 ...... 173 8.1.1.2 Soundness of Algorithm8 ...... 174 8.1.1.3 Completeness of Algorithm8 ...... 175 8.1.1.4 Complexity of Algorithm8 ...... 175 8.2 CONFIGURATIONS IN A VERTICAL PLANE ...... 175 8.3 CONCLUSIONS...... 180 9 IMPLEMENTATION AND RESULTS ...... 183 9.1 CONFIGURATIONS COMPOSED BY ROBOT SYSTEMS 183 9.2 MODULAR CONSTRUCTION...... 184 10 CONCLUSIONS...... 187 10.1 CONTRIBUTIONS OF THIS THESIS ...... 187 10.1.1 Enumeration of modular robot configura- tions ...... 187 10.1.2 ASP for modular robots ...... 188 10.2 PUBLICATIONS ...... 189 10.3 FURTHER WORKS ...... 190 BIBLIOGRAPHY ...... 191 A GRAPH AND GROUP THEORY ...... 201 A.1 GROUP THEORY TOOLS ...... 201 A.1.1 Isomorphism and Automorphism ...... 203 A.1.2 Actions and orbits ...... 204 A.2 GRAPH THEORY...... 205 A.2.1 Degree of a vertex ...... 206 A.2.2 Walks and circuits ...... 207 A.2.3 Connected Graphs, subgraphs and com- ponents ...... 207 A.2.4 Articulation points and bridges ...... 207 A.2.5 Directed and undirected graph ...... 207 A.2.6 Biconnected graph ...... 208 A.2.7 Tree ...... 208 A.2.8 Graph isomorphism and automorphism ... 209 A.2.9 Actions and orbits ...... 211 A.3 GRAPH TRAVERSALS...... 212 A.3.1 Breadth-First Search ...... 213 A.3.2 Depth-First Search ...... 214 B ALGORITHMS: LITERATURE REVIEW ...... 217 C ALGORITHMS: THESIS CONTRIBUTIONS . . . 221 35

1 INTRODUCTION

Reconfigurable modular robots are robots built from independ- ent homogeneous or heterogeneous modules. Each module has actu- ators, sensors, processing power, memory, and means of communicat- ing and connecting to neighbors. If a reconfigurable modular robot is autonomously able to change the way these modules are connected, the robot is called a modular self-reconfigurable robot (MSR). In other words, an MSR is able to autonomously change its own shape rearran- ging the connectivity of its modules. An MSR can change its shape to suit the task, whether it is climbing through a hole, rolling like a hoop, assembling a complex structure with many arms or using reconfiguration for locomotion. Fig- ure1 shows examples of MSR: Figure 1a shows a M-Tran robot during reconfiguration, Murata e Kurokawa[1]; Figure 1b presents a landing platform assembled with self-propelled ISO shipping containers, Paulos et al.[2]; Figure 1c presents a configuration of the Distributed Flight Array in flight, Oung et al.[3].

(a) (b)

(c)

Figure 1 – (a) A M-Tran robot during reconfiguration [1]. (b) A land- ing platform autonomously assembled with robotic boats [2]. (c) A configuration of the Distributed Flight Array in flight [3]. 36 Chapter 1. Introduction

An important subclass of the MSR are the metamorphic robots. For this subclass, a change in the macroscopic morphology results from the locomotion of each module over its neighbors [13]. Thus, every metamorphic robot is an MSR, but not all MSR are metamorphic ro- bots. For example, all robots in Figure1 are MSR, however, only Figure 1a presents a metamorphic robot. In fact, each module in Fig- ure 1b and in Figure 1c is free-flying while each module in Figure 1a must climb over its neighbors in order to reconfigure the total structure. Common planar module designs are rectangular, regular and non-regular ones [2,5,14,15] and hexagonal [3,5,14,16,17]. For spatial metamorphic systems, cubic [18,19] and dodecahedral [20] modules are employed. In this thesis, the MSR in general are considered and they are denoted only by modular robots, for simplicity. More specifically, this thesis deals with modular robots composed by rectangular or by cubic modules. According to Yim et al.[21], modular robots have three promises:

• “versatility: the ability to reconfigure allows a robot to disassemble and/or reassemble itself to form morpho- logies that are well-suited for a variety of given tasks; • robustness: since the system is composed of many re- peated parts which can be rearranged during opera- tion, faulty parts can be discarded and replaced with an identical module on-the-fly, leading to self-repair; • low cost: MSR systems can lower module costs since mass production of identical unit modules has an eco- nomic advantage that scales favorably. Also, a range of complex machines can be made from a set of modules saving the cost versus having multiple single-function machines for doing different tasks.”

In order to realize their potential, these versatile robots must be operated in as many different configurations as possible. Therefore, it is important to know all the configurations that a given set of modules can assume and also how to assembly these configurations with respect to modules constraints. These two relevant problems, the enumeration and the assembly of modular robot configurations, are strongly related. In fact, in order to assemble a given configuration, the configuration must be selected from all possible configurations which can be assembled from a given 37 set of modules, i.e. it is important to enumerate all possible configur- ations which a modular robotic system can assume. Also, given a set of configurations, it is important to determine how to assembly these configurations with respect to modules constraints. The problem of enumerating all possible configurations which a modular robotic system can assume is a complex one. The number of configurations with n modules grows exponentially with n, thus the time required for an algorithm that lists all the configurations grows exponentially [22]. Due to the huge number of configurations, several authors opted for enumerating only the distinct, i.e. nonisomorphic configurations, which a modular robotic system can assume [4,6–8, 22–24]. In other words, configurations can be organized in distinct classes, thus, ana- lysis of control strategies, mobility, stability and mass distribution, among others, can be performed for only one representative of each class. Then, the results can be extended to the other configurations belonging to the same class. This is the strategy adopted in this thesis, which provides a complete and original method to enumerate cubic modular robot configurations. An assembly is a collection of independent parts which form a structure or product. The Assembly Sequence Planning (ASP) is the problem of finding a sequence of collision-free operations that brings the assembly parts together. The ASP is an NP-hard problem [25, 26]. For n parts, the total number of possible sequences is n!. An extensive survey on the ASP is presented by Jiménez[27]. The assembly sequence problem for modular robots presents some peculiarities, particularly regarding modules constraints. During assembly, easy accessibility of individual modules must be guaranteed. This condition was stated by Paulos et al.[2] as:

“Any rectangular module cannot pass through a gap only as large as a side of a module between two physical robots already assembled in the structure.”

Paulos et al.[2] and Seo, Yim e Kumar[10, 11] introduced the assembly sequence problem for modular robots. They addressed the problem of assembling large teams of autonomous robotic boats into floating platforms structures of arbitrary shapes, aggregating module by module to the target structure. However, their ASP can only be applied to a restricted subclass of planar modular robots. 38 Chapter 1. Introduction

Another important problem, directly related to the ASP problem for modular robots, is the collective construction of modular structures by robot teams using building blocks, as presented in [28–30] and in [31], which employed square and triangular modules, respectively. However, even considering related works, the ASP problem for modular robots remains unsolved for large classes of target structures. In this context, the thesis introduces three novel ASP for modu- lar robots. These ASP cover classes of target structures not treated in literature. The main goals of this thesis are discussed in the next section.

1.1 GOALS

The main goals of this thesis are the development of enumeration and assembly methods for modular robots’ configurations. In order to attend these goals, mathematical tools, more specific- ally graph theory tools, are extensively employed for both problems’ treatment.

1.1.1 Enumeration problem: specific goals With respect to the enumeration of modular robot configura- tions, the thesis has two specific goals:

• develop an enumeration method for configurations composed by cubic modules;

• develop a simple method for detecting a configuration’s symmet- ries.

1.1.2 Assembly sequence planning: specific goals With respect to assembling of modular robot configurations, the specific goal of this thesis is to cover classes of target structures not solved in the literature such as:

• target structures composed by modular substructures, herein called robot systems;

• target structures with narrow corridors, i.e. corridors which are too narrow for a robot to traverse;

• planar vertical target structures. 1.2. Methodology 39

In the next sections, a brief review of the methodologies and results is presented.

1.2 METHODOLOGY

As previously stated, this thesis focuses on two strongly related problems: the enumeration and the assembly of modular robot con- figurations. Each of these problems is treated in different sections of this thesis and has a specific modeling. However, graph theory tools are largely employed in both problems treatment and provide a com- mon tool for this thesis. Next subsections present the methodology employed for each problem.

1.2.1 Enumeration problem: methodology In previous works [7,8, 22], the author proposed two techniques for enumerating all nonisomorphic metamorphic robots. One of these techniques is called Orbital Method [8,22] and presents an enumeration method for square metamorphic robots. The thesis extends the Orbital Method to enumerate configura- tions composed by cubic modules. In order to perform this extension, group and graph theory tools are extensively used. Furthermore, a novel way to determine a graph which captures the symmetries of a given cubic metamorphic robots is presented. Based on this formu- lation, a simple procedure for detecting configuration’s symmetries is provided. In order to decrease the number of isomorphic configurations generated during the enumeration process, two results introduced by the author [7] are extended to cubic modules. Thus, a complete and novel method is presented in this thesis, which allows enumerating the nonisomorphic configurations of cubic modular robots. The novel method was implemented in C++providing the enu- meration of configurations up to 10 cubic modules which constitute an advance compared to the number of modules achieved in literature. The thesis principal contributions for the enumeration problem are discussed in greater detail in Section 1.3.

1.2.2 Assembly sequence planning: methodology In order to treat different classes of configurations, the thesis introduces three novel ASP. These ASP are based on graph theory tools, especially graph traversals. Also, they are designed to satisfy the 40 Chapter 1. Introduction accessibility condition stated by Paulos et al.[2] because it aggregates common modules mechanical restrictions. In these ASP, the target structure is modeled as an undirected graph in the adjacency list form. These ASP are structured with a main algorithm, which is different to each problem treated. The main algorithms have a recursive structure similar to the DFS search in a graph and they call two novel auxiliary procedures. First, it is explained how to apply these ASP to configurations composed by regular rectangles, i.e. for squares ones. Then, these ASP are extended for general rectangular modules. The major differences between the square case and other rectangular patterns are how the modules are connected to its neighbors and how many neighbors a module owns. In Chapter7, in order to assembly the target structure, the strategy of decomposing the target structure into substructures is ad- opted. Each substructure is considered free-flying and composed by any number of rectangular modules joined edge to edge, forming ar- bitrary shapes. This kind of substructure will be referred to as shape heterogeneous modular robot systems, or robot system, for simplicity. In Chapter8, the conventional modular construction is con- sidered, i.e. aggregating module by module to assembly the target structure. In this case, no previously assembled substructures are al- lowed. All the ASP proposed in this thesis were implemented C++and the results are shown in Chapter9. The principal contributions for the ASP problem are presented in the next section.

1.3 ORIGINAL CONTRIBUTIONS OF THIS THESIS

This section presents the thesis principal contributions for the enumeration and the assembly of modular robot configurations.

1.3.1 Contributions to the enumeration of modular robot configurations In the first part, the thesis deals with the enumeration problem, providing a complete and original method to enumerate cubic modular robot configurations. The principal contributions of this thesis for the enumeration problem can be summarized below.

• Chapter4 introduces a novel method for enumerating all noniso- morphic cubic modular robot configurations. 1.3. Original contributions of this thesis 41

• In Section 4.1, a novel way to determine a graph which captures the symmetries of a given cubic metamorphic robots is presented. Also, two novel algorithms, Algorithms1 and 15, are introduced. These algorithms allow to determine the graph representation directly from the configuration’s matrix representation.

• In Section 4.2, two results introduced by the author in the Sym- metry Method [7] are extended to cubic modules, allowing to de- crease the number of isomorphic configurations generated during the enumeration process.

• The novel method was implemented in C++providing the enumer- ation of configurations up to 10 cubic modules. These results are show in Section 4.3 and they constitute an advance compared to the number of modules achieved in literature.

1.3.2 Contributions to the Assembly Sequence Planning for modular robots In the second part, the thesis deals with the Assembly Sequence Planning (ASP) problem for modular robots. Three original ASP are introduced in this thesis which cover classes of target structures not solved in literature. The principal contributions of the thesis for the ASP problem can be summarized below.

• For configurations composed by robot systems, the thesis in- troduces two novel ASP for configurations without or with in- ternal holes. These ASP present two novel main algorithms: Al- gorithm4 and Algorithm7, respectively. These algorithms are based on novel rules introduced in this thesis. To the best of the author’s knowledge, this thesis is the first work that shows how to assembly target structures composed by shape heterogeneous modular robot systems.

• For modular construction, i.e. aggregating module by module to assembly the target structure, a novel ASP is introduced. This ASP has Algorithm8 as main algorithm. It can be applied for configurations with and without internal holes and it is based on novel rules which are also original contributions of this thesis.

• All three ASP introduced in this thesis call two novel auxiliary procedures: Algorithm5 (addEdge), which determines when a new robot system can be added to the growing structure and 42 Chapter 1. Introduction

Algorithm6 (deleteBranch), which gives a strategy to delete a not allowed robot system from the growing structure. These original auxiliary procedures are based on novel rules introduced in this thesis.

• The three ASP were implemented in C++and the results are shown in Section9. These ASP presented some advances compared to literature. To the best of the author’s knowledge, this thesis is the first work that shows:

– how to assembly target structures composed by shape het- erogeneous modular robot systems; – how to assembly planar target structures with narrow cor- ridors, i.e. corridors which are too narrow for a robot to traverse; – how to assembly configurations with internal holes, without narrow corridors, and choosing the ASP starting point; – how to assembly planar vertical structures.

• As a complementary result, this thesis presents a class of con- figurations that satisfies the necessary conditions stated by Seo, Yim e Kumar[11] and for which their algorithm can return an incorrect ASP.

All the ASP herein proposed satisfies the accessibility condition, i.e. any rectangular module cannot pass through a gap only as large as a side of a module between two physical robots already assembled in the structure.

1.4 THESIS OUTLINE

In Chapter2 a bibliographic review on the enumeration of modu- lar robot configurations is presented, focusing on the related works from which the proposed enumeration method for cubic modular robots is derived. Chapter4 introduces a novel method, original contribution of this thesis, for enumeration of all nonisomorphic cubic modular robot configurations. Chapter5 presents a bibliographic review on the assembly se- quence planning, focusing on the principal works in ASP for modular robots. 1.4. Thesis outline 43

Chapter6 presents a novel contribution to the ASP of Seo, Yim e Kumar[11]. In this chapter, a class of configurations that satisfies the necessary conditions stated by Seo, Yim e Kumar[11] and for which their algorithm can return an incorrect ASP is presented. Chapter7 presents two novel ASP. In this chapter, in order to assembly the target structure, the strategy of decomposing it into sub- structures is adopted. First, each substructure is considered free-flying and composed by any number of square modules joined edge to edge, forming arbitrary shapes, then, an extension to general rectangular modules is presented. Chapter8 present a novel ASP for modular construction, i.e. ag- gregating module by module to assembly the target structure. In this case, the novel ASP can be applied for general rectangular modules and also for vertical planar structures composed by cubic modules. Chapter9 presents the three novel ASP implementations results while Chapter 10 presents the conclusions and suggestions of further work. AppendixA, presents a brief review of the main topics of Group and Graph Theory applied in this thesis. AppendixB presents the algorithms from literature review. AppendixC presents a novel al- gorithm, original contribution of this thesis, introduced in Chapter4. This algorithm is used to obtain a graph representation for cubic mod- ular robots.

45

2 LITERATURE REVIEW: ENUMERATION OF MOD- ULAR ROBOTS’ CONFIGURATIONS

For a given number of modules, a modular robot composed by these modules present different configurations based on their relative coupling. Configurations are considered as distinct (nonisomorphic) when none of them is a rigid transformation of another, i.e. rotations, translations, reflections, or their combination [32]. The four configur- ations shown in Figure 2a are considered isomorphic, while the two configurations shown in Figure 2b are considered distinct.

(a) (b)

Figure 2 – A set of four isomorphic configurations (a), and a set of two distinct configurations (b).

The problem of enumerating all possible configurations which a modular robotic system can assume is a complex task. The number of configurations composed by n modules grows exponentially with n, thus the time required for an algorithm that lists all the configurations also grows exponentially [22]. Due to the huge number of configurations, several authors opted for enumerating only the distinct, i.e. nonisomorphic configurations, which a modular robotic system can assume [4,6–8, 22–24]. In other words, configurations can be organized in distinct classes, thus, ana- lysis of control strategies, mobility, stability and mass distribution, among others, can be performed for only one representative of each class. Then, the results can be extended to the other configurations belonging to the same class. This is the strategy adopted in this thesis, which provides a complete and original method to enumerate cubic modular robot configurations. 46 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

According to Jinguo et al.[23], configuration analysis is the first step to design a reconfigurable modular robot since configuration not only reflects the topology of the system but also has close relation- ship with the robotic flexibility and controllability. Thus, according to these authors, it is important to set up a library of the nonisomorphic configurations as a database for configuration design and control. The problem of enumerating all possible distinct arrangements of the modular robotic systems, given a number of modules, is called enumeration of modular robot configurations or, in short, enumeration of modular robots [4]. This problem was first addressed by Chen e Burdick[4]. These authors propose an algorithm for generating nonisomorphic assembly configurations of a n-link tree-like robot with different joint and link module types. Jinguo et al.[23] developed a technique to enumerate the noni- somorphic configurations composed by cubic modules. These modules have four connectors on its lateral surfaces, thus they have square lat- tice like 2D projection. Their technique is similar to the one presented by Chen e Burdick[4]. Chitta e Ostrowski[24] developed a technique to enumerate the nonisomorphic configurations of a modular robot and to generate gates for hybrid robots with wheels and legs. The distinct configurations are enumerated for a locomotion system consisting of a base with multiple ports to which wheel or leg modules can be attached. In this work, graph theory tools are used in order to determine if two configurations are isomorphic. Martins e Simoni[6] considered the enumeration of all noniso- morphic planar for metamorphic robots. In order to avoid repeated configurations in the process, the authors also used group and graph theory tools. They developed a constructive technique to determine all distinct configurations and presented the configurations for a small quantity of square and hexagonal modules. In [7], the author of this thesis developed a constructive tech- nique to enumerate all nonisomorphic modular robots composed by square modules. The technique is based on the directly recognition of the configurations’ symmetries. Also, the author introduced results which allow reducing the symmetries checking during the enumeration and an isomorphism test. In [8], the author of this thesis presented an enumeration method for square modular robots derived from the contributions of Martins e Simoni[6] and which employs two results introduced by the author 2.1. Contributions of Chen and Burdick 47 in [7]. Moreover, in this work, novel graph representations for square modular robots were introduced. Also, in order to extend the method to cubic modular robots, the author presented a novel way to determine a graph representation for cubic modular robots. It is important to notice that, in order to enumerate all non- isomorphic configurations of a modular robotic system, group theory tools are extensively used by the enumeration methods herein reviewed. These tools are also largely employed in the novel enumeration method to be introduced in this thesis. Therefore, AppendixA presents some basic definitions and examples of group theory. For further refer- ences, [6, 33–35] can be consulted.

2.1 CONTRIBUTIONS OF CHEN AND BURDICK

Chen e Burdick[4] introduced the enumeration problem for mod- ular robots. The authors propose an algorithm for generating noniso- morphic assembly configurations of an n-link tree-like robot with dif- ferent joint and link module types. According to Chen e Burdick[4]:

“A modular robotic system consists of joint and link mod- ules that can be assembled in a variety of configurations to meet different or changing task requirements. However, due to typical symmetries in module design, different as- sembly configurations may lead to robotic structures which are kinematically identical, or isomorphic”.

For example, Figure3 presents two isomorphic configurations composed by a prism with one revolute (R) and one helicoidal (H) joint. H R

H R

Figure 3 – Two isomorphic configurations composed by a prism with one revolute and one helicoidal joint [4].

These authors [4] were the first ones to use the kinematic graph in order to represent a modular robot link arrangement. For example, Figure 4a presents a modular robot and Figure 4b presents its kinematic 48 Chapter 2. Literature Review: Enumeration of modular robots’ configurations graph. The kinematic graph is obtained by associating each link to a vertex and each joint to an edge [4].

e3 v4 e2

v2 v1 v4 v2

e1 e3 e2

v1

v3 e1

v3 (a) (b)

Figure 4 – A modular robot (a) and its graph representation (b) [4].

In order to enumerate all nonisomorphic configurations with n links, the authors first generated all nonisomorphic trees with n links. Then, their method considered nonisomorphic joint arrangements. However, by introducing the joints in the enumeration process, they increased its complexity, thus they did not apply the method for configurations with more than five modules. Figure5 shows distinct (nonisomorphic) constructions of a 3-link robot obtained in [4]. Despite its inherent complexity, the method proposed by Chen e Burdick[4] was extended for Jinguo et al.[23] to cubic modules having four connectors on its lateral surfaces, i.e. modules with square lattice like 2D projection. Also, it inspired several works in the modular robot enumeration, as the works of Martins e Simoni[6] and author’s previous works [7,8] which are reviewed in the next sections.

2.2 CONTRIBUTIONS OF MARTINS AND SIMONI

Martins e Simoni[6] developed a technique for enumeration of all nonisomorphic planar modular robot configurations. Using graph theory tools, they were able to capture configurations symmetries in order to avoid partial generation of isomorphic configurations during the enumeration process. 2.2. Contributions of Martins and Simoni 49

Figure 5 – Distinct constructions of a 3-link robot [4].

In order to identify symmetries of the metamorphic robot system using graph tools, it is necessary to associate a graph to each modular robot structure. In order to obtain these graphs, Martins e Simoni [6] analyzed the structure’s kinematic chain. However, the kinematic chain is modeled in a different way than the one proposed by Chen e Burdick[4]. Also, different types of joints were not considered in the enumeration process as done by Chen e Burdick[4]. Martins e Simoni[6] analyzed two standard type of modules:

• square modules [5, 14, 15], Figure 6a, and

• hexagonal modules [5, 14, 16, 17], Figure 6b.

In the methodology proposed by Martins e Simoni[6], the square module is represented by a four-bar kinematic chain as shown in Fig- ure 7a. Similarly, the hexagonal module is represented by a six-bar kinematic chain as shown in Figure 7b. Figure 8a shows a metamorphic robot composed by two hexagonal modules, which were introduced by Pamecha et al.[5]. Figure 8b shows the configuration’s kinematic chain where labels 1 to 11 represent the links and the circles represent the joints. Figure 8c shows the graph obtained by Martins e Simoni[6]. This graph, called kinematic graph, is obtained by the kinematic chain by the following associations: links to vertices and joints to edges. 50 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

(a) (b)

Figure 6 – Two standard type of modules of planar metamorphic ro- bots.

(a) (b)

Figure 7 – (a) Kinematic chain of a single square module, (b) Kin- ematic chain of a single hexagonal module.

Thus, two vertices of the kinematic graph are adjacent whenever the corresponding links of the kinematic chain have a common joint [36]. The complete automorphism group for the graph in Figure 8c is composed by eight elements: σ1, σ2, σ4 = σ1 ◦ σ2, σ5 = σ1 ◦ σ3, σ6 = σ2 ◦ σ3, σ7 = σ1 ◦ σ2 ◦ σ3 and the identity element: σ8 = e.

 1 2 3 4 5 6 7 8 9 10 11  σ = 1 7 2 3 4 5 6 1 10 9 8 11

 1 2 3 4 5 6 7 8 9 10 11  σ = 2 1 6 5 4 3 2 7 8 9 10 11

 1 2 3 4 5 6 7 8 9 10 11  σ = 3 2 1 8 9 10 7 6 3 4 5 11 2.2. Contributions of Martins and Simoni 51

8 9 7 10 6 5 11 1 2 3 4

(a)

8 8 9 7 9 7 6 6 10 10 5 5 11 11 1 1 2 4 4 2 3 3

(b) (c)

Figure 8 – (a) A metamorphic robot composed by two hexagonal mod- ules, Pamecha et al.[5]; (b,c) are respectively the kinematic chain and the graph obtained by Martins e Simoni[6].

 1 2 3 4 5 6 7 8 9 10 11  σ = 4 7 6 5 4 3 2 1 10 9 8 11

 1 2 3 4 5 6 7 8 9 10 11  σ = 5 2 7 10 9 8 1 6 3 4 5 11

 1 2 3 4 5 6 7 8 9 10 11  σ = 6 6 1 8 9 10 7 2 5 4 3 11

 1 2 3 4 5 6 7 8 9 10 11  σ = 7 6 7 10 9 8 1 2 5 4 3 11 52 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

Figure9 shows the actions of σ1, σ2, σ3 and σ4 on the graph in Figure 8c. Let us analyze the orbits by the action of the automorphisms group on the graph G in Figure 8c. The orbit of the element 1 is the set of vertices to which 1 can be moved by the elements of G. As e(1) = 1, σ1(1) = 7, σ2(1) = 1, σ3(1) = 2, σ4(1) = 7, σ5(1) = 2, σ6(1) = 6 and σ7(1) = 6. Thus, O1 = {1, 2, 6, 7}. Applying a similar procedure, the orbits by the action of the automorphisms group are:

• O1 = O2 = O6 = O7 = {1, 2, 6, 7};

• O3 = O5 = O8 = O10 = {3, 5, 8, 10};

• O4 = O9 = {4, 9} e O11 = {11}. Martins e Simoni[6] stated that elements (links) in the same orbit, when connected to other elements, result in isomorphic config- urations. This fact will be demonstrated in Chapter3 and it is one contribution of this thesis. For example, links 3 and 5 in Figure 8a correspond to elements in the same orbit by the action of the auto- morphism group on the graph in Figure 8c. Figure 10 shows that if a new module is connected to link 3 or to link 5, isomorphic configura- tions are generated. According to Martins e Simoni[6] there are two types of links in the metamorphic robot system: binary and quaternary. Binary links are connected to two other links while the quaternary links are connec- ted to four other links. Thus, for the example in Figure9, the orbits O11 is composed by quaternary links while the other orbits are composed by binary links. An important remark is that new modules can only be added to binary links. For example, link 11 in Figure 8a is not binary, thus new modules cannot be attached to this not binary link. The authors [6] also introduced the concept of binary orbits. Binary orbits are orbits composed only by binary links. Considering the graphs obtained by the kinematic chain of each configuration and the concept of binary orbit, the authors proposed a procedure to enumerate the nonisomorphic planar metamorphic robot configuration. The procedure was summarized by Martins e Simoni[6] as: Step 1 Calculate the binary orbits of the metamorphic robot config- uration of the root. 2.2. Contributions of Martins and Simoni 53

10 8 9 1 9 7 6 2 8 10 11 5 11 3 7 1 4 4 2 6 3 5

(a) (b)

5 8 4 6 9 7 7 2 3 10 11 8 11 3 2 1 9 4 1 6 10 5

(c) (d)

Figure 9 – Actions of σ1 , σ2, σ3 and σ4 , respectively, on the graph in Figure 8c, Martins e Simoni[6].

Step 2 Assemble a new module with one element from each binary orbit, identified in the previous step, of the current metamorphic robot configuration.

Step 3 Run an (efficient) isomorphism test to eliminate the possible isomorphic configurations in each level of the tree.

Thus, the enumeration process follows a tree structure. In the root of the tree, a first module is placed. The following modules are added, one at a time, selecting just one representative for each binary orbit. Figure 11 illustrates this procedure for square modules. The authors presented their results limited to five square and five hexagonal modules. The results were shown in flowcharts, called 54 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

3 New Module New 5 Module

(a) (b)

Figure 10 – Two isomorphic configurations obtained by connect a new module to links in the same orbit. generation trees, as the one in Figure 11. In order to implement the algorithm, Martins e Simoni[6] used two freely available software: Nauty [37] and the Boost Graph Library [38]. Nauty (No AUTomorphisms, Yes?) [37,39], is a set of C language procedures for determining the group of automorphisms of a graph with colored vertices. Nauty also generates a canonically-labeled isomorph of the graph to assist in isomorphism testing. In the methodology proposed by the authors [6], the program Nauty [37, 39] is used for: • determining the binary orbits for each robot configuration and for • eliminating the isomorphic configurations in each level of the gen- eration tree as shown in Figure 11. On the other hand, the interface which generates the config- urations is based on graph structures provided by the Boost Graph Library [38]. The complexity of the enumeration method [6] is limited by com- plexity of the isomorphism test, i.e. it is exponential time (O(en)) 2.2. Contributions of Martins and Simoni 55

Level 1 Level 2 Level 3 Level 4 Level 5

Five Five binary binary orbits orbits

One One binary binary orbit orbit

Six binary orbits Two binary Three orbits binary orbits Ten binary orbits

Three Set of five square modules binary orbits

Figure 11 – Flowchart of the method proposed by Martins e Simoni[6] outlining the role of the group theory tools for enumera- tion configurations of the metamorphic robot. The dashed squares are the representatives of the binary orbits.

[40–42]. The other procedures, which are performed with the Boost Graph Library, have polynomial-time complexity (O(n)). According to [6], the method can be applied to parallel robots. A parallel robot is made up of an end-effector with n degrees of freedom, and of a fixed base, linked together by at least two independent kin- ematic chains. Actuation takes place through n simple actuators [43]. It is important to notice that the technique requires identifying the configuration’s kinematic chain. However, these kinematic chains can be difficult to identify. Robots can have different docking mechan- isms and can be arranged in different forms, implying that the joints and edges arrangements can differ drastically from robot to robot. Thus, it is difficult to design and automate a process which derives the kinematic chain for each configuration. Therefore, it is difficult to design and automate a process to obtain the kinematic graph. Thus, Salvi et.al developed novel techniques to obtain the configurations sym- 56 Chapter 2. Literature Review: Enumeration of modular robots’ configurations metries without evaluating the kinematic chain.

2.3 CONTRIBUTIONS OF SALVI ET. AL

In [7,8], the author developed two methods to enumerate all non- isomorphic square metamorphic robots. These methods, implemented in C++, provide the enumeration of configurations up to 12 modules. These results constituted an advance compared to the number of mod- ules achieved in literature [4,6]. The first proposed method is called Symmetry Method and the second one, Orbital Method. These meth- ods are reviewed in details in the next subsections because they will be extended in this thesis to cubic modules.

2.3.1 Symmetry Method

The first method introduced by Salvi et al.[7] is called Sym- metry Method. This method is based on the direct recognition of the configurations’ symmetries. It is a recursive method, i.e. the configur- ations with n + 1 modules are obtained from the configurations with n modules by adding a new module. Initially, a matrix representation named ID is introduced. In this matrix, 1 at entry (i, j) represents a square module in position (i, j) and 0 represents an empty space. A coordinate system is also introduced, starting at the centroid of each configuration. Figure 12a shows the association of the coordinate system to a given configuration. Figure 12b shows the ID matrix of this configuration.

Oy

  O Ox 1 0 0 1 ID =  1 1 1 1  (a) 1 0 0 1 3×4 (b)

Figure 12 – (a) A configuration and its coordinate system; (b) ID Mat- rix. 2.3. Contributions of Salvi et. al 57

2.3.1.1 Symmetry detection In order to determine the configuration’s symmetries, the cir- cumscribed rectangle is considered, as shown in Figures 13a and 13b. Thus, a modular robot configuration composed by square modules can present the symmetries of the square or the rectangle that contains it, depending on the modules’ arrangement.

(a) (b)

Figure 13 – (a) Configuration circumscribed by a non-regular rect- angle; (b) Configuration circumscribed by in a square, i.e. regular rectangle.

For the configurations circumscribed by a non-regular rectangle, the possible symmetries are: identity, reflections on Ox and Oy and the rotation of π radians around the origin. For the configurations circum- scribed by a square, the possible symmetries are: identity, reflections π on Ox, Oy and on the square wrap diagonals and the rotations of 2 , π 3π and 2 radians around the origin. Salvi et al.[7] introduced novel rules to verify what symmetries the configuration presents. For example, the configuration in Figure 14 is symmetrical with respect to the Ox axes. In order to verify this type of symmetry, Proposition1 was intro- duced [7]. In this proposition, Llimite is defined as the line correspond- l l−1 ing to the Ox axes. Thus, Llimite = 2 − 1, if l is even, Llimite = 2 , if l is odd [7].

Proposition 1. Consider the ID = [aij]i=0,··· ,l−1 . If, for all i ∈ j=0,··· ,l−1 {0, 1, ..., Llimite} and for all j ∈ {0, 1, ..., c − 1},

aij = a(l−i−1)j (2.1) the configuration is symmetrical with respect to the Ox axis.

For each of the possible symmetry, the author introduced a pro- position in a similar manner presented for the Ox symmetry. The set 58 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

H

Oy F G U V W D E

Ox V 0 W 0 D0 E0 U 0 F 0 G0 H0

Figure 14 – Configuration symmetrical with respect to the Ox axes. of these propositions constitutes a complete test for checking the con- figuration’s symmetries [7].

2.3.1.2 New modules addition In order to avoid the generation of isomorphic configurations, a new module is added only to non-symmetric positions, respecting the rules stated by the author in [7]. For example, the configuration in Figure 15 presents the iden- tity symmetry and also the reflection on Oy. The sets of points which 0 0 are symmetric to each other are: SP = {P,P }, SQ = {Q, Q }, SM = 0 0 0 0 0 {M,M }, SN = {N,N }, SO = {O,O }, SR = {R,R }, SW = {W, W }, SS = {S} e ST = {T }. Thus, a new module can only be added to one representative of each of these sets. For example, points P, Q, M,N, O, R, W, S, T can be chosen. However, the determination of these representatives of each set can be performed in a simpler way. As the configuration is symmetrical with respect to Oy, each point at the left of Oy has a symmetrical representative at its right. Thus, only points at the left or at the right of Oy can be considered. These regions at left or at right of Oy are called addition regions for the reflection in Oy [7]. 2.3. Contributions of Salvi et. al 59

O P y P 0 M O O0 M 0

W S W 0 N R R0 N 0 Ox Q T Q0

Figure 15 – Example of a configuration symmetric over Oy.

For the other types of symmetry, the author presented a way to determine the addition regions and a way to determine the complete addition region if a configuration presents more then one symmetry. A more detailed explanation is presented in [7].

2.3.1.3 Two results about the enumeration of square modu- lar robots A theorem and a proposition about the enumeration of square modular robots can be used to decrease the number of symmetries checking during the process of enumeration. These results were presen- ted by Salvi et al.[7] and are herein discussed. Theorem 2: In the enumeration process of nonisomorphic con- figurations of square modular robots, the configuration with k aligned modules k ∈ N, k ≥ 3 can generate only the configuration with k + 1 aligned modules without loss in the total process. Proposition 2: In the enumeration process of nonisomorphic square modular robots, the configurations with IDm,n, m, n > 1, IDi,j =6 0 for all i ∈ {0, 1, ..., m − 1} and for all j ∈ {0, 1, ..., n − 1} can be forbidden of generating a child without any loss in the total process. Here it is only discussed the relevance of Theorem 2 and Propos- ition 2 in the enumeration process. In Figure 16, the configurations in gray is discarded due to iso- morphism with other generated configurations. Also, it is important to notice that the dashed squares in this figure are the ones on the 60 Chapter 2. Literature Review: Enumeration of modular robots’ configurations addition region, which is determined by the propositions introduced by Salvi et al.[7].

Level 1 Level 2 Level 3 Level 4 Level 5 Addition Region

No children! Proposition 2 Addition Addition Region Region

Addition Addition Region Region Addition One child! Region Theorem 2 One child! Theorem 2

Set of five square modules

Figure 16 – Isomorphic free generation with the results of Theorem 2 and Proposition 2. The dashed squares are the ones on the addition region, which is determined by the propositions introduced in [7].

The next section presents the isomorphism test used for this task.

2.3.1.4 Isomorphism Test The isomorphism test introduced by Salvi et al.[7] is composed by three sub-tests. In the original paper, completed algorithms and implementation details were presented.

1 2 1. Dimension test: Given two ID matrices, IDm×n and IDl×k, if the conditions (i) and (ii) are false, the configurations are noni- somorphic.

i) m = l and n = k; ii)m = k and n = l. 2.3. Contributions of Salvi et. al 61

1  Consider for instance the configurations ID1,3 = 1 1 1  1 1  and ID2 = . According to the dimension test, the 2,2 0 1 configurations are nonisomorphic. However, if we consider con-  1 1 1   1 1 1  figurations ID4 = and ID5 = , 2,3 0 0 1 2,3 0 1 0 the dimension test is inconclusive.

1 2 2. Neighborhood test: Let IDm×n and IDl×k be two square modu- lar robot configurations. If in ID1 there is a module connected to n other modules and for ID2 that condition is not valid, the configurations are nonisomorphic. Consider the configurations ID4 and ID5. For the neighborhood test, the configurations are nonisomorphic. But, if configurations  0 1 0  ID5 and ID6 = are considered, the neighbor- 2,3 2,3 1 1 1 hood test is inconclusive. Configurations ID5 and ID6 are in fact isomorphic (one configuration can be obtained by other through a rotation, for example).

3. Comparison test: checks if a configuration is a rotation, transla- tion, or reflection of another. The outline of this test is presented in Algorithm 11, AppendixB. The test follows a cascade struc- ture. Details are presented in [7].

The complete isomorphism test structure, composed by the three sub-tests presented, is outlined in Figure 17. The complexity of the enumeration method [7] depends on the complexity of the isomorphism test. Each matrix comparison can be performed in O(n2), however, the procedure must be performed for each pair of configurations generated before the isomorphism test. As the number of configurations with n modules grows exponentially with n [22], the complexity of the enumeration method [7] is exponential (O(en)). The other procedures have (O(n2)) complexity.

2.3.1.5 Outlines of the Symmetry Method The Symmetry Method is a recursive method and starts with only one module. In each iteration, the conditions of Theorem 1 and Proposition 1 are verified. If they are verified, the method proceeds as stated by these results. Otherwise, the method checks the config- uration’s symmetries. After checking the symmetries, a new module 62 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

Start

ID1 and ID2

yes Dimension no Test ID1 and ID2

are no Neighborhood Nonisomorphic Test Comparision no yes Test yes

ID1 and ID2

are Isomorphic

Figure 17 – Isomorphism test structure, proposed by Salvi et al.[7]. is added only to non-symmetrical positions, i.e. to each of the posi- tions in the addition region. Finally, the method checks for isomorphic configurations. The method can be summarized as:

Step 1 Verify the conditions of Theorem 1/Proposition 1. If these conditions are satisfied, proceed as stated in Theorem 1 or in Proposition 1. Otherwise, go to Step 2; Step 2 Determine the configurations symmetries, Section 2.3.1.1; Step 3 Add a new module to the positions into the addition region, Section 2.3.1.2; Step 4 Run the isomorphism test, Section 2.3.1.4, in order to eliminate isomorphic configurations. 2.3. Contributions of Salvi et. al 63

Salvi et al.[7] presented the pseudo-codes used to implement the Symmetry Method’s steps. The Symmetry Method was implemented in C++, providing the enumeration of configurations up to 12 mod- ules. This constitutes an advance compared to the number of modules achieved in literature [4,6]. The results are shown in Table1, where A000105 [44] is the number of polyominoes with n squares, a correlated problem, as will be explained in the following lines. As evidenced in Table1, the results match with those reported by [45,46] for an equivalent problem: the enumeration of polyominoes. A is a collection of equal-sized squares in a plane, joined along complete edges [45]. In the same way, a is a plane figure constructed by joining together identical basic polygons. More specific names have been given to resulting from specific basic polygons, such as: polyomino (square), (regular ), and polydrafter (drafting with angles of 30◦, 60◦ and 90◦). Polyominoes’ enumeration approaches focus on counting and not on listing configurations, mainly because the growth in the number of distinct configurations is a considerable limitation for the process. For example, Redelmeier[45] took 6959.665 CPU hours to enumerate free polyominoes up to 24 modules. Currently, parallel versions the enu- meration algorithm proposed by [45] are being implemented in clusters and the results are shown in The On-Line Encyclopedia of Integer Se- quences, sequence A000105 [44]. Regard that, for modular robots it is important to actually know the whole configurations set. Thus, it is necessary to list all the nonisomorphic configurations, as done in the proposed procedure. It is important to notice that the computer simulations of the Symmetry Method were performed in a 4GB, Intel Core I5, 1.6 GHz machine. Also, the algorithm was allowed to run for a maximum of 30 minutes. The next section reviews the second enumeration method presen- ted by the author for square modular robots.

2.3.2 Orbital Method The second method proposed by Salvi et al.[8] is called Or- bital Method. This method is derived from the methodology proposed by Martins e Simoni[6] differing on the graph modeling and also on the isomorphism test. Furthermore, this second method also employs two results presented by the author [7] in the Symmetry Method. As in Martins e Simoni[6], the Orbital Method employs a graph representation in order to captures the configuration’s symmetries. How- 64 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

Table 1 – Number of nonisomorphic configurations with n square mod- ules.

№ of square modules № of Configurations [7] A000105 [44] 1 1 X 2 1 X 3 2 X 4 5 X 5 12 X 6 35 X 7 108 X 8 369 X 9 1285 X 10 4655 X 11 17073 X 12 63600 X 13 238591 14 901971 15 3426576 16 13079255 17 50107909 18 192622052 19 742624232 20 2870671950 21 11123060678 22 43191857688 23 168047007728 24 654999700403 25 2557227044764 26 9999088822075 27 39153010938487 28 153511100594603

ever, in Martins e Simoni[6], in order to build the graph representation of a planar modular robot, it is necessary to identify the corresponding kinematic chain. This task needs to be done manually. Furthermore, these kinematic chains can be difficult to identify because robots have different docking mechanisms and can be arranged in different forms. Thus, it is difficult to design and automate a process which obtain the 2.3. Contributions of Salvi et. al 65 kinematic chain for each configuration. On the other hand, the Orbital Method primarily focuses on a set of rules for determining the graph representation of a planar square based modular robot without analyzing the configuration’s kinematic chain. Two new graphs were introduced in this work, in order to rep- resent a square modular robot configuration. They are referred to as Graph I and Graph II. These graphs are presented in the next section.

2.3.2.1 Graph representations for square modular robots The two graph representations for square modular robots intro- duced by Salvi et al.[8] are reviewed in this section. These graph representations are obtained without analyzing the kinematic chain. Furthermore, vertex construction is the same for both graphs and they only differ in the set of edges. Thus, vertices determination is first explained. Given a square modular robot configuration, each square’s side is associated to a vertex. An example is shown in Figure 18.

(a) (b)

Figure 18 – (b) vertices for the configuration in (a).

In both graphs, each vertex is labeled just once, following the clockwise convention. Also, each configuration is represented by its ID matrix, as in the Symmetry Method. For example, consider the configuration given by the ID matrix,  1 0 1  ID = . The points labeled with numbers 1 to 16 in 1 1 1 Figure 19 are the vertices associated to this configuration. In the Orbital Method, in order to obtain the vertices from the ID matrix, the author introduced another matrix, the Mgrafo Matrix. The matrix which contains the graph labels is called Mgrafo. Obtaining this matrix is the first step to achieve the graph representa- tion of a square modular robot configuration. The graph’s vertices are created in this step. Given the configuration in Figure 19, graph’s labels are stored into a matrix, Mgrafo matrix: 66 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

1 5 4 2 8 6 3 7 12 11 9 13 15 10 14 16

Figure 19 – Configuration that exemplifies how the Mgrafo matrix is obtained.

 [1, 2, 3, 4] [0, 0, 0, 0] [5, 6, 7, 8]  Mgrafo = [3, 9, 10, 11] [12, 13, 14, 9] [7, 15, 16, 13] . Graph’s labels are stored in the matrix depth and, for each mod- ule, the labeling follows the clockwise convention. The Algorithm 12, AppendixB, resumes the discussion above, and presents the steps to obtain the Mgrafo matrix for any configur- ation in the ID form. With the Mgrafo matrix, i.e. with the graph’s vertices, it is possible to obtain the two graphs introduced by Salvi et al.[8]. The first graph, called Graph I, considers that, if two square’s sides are adjacent, the vertices that represent them must also be ad- jacent. So, it is necessary to create edges between the vertices that represent adjacent squares’ sides because two vertices are adjacent if, and only if, there is an edge between them. Consider the configuration in Figure 20a and the Graph I of that configuration shown in Figure 20b. Each vertex is labeled just once, following the clockwise convention. It is important to notice that the graph satisfies the necessary condition imposed by Martins e Simoni[6] for a correct graph repres- entation: whenever a new module is connected to two or more vertices from a same orbit, the resulting configurations are isomorphic. How- ever, this graph is not obtained from the kinematic chain, as the one used by Martins e Simoni[6]. For the graph shown in Fig. 20 the orbits by the action of the graph automorphism group are:

• O1 = {1}; • O5 = {5, 11};

• O2 = {2, 4}; • O6 = {6, 9};

• O3 = {3}; • O7 = {7, 13}; 2.3. Contributions of Salvi et. al 67

1 1 4 2 4 2 3 5 3 11 5 11 8 12 8 6 9 12 6 9 7 10 13 7 10 13

(a) (b)

Figure 20 – (b) Graph I associated to the configuration in (a).

• O8 = {8, 12}; • O10 = {10}.

The obtained orbits represent the set of vertices which generates the same configuration if a new module is added. The Algorithm 13, AppendixB, presents the main steps to ob- tain the Graph I from the Mgrafo matrix. Graph II is obtained by taking into account the upper or lower lateral neighbors of each vertex. For example, Figure 21 presents the Graph II for the configuration in Figure 20 (a).

1

4 2 5 3 11

8 12 6 9 7 10 13

Figure 21 – Graph II associated to the configuration in 20 (a).

As said before, two graphs vertices are neighbors if there is an edge between them, thus: • edge (4, 5) identifies the vertex 4 left-lower neighbor: the vertex 5, 68 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

• edge (2, 11) identifies the vertex 2 right-lower neighbor: the vertex 11.

Graph II in Figure 21 presents the same orbits by the action of the graph automorphism group as the Graph I in Figure 20b. Thus, both graphs are able to capture the symmetries of the configuration in Figure 20a, as desired. Figure 22 (b) shows the Graph II for the configuration in Fig- ure 22 (a).

N W 1 E S 1 N N W E W E N S S W E N N N N S W E W E W E W E S S S S N N W E W E S S (a) (b)

Figure 22 – (a) Graph I associated to the configuration in (b).

Analyzing the Figure 22, it can be concluded that Graph II con- siders all diagonal neighbors above each northern vertex and all diag- onal neighbors below each southern vertex. The Algorithm 14, AppendixB, presents the main steps to ob- tain the Graph II from the Mgrafo matrix.

2.3.2.2 Outlines of the Orbital Method The steps of the Orbital algorithm are:

Step 1 Given a configuration in the ID form, verify the conditions of Theorem 1/ Proposition 1, Section 2.3.1.3. If the conditions are satisfied proceed as Theorem 1/Proposition 1, otherwise, go to Step 2;

Step 2 Choose a graph representation (Graph I or Graph II, Sec- tion 2.3.2.1); 2.3. Contributions of Salvi et. al 69

Step 3 Calculate the binary orbits of the configuration; Step 4 Assemble a new module with one element from each binary orbit, identified in the previous step, of the current modular robot configuration; Step 5 Run the isomorphism test presented in Section 2.3.1.4.

Figure 23 illustrates the procedure. Level 1 Level 2 Level 3 Level 4 Level 5 Orbits Graph I or II

No children! Orbits Proposition 2 Graph Orbits I or II Orbits Graph Graph I or II I or II Orbits Graph I or II

Orbits Graph One child! I or II Theorem 2 One child! Theorem 2

Set of five square modules

Figure 23 – Flowchart of the enumeration method proposed by Salvi et al.[8].

The Orbital Method was implemented in C++. The vertices or- bits were determinated with Nauty software [37, 39]. For 12 square modules the number of nonisomorphic configurations obtained is shown in Table1. The complexity of the enumeration method [8] is determined by complexity of the isomorphism test, i.e. it is exponential time (O(en)) [40–42]. The other procedures have (O(n2)) complexity. It is important to regard that only the number of obtained con- figurations is presented here, but the implemented algorithm returns the complete list of the nonisomorphic configurations. For example, the obtained configurations with 4 modules are: 70 Chapter 2. Literature Review: Enumeration of modular robots’ configurations

 ID1 = 1 1 1 1

 1 0   1 0  ID2 =  1 1  ID4 =  1 0  1 0 1 1

 0 1   1 1  ID5 = . ID3 =  1 1  1 1 1 0

In this literature review, different graph representations designed to capture the configurations’ symmetries were analyzed. These rep- resentations were introduced in order to verify if two configurations are isomorphic and in order to determine novel positions for adding an incoming module. Also, in order to avoid generating isomorphic con- figurations during the enumeration process, the incoming modules are assembled with one element from each binary orbit. This procedure was originally presented by Martins e Simoni[6] who stated that elements (links) in the same orbit when connected to other elements result in isomorphic configurations. However, they did not present a formal proof of this fact which has been addressed by the author in [8]. This proof is introduced in the next chapter and it is an original contribution of this thesis. 71

3 NOVEL CONTRIBUTIONS TO THE ORBITAL METHOD

Martins e Simoni[6] and Salvi et al.[8] presented different graph representations designed to capture the configurations’ symmetries. These representations were introduced in order to verify if two configurations are isomorphic and in order to determine novel positions for adding an incoming module. Also, in order to avoid generating iso- morphic configurations during the enumeration process, the incoming modules are assembled with one element from each binary orbit. This procedure was originally presented by Martins e Simoni[6] who stated that elements (links) in the same orbit when connected to other elements result in isomorphic configurations. However, they did not present a formal proof of this fact. This proof is herein provided and it is an original contribution of this thesis. Consider a configuration and two links a and a0 symmetric by some configuration’s symmetry. It will be shown that if a new mod- ule is connected to a and a new module is connected to a0, obtaining two novel configurations, the novel configurations are isomorphic and the symmetry relating a and a0 is an isomorphism between the novel configurations. An example is shown in Figure 24. In Figure 24a, the square sides a and a0 are symmetric in relation to an axis v. The configura- tion in Figure 24b is obtained by adding a new module to a and the configuration in Figure 24c is obtained and adding a new module to a0. The configurations in Figure 24b and in Figure 24c are iso- morphic. In fact, as evidenced in Figure 25, these configurations are related by a reflection on v, the symmetry originally relating a and a0 in Figure 24a. Let Q0 be the original square in Figure 24a, Q1 be the square 0 added to a in Figure 24b and Q2 be the square added to a in Figure 24c. It can be demonstrated that configuration Q2Q0 is the reflection on v of Q1Q0. First, Q0 in both configurations correspond to the original square 0 0 in Figure 24a. As the reflection of a on V is a and a is a side of Q1, a 0 must be one of the sides of Q1, the reflection of Q1 on v. 0 Q0 in Q2Q0 is one of the two squares whit side a , the other 0 one is Q2. It can be shown that Q1 = Q2. Suppose, by absurd, that 0 0 Q1 = Q0. Then, the maximum distance between two points in Q1Q0 is the measure of the square diagonal. However, in the original con- figuration Q1Q0, the maximum distance between two points is greater 72 Chapter 3. Novel contributions to the Orbital Method

a 0 a 0 a a0 a a

v v v

(a) (b) (c)

Figure 24 – (a) Sides a and a0 are symmetric in relation to v; (b) and (c) are isomorphic configurations obtained by adding a new module to the sides a and a0of the square in (a), respect- ively.

a a0

v

a a0

Figure 25 – The configurations obtaining by adding a new module to a and to a0 are related by a reflection on v. than this value (because this configuration is constituted by two squares side by side). This is an absurd because the reflection on v is a rigid transformation and therefore it preserves the relative distances. Thus, 0 Q1 = Q2. Next, two novel propositions are introduced herein. The first one formalizes the previous discussion for any type of regular 73 or regular and the second one extends the discussion to configuration composed by any number of regular polygon (polyhedron) modules.

Proposition 2. Let Q0 be a regular polygon (polyhedron) and let π be a symmetry of Q0. Consider a side (face) a and its symmetric by 0 π, side (face) a . If a new module Q1 is connect to a, obtaining a 0 configuration Q1Q0, and a new module Q2 is connect to a , obtaining the configuration Q2Q0, then π takes Q1Q0 in Q2Q0.

Q0 in both configurations corresponds to the original regular polygon (polyhedron). The symmetry π takes side (face) a of Q1 to 0 0 0 the side (face) a . Thus, a must be one of the sides (faces) of Q1. Q0 in Q2Q0 is one of the two regular polygons () of 0 side (face) a , the other polygon (polyhedron) is Q2. It can be shown 0 0 that Q1 = Q2. Suppose, by absurd, that Q1 = Q0. Then, the maximum 0 distance between two points in Q1Q0 is the measure of the regular polygon (polyhedron) diagonal. However, in the original configuration Q1Q0, the maximum distance between two points is greater than this value (because this configuration is constituted by two regular polygons (polyhedrons) side by side). This is an absurd because π is a rigid transformation, and therefore it preserves the relative distances. Thus, 0 Q1 = Q2. The result implies that π takes Q1Q0 to Q2Q0. The next result extends the discussion to configuration composed by any number of regular polygon (polyhedron) modules.

Proposition 3. Let A be modular robot configuration composed by regular polygons (polyhedrons) and let π be a symmetry of A which takes the sides (faces) of A to a relabeled configuration B. Consider a polygon side (polyhedron face) a ∈ A which is taken to a polygon side (polyhedron face) a0 ∈ B. If a novel module is added to a ∈ A 0 obtaining configuration A1 and a novel module is added to a ∈ B obtaining configuration B1, then π takes A1 to B1.

Consider a side (face) a belonging to a module Q0 ∈ A and 0 0 0 Q0 ∈ B the symmetrical of Q0 by π. Consider also a ∈ Q0 being the symmetrical of side (face) a ∈ Q0. Let A1 be the configuration obtained by adding a new module Q2 to side (face) a of configuration A and let B1 be the configuration 0 obtained by adding a new module Q3 to side (face) a of configuration B. 74 Chapter 3. Novel contributions to the Orbital Method

By hypotheses, π takes A to B. In order to prove that π takes A1 to B1, it can be shown that by applying π to A1, the new module Q2 ∈ A1 is taken to the new module Q3 ∈ B1. 0 Consider the sub-configurations Q0 ∈ A and Q0 ∈ B. The sub- 0 configurations Q2Q0 ∈ A1 and Q3Q0 ∈ A2 are obtained by adding a 0 0 novel module to symmetrical sides by π with a ∈ Q0 and a ∈ Q0, 0 Proposition2 implies that Q2Q0 = Q3Q0 thus, Q2 = Q3. Figure 26 shows an example of Proposition3. In Figure 26a, sides a and a0 are symmetric by a 90° rotation around K. Figure 26b shows that by adding a novel module to a and then applying a 90° rotation around K, the configuration where a novel module is added to a0 is obtained. It is important to notice that in Proposition3, if configuration B, which is a relabeling of A, is considered as an independent config- uration, then function π can be interpreted as a rigid transformation taking configuration A to a configuration B. Therefore, π is as an isomorphism taking configuration A to configuration B. Next chapter, Chapter4, introduces an extension of the Orbital Method, original contribution of this thesis, for the enumeration of cubic modular robot configurations. In Section 4.4 is demonstrated that the Orbital Method terminates and it is sound and complete. 75

K

a

a0

(a)

K

(b)

Figure 26 – (a) Sides a and a0 are symmetric by a 90° rotation around K; (b) shows that by adding a novel module to a and then applying a 90° rotation around K, the configuration where a novel module is added to a0 in (a) is obtained.

77

4 NOVEL ENUMERATION METHOD FOR CUBIC MODULAR ROBOTS

In this chapter, the Orbital Method [8], reviewed in Section 2.3.2, is extended to enumerate configurations composed by cubic modules. This extension is an original contribution of this thesis and constitutes a novel method to enumerate cubic modular robots’ configurations. First, similar to the planar case presented in Section 2.3.2, the cubic modular robot configurations are represented by an ID mat- rix. However, for cubic modular robots, the ID matrix is a three- dimensional matrix. In this matrix, 1 represents a cubic module and 0 represents an empty space. For example, for the configuration in Figure 27a, the three-dimensional ID matrix is given in Figure 27b.

s (a)

0 0 1 0 0 1 1 1 0 1 0 0 (b)

Figure 27 – (a) A configuration composed by cubic modular robots; (b) the configuration’s three-dimensional ID matrix.

The primary concern is to state a set of rules for determining the graph representation of a cubic modular robot without analyzing 78 Chapter 4. Novel enumeration method for cubic modular robots configuration’s kinematic chain. This novel graph is presented in the next subsection.

4.1 NOVEL GRAPH REPRESENTATION FOR CUBIC MODULAR ROBOTS

This section introduces a set of rules for obtaining the graph representation of a cubic modular robot without analyzing the con- figuration’s kinematic chain. These rules represent an original contri- bution of this thesis. Also, two novel algorithms for determining the proposed graph directly from the configuration’s ID matrix are herein introduced. These algorithms are presented in greater details in Ap- pendixC, but their bases are discussed in this section. In order to determine graph representations for cubic modular robots, two related problems are considered: the representation of poly- and the representation of cubic crystal system. A polycube is a solid figure formed by joining one or more equal cubes face to face. For this kind of structures, some graph represent- ations are well established in literature and can be extended to cubic modular robots. First, let us consider the cubical graph, represented in Figure 28a. The cubical graph is the graph corresponding to the connectivity of a . In a similar manner, a polycube graph is a finite subgraph of the cubic grid graph [47]. An example of a polycube graph is shown in Figure 28b.

(a) (b)

Figure 28 – (a) The cubical graph; (b) A polycube graph.

Polycube graph were first introduced for , but they can be used to identify a cubic modular robot symmetry. 4.1. Novel graph representation for cubic modular robots 79

Consider a polycube P and its polycube graph G. Each vertex of the graph G is also a vertex of some cube in P . Consider a symmetry π of the polycube P . As π is a rigid transformation, it preserves the relative distances among the points in P . Thus, π permutes the vertices of P maintaining their neighborhood relations. As shown in Figure 28b, the polycube graph models the neigh- borhood relations among the vertices of P . In fact, for each pair of neighbor vertices in P there exists an edge in G connecting these ver- tices. Therefore, the action of the automorphism group over the vertices of G is the same as the action of the symmetry group over the vertices of P . Thus, the polycube graph can be used to identify configuration’s symmetry. However, with this representation each face cannot be correlated with a single vertex. Thus, it is difficult to determine symmetric faces and to apply the enumeration strategy presented by the author in the Orbital Method [8]. As a first solution to this problem, this thesis suggests the adop- tion of the face-centered cubic cell lattice. This representation is shown in Figures 29.

(a) (b)

Figure 29 – (a) The face-centered cubic cell lattice.; (b) Graph repres- entation of a cubic modular robot using the cell lattice in (a).

The face-centered lattice has lattice points at the eight corners of the unit cell plus additional points at the centers of each face of the unit cell [48]. Thus, the original problem for the polycube graph representation can be easily solved by considering that each cubic face is represented by its center point. 80 Chapter 4. Novel enumeration method for cubic modular robots

Consider a graph G composed of face-centered cells which repres- ents a polycube P with n cubes. Each vertex in G represents a cube’s vertex or the middle point a cube’s face. It is important to notice that: • if a vertex v in G represents a cube’s vertex, it has degree 6, • if a vertex v in G represents the middle point a cube’s face, it has degree 4. Therefore, an automorphism of G cannot relate a cube’s vertex to a point representing the middle point a cube’s face. Consider an automorphism π of G and the set of vertices of G which can be related to cube’s vertices. As previously stated, π takes cube’s vertices to cube’s vertices. Also, as in the polycube case, the face-centered cells capture all the neighborhood relations among cubes’ vertices. Thus, π permutes cubes’ vertices maintaining their neighborhood relations. Therefore, in order to determine the effect of π over all the vertices in G, the effect of π over vertices representing middle point of cubes’ faces must be determined. Consider a point f representing the middle point a cube’s face with vertices a, b, c, d. Suppose that the automorphism π takes a to a0,b to b0,c to c0, d to d0 and f to f 0. As π is an automorphism of G, f 0 must be a neighbor of a0, b0, c0 and d0. Also, f 0 cannot be related to a cube’s vertex, thus f 0 is related to the middle point of the cube’s face with vertices a0, b0, c0, d0. Thus, an automorphism π of a graph G composed of face-centered cells has the following properties:

• permutes cubes’ vertices maintaining their neighborhood rela- tions, • permutes the vertices representing the middle point a cube’s face maintaining face incidence, i.e. if f represents the middle point of a face with vertices a, b, c, d, then, f 0, the image of f by π, represents the middle point of the face with vertices a0, b0, c0, d0, the images of a, b, c and d by π.

It is important to notice that the effects described above cor- respond to the effects of the polycube symmetry group over the set composed by cubes’ vertices and the middle points of each cube’s face. Thus, the graph G composed of face-centered cells captures configura- tion’s symmetry. Also, as this kind of graph presents a vertex for each cube face, it can be used to determine symmetric faces. Thus, the enu- meration strategy presented by the author in the Orbital Method [8] 4.1. Novel graph representation for cubic modular robots 81 can be extended to the cubic case using the face-centered lattice rep- resentation. However, the face-centered lattice representation considers a total number of vertices larger than the number of cubic faces. Thus, another graph representation for cubic modular robots is introduced by the au- thor in [8]. This representation considers the same number of vertices and cubic faces and relies in the dual representation of a polycube. According to Tarini et al.[9]:

“Given an initial polycube domain P = {Pi}, the topo- logy of the polycube P is defined by its dual graph DM = {DV,DE}. DV = {dv1, . . . , dvn} are nodes corresponding to rectangle subpatches of Pi. DE is a set of edges: an edge (dvi, dvj) is in DE, if Pi and Pj are adjacent to each other. Also, two polycubes P and Q are topologically equivalent if their dual graphs DP and DQ are isomorphic”.

Figure 30 shows part of the dual graph corresponding of a poly- cube configuration composed by three cubes [9].

Figure 30 – Part of the dual graph corresponding to one facet (red node) and its neighboring facets (blue node) [9].

Consider a polycube P and its dual graph G. Each vertex of the graph G is a face of some cube in P . Consider a symmetry π of the polycube P . As π is a rigid transformation, it preserves the relative distances among the points in P . Thus, π permutes the faces of P maintaining their neighborhood relations. As shown in Figure 30, the dual graph models the neighborhood relations among the faces of P . In fact, for each pair of neighbor faces in P there exists an edge in G connecting these faces. Therefore, the action of the automorphism group over the vertices of G is the same as the action of the symmetry group over the faces of P . Thus, the dual 82 Chapter 4. Novel enumeration method for cubic modular robots graph can be used to identify configuration’s symmetry. Furthermore, as this kind of graph presents a vertex for each cube face, it can be used to determine symmetric faces. Thus, the enumeration strategy presented by the author in the Orbital Method [8] can be extended to the cubic case using the dual graph representation. It is important to notice that the dual graph representation is used by Tarini et al.[9] to determine if two polycube configurations are isomorphic, i.e. if a configuration is a rigid transformation of the other. In this thesis, the dual representation is extended to cubic mod- ular robots. Also, the dual representation is used not only to determine if two cubic modular robots are isomorphic but also to determine the symmetry of a given cubic modular robot configuration. This repres- entation for cubic modular robots was first introduced by the author in [8]. Thus, in order to determine a graph which captures the sym- metry of a given cubic modular robot, the following associations are performed:

1. A vertex to each cube’s face;

2. An edge to connect the faces that share a common square side.

Figure 31 presents an example of these associations.

7 1

6 11 8 2 4 5 10

9 3

16 14 12 15

13

Figure 31 – A cubic modular robot and its graph representation. 4.1. Novel graph representation for cubic modular robots 83

Considering the graph in Figure 31, the orbits by the action of the graph automorphism group over the vertices are:

• O1 = {1, 4}; • O8 = {8, 13};

• O2 = {2, 3}; • O9 = {9, 12}; • O5 = {5, 6};

• O7 = {7, 14}; • O10 = {10, 11, 15, 16}.

Let us consider the plane π passing through 1, 4 and 8, and the plane α passing through 5, 6 and the middle point between 9 and 12 in Figure 31.

• The pairs which represent symmetrical points from the plane π are: (5, 6), (10, 11), (15, 16), (1, 1), (2, 2), (3, 3), (4, 4), (7, 7), (8, 8), (9, 9), (12, 12), (13, 13), and (14, 14). • The pairs which represent symmetrical points from the plane α are: (1, 4), (2, 3), (7, 14), (8, 13), (9, 12), (10, 15), (11, 16), (5, 5) and (6, 6) .

In fact, the reflections about plane π and plane α capture the effects of all the configuration’s symmetry over the points 1 − 16. Fur- thermore, the orbits by the action of the symmetric group over the points 1 − 16 are equal to the ones obtained by the action of the auto- morphism group over the graph. It can be concluded that the proposed graph captures the configuration’s symmetry. It is important to notice that some edges do not represent mech- anical connection between modules. For example, edge (9, 12) in Fig- ure 31 does not represent a connection between two modules. In fact, 9 and 12 belong to modules which are not mechanically docked be- cause modules connect face to face, therefore this is not the kinematic graph. In this graph, 9 and 12 are modeling adjacent but not mechan- ically docked faces. The same situation holds for edges (2, 12),(4, 14), (6, 16),(5, 15),(6, 11), (5, 10), (1, 7) and (3, 9). Thus, each edge con- struction is performed to identify a module’s neighbors in a certain direction. Other examples of the graph construction are shown in Fig- ures 32b and 33a. In order to extend the Orbital Method, reviewed in Section 2.3.2, to configurations composed by cubic modules, the graph representation must be obtained directly from the ID matrix. First, it is explained how to obtain the vertices from the ID matrix. As in the Orbital 84 Chapter 4. Novel enumeration method for cubic modular robots

Method, these vertices are stored in the Mgrafo Matrix. Then, it is explained how to obtain the graph’s edges from the Mgrafo matrix. For cubic modular robots, the four-dimensional matrix that con- tains the graph label is called Mgrafo. Obtaining this matrix is the first step to achieve the graph representation of a cubic modular ro- bot configuration. The graph’s vertices are created in this step and are stored into Mgrafo forth dimension. For each module, the labeling fol- lows the north-west, front-back convention and each vertex is labeled just once. This convention is exemplified in Figure 32.

NORTH 1

BACK WEST EAST 6 FRONT 4 5 2

SOUTH 3

(a) (b)

Figure 32 – For each module, vertices labeling follows the north-west, front-back convention and each vertex is labeled just once.

For the configuration in Figure 32, the Mgrafo matrix is:

[NORTH,EAST,SOUTH,WEST,FRONT,BACK]  = [1, 2, 3, 4, 5, 6]  .

Following the same convention for labeling and storing the ver- tices, the Mgrafo matrix for the configuration in Figure 31 is:

 [1, 2, 3, 4, 5, 6] [7, 8, 9, 2, 10, 11]  Mgrafo . = [3, 12, 13, 14, 15, 16] [0, 0, 0, 0, 0, 0]

As another example, consider the configuration in Figure 33a. Adopting the north-west then front-back convention for labeling and storing the vertices, the Mgrafo matrix in Figure 33b is obtained. It is important to notice that, if two modules share a vertex, this vertex is labeled just once. For example, vertices 2 and 3 in Figure 31 are shared for more than one module, but they have been labeled just once during the labeling procedure. 4.1. Novel graph representation for cubic modular robots 85

7 1 11 8 10 2 6 5 22 9 4 12 3 23 21 26 18 25 17 13 20 15 16 24 19 14

(a)

(0,0,0,0,0,0) (0,0,0,0,0,0) (22,23,24,25,17,26) (0,0,0,0,0,0) (0,0,0,0,0,0) (7,8,9,10,6,11) (12,13,14,15,16,17) (9,18,19,13,20,21) d (0,0,0,0,0,0) (1,2,3,4,5,6) m (0,0,0,0,0,0) (0,0,0,0,0,0) n (b)

Figure 33 – (a) A configuration composed by cubic modular robots; (b) the configuration’s four-dimensional Mgrafo matrix.

A novel algorithm, original contribution of this thesis, is presen- ted in this section in order to obtain the Mgrafo matrix for any con- figuration in the ID form. This algorithm traverses the ID matrix searching for modules, i.e. non-zero elements and then creates and la- bels the correspondent vertices. The algorithm must label each vertex only once. The algorithm traverses the ID matrix from up to button, from left to right and with increasing depth. Thus, vertices at north, west or at the front of a module are not freely labeled. In fact, the algorithm must verify if these vertices were not labeled in previous steps. 86 Chapter 4. Novel enumeration method for cubic modular robots

Consider the configuration in Figure 33a. Consider also the con- figuration’s Mgrafod×m×n matrix in Figure 33b, where d = {0, 1, 2},m = {0, 1} and n = {0, 1} represent matrix depth, lines and columns, re- spectively.

1. Vertex 9 is a north vertex for ID1,1,1. However, it was first dis- covered when the algorithm examined ID1,0,1, where this vertex was freely labeled because it was a south vertex.

2. Vertex 17 is a front vertex for ID2,1,0. However, it was first dis- covered when the algorithm examined ID1,1,0, where this vertex was freely labeled because it was a back vertex.

3. Vertex 13 is a west vertex for ID1,1,1. However, it was first dis- covered when the algorithm examined ID1,1,0, where this vertex was freely labeled because it was a east vertex.

The Algorithm1 resumes the discussion above and presents the steps to obtain the Mgrafo matrix to any configuration in the ID form. This algorithm is an original contribution of this thesis and constitutes the first step to obtain the graph representation of a cubic modular robot configuration. Once the Mgrafo matrix is obtained, it is possible to achieve the complete graph representation of a cubic modular robot. As previously stated, each edge is constructed in order to connect faces that share a common square side. Let us first consider a single cubic module, as shown in Figure 32a. In this figure, it can be regarded that there are edges between vertices:

• North and east, north and west, north and front, north and back.

• South and east, south and west, south and front, south and back.

• East and front, east and back.

• West and front, west and back.

In fact, as shown in Figures 32b and 33a, each set of vertices constituting a cubic modular robot configuration present these types of edges. However, edges can also connect vertices belonging to modules in different depths, lines, or columns. Thus, each of these possibilities must be verified while creating the edges. Figure 34 shows all possible edge types between vertices belonging to modules in different depths, lines, or columns. 4.1. Novel graph representation for cubic modular robots 87

Algorithm 1 Mgrafo

1: INPUT: IDd×l×c 2: OUTPUT: Md×l×c×6 = Mgrafo 3: Define Counter = 1. 4: for i = 0, to i = d − 1 do 5: for j = 0, to j = l − 1 do 6: for k = 0, to i = c − 1 do 7: if IDi,j,k = 1 then 8: if j = 0 or IDi,j−1,k = 0 then 9: Mi,j,k,NORT H = Counter + +; 10: else 11: Mi,j,k,NORT H = Mi,j−1,k,SOUT H ; 12: end if 13: Mi,j,k,EAST = Counter + +; 14: Mi,j,k,SOUT H = Counter + +; 15: if k = 0 or IDi,j,k−1 = 0 then 16: Mi,j,k,W EST = Counter + +; 17: else 18: Mi,j,k,W EST = Mi,j,k−1,EAST ; 19: end if 20: if i = 0 or ID[i − 1][j][k] = 0 then 21: Mi,j,k,F RONT = Counter + +; 22: else 23: Mi,j,k,F RONT = Mi−1,j,k,BACK ; 24: end if 25: Mi,j,k,BACK = Counter + +; 26: else 27: Mi,j,k,NORT H = 0; 28: Mi,j,k,EAST = 0; 29: Mi,j,k,SOUT H = 0; 30: Mi,j,k,W EST = 0; 31: Mi,j,k,F RONT = 0; 32: Mi,j,k,BACK = 0; 33: end if 34: end for 35: end for 36: end for

1. Figure 34a shows that between neighbor modules in increasing depth (d), same line and column, edges (N,N), (E,E), (W, W ) and (S, S) must be created.

2. Figure 34b shows that between neighbor modules in increasing lines (m), same depth and column, edges (F,F ), (B,B), (E,E) and (W, W ) must be created.

3. Figure 34c shows that between neighbor modules in increasing columns (n), in the same line and depth, edges (N,N), (S, S), 88 Chapter 4. Novel enumeration method for cubic modular robots

B E n d W F N N m N N B W W B E F E W B F E F S S S S (a) (b) (c)

d n B m m F N WE N N B N W E B S S S S F W E F B WE F d n (d) (e) (f)

Figure 34 – Possible edges types between vertices belonging to different modules.

(F,F ) and (B,B) must be created. 4. Figure 34d shows that between neighbor modules in increasing depth (d) and lines (m), same column, edges (F,N), (B,N), (S, F ) and (S, B) must be created. 5. Figure 34e shows that between neighbor modules in increasing lines (m) and columns (n), same depth, edges (W, N), (E,N), (S, W ) and (S, E) must be created. 6. Figure 34f shows that between neighbor modules in increasing depth (d) and columns (n), same line, edges (W, F ), (E,F ), (B,W ) and (B,E) must be created.

The Algorithm 15, AppendixC, resumes the discussion above, presenting the complete steps to obtain graph’s edges from the Mgrafo matrix. Because of its length, the algorithm is presented in the ap- pendix. The algorithm considers all edges between vertices in the same module and also all edges between vertices belonging to modules in different depths, lines, or columns. 4.2. Isomorphism avoidance 89

With the graph representation provided by Algorithms1 and 15, a novel method to enumerate cubic modular robots can be implemen- ted. However, two more novel results are useful to implement the novel enumeration method. These results are introduced in the next section.

4.2 ISOMORPHISM AVOIDANCE

The results of Theorem 2 and Proposition 2 introduced by the author in the Symmetry Method [7], reviewed in Section 2.3.1.3, can be directly extended to cubic modular robots. The extension of these two results, originally stated for square modules, is immediate and it decreases the number of isomorphic configurations generated during the enumeration process. Details can be found in [7].

1. Aligned configurations with k cubic modules can generate only aligned configurations with k + 1 modules.  For example, configuration ID1 = 1 1 1 1 1 1 gen-  erates only the configuration ID2 = 1 1 1 1 1 1 1 during the enumeration process.

2. The configurations constituted only by ones in the ID represent- ation can be forbidden of generating a child. For example, configurations in Figure 35 can be forbidden of gen- erating a child during the enumeration process.

1 1 1 1 1 1 1 1 1 1   1 1 1 1 1 1 ID1 = 1 1 1 1 (b) (a)

Figure 35 – Configurations constituted only by ones in the ID repres- entation can be forbidden of generating a child during the enumeration process. 90 Chapter 4. Novel enumeration method for cubic modular robots

4.3 ENUMERATING CUBIC MODULAR ROBOTS

In order to extend the Orbital Method, reviewed in Section 2.3.2, to cubic modular robots, the following algorithm is proposed:

Step 1 Given a configuration in ID form, verify the conditions of the expanded Theorem 2/ Proposition 2(Section 4.2). If the condi- tions are satisfied, proceed as stated by Theorem 2 or as Propos- ition 2. Otherwise, go to Step 2;

Step 2 Determine the graph representation (Section 4.1);

Step 3 Calculate the binary orbits of the configuration;

Step 4 Assemble a new module with one element from each binary orbit, identified in the previous step, of the current modular robot configuration;

Step 5 Run an isomorphism test. Next section discusses the correctness of the Orbital Method.

4.4 ORBITAL METHOD OVERALL DISCUSSION

In this section, the termination, soundness and completeness of the Orbital Method is discussed.

4.4.1 Termination In Step 1: if the conditions of Theorem 2 are satisfied then, a configuration with n modules is generated and the algorithm goes to Step 5. If the conditions of Proposition 2 are satisfied then no configuration is generated and the algorithm goes to Step 5. In Step 2, Algorithm1 and Algorithm 15 are called in order to obtain a graph representation for each configuration. These al- gorithms terminate after all for cycles are complete, i.e. respect- ively after dlc operations (for an IDd×l×c) and after 6dlc opera- tions (for Md×l×c×6 = Mgrafo). Step 3 terminates after all binary orbits are determined by the Nauty software [37, 39], i.e. after all 6n vertices (for a configura- tion with n modules) are placed into their orbits. Step 4 terminates after a new module is added to one element of each binary orbit. In the worst scenario, for each configuration, 4.4. Orbital Method overall discussion 91

each of the 6n vertices are placed into different orbits, thus 6n operations are performed in this step. Step 5 terminates after all isomorphism tests are performed by the Nauty software [37, 39]. Considering nt the number of con- figurations generated in previous steps, the number isomorphism tests performed in Step 5 will be Cnt, 2.

4.4.2 Soundness The method is recursive, it starts with a configuration composed by a single module and then, in each iteration, a novel module is added to each of the configuration generate in a previous step. For n = 1 or n = 2 only the aligned configurations are generated. For n = 3 it generates aligned and misaligned configurations,    1 1 IDa = 1 1 1 1×3 and IDm = . 0 1 2×2 Let us analyze the case where n > 3. It will be shown that in the n iteration, only configurations with n modules are generated. If the conditions of Theorem 2 are verified, then the configuration been tested is composed by n − 1 aligned modules. Thus, this configuration generates a configuration with n aligned modules. If the conditions of the Proposition 2 are verified, then no config- uration is generated. In the other cases, a single module is added with one element from each binary orbit. Thus, only configurations with n modules are generated. Also, in the worst scenario, all the vertices composing a configuration are in the same binary orbit. This implies that only one configuration with n modules is generated in this step. Also, for n ≥ 3 there exists at least an aligned configuration with n modules and a misaligned configuration with n modules. The aligned configurations are generated by recursively adding a novel module to IDa. The misaligned configurations are generated by adding novel modules to the first line (or to isomorphic positions) of IDm. Thus, the method does not generate empty outputs. Finally, after the isomorphism test, only non-isomorphic config- urations with n modules are obtained. Therefore, the method is sound. 92 Chapter 4. Novel enumeration method for cubic modular robots

4.4.3 Completeness In this section the completeness of the Orbital Method is ana- lyzed. The results herein presented are applicable for regular and planar modules and for cubic modules. The completeness can be stated as: given n ∈ N∗, n ≥ 3, the method generates one representative of each type of non-isomorphic configurations with n modules. The result will be demonstrated by an induction in n. For n = 3 the hypothesis is valid. Assume that for n = k ∈ N, k ≥ 3 the hypothesis is valid, i.e. the method generates one representative of each type of non-isomorphic configurations with k modules. Let n = k + 1. Suppose, by absurd, that exists a configuration α which is not isomorphic to any configuration with k +1 generated by the method. If α is an aligned configuration with k + 1 modules then, in Step 1, α is generated by the aligned with k modules. Otherwise, let us consider a configuration β with k modules obtained from α by eliminating a single module from a position a, as follows. Choose a random binary link a in α and eliminate a single module from it.

• If the resulting configuration is not aligned and its ID has at least one zero, label this configuration as β. Otherwise, return the initial eliminated module to the configuration, and eliminate another module which does not disconnect the configuration. Then, label the remaining configuration as β. This process produces only configurations β which are not aligned and whose ID have at least one zero. In fact, as stated at the start of the process, configuration α is not aligned and its ID has at least one zero. Then, the process eliminates a single module. If an aligned configuration or a configuration with ID composed only by ones is obtained then the eliminated module is returned to the configuration, causing again a misalignment or introducing zeros into the ID. As another module is then eliminated, the misalignment or the ID zeros remain. Thus, β is misaligned or contains zeros in its ID. 4.5. Results 93

As β has k modules, by the induction hypotheses, β must be iso- morphic by some isomorphism π to a configuration β1 generated by the method. The isomorphism (rigid transformation) π takes position a in β to a position a1 in β1. If a new module is added to position a in β, obtaining the original configuration α and a new module is added to position a1 in β1, obtaining a configuration α1, then, by Proposition3, π takes α to α1.

As α1 is obtained by adding a novel module to β which is not aligned and whose ID has at least one zero, in Step 4, α1 or one of its isomorphic configurations will be generated by the method.

In fact, in Step 4, a novel module is added to a1 or to another element a2 from the same binary orbit as a1. If a1 is chosen, then α1 is generated. If another element a2 from the binary orbit of a1 is chosen, then a different configuration α2 is obtained. However, by Proposition3 the symmetry relating a2 and a1 will relate configurations α1 and α2. Thus, α1 and α2 will be isomorphic.

As the original configuration α is isomorphic to α1, the discussion implies that an isomorphic configuration of α is always generated by the method in Step 4. Finally, in Step 5, only isomorphic configurations are discarded. Thus, only one configuration iso- morphic to α must remain after this step. Therefore, α is iso- morphic to a configuration with k + 1 modules generated by the method.

4.4.4 Complexity The complexity of the enumeration method [8] is defined by complexity of the isomorphism test, i.e. it is exponential time (O(en)) [40–42]. The other procedures, have (O(n2)) complexity.

4.5 RESULTS

The novel method was implemented in C++, providing the enu- meration of configurations up to 10 cubic modules. This constitutes an advance compared to the number of modules achieved in literature [23]. The results are shown in Table2, where A038119 [49] is the number of polycubes with n cubes, a related problem where the con- figurations are only counted not listed. The orbits determination and the isomorphism test were performed with Nauty software [37, 39]. 94 Chapter 4. Novel enumeration method for cubic modular robots

Table 2 – Number of nonisomorphic configurations with n cubic mod- ules.

Time № of Orbital № of № of non-isomorphic Method non-isomorphic cubic modular for cubic polycubes modules robots modules A038119 [49] 1 1 X 2 1 0,0001 sec X 3 2 0,0001 sec X 4 7 0,085 sec X 5 23 0,071 sec X 6 112 1,65 sec X 7 607 1 min 15 sec X 8 3811 5 min 56 sec X 9 25413 15 min 26 sec X 10 178083 27 min 50 sec X 11 1279537 12 9371094 13 69513546 14 520878101 15 3934285874 16 29915913663

It is important to notice that only the number of obtained con- figurations were presented here, but the implemented algorithms return a complete list of non-isomorphic configurations. As previously stated, the results match with those reported by [49, 50] for an equivalent problem: the enumeration of polycubes. Polycube’s enumeration approaches focus on counting and not on listing configurations, mainly because the growth in the number of distinct configurations is a considerable limitation for the process. For example, Gong[51] took 11 days to enumerate free polycubes up to 16 modules in November/December 2004, on a Power Mac G5. However, as previously stated, for modular robots it is necessary to actually know the complete configurations set, so the configurations must be listed, as done in the herein proposed procedure. The computer 4.6. Conclusions 95 simulations of the proposed method were performed in a 4GB, Intel Core I5, 1.6 GHz machine. Also, the algorithm was allowed to run for a maximum of 30 minutes.

4.6 CONCLUSIONS

This chapter introduced a novel method, original contribution of this thesis, for enumeration of all nonisomorphic cubic modular robot configurations. The novel method is an extension of a previous enu- meration method proposed by the author for square modular robots, the Orbital Method. In order to perform this extension, this chapter presented a new way to determine a graph which captures the symmetry of a given cubic modular robots. Two novel algorithms, which allow to determine the graph representation directly from the configuration’s ID matrix, were also introduced. In order to decrease the number of isomorphic configurations generated during the enumeration process, the results introduced by the author in the Symmetry Method were extended to cubic modules. The novel method was implemented in C++, providing the enumeration of configurations up to 10 cubic mod- ules. This constitutes an advance compared to the number of modules achieved in literature [23]. The next part of this thesis discusses the assembly problem for modular robot configurations.

97

5 LITERATURE REVIEW: ASSEMBLY SEQUENCE PLANNING

The assembly of a product is the final step in a manufacturing process. Assembly Sequence Planning (ASP) can be defined as the problem of finding a sequence of collision-free operations that brings the assembly parts together. According to Su[52], the purpose of assembly sequence planning is to determine a proper sequence of components and assembly operations. With the ordered sequence, the components can be located at the specified positions and fixed with the assembly operations to construct the final product. According to [53], ASP is a critical technology which achieves product design and facilitates realization. The first approach to ASP was the human interaction method. This approach relies on user responses to program queries on the con- nection between a pair of parts and was introduced by Fazio e Whit- ney[54]. Since this approach does not allow factory automation, it was soon superseded by the geometric feasible reasoning approach which is mainly based on the ‘assembly by disassembly’ principle. This principle indicates that (under certain conditions) disassembly sequence is the inverse of assembly sequence [55]. As an important part of the manu- facturing process, the traditional approach to ASP has been generalized in many directions. Concerning the assembly of mechanical products, according to Ghandi e Masehian[55], assembly generation methods lies in four general categories:

• Human interaction methods: this approach relies on user re- sponses to a set of questions [54].

• Geometric feasible reasoning approaches: those methods plan feasible assembly paths [56–59].

• Knowledge-based reasoning approaches: this approach consider geometrical and non-geometrical information and also human reas- oning about the assembly process [53, 60].

• Intelligent methods: those methods use multiple techniques as neural networks [61], heuristics [62–64] and optimization, among others.

The ASP is an NP-hard problem [25, 26]. An inclusive survey on the ASP for mechanical products is presented in [27]. 98 Chapter 5. Literature Review: Assembly Sequence Planning

Concerning the assembly of modular structures, an important problem is the collective construction of modular structures by robot teams using building blocks, i.e. non-actuated modular units. Werfel et al.[28] presented an algorithm for assembling arbitrary solid structures composed by square blocks and without internal holes. Werfel, Ingber e Nagpal[29] introduced a rule-based algorithm for target structures with holes. Werfel e Nagpal[30] presented another algorithm that prevents module attachment at sites that are supposed to be left empty according to an occupancy matrix. Bishop et al.[31] addressed the problem of assembling planar structures using triangular modules. In this work, the authors provided a system implementation for their theory of graph grammars in order to assembly modular structures. However, their modules move inde- pendently in a stochastic manner by external actuation. Pamecha et al.[5] introduced the concept of metamorphic robot system. A metamorphic robotic system is a collection of independently controlled mechatronic modules which have the ability to connect, dis- connect, and climb over adjacent modules. However, for this kind of robot, the assembly problem is usually treated as a byproduct of path planning. The assembly sequence planning problem for autonomous mod- ular robots was introduced by Paulos et al.[2] and Seo, Yim e Ku- mar[10, 11]. They addressed the problem of assembly large teams of autonomous robotic boats into floating platforms structures of arbit- rary shapes, aggregating module by module to the target structure. Their work is reviewed in the next subsections.

5.1 CONTRIBUTIONS OF SEO ET AL. AND PAULUS ET AL.

Seo, Yim e Kumar[10, 11] and Paulos et al.[2] addressed the problem of constructing large scale floating structures to accelerate hu- manitarian missions or disaster relief. This can be achieved by assem- bling together many self-propelled ISO shipping containers, i.e. con- tainers whose dimensions are related by the International Standards Organization (ISO). These ISO shipping containers are considered as robotic boats or modules. Figure 36 illustrates the modules: Figure 36a shows ten mod- ules autonomously traversing a pool and Figure 36b presents a bridge composed by 33 modules. As evidenced in Figure 36, the robotic boats are rectangular modular units that can be assembled in a regular pattern that loc- 5.1. Contributions of Seo et al. and Paulus et al. 99

(a) (b)

Figure 36 – (a) A set of robotic boats or modules (b) A bridge com- posed by 33 modules, Paulos et al.[2]. ally looks like a common brick wall. The docking mechanism requires modules to approach “broad side”: all modules have a male to female connection mechanism, in one long side of the module is a male con- nector and, in the opposing long side, is a female connector, as shown in Figure 37a. Due to the docking mechanism, neighboring modules are not ne- cessarily mechanically connected. For example: in Figure 37b, neigh- boring modules i − j, i − k, j − l and k − l are mechanically connected. On the contrary, modules j − k are not mechanically connected.

i

j k

l

(a) (b)

Figure 37 – (a) Robotic boats docking mechanism, Paulos et al.[2]. (b) A configuration composed by four robotic boats.

Seo, Yim e Kumar[10, 11] and Paulos et al.[2] introduced two ASP to assembly target planar structures composed by these modules. Seo, Yim e Kumar[10,11] addressed the problem of assembling config- urations without internal holes and Paulos et al.[2] presented a method to assembly configuration with internal holes. These methods are dis- cussed in details in the next subsections. Both methods are based on 100 Chapter 5. Literature Review: Assembly Sequence Planning graph theory tools and on a set of definitions which are reviewed in Section 5.1.1.

5.1.1 Common definitions for the ASP of Seo et al. and Paulus et al.

Seo, Yim e Kumar[10, 11] and Paulos et al.[2] introduced two ASP to assembly target structures composed by self-propelled ISO ship- ping containers, considered as robotic boats or modules. Both ASP are based on graph theory tools and on a set of definitions which are re- viewed in this section. For planning purposes, the robotic boats are just regarded as congruent rectangles moving on the plane. A target structure can be visualized as the collection of rectangular sites that locally looks like the common brick wall pattern without a gap between two adjacent rectangular sites. Each rectangular site is the footprint of a single robot in the finally assembled structure. Figure 38 shows examples of target structures.

(a) (b)

Figure 38 – Example of target structures. Configuration in (a) can be assembled by the both ASP of Seo, Yim e Kumar[10, 11] and Paulos et al.[2]. Configuration in (b) can only be assembled by the ASP of Paulos et al.[2].

It is important to notice that Figure 38b presents an internal hole, thus it can only be assembled by the ASP of Paulos et al.[2]. Figure 38a can be assembled by the both ASP of Seo, Yim e Kumar 5.1. Contributions of Seo et al. and Paulus et al. 101

[10, 11] and Paulos et al.[2]. However, the first one returns a parallel planner, i.e. more than one module can be added at the same step. Given a target structure, both authors constructed an undir- ected graph C = (V,E) that represents the mechanical connectivity among the robots occupying the member sites. Graph C is considered embedded on the corresponding target structure: the vertices are the rectangular site’s centroids and the edges are line segments between centroids. Thus, for graph C = (V,E), the set V of vertices represents to the collection of rectangular site’s centroids, and the set E of edges consists of unordered pairs modeling the mechanical connection among two mechanically docked robots. Figure 39 presents the graphs C for the configurations in Figure 38.

y y

x x

(a) (b)

Figure 39 – Graphs C for: (a) configuration in Figure 38a; (b) config- uration in Figure 38b.

Target structures are assumed to be connected and free from narrow corridors which are too narrow for a robot to traverse; the following paragraphs elaborate the concepts of structure connection and narrow corridor. If graph C is connected, the target structure is considered con- nected. If there are multiple connected components, they are assembled individually. Figure 38 presents two connected configurations. In fact, graph C for the configuration in Figure 38a is presented in Figure 39a, and Figure 39b shows the graph C for the configuration in Figure 38b. As both graphs are connected, the configurations are considered as connected. Seo, Yim e Kumar[11] presents the following definition for nar- 102 Chapter 5. Literature Review: Assembly Sequence Planning row corridors:

“Consider a rhombus whose side length is three times as large as the edge of the lattice unit. For each face of graph C, let the rhombus translate along the frontier of the face without losing contact with the frontier and intersecting the exterior of the frontier. If the rhombus can reach every point on the frontier, the face is free from narrow corridors”.

Figure 40a presents a configuration with an internal hole and free from narrow corridors, Figure 40b illustrates the graph C and the rhombus moving along the frontier of C’s faces. Note that the test does not apply to smallest faces (such as the one colored blue in Figure 40b) because the face is in fact not an empty space.

f2 f1

δ

(a) (b)

Figure 40 – (a) A target structure. Each rectangle represents a site to be occupied. (b) The points represent the centroids of the sites. The orange rhombus whose edge length δ is three times as large to the edges of the lattice units can transverse the configuration, thus the configuration has no narrow corridor Seo, Yim e Kumar[11].

During assembling, both ASP of Seo, Yim e Kumar[10,11] and Paulos et al.[2] avoid generation of any hole, i.e. they avoid situations where a site(s) to be occupied is enclosed by existing robots in the 5.1. Contributions of Seo et al. and Paulus et al. 103 structure. In addition, they avoid any situation where a site(s) to be occupied can only be reached by passing through a gap at most as large as the edge of a robot, i.e. through a narrow corridor. These situations are illustrated in Figure 41.

a b

a a b b

(a) (b) (c)

Figure 41 – In each of the cases, the modules a and b are forming a narrow corridor. (a), (b) A narrow corridor may be a local issue in terms of the site between a and b. (c) However, it can also be a nonlocal issue in terms of a site far from them Seo, Yim e Kumar[11].

If the assembly planning results in an intermediate configuration having any of the described situations, it is considered an infeasible plan. In the next subsections the ASP of Seo, Yim e Kumar[10, 11] and Paulos et al.[2] are reviewed.

5.1.2 Configurations without internal holes Paulos et al.[2] and Seo, Yim e Kumar[10] addressed the as- sembly planning problem related to identical rectangular robots moving on the plane and forming planar structures locally like a common brick wall. As stated in Section 5.1.1, a target structure is considered con- nected and free from narrow corridors. The configuration is defined to cover a simply-connected, compact area on the plane such that there is no hole, i.e. , an empty area enclosed by member sites. Figure 42a presents an example of configuration that is connected, free from nar- row corridors and without internal holes. Thus, this configuration can be assembled with the ASP reviewed in this section and it will be taken as example to explain the ASP steps. 104 Chapter 5. Literature Review: Assembly Sequence Planning

The ASP takes as input an array containing a sequence of the sites of a target structure, denoted as T . The order of the sequence it is not important. As discussed in Section 5.1.1, each rectangular site in the target structure is represented by the coordinate of its centroid, which is simply referred to as the coordinate of the site, see Figure 39a for an example. The ASP returns a graph GA, a directed acyclic graph constructed on the member sites. Algorithm2 models the ASP steps and can run in O(m) time, where m is the number of the member sites. Algorithm2 will be explained in the following paragraphs describing each line of the algorithm.

Algorithm 2 ASP of Paulus et al.(T)

1: Let GA = (T, ∅) 2: Decompose T into cells and construct C0. 3: Designate one seed for each cell; turn C0 into a rooted tree. 4: for each vertex of GA , si , do 5: Construct directed edges that leave si and enter its neighbors that belong to the parent cell or are more proximal to the seed in the same cell. 6: end for 7: Return GA. 8: (optional) Perform a topological sort of GA.

Line 1: First, the algorithm begins with declaring a graph GA that will contain the ASP information. This graph is constructed on the sites of T , without any edges at this moment.

Line 2: The list T is decomposed into the collections of consecutive sites parallel to the x-axis. For example, for configuration in Figure 42a, the cell decomposition is presented in Figure 44a. 0 Then, the algorithm construct a graph C = (Vc,Ec), where Vc is the collection of the cells and Ec is the collection of the unordered pairs of two adjacent, connected cells. Thus, C0 captures the connectivity among the cells and, since the target structure does not have any holes, C0 is a tree. For configuration in Figure 42a, graph C0 is represented in Figure 43.

Line 3: A seed is designated for each of the cells. The process for choosing these seeds starts by picking any arbitrary rectangular site s and making s the seed to the cell it belongs to. Now C0 5.1. Contributions of Seo et al. and Paulus et al. 105

y

x

(a) (b)

Figure 42 – (a) A target structure. (b) The goal shape has been decom- posed into cells, i.e. collections of consecutive sites parallel to the x-axis.

Figure 43 – Graph C0 for the configuration in Figure 42a.

can be turned into a rooted tree by letting the cell with the first seed be the root. In Figure 44a, the initial seed s is colored and C0 is rooted by the correspondent cell, i.e. , by the red vertex in Figure 44b. The next seeds are chosen by the following rule: “Given a cell, if its y-coordinate is larger (less) than that of its parent with respect to C0 , then the site with the largest (least) x-coordinate to accommodate a robot which is to be mechanically docked to the parent is designated as its seed”. In Figure 44a, the initial seed s is colored in red and the other colored cells correspond to the other seeds. Line 4: A breadth-first search on C0, starting in the cell containing the initial seed s, the red colored vertex in Figure 44b, is used to identify the parent-child relationships among the cells. Then, a graph GA is obtained by the following rule stated by Seo, Yim e Kumar[10]: 106 Chapter 5. Literature Review: Assembly Sequence Planning

y

s

x

(a) (b)

Figure 44 – (a) Colored rectangles correspond to the chosen seed for each cell in Figure 44a. (b) The red colored vertex cor- responds to the cell to which s, the initial seed, belongs to.

“Given a site i ∈ T , consider the collection of sites simultaneously belonging to T and i0s one-hop neigh- borhood. For each site of the collection, denoted as j, add a directed edge (i, j) to EA: (1) if i and j belong to the same cell and i is more proximal to the seed than j; or (2) if i belongs to the parent, with respect to C0 , of the cell to which j belongs”.

Figure 45 represents a possible graph GA for the configuration proposed in Figure 42a with seeds chosen as in Figure 44a.

Line 5: Finally, the algorithm performs a topological sort on GA. Thus, a parallel ordering of sites satisfying the accessibility re- strictions is obtained. The topological sort of graph GA in Fig- ure 45 is illustrated in Figure 46.

The ASP reviewed in this section can be applied to target struc- tures that are connected, free from narrow corridor and without in- ternal holes. If the topological sort is performed, the structure grows as a single connected component and multiple robots can dock to the structure in a parallel manner. However, configurations with internal holes cannot be assembled with this ASP, thus Seo, Yim e Kumar[11] presents an ASP able to assemble this kind of configuration. This ASP is reviewed in the next subsection. 5.1. Contributions of Seo et al. and Paulus et al. 107

0 18 1 5 13 19 2 6 10 14 7 11 15 8 12 16 20 3 9 17 21 4 22

Figure 45 – The colored rectangles correspond to the seeds chosen for each cell in Figure 44a. The initial seed s corresponds to the red rectangle, numbered as 11.

11 10 12 15 7 6 8 16 14

Figure 46 – Topological sort of graph GA in Figure 45.

5.1.3 Configurations with internal holes

The algorithm explained in subsection 5.1.2, proposed by Paulos et al.[2] and Seo, Yim e Kumar[10] is not able to address configurations with internal holes. Seo, Yim e Kumar[11] presented an assembly sequencing algorithm for target structures with internal holes. Their method is summarized in Algorithm3. The input to Algorithm3 is an array T containing a sequence of the coordinates of the sites of a target structure, T = hs1, s2, . . . , smi; where the coordinate of a site actually refers to the coordinate of its centroid, as discussed in Section 5.1.1. Figure 47a and Figure 47b show the configuration used by the authors to illustrate the steps of Algorithm3 and its graph C, respectively. 108 Chapter 5. Literature Review: Assembly Sequence Planning

(a) (b)

Figure 47 – (a) A target structure. Each rectangle represents a site to be occupied. (b) Graph C for the configuration in (a), Seo, Yim e Kumar[11].

Algorithm3 actually features disassembly sequencing, i.e. it primarily focuses on an order to extract modules from the structure. Then, the assembly sequence planning is obtained by inverting the dis- assembly sequence. As the algorithm uses a stack A to maintain the disassembly order, the assembly sequence planning is obtained extract- ing elements from the top of A. The lines of Algorithm3 are herein discussed.

• Line 1: Consider an empty stack A.

• Line 2: A graph C = (V,E) representing the mechanical con- nectivity of the target structure is constructed (Refer to Fig- ure 47).

• Lines 3 – 13: This is the main loop where one or more vertices in graph C are deleted, until there remains no vertex. Thus, the ASP actually features disassembly sequencing.

– Line 4: A graph ∂C, representing the frontier of the outer face of C, is constructed. Seo, Yim e Kumar[11] present a method to obtain the frontier in O(m) time: “First, locate a site of degree less than 3 that is on the frontier by, for example, picking the site with the smallest x-coordinate among the ones with the 5.1. Contributions of Seo et al. and Paulus et al. 109

Algorithm 3 ASSEMBLY-PLANNING (T) 1: Let A be an empty stack. 2: Construct C. 3: while C is not a null graph do 4: Construct ∂C. 5: if ∂C has a vertex of degree 1, say si then 6: Push si to A. 7: C = C − si 8: else 9: Search for a block of ∂C that contains only one cut-vertex of ∂C; establish sequence of sites hsi, sj, ski to be disassembled from the block. 10: Push si, sj and sk to A. 11: C = C − {si, sj, sk} 12: end if 13: end while 14: Return A.

largest y-coordinate. From the site, traverse edges of C in one direction until we return to the site (whenever there is a vertex of degree 3, move along the leftmost edge). Then each vertex on the outer frontier is visited at most twice”. Figure 48 shows the graph ∂C for the configuration in Fig- ure 47b.

Figure 48 – Graph ∂C for the configuration in Figure 47b, Seo, Yim e Kumar[11]. 110 Chapter 5. Literature Review: Assembly Sequence Planning

– Lines 6 – 7: If frontier graph ∂C has a vertex of degree 1, the vertex is pushed to the stack A (Line 1) and deleted from C along with any incident edges. After deleting the degree one vertices, from frontier ∂C in Figure 48, the graph in Figure 49 is obtained. – Lines 9 – 11: Seo, Yim e Kumar[11] stated that: “For frontier ∂C that does not have a vertex of de- gree less than 2, there exists a block with one or no cut-vertex of the original graph; moreover, such a block must be a cycle”. By picking such a cycle, the ASP establishes a sequence of sites that can be disassembled from the cycle as follows. Ac- cording to Seo, Yim e Kumar[11] this sequence is established as follows: “Consider the site with the smallest x-coordinate on the row of the largest y-coordinate. Next, inspect if the site at southwest from si, denoted, si,SE, is a vertex of C or not. If so, establish a sequence hsii as the potential output of this line. If not, pick two more sites, sj and sk , and establish hsi, sj, ski as the potential output. Repeat this process by let- ting si be the site with the largest x-coordinate on the row of the smallest y-coordinate and inspect- ing if the northwest site from si, si,NE, is occupied. Between the two sequences established for the po- tential output, pick one without the cut-vertex for the output of Line 9”. In the previous step, after deleting the degree one vertices, the frontier graph ∂C in Figure 49 was obtained. This new graph has two blocks that are cycles, denoted as β1and β2 and each red vertex is a cut-vertex of ∂C that belongs to β1 or β2. In this step, the ASP chooses a sequence of sites to be po- tentially disassembled from the structure. Suppose that block β1 is chosen. Considering si the site with the smallest x-coordinate on the row of the largest y-coordinate, as cell Si,SE is empty, the sequence of sites si, sj , and sk in Figure 50a can potentially be disassembled from the structure. Thus, graph C will then be updated as 5.1. Contributions of Seo et al. and Paulus et al. 111

y

x

β1

β2

∂C

Figure 49 – ∂C in Figure 48 has two blocks that are cycles, denoted as β1and β2. Each red vertex is a cut-vertex of ∂C that belongs to β1 or β2, Seo, Yim e Kumar[11].

the graph shown in Figure 50c. Repeating the process by letting si be the site with the largest x-coordinate on the row of the smallest y-coordinate, the sequence of sites to be potentially disassembled from the structure is shown in Fig- ure 50b. Then, the updated graph C is shown in Figure 50d. If β2 is chosen, as the sequence of sites in Figure 50f contain one of the cut-vertex output on Line 9, it cannot be disas- sembled from the structure. Thus, if β2 is chosen, only si in Figure 50e can be disassembled from the structure. There- fore, the configuration in Figure 50g will be obtained. • Line 14: The algorithm finally returns A.

Algorithm3 can be extended to other patterns composed by congruent rectangles. Figure 51 shows those patterns. Seo, Yim e Kumar[11] presented the completeness and correct- ness of Algorithm3. These results are presented as lemmas and are herein discussed. Lemma 1. Line 9 of Algorithm3 returns a nonempty sequence.

Lemma 2. At the start of each iteration of the while loop in Al- gorithm3, graph C satisfies the assumptions stated in Section 5.1: C is connected and free of narrow corridors.

Lemma 1 guarantees that a assembly sequence is founded by Al- gorithm3. Lemma 2 guarantees that when the while loop is initialized, 112 Chapter 5. Literature Review: Assembly Sequence Planning the configuration is connected and free of narrow corridors. This lemma also guarantees that this property will be maintained before the next iteration of Algorithm3. With these results, the authors state the com- pleteness and correctness of Algorithm3. However, for a certain type of configurations the assembly sequence planning presents limitations and can even return an incorrect assembly sequence. These limitations are discussed in the next chapter. 5.1. Contributions of Seo et al. and Paulus et al. 113

Si Sj β1 β1 Sk

Si,SE

Si,NW

Sj

Sk Si (a) (b)

(c) (d)

Si

β2 β2

Si,SE

Si,NW

Sk

Sj Si (e) (f)

(g)

Figure 50 – If β1 is chosen, si, sj , and sk can potentially be disas- sembled from the structure both in (a) and (b); C will then be updated as shown in (c) and (d), respectively. If β2 is chosen, (e) si can be disassembled from the structure; (f) because sk is the cut-vertex, the sequence si, sj, sk will not be returned; (g) represents the update of graph C for this case, Seo, Yim e Kumar[11]. 114 Chapter 5. Literature Review: Assembly Sequence Planning

(a) cmm (b) p2 (c) pmg

(d) pgg (e) pmm (f) p4g

Figure 51 – Algorithm3 can be extended to the six patterns in the fig- ure. The red polygons are the lattice units of the patterns, Seo, Yim e Kumar[11]. 115

6 NOVEL CONTRIBUTION TO THE ASP OF SEO, YIM AND KUMAR

According to Seo, Yim e Kumar[11], their algorithm for as- sembly configurations with internal holes, Algorithm3-Section 5.1, guarantees a feasible assembly sequence for which robots do not have to pass through narrow corridors while approaching their target positions. In order to ensure proper assembly, the configuration only has to obey the assumptions stated by the authors and reviewed in Section 5.1.1:

• The configuration must be connected, i.e. its graph C must be connected.

• The configuration must be free of narrow corridors.

However, for certain type of configurations, Algorithm3 presents limitations, and can even return an incorrect assembly sequence. These limitations are discussed in this chapter and a class of counterexamples, original contribution of this thesis, is herein presented. First, an example is introduced where Algorithm3 returns a correct ASP. Then, a modification of the initial example is presented. For this modification, which obeys the necessary conditions stated by the authors, Algorithm3 can return an incorrect ASP. Consider the configuration in Figure 52a and it’s graph C in Figure 52b. The configuration obeys to the assumptions stated in Sec- tion 5.1.1:

• The configuration is connected because, as stated by Jungwon et al. [10, 11] and Paulus et al. [2], its graph C is connected.

• The configuration in Figure 52a is free from narrow corridors. In fact, Figures 52c and 52d show that a rhombus whose side length is three times as large as the edge of the lattice unit is able to translate along the frontier of each graph C’s faces, f1 and f2, without losing contact with the frontier and intersecting it’s exterior.

When Algorithm3 is applied to the configuration in Figure 52a it returns a correct assembly sequence. However, if module 22 for ex- ample, is deleted from the configuration, obtaining the configuration in Figure 53a, the Algorithm3 can return an incorrect assembly se- quence. The new configuration also obeys to the assumptions stated in Section 5.1.1, i.e. , it is connected and free from narrow corridors: 116 Chapter 6. Novel contribution to the ASP of Seo, Yim and Kumar

• The configuration is connected because it’s graph C in Figure 53b is connected.

• The configuration is free from narrow corridors because a rhom- bus whose edge length is three times as large to the edges of the lattice units can translate along the frontier of the unique graph C’s face, f1, as illustrated in Figure 53c.

Algorithm3 is applied to the configuration presented in Fig- ure 53a. Algorithm steps are described in the following text.

• Steps 1-2: Graph C is constructed as shown in Figure 53b.

• Step 3-4: Frontier ∂C is equal to graph C in Figure 53b.

• Step 5: As vertices 19, 23 and 17 have degree one, the algorithm can delete any of these vertices from the structure.

If vertex 17 is the first vertex to be deleted, the algorithm returns an incorrect assembly sequence. In fact, vertex 17 cannot be mech- anically disassembled from the structure in this step without passing through a narrow corridor, see Figure 53a. The same problem occurs if the algorithm tries to disassemble 23 − 17, 19 − 23 − 17, 19 − 17 or 23 − 19 − 17, among others sequences. Another counterexample can be viewed in Figure 54. It is im- portant to notice, however, that the configuration in Figure 53b is not stable because modules 19 and 23 are not mechanically docked, a sim- ilar situation occurs for any other counterexample for Algorithm3. Algorithm3 is applied to the counterexample presented in Fig- ure 54a. Algorithm steps are described in the following text.

• Steps 1-2: Graph C is constructed as shown in Figure 54b.

• Step 3-4: Frontier ∂C is equal to graph C shown in Figure 54b.

• Step 5: Frontier ∂C has four vertices of degree one, including vertices A and B, thus, the algorithm can delete any of these vertices from the structure.

If vertex A or vertex B is the first vertex to be deleted, the algorithm returns an incorrect assembly sequence because those vertices cannot be mechanically disassembled from the structure in this step without passing through a narrow corridor, see Figure 54a. 117

In [65], Seo show that Algorithm3 terminates and returns a feas- ible assembly sequence without the discussed accessibility issue. How- ever, his analysis, which is performed through three Lemmas, is not complete. In fact, while discussing the second Lemma, the author states that:

“Because assembly happens only on ∂C, a robot can reach a site open for occupancy without being blocked by a physical wall or a narrow corridor”.

This statement is not valid for the two counterexamples herein presented. In the first counterexample, consider that vertex 17 is the first vertex to be deleted from the configuration in Figure 52a. In this case, vertex 17 cannot be disassembled from the configuration without being blocked by a physical wall or a narrow corridor. As the assembly is done in the disassembly reverse order, 17 will be the last assembled vertex. Therefore, 17 cannot reach a site open for occupancy without being blocked by a physical wall or a narrow corridor, contradicting what was stated by Seo[65]. A similar fact occurs for the second counterexample. If vertex A or vertex B is the first vertex to be deleted from the configuration in Figure 54. As the assembly is done in the disassembly reverse order, none of these vertices can reach a site open for occupancy without being blocked by a physical wall or a narrow corridor. Thus, a class of configurations which obeys to the assumptions stated in Section 5.1.1, but for which Algorithm3 returns an incorrect ASP is presented: Let A be a configuration obeying the assumptions Section 5.1.1. Suppose that A forms a loop and graph C is not bicon- nected. Suppose also that there exists a degree one module internal to the configuration’s loop. Then, Algorithm3 can return an incorrect ASP. Let A be a configuration obeying the assumptions Section 5.1.1, thus A is connected and free from narrow corridors. Suppose that A forms a loop and its graph C is not biconnected. Suppose also that there exists a degree one module m which is internal to the configuration’s loop. As A does not form a block, when Algorithm3 is applied to A, it disassembles degree one modules. As m has degree one, Algorithm3 can choose to disassembling this module. However, m cannot reach a site open for occupancy without being blocked by a physical wall or a narrow corridor, because this module is internal to loop formed by 118 Chapter 6. Novel contribution to the ASP of Seo, Yim and Kumar the modules in A. Thus, Algorithm3 return an incorrect assembly sequence if m is the first disassembled module. Therefore, if a configuration A, obeying the assumptions Sec- tion 5.1.1, forms a loop and its graph C is not biconnected and there exists a degree one module m which is internal to the configuration’s loop, then, Algorithm3 can return an incorrect ASP.

6.1 CONCLUSIONS

This chapter presented a novel contribution to the ASP of Seo, Yim e Kumar[11]: a class of configurations which obeys to the neces- sary conditions stated by these authors, but for which their algorithm can return an incorrect ASP. For this class of configurations their algorithm can choose to disassemble a module that cannot be disas- sembled at that point, returning a incorrect ASP. In the next chapter, two novel ASP, original contribution of this thesis, are introduced. 6.1. Conclusions 119

22 19 23 16 24 14 25 12 26 10 20 27 1 17 28 2 29 3 30 4 21 5 18 6 15 7 13 8 11 9

(a)

22 23 24 25 26 27 28 29 30

19 20 21

16 17 18

14 15

12 13

10 11

1 2 3 4 5 6 7 8 9 (b)

f2

f1

;

(c) (d)

Figure 52 – (a) A target structure. (b) Graph C for the configuration in (a). (c) and (d) A rhombus whose edge length is three times as large to the edges of the lattice units can translate along the frontier of each graph C’s faces, f1 and f2: Thus, the configuration has no narrow corridor. 120 Chapter 6. Novel contribution to the ASP of Seo, Yim and Kumar

19 23 16 24 14 25 12 26 10 20 27 1 17 28 2 29 3 30 4 21 5 18 6 15 7 13 8 11 9

(a)

23 24 25 26 27 28 29 30

19 20 21

16 17 18

14 15

12 13 f1

10 11 ;

1 2 3 4 5 6 7 8 9 (b) (c)

Figure 53 – (a) A target structure. (b) Graph C for the configuration in (a). (c) A rhombus whose edge length is three times as large to the edges of the lattice units can translate along the frontier of the unique graph C’s face, f1: Thus, the configuration is free from narrow corridors. 6.1. Conclusions 121

B

A B

A

(a) (b)

Figure 54 – Another counter example for Algorithm3.

123

7 TWO NOVEL ASP FOR SHAPE HETEROGENEOUS MODULAR ROBOT SYSTEMS

Seo, Yim e Kumar[10, 11] and Paulos et al.[2] introduced two ASP for target structures formed by self-propelled ISO shipping con- tainers, considered as robotic boats or modules. Applying these ASP, reviewed in Section 5.1, the structure grows as a single connected com- ponent and no pre-assembled non-rectangular subparts are allowed, i.e. non-rectangular subparts cannot be assembled independently and then joined together in order to obtain the complete target structure. Also, configurations with narrow corridor or spatial configurations can- not be assembled. In this chapter, two novel ASP are introduced. In order to as- sembly the target structure, the strategy of decomposing it into sub- structures is adopted. This kind of modular substructure will be re- ferred to as shape heterogeneous modular robot systems, or robot system, for simplicity. An example of this kind of configuration is presented in Figure 55 which is composed by 12 different shape heterogeneous robot systems. First, each robot system is considered free-flying and com- posed by any number of square modules joined edge to edge, forming arbitrary shapes. Then, an extension to general rectangular modules is presented. In order to present the bases of the two novel ASP for shape het- erogeneous modular robot systems, let us consider the configuration in Figure 55. This configuration is composed by 12 different robot sys- tems, labeled from A to L. The two ASP for robot systems assemble the complete target structure in Figure 55 by joining the 12 robot sys- tems. Each of these robot systems is a collection of regular rectangular modules, i.e. squares, arranged in an arbitrary shape, and constituting an independent modular robot. As evidenced in Figure 55, each module belonging to a robot system is represented by the coordinates of its centroid. For example, robot system F in Figure 55 is composed by modules {(0, 5); (0, 6); (1, 3); (1, 4); (1, 5)}. As previously stated, only robot systems composed by regular rectangles, i.e. by squares, are considered in the first two sections. Then, in Section 7.3 an extension for robot systems formed by gen- eral rectangular modules is presented. During the assembly process, the following condition about ac- cessibility, proposed by Paulos et al.[2], must be verified: Any rect- angular module cannot pass through a gap only as large as a side of a 124 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

y

7 H H H 6 F H G I I 5 FF E G G G I I J J J 4 F E E D I I K L J 3 F C E D K L J 2 C D D K LLL 1 C B B A A A 0123 4 5 6 7 8 9 10 11 x

Figure 55 – A configuration composed by 12 shape heterogeneous mod- ular robot systems.

module between two physical robots already assembled in the structure. Consider only the sub-structure formed by robot systems F , E and C in Figure 55. Due to the accessibility condition, these robot systems cannot be assembled in the F → E → C order. In fact, as shown in Figure 56, if F and E are already placed in the structure, C cannot be added. More precisely, module (2, 3) ∈ C cannot be added to the growing structure without violating the accessibility condition. The accessibility condition avoids any situation where a site to be occupied can only be reached by passing through a gap at most as large as the edge of a robot, i.e. through a narrow corridor. This scenario has been illustrated in Figure 41, Section 5.1.1. This condition was incorporated into the three novel ASP because it comprises common mechanical constraints found in modular robots. Other constraints can be easily incorporated into all the ASP. Also, although the three novel ASP use the same accessibility condition for individual modules as Seo, Yim e Kumar[10,11] and Paulos et al.[2], each of the three ASP proposed in this thesis is able to assembling configurations with narrow corridors, arranged in vertical planes or formed by robot systems. None of these situations can be treated with the ASP of Seo, Yim e Kumar [10, 11] and Paulos et al.[2]. The present chapter is divided in two principal parts. Section 7.1 considers how to assembly target structures without internal holes and composed by robot systems. On the other hand, Section 7.2 considers 7.1. Novel algorithms for configurations without internal holes 125

F E

(2, 3)

C

Figure 56 – Due to the accessibility condition, robot systems F , E and C cannot be joined in the F → E → C order. More pre- cisely, module (2, 3) ∈ C cannot be added to the structure without violating the accessibility condition. configurations composed by robot systems with internal holes.

7.1 NOVEL ALGORITHMS FOR CONFIGURATIONS WITHOUT INTERNAL HOLES

This thesis introduces three novels ASP, each applicable to a different situation. In all these ASP, the target structure is modeled as an undirected graph in the adjacency list form. They differ by their main algorithms which have a recursive structure similar to the DFS search in a graph. For a brief review of the DFS search in its recursive form, see the AppendixA. This section considers only target structures without internal holes and composed by robot systems. The main algorithm for this type of configurations, Algorithm4 (Assembly Order), is herein introduced. Algorithm4 contains the necessary steps to plan the sequence in which robot systems are added to the structure. Algorithm4 calls two auxiliary procedures: Algorithm5 (addEdge), which determines when a new robot system can be added to the growing structure and Algorithm6 (deleteBranch), which gives a strategy to delete a not allowed robot system from the growing structure. These two algorithms 126 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems will be presented along this section. Consider a target structure assembled with shape heterogeneous modular robot systems. The problem of determining an ASP can be regarded as the problem of choosing a path to transverse the whole target structure adding as many robot systems as possible without violating the accessibility condition for any module belonging to any robot system. Applying graph theory to configurations composed by robot sys- tems, each robot system is represented by a vertex and robot systems neighborhood relations are represented by edges. For example, the con- figuration showed in Figure 55, robot system A has robot systems B and C as neighbors, thus the adjacency list of A is {B,C}. The com- plete graph in the adjacency list form for the configuration in Figure 55 is shown in Figure 57.

A B C B A C D C A B D E F D B C E G E C D F G F C E G D E H I H G I I H J K J I K L K I J L L J K

Figure 57 – Adjacency list for the graph representing the neighborhood relations between the robot systems in Figure 55.

Algorithm4 was structured using object-oriented language. For a better understanding of the algorithm’s structure, the main class employed in the algorithm is herein introduced. Class G contains information about the target structure and the assembly sequence planning. In the class G, the following structures are presented:

• G.adj[s] is the adjacency list of element s, in other words, it is the list of robot systems that are neighbors of robot system s in the target structure; 7.1. Novel algorithms for configurations without internal holes 127

• G.T ree[s] is the list of robot systems added to a robot system s during the assembly process;

• G.parent(s) is the parent of robot system s in the assembly pro- cess.

Algorithm 4 AssemblyOrder(G,s) 1: Label s as discovered 2: for each vertex w in G.adj[s] do 3: if vertex w is labeled as undiscovered then 4: if w can be added to the structure (AddEdge(G,w) is true) then 5: G.T ree[s] ← w 6: G.parent(w) = s 7: Label w as discovered 8: AssemblyOrder(G,w) 9: else 10: deleteBranch(G,s) 11: Label s as undiscovered 12: Return 13: end if 14: end if 15: end for 16: if Exists w in G.adj[s] marked as undiscovered then 17: deleteBranch(G,s) 18: Label s as undiscovered 19: Return 20: end if

In order to initialize the assembly process, select a robot system s as starting point and then, run Algorithm4. The algorithm is for- mulated as a recursion, similar to a DFS search in a graph. A brief explanation of Algorithm4 (Assembly Order) is presented below.

Line 1: Add robot system s to the growing structure (label s as dis- covered).

Lines 2−3: Select a robot system w which is a neighbor of robot system s and which has not yet been added to the growing structure, i.e. a robot system w yet marked as undiscovered. 128 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

Line 4: Function AddEdge, which will be explained in Section 7.1.1, checks if it is possible to add robot system w, i.e. if the accessib- ility condition holds for w. If it is possible, continue, otherwise, go to line 9.

Lines 5 − 7: Add robot system w to the growing structure and mark robot system s as the parent of w. It is important to note that Line 7 is redundant. In fact, in Line 8 the procedure will be called for w, then, in Line 1, w will be marked as discovered. Thus, Line 7 can be eliminated from the algorithm and it was only included for a better understanding.

Line 8: Call recursively the procedure AssemblyOrder(G,w), i.e. con- tinue searching “deeper” for new robot systems to be added to the growing structure.

Lines 9 − 12: If AddEdge(G,w) is false, the robot system w cannot be added to the growing structure due to the accessibility condition. This implies that other already assembled robot systems must be deleted from the growing structure. Otherwise, the accessibility issue will not be resolved and wherever the ASP tries to add w, the same problem will occur. For example, robot systems in Figure 56 cannot be assembled in F → E → C order. As discussed, robot system C cannot be added to the structure due to the accessibility issue. This implies that robot system E or robot system F must be deleted from the structure, otherwise, robot system C cannot be added. Returning to Algorithm4, a robot system s is deleted from the growing structure in Line 11, where s is marked as undiscovered. This deletion is performed to solve an accessibility issue for s’s child, robot system w. Thus, robot system s is deleted from the structure because there is a chance that robot system s is the one causing the accessibility issue for robot system w. However, if s is deleted from the growing structure but its children are not deleted, the configuration will become disconnected. Thus, if a robot system is deleted from the growing structure, its children must also be deleted along with its children’s children, and so on. Furthermore, this deletion must be performed before delet- ing robot system s. This part of the deletion process is done in Line 10, by function DeleteBranch, which will be explained in Section 7.1.2. 7.1. Novel algorithms for configurations without internal holes 129

Let us consider a simple example for a better understanding. Con- sider only the sub-structure formed by robot systems F,E,G and C in Figure 55. Suppose that the algorithm visits F → E → G, as shown in Figures 58a and 58b, following Steps 1 and 2. Robot system G has no neighbor to add, so the algorithm tries to add a new neighbor of robot system E. In Step 3, the only undiscovered neighbor of E is robot system C, which cannot be added to the structure because of the accessibility condition.

G F (2) F (1) Step 1 E

(3) E Step 2 Step 3 C

G @C (a) (b)

Figure 58 – If the algorithms places F → E → G and then, in Step 3, E tries to add robot system C, an incorrect ASP is en- countered because C cannot be added to the growing struc- ture.

As C cannot be added to the growing structure, C’s parent, robot system E, cannot also added to the structure at this point and it will be deleted by the condition in Line 11. However, as robot system E has added robot system G, G must be deleted before E, otherwise the configuration become disconnected. Thus, in Line 10, function deleteBranch deletes G which is a child of E, as shown in Step 4 of Figure 59a. Then, as explained, robot system E will be deleted by the condition in Line 11, as shown in Step 5 of Figure 59a. If G has added any neighbors to the growing structure, that neighbors would have been also deleted by function deleteBranch. After the deletion of G and E, the search returns to the previous added robot, in this case, F . New neighbors of F are explored (Step 6 in Figure 59b). Finally, the correct assembly sequence F → C → E → G is eventually encountered (Steps 6 − 8 in 130 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

F Step 6 F Step 5: @E C

Step 7 Step 5: @E Step 4: @G Step 3: @C E

Step 8

Step 4: @G Step 3: @C G (a) (b)

Figure 59 – Following steps of the assembly sequence for the example in Figure 58a. (a) Step 4: G is deleted by function deleteBranch(G,E). Step 5: robot system E is deleted by the condition in Line 11 of Algorithm4. (b) Steps 6 − 8: the correct assembly sequence F → C → E → G is en- countered.

Figure 59b). Lines 16-20: Given a robot system s, when the recursion explores all neighbors of s, if any of these neighbors is still not added to the structure, then s cannot also be added to the structure.

For better understanding, consider only the sub-structure formed by robot systems I, J, K, L in Figure 55, as shown in Figure 60a. Consider that robot systems I and J had being connected to the growing structure in I → J order. For the remaining robot systems K and L there are two possible assembly orders I → J → K → L or I → J → L → K. Let’s analyze each case: • Sequence I → J → K → L: Due to the accessibility issue, robot system L cannot be added to the growing structure, as shown in Figure 60b. Robot system K is marked as undiscovered by the condition in lines 9-12. Thus, by the end of this cycle, I − J are marked as discovered, and K − L as undiscovered; • Sequence I → J → L → K: Due to the accessibility issue, robot system K cannot be added to the growing structure, as shown in Figure 60c. Robot system L is marked as undiscovered by the condition in lines 9-12. Thus, by the end of this cycle, I − J are marked as discovered, and K − L as undiscovered. 7.1. Novel algorithms for configurations without internal holes 131

(1) I I (1) (2) I I II J J J (2) II J J J I I I I K J I I L J II J JJ K J (3) L J II K L J K K L L LL K L J L K (3) (4) (4) K L LL L LL K

(a) (b) (c)

Figure 60 – (a) Sub-structure of the configuration in Figure 55 used to explain Lines 16-20 of Algorithm4. Due to the accessib- ility issue, robot system L and K cannot be added to the growing structure in cases (b) and (c), respectively.

Thus, it can be concluded that after the neighborhood checking cycle for robot system J, not all of J’s neighbors can be added to the growing structure. This implies that robot system J cannot be added to the growing structure, otherwise the entirely structure cannot be assembled. As J had already been marked as discovered in the first part of the Algorithm4, robot system J needs to be remarked as undiscovered (in Line 15). In the next section, the auxiliary algorithms called by the main procedure, Algorithm4, the Algorithms5 (addEdge) and6 (deleteBranch) are presented.

7.1.1 Conditions for adding a new robot system to the target structure The algorithm herein described gives a procedure to determine if a new robot system can be added to the growing structure. This algorithm considers an oriented graph constructed as follows. Wherever a new robot system s is added to the growing structure, construct oriented edges ending in s and starting in the s’s already added neighbors. Figure 61 represents an incorrect assembly order K → J → L between robot systems K, L, J. Let us analyze the edges creation and how they detect the incorrect assembly order. First, robot system J 132 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems is added to the configuration composed only by robot system K, thus edge K → J is created, as shown in Figure 61a. Then, robot system L is added to the configuration composed by robot systems K,J, thus edges K → L and J → L are created, as shown in Figure 61b.

J J (8, 5) (9, 5) N,E (8, 4) , 4) (9, 4)(8(10, 4) S W K K L

(a) (b)

Figure 61 – (a) Robot system J is added to the configuration composed only by robot system K, thus edge K → J is created. (b) Robot system L is added, thus edges K → L and J → L are created.

As seen in Figure 61, each edge can receive one to four labels: north, south, east and west, according to the following rule. If exist adjacent modules a ∈ A and b ∈ B, with a = (ax, ay), b = (bx, by), an edge from robot A to robot B (edge A → B) is labeled as:

• North: if module a is at north of module b, i.e. ax = bx and ay = by + 1;

• South: if module a is at south of module b, i.e. ax = bx and ay = by − 1;

• East: if module a is at east of module b, i.e. ay = by and ax = bx + 1;

• West: if module a is at west of module b, i.e. ay = by and ax = bx − 1.

As previously stated, Figure 61 represents an incorrect assembly order K → J → L between robot systems K, L, J. In fact, L cannot 7.1. Novel algorithms for configurations without internal holes 133 be added between K and J, if these robot systems are already in the target structure. Let us analyze this incorrect assembly order.

Step 1: When robot system K is added, no edge is constructed; Step 2: When robot system J is added, an edge coming from his already added neighbor K is constructed. This edge is labeled as south, as shown in Figure 61a. In fact, module (8, 4) ∈ K is adjacent to the south of module (8, 5) ∈ J; Step 3: When robot system L is added, edges starting in his already placed neighbors K and J are constructed. These edges are shown in Figure 61b and are labeled as: • West: module (8, 4) ∈ K is adjacent to the west of module (9, 4) ∈ L; • North: (9, 5) ∈ J is adjacent to the north of module (9, 4) ∈ L; • East: module (10, 4) ∈ J is adjacent to the east of module (9, 4) ∈ L.

In Figure 61b, the presence of west and east edges formalizes the fact that L is placed in a narrow space between K and J, representing an incorrect assembly order. The same analysis holds for north-south edges. In fact, the presence of north-south or east-west edges pairs end- ing at a robot system shows that this robot system cannot be added to the structure. Thus, in order to determine if a new robot system s can be added to the growing structure, Algorithm5 (AddEdge) considers all edges arriving in s. These edges start at s’s neighbors already added to the growing structure. AddEdge checks if these edges are in conflict, i.e. if exists north-south or east-west edges pairs. If no conflict occurs, the algorithm returns true, signalizing that the new robot system can be added to the growing structure. Otherwise, it returns false. It is important to regard that in this construction, the case where a module is blocked by diagonal neighbors is not considered. For ex- ample, consider the configuration in Figure 62a. This configuration cannot be assembled in A → C → B → D → E order. Algorithm5, AddEdge, is capable of detecting that robot system E cannot be added to the structure if A, B, C and D have already been added to it. In fact, conflicting edges coming from north-south and east-west arrive at E coming from robot systems A − C and A − D, respectively. However, the accessibility issue that forbids configuration in Fig- ure 62a from been assembled in A → C → B → D → E order occurs 134 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

Algorithm 5 AddEdge(G,s) 1: for each vertex w in G.adj[s] do 2: if vertex w is labeled as discovered then 3: Create edge (w, s) 4: end if 5: end for 6: Check if any created edges are in conflict 7: if A conflict occurs then 8: Return false 9: else 10: Return true 11: end if

A B A B D E D 3 2

1

C C (a) (b)

Figure 62 – (a) A target structure. (b) Robot system D cannot be added to the growing structure without passing through a narrow corridor. before robot system E is added to the structure. In fact, robot system D has to pass through a narrow corridor if A, B and C are already placed in the growing structure, as can be concluded by analyzing Fig- ure 62b. However, AddEdge is not able to detected this problem, be- cause, as shown in Figure 62b, robot systems A and B are diagonal neighbors of robot system D. In fact, the diagonal edges 3 and 2 in Figure 62b are not considered by algorithm AddEdge. These edges come respectively from robot systems A and B and arrived at D, and they are the ones who reflect the accessibility issue. It can be concluded that AddEdge does not directly detects ac- cessibility issues caused by diagonal neighbors. However, this is not an algorithm’s limitation. In fact, as holes are considered as auxiliary ro- bot systems, if a robot system is blocked for diagonal neighbors, at least 7.1. Novel algorithms for configurations without internal holes 135 one of the successively added robot system is blocked by north-south, west-east neighbors, as occurred for robot system E in the previous example. This fact is better explained in Section 7.1.1.2 where the soundness of AddEgde is discussed. In the next sections, termination, soundness and completeness of Algorithm5, AddEdge are discussed.

7.1.1.1 Termination of Algorithm5 Lines 1 − 5 are terminated when cycle for is completed for graph G. In the worst scenario, G is a complete and finite graph with n n(n−1) vertices, thus it has 2 edges. In this case, as G is presented in the adjacency list form, cycle for finishes after n(n−1) operations. Also, considering m as the number of novel edges created in Line n(n−1) 3 then, m is limited by the number of edges in G, i.e. m ≤ 2 . Line 6 is finished when all pairs of edges created in Line 3 are tested. If m edges are generated in the previous step then, the number m! of testes is limited by (m−2)!2! < m(m − 1). If a conflict occurs then, Lines 7 − 8 are performed and the algorithm returns false. Otherwise, Lines 9 − 11 are performed and the algorithm returns true.

7.1.1.2 Soundness of Algorithm5 Consider a configuration C, its graph G and a robot system s belonging to C. A call of function AddEdge is started when As- semblyOrder, Algorithm4, tries to add a robot system s to the ASP constructing C. Thus, in Lines 1 − 5, AddEdge creates edges between s and its already assembled neighbors. In Line 6, AddEdge checks if there exists north/south or east/west pair of edges. If a conflict occurs, AddEdge returns false, otherwise it returns true. Therefore, for each robot system s being added by AssemblyOrder, AddEgde guarantees that there are not direct neighbors of robot system s at its north and south or at its east and west. Thus, s is not blocked by north/south or east/west neighbors. Let us now examine if the north/south or east/west checking is a sufficient condition in order to detect that a module passes through a narrow corridor during assembly. First, let us consider an example. Consider the scenario shown in Figure 63a where each module is considered as an independent robot 136 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems system. In this figure, module k cannot be added to the structure due to the accessibility condition. However, as shown in Figure 63b there is no conflicting edges coming from the k’s already assembled neighbors, thus, function AddEdge, Algorithm5, does not detect the accessibility issue at this point and k is temporarily added to the growing structure.

k

t W k k W E S

(a) (b) (c)

Figure 63 – Accessibility issue detection.

However, as at first, the ASP only considers configurations without internal holes, other modules are added to the growing structure as shown in Figure 63c. Thus, at some point, some module will be blocked by north-south or east-west neighbors, as shown in Figure 63c. This example illustrates that function AddEdge detects access- ibility issues if configurations do not have internal empty spaces, even if this detection is not immediate. Furthermore, as explained in Section 7.1.4.2, after detecting the accessibility issue, Algorithm4 performs sequential deletions until, k, the first robot system violating the accessibility condition is deleted from the growing structure. In fact, let t be the last added robot system in Figure 63c. Robot system t is deleted from the ASP because function deleteBranch detects east/west conflicting edges arriving at t. Then, the ASP returns to robot system k which can try add other robot systems to the structure. However, at the end of the neighborhood checking for k, its neighbor t remains undiscovered. Thus, k is deleted from the ASP by the conditions in Line 16 − 20 of Algorithm4. An important implication of this example is that, in order to detect all possible accessibility issues, internal holes must also be re- garded as robot systems, otherwise situations as in Figure 63a cannot 7.1. Novel algorithms for configurations without internal holes 137 be avoided. This approach will be better explained in the next section. However, in order to discuss the soundness of function AddEdge, it is sufficient to regard that the proposed ASP considers internal holes as auxiliary robot systems. Let us now analyze the creation of a narrow corridor between two assembled modules. Consider only module A in Figure 64 and consider a generic configuration C containing A. If any module from B to Q in Figure 64 is added to configuration C then, a narrow corridor between A and the novel module is created.

B C D E F

Q G

P A H

O I

N M L K J

Figure 64 – Module A forms a narrow corridor with any of the modules from B to Q.

First, let us analyze the case where the narrow corridor is created in the generic configuration C between module A in position (i, i) and one of the modules D, H, L or P , which are respectively in positions (i − 2, j), (i, j + 2), (i + 2, j), (i, j − 2) as shown in Figure 65a. Figure 65b shows that if configuration C has no internal holes, a novel module is eventually added in position (i−1, j), (i, j+1), (i+1, j), (i, j −1). Thus, function AddEdge will create north/south or west/east edges arriving at the novel module, detecting the accessibility issue. Also, as internal holes must be regarded as robot systems, if any of the positions (i−1, j), (i, j+1), (i+1, j), (i, j−1) belongs to an internal hole, an auxiliary module eventually occupies this position thus, function 138 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

AddEdge will create north/south or west/east edges arriving at this auxiliary module.

D D (i − 2, j) N S P A H P W E A W E H (i, j − 2) (i, j) (i, j + 2) N S L L (i + 2, j)

(a) (b)

Figure 65 – Detection of the narrow corridors between module A and modules D, H, L and P .

Second, let us consider the case where a narrow corridor is cre- ated in configuration C between module A and the other modules in Figure 64, i.e. modules B, C, E, F , G, I, J, K, M, N, O or Q. In order to perform the analysis, let us consider modules in the narrow corridor created between modules A, which is in position (i, j), and F , which is in position (i − 2, j + 2), the other cases are similar. Figure 66b shows that if a new module s is added in position (i−1, j+1) no accessibility issues are encountered. Thus, the creation of a narrow corridor may not translate into accessibility issues. In fact, in order to have an accessibility issue, a novel module must transverse the narrow corridor and then be added to some position inside the structure. This situation is illustrated in Figure 67. Let us consider a generic connected configuration C containing modules A and F , and let us consider a path of modules between mod- ules A and F , as shown in Figure 67. This path must exist because the generic configuration C is connected. Also, this path is not closed, because A and F are not mechanical docked. However, it can be closed by connecting modules A and F , as shown in Figure 68. If a novel module transverse the narrow corridor between A and 7.1. Novel algorithms for configurations without internal holes 139

F F

s

A A

(a) (b)

Figure 66 – Conditions for obtain a narrow corridor.

F

Novel module

A

Figure 67 – Conditions for obtain a narrow corridor.

F , it will be surrounded by the modules in the closed path. After placing this module inside the closed path, if no accessibility issues are detected, the ASP tries to fully cover the remaining space with 140 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems novel modules. In the worst scenario, the last module added inside the closed path is blocked by north/south and west/east neighbors. Thus, AddEdge eventually detects the accessibility issue.

F

Novel module

A

Figure 68 – Conditions for obtain a narrow corridor.

Furthermore, as explained in Section 7.1.4.2, after detecting the accessibility issue, Algorithm4 performs sequential deletions until the first robot system violating the accessibility condition is deleted from the growing structure. Next section discusses the complexity of Algorithm5.

7.1.1.3 Complexity of Algorithm5

Consider a configuration composed by n robot systems. As dis- cussed in Section 7.1.1.1, in order to identify accessibility issues, Al- n(n−1) gorithm5 creates m ≤ 2 novel edges. Also, the number of com- m! parisons between these edges is limited to (m−2)!2! comparisons. In the n(n−1) 2 ! worst scenario, n(n−1) testes are performed; thus, the algorithm ( 2 −2)!2! has O(n4) complexity. In the next section, Algorithm6 (deleteBranch), which gives a procedure to delete forbidden robot systems from the growing structure, 7.1. Novel algorithms for configurations without internal holes 141 is introduced. This algorithm is the other function which is called by main algorithm, Algorithm4.

7.1.2 Deleting a branch from the structure In this section, Algorithm6 (deleteBranch), which gives a pro- cedure to delete forbidden robot systems from the growing structure, is introduced. For better understanding, of Algorithm6, consider that a generic robot system w must be deleted from the ASP and that his parent in the assembly process is robot system s. When w was added to the growing structure two operations occurred:

• Robot system w was added to his parent adjacent list in Line 5 of Algorithm4 (Assembly Order), i.e. G.T ree[s] has received w;

• Robot system w was marked as discovered in Line 7 of Algorithm4 (Assembly Order).

Thus, in order to delete robot system w from the growing struc- ture it is necessary to:

• Delete robot system w from G.Tree[s];

• Mark robot system w as undiscovered.

It is important to regard that a robot w is deleted from the ASP when it is marked as undiscovered. G.T ree is an auxiliary structure which allows keeping track of the parent-child relations. As previously stated, if a robot system w is deleted from the growing structure, its children must be also deleted along with its children’s children, and so on. Thus, G.T ree is used to identify which robot systems must be deleted from the growing structure. An example of this procedure was shown in Figure 58b. In Step 3, robot system E tried to add robot system C. Due to the access- ibility issue, robot system C could not be added to the growing struc- ture. Thus, Algorithm4 (Assembly Order) called the deleteBranch pro- cedure for robot system E (C’s parent). As robot system E added robot system G, both robot systems E and G were deleted from the growing structure, as shown in Figure 59a. The function deleteBranch(G, E) performed the following operations:

• Marked robot system E as undiscovered and deleted it from G.Tree[F ]; 142 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

• Marked robot system G as undiscovered and deleted it from G.Tree[E]. If robot system G has added any neighbors to the growing structure, those neighbors would have been deleted in a similar process. This sug- gest a recursive implementation of the deletion process. Algorithm6, deleteBranch, summarizes this idea.

Algorithm 6 deleteBranch(G,s) 1: Remove s from G.Tree[parent(s)]; 2: while G.Tree[s] isn’t empty do 3: Pop the first element w from G.Tree[s]; 4: Mark w as undiscovered; 5: deleteBranch(G,w); 6: end while

As a complementary example, consider the target configuration in Figure 69a. Consider the ASP with Steps 1 − 8 in Figure 69b. In Step 8, robot system H cannot be added to the growing structure due to the accessibility condition, thus the ASP tree branch B − H is not created. As the parent of robot system H is robot system B, B must be deleted from the structure along with its children, also, its children’s children must be deleted, and so on. Thus, function deleteBranch(G,B) is called to performed this deletion process. The function will delete all branches of the ASP tree starting at B, i.e. branches B − C − G and B − D − E − F will be deleted by function deleteBranch(G,B). As previously stated, G.T ree is used to identify which robot systems must be deleted from the growing structure when function deleteBranch is called. For the example in Figure 69b, because robot system H cannot be added by B to the growing structure, deleteBranch is called for robot system B. This situation is shown in Figure 70a. The sequence of operations performed by deleteBranch(G,B) in G.T ree is given below. • As robot system A added B, function deleteBranch(G,B) deletes B from the auxiliary structure G.T ree[A], as shown in Figure 70b. • The algorithm searches for robot systems which have been added by B. Thus, as shown in Figure 70c, C is deleted from G.T ree[B]. • Function deleteBranch(G,C) is called and the same process is restarted for C. Robot system G which is a child of C is deleted from the auxiliary structure, G.T ree[C], as shown in Figure 70d. 7.1. Novel algorithms for configurations without internal holes 143

A

(1)

B (2) F (8) (5) E C D HZZ D (3) (6)

A B C G G E

H (7)

F (a) (b)

Figure 69 – (a) A target structure. (b) An ASP for the configuration in (a). In Step 8 of the ASP, robot system H cannot be added to the growing structure due to the accessibility condition. Thus, the ASP tree branch B − H is not created. Also, all branches of the ASP tree starting at H’s parent, robot system B, will be deleted by function deleteBranch(G,B), i.e. branches B − C − G, B − D − E − F will be deleted.

• As G added no robot systems to the growing structure, the al- gorithm tries to return to his parent C. As G.T ree[C] is empty, the algorithm returns to C’s parent, robot system B. Thus, robot system D is deleted from G.T ree[B], as shown in Figure 70e.

• Robot system E is deleted from G.T ree[D], as shown in Fig- ure 70f.

• Robot system F is deleted from G.T ree[E], as shown in Fig- ure 70g.

However, when a robot system w is deleted from G.tree, it is deleted from an auxiliary structure, not from the growing structure, i.e. from the ASP. In fact, Algorithm6, deleteBranch, not only de- letes a robot system w from G.T ree in Line 3, but also marks w as undiscovered in the successive line, Line 4. Thus, G.T ree is used to de- termine which robot systems must be marked as undiscovered, i.e. must be deleted from the growing structure. In the next section, the termination, the soundness and the com- plexity of Algorithm6 are discussed. 144 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

A @B A B A B C D B C D @H B @C D C G C G C G D E D E D E E F E F E F F F F G G G H H H (a) (b) (c)

A A A A A B B D B @D B B C C @G C C C D E D E D SE D D E F E F E F E SF E F F F F F G G G G G H H H H H (d) (e) (f) (g) (h)

Figure 70 – (a) Robot system H cannot be added to the growing structure, thus deleteBranch(G,B) is called. (b-h) Se- quence of operations performed in G.T ree by function deleteBranch(G,B).

7.1.2.1 Termination of Algorithm6

Algorithm6 is executed in order to delete elements from the ASP created by Algorithm4. In Section 7.1.4.2, it is shown that Algorithm4 always returns connected and finite trees without accessibility issues. Thus, Algorithm6 is executed on a finite and connected tree. Suppose that Algorithm6 is executed on a tree G with n vertices. In the worst scenario, the first call of Algorithm6 is performed for the tree root, a generic robot system s. As G is a tree with n elements, it has n − 1 edges. Also, for each call of Algorithm6, when Line 3 is performed, a tree edge is eliminated along with its tree leaf. Thus, after n − 1 calls of Algorithm6, all the n−1 tree edges are eliminated. At this point, each while cycle is closed, terminating the entirely procedure. 7.1. Novel algorithms for configurations without internal holes 145

7.1.2.2 Soundness of Algorithm6

In order to show the soundness of Algorithm6, it is necessary to show that the ASP tree is not disconnected while performing the deletion process. This is done in Section 7.1.4.2, when the soundness of Algorithm4 is discussed.

7.1.2.3 Complexity of Algorithm6

As discussed in Section 7.1.2.2, Algorithm6 is executed on a finite and connected tree G. As the tree G is implemented using adja- cency lists, the overall complexity is O(V ) + O(2E), i.e. O(V + E). The three algorithms: Algorithm4, Algorithm5 (addEdge) and Algorithm6 (deleteBranch) contain the necessary steps to assembly tar- get structures without internal holes and composed by robot systems. Section 7.1.3 provides the general steps for applying these procedures.

7.1.3 Applying the novel algorithms for configurations without internal holes

As previously stated, the ASP algorithms have been programmed using object-oriented language C++. In order to obtain the class ele- ment G.adj, the target structure is modeled as an undirected graph in the adjacency list form: each robot systems is represented by a vertex and robot systems neighborhood relations are represented by edges. The other elements of class G, G.T ree[s] and G.parent, contain the ASP steps. Thus, they are initialized as empty elements. At the end of the ASP procedures, G.T ree contains a total order to assembly the tar- get structure, i.e. the ASP provides a non-parallel sequence for adding the robot systems to the growing structure. All computer simulations were performed in a 4GB, Intel Core I5, 1.6 GHz machine. For configurations without internal holes, the ASP main algorithm is Algorithm4. Considering the configuration in Figure 55, given an arbitrary choice of the starting robot system for the assembling process, the average computational time was 8 ms. For ex- ample, Figure 71 shows how the configuration in Figure 55 is assembled with the proposed ASP whit robot system F chosen as starting point. There is no guarantee that the ASP will return all possible assemble sequences for a given configuration. But any sequence returned by the ASP will not violate the accessibility condition for any module. To the best of the author’s knowledge, this is the first work that shows how to 146 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems assembly target structures composed by shape heterogeneous modular robot systems. A further discussion about all ASP implementation and results is presented in Chapter9. Next, the termination, the soundness, the completeness and the complexity of Algorithm4 are discussed. This algorithm provides the main procedure to assemble configurations composed by robot system and without internal holes. This analysis is herein presented after the analysis of Algorithm5 and Algorithm6 because these two algorithms are subroutines of Algorithm4 which is the main procedure.

7.1.4 Properties of Algorithm4 In this section, termination, soundness and completeness of Al- gorithm4 are discussed. It is shown that Algorithm4 terminates and it is sound, however, it is not complete.

7.1.4.1 Termination of Algorithm4 Given a configuration C with n robot systems, Algorithm4 ter- minates if an ASP with n elements is founded or if all possible sequences are explored. In the first case, as Algorithm4 finds an ASP with n elements, all robot systems belonging to configuration C are marked as discovered. Thus, each open call of function AssemblyOrder is closed when the cycle for in Line 2 is terminated. In fact, as there are no undiscovered robot systems, the conditions in Line 3 and in Line 16 are not true. Therefore, for each open call of AssemblyOrder, the cycle for in Line 2 is terminated without further operations, thus, the algorithm ends. In the second case, in the worst scenario, the algorithm ends when all possible vertices combinations are explored, i.e. when all span- ning trees are visited. For a complete graph with n vertices the number of these trees is nn−2. However, for the modular robot case, the con- figuration graph is usually not complete, therefore the number of these possibilities is lower and can be determined by the Kirchoff’s matrix tree theorem [66].

7.1.4.2 Soundness of Algorithm4 In order to show the soundness of Algorithm4, it will be show that it always returns connected trees without accessibility issues. 7.1. Novel algorithms for configurations without internal holes 147

(a) (b) (c) (d) (e)

(f) (g) (h)

(i) (j)

(k) (l)

Figure 71 – ASP for the configuration in Figure 55 with robot system F as starting point. 148 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

Consider an ASP Sn with n elements returned by Algorithm4. First, the accessibility condition is shown by an induction in n. For n = 1 the property is true. In fact, if n = 1, when the algorithm starts, Line 1 marks this element as discovered. Then, as no undiscovered elements remains, the algorithm ends. Thus, for n = 1, the algorithm returns a tree with a single element which is connected and does not presents accessibility issues. Assume that for some n ∈ N, the algorithm returns ASPs without accessibility issues for every natural i < n. Consider an ASP Sn with n elements, obtained from an ASP Sn−1 with n − 1 elements by adding a new element k. By the induction hypothesis, Sn−1 presents no ac- cessibility issues. Thus, if Sn presents some accessibility issue it must be caused by element k. Consider s the parent of k in this step of the process. There are two possibilities:

i) If k causes no accessibility issues, Line 4 of Algorithm4 is satis- fied. Thus, k is added to the structure in Lines 5 − 7. Then, AssemblyOrder(G,k) is called in Line 8. Because k has no un- discovered neighbors, AssemblyOrder(G,k) is terminated as all the others AssemblyOrder calls. Therefore, an ASP Sn with n elements presenting no accessibility issues is returned.

ii) If k causes an accessibility issue, deleteBranch(G,s) is called in Line 10. Thus, the ASP branch starting in s, parent of k, is deleted. Then, s is also deleted from the structure in Line 11. At this point, the assembly ASP presents l < n elements thus, by the induction hypothesis, it presents no accessibility issues. The algorithm returns to s’s parent, an element a. If a has unvis- ited and unexplored neighbors, they are explored at this point. If, at the end of the neighborhood checking for a, s and all the other a’s neighbors are added to the structure, AssemblyOrder(G,a) is terminated. At this point, the algorithm returns a partial ASP with less than n elements. Thus, by the induction hypothesis, it presents no accessibility issues. If, at the end of the neighboring checking for a, s or any other a’s neighbors are not added to the structure, Lines 16 − 20 are performed. Thus, s and a are deleted, along with the branch starting in a. As in the previous case, the algorithm returns a partial ASP with less than n elements, thus, by the induction hypothesis, it presents no accessibility issues. 7.1. Novel algorithms for configurations without internal holes 149

The algorithm then returns to a’s parent, an element b and the process described in the two paragraphs above is performed for b, and so on. At the worst scenario, an element j cannot be added to the structure at any step thus, the resulting ASP is empty. Consider that all possible ASP but one were already tested. Sup- pose that in the final possible sequence, an element i tries to add j. As j cannot be added to the structure at any point, i and its entirely ASP branch are deleted. Then, the parent of i is deleted by the condition in Lines 16 − 20 and so on, until all elements are deleted. Thus, the resulting ASP is empty. Therefore, when the Algorithm4 ends, the ASP presents n ele- ments without accessibility issues or it is empty.

Next, it is shown that the ASP is a tree. When an element w with parent s is added to the structure, a single edge is created. In fact, in Line 5, w is added to G.Tree[s] i.e. edge (s,w) is created. Thus, for each added element, only one edge is created. Therefore, if n elements are added, n − 1 edges are created. Also, no cycles are created. In fact, if a vertex k is incident to two edges, k has two parents x and y in the process. This is an absurd because after k is added to the ASP by an element x, k is marked as discovered. Thus, another element y cannot add k unless it has been remarked as undiscovered. In order to marked k as undiscovered, function deleteBranch(G, x) must be called, which can only occur in Lines 10 or 17. However, after each of these lines, x is marked as undiscovered. Thus, even in this case, k has only one parent, y. Therefore, no cycles are created in the ASP process. As the process creates n−1 edges and no cycles when n elements are added, the ASP constructs a tree. Furthermore, when function deleteBranch is called, it performs an DFS search marking tree leaves as undiscovered. Therefore, the ASP remains a tree when this function is called. In fact, suppose that deleteBranch is called for some element s. Fist, in its Line 3, function deleteBranch pops the first element w from G.Tree[s], i.e. edge (w,s) is deleted. Then, in Line 5, deleteBranch(G, w) pops the first element z from G.Tree[w], i.e. edge (z,w) is deleted. This process continues until function deleteBranch reaches an element d whose G.Tree[d] is empty, i.e. d is a leaf of the ASP tree. Then, function deleteBranch returns to d’s parent, some element c. In other words, it returns to deleteBranch(G, c) open call. However, 150 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems this call is only closed when all elements in G.Tree[c] are deleted. Thus, when deleteBranch(G, c) is closed, c is a leaf of the ASP tree. The same occurs for each of function deleteBranch calls. Thus, this the recursive deletion process can be viewed as successively deleting tree leafs. Therefore, the ASP remains a tree after all the deletions.

7.1.4.3 Completeness of Algorithm4 Algorithm4 is not complete. In fact, some viable assembly se- quences might not be discovered. Given a configuration G composed by robot systems, the algorithm considers sequences starting in a chosen robot system, s. Then, in order to achieve a correct ASP, Algorithm4 traverse G’s adjacent lists and it stops if any ASP starting in s is found. Thus, it can only find one ASP for each starting point. Therefore, if exists more than one ASP starting at a robot system s, Algorithm4 can only find one of these ASP.

7.1.4.4 Complexity of Algorithm4 As stated in Section 7.1.4, in the worst scenario, the algorithm ends when all possible vertices combinations are explored, i.e. when all spanning trees are visited. For a complete graph with n vertices the number of these trees is nn−2 thus, the complexity is O(nn−2). However, for the modular robot case, the configuration graph is usually not complete, therefore the number of these possibilities is lower and can be determined by the Kirchoff’s matrix tree theorem [66].

7.2 NOVEL ALGORITHMS FOR CONFIGURATIONS WITH IN- TERNAL HOLES

Section 7.1 presented the basic steps of the novel ASP for target structures without internal holes. In this section, the proposed ASP is extended for target structures with internal holes. In order to per- form this extension, holes are regarded as one or more robot system. Also, additional rules, original contribution of this thesis, are herein introduced. The difference between the ASP proposed for configurations with and without internal holes is in the main procedure, Algorithm4. Thus, the new rules are aggregated only into this procedure. In other words, the auxiliary procedures: Algorithm5 (addEdge) and Algorithm6 (de- leteBranch) remain unchanged. 7.2. Novel algorithms for configurations with internal holes 151

Consider the configuration in Figure 72a. This configuration is composed by robot systems A, B, C and D and contains an internal hole. As discussed in Section 7.1.1.2, internal holes must be treated as robot systems, otherwise accessibility issues might not be detected. However, let us first disconsider the internal hole. If the proposed ASP starts at robot system B, then one of the correct assemble sequences: B → D → C → A or B → A → C → D, is found, depending on whether B adds first A or D. A similar situation occurs if the ASP stars at robot system C. However, if the ASP starts at A or D no assembly sequence is found.

D D

C Internal Hole B C B h1

A A

(a) (b)

Figure 72 – (a) A target structure with an internal hole. (b) If the internal hole is modeled as a robot system h1, then, the target structure can be assembled with the proposed ASP.

Let us analyze the case where ASP starts at robot system A. Consider initially the incorrect order A → C → D → @ @B . In order to achieve this sequence, robot system A adds robot system C and robot system C adds robot system D. Finally, robot system D tries to add robot system B. However, as robot system B cannot be added at that point, B’s parent, robot system D, is delete from the growing structure. Then, the ASP returns to robot system C. As there are no unexplored neighbors of C, C is deleted from the growing structure and the ASP returns to robot system A. Consider now the other incorrect assembly order starting at A, A → B → D → @C . Robot system A adds now robot system B, robot system B adds robot system D and then, robot system D tries to add robot system C. However, as robot system C cannot be added at that 152 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems point, C’s parent, robot system D, is delete from the growing structure. The ASP then returns to robot system B. As there are no unexplored neighbors of B, B is deleted from the growing structure. It can be concluded that after the neighborhood checking cycle for robot system A, not all of A’s neighbors can be added to the growing structure. Thus, robot system A is deleted from the structure and the ASP returns an empty sequence. However, A → B → C → D and A → C → B → D are correct assemble sequences which could not be found by the proposed ASP. This implies that, in order to find a correct ASP, a modification must be introduced. As previously stated, in order to apply the proposed ASP for configurations with internal holes, the internal holes are considered as one or more auxiliary robot systems and two additional rules are herein introduced. Let us consider again the configuration in Figure 72a, however let us consider the internal hole as a new robot system h1, as shown in Figure 72b. If the proposed ASP starts at robot system A, then a (1) (2) (3) (4) correct assemble sequence is found: A −−→ B −−→ h1 −−→ C −−→ D or (1) (2) (3) (4) A −−→ C −−→ h1 −−→ B −−→ D, depending on whether A adds first B or C. (1) (2) (3) (4) Consider the A −−→ B −−→ h1 −−→ C −−→ D case. It is important to notice that when robot system h1, which represents the internal hole, added robot system C, robot system C connected with robot system A. As these operations have occurred at Step 3, this step can be modified by letting robot system A add robot system C, as shown in Figure 73a. Thus, the auxiliary structure h1 can be eliminated from the original ASP, as shown in Figure 73b. Thus, Figure 73c shows the correct ASP without the auxiliary structure h1. (1) (2) (3) (4) A similar situation occurs for the A −−→ C −−→ h1 −−→ B −−→ D case. When robot system h1, which represents the internal hole, added robot system B, robot system B connected with robot system A. As these operations have occurred at Step 3, this step can be modified by letting robot system A add robot system B. Then, the auxiliary structure h1 can be eliminated from the original ASP, as shown in Figure 74a. Thus, the correct ASP in Figure 74b, without the auxiliary structure h1, is obtained. It is important to notice that, in both cases, h1 was taken as an auxiliary structure which was posteriorly deleted from the ASP. This deletion was only possible because in both cases the robot system added by h1 had connected with other robot system already in the 7.2. Novel algorithms for configurations with internal holes 153

A A A

(1) (3) (1) (3) (1) (2)

B C B C B C

(2) (4) (2) (4) (3)

h1 D h@ @1 D D (a) (b) (c)

Figure 73 – Consider the configuration in Figure 72b and the assembly (1) (2) (3) (4) order A −−→ B −−→ h1 −−→ C −−→ D. (a,b) By letting robot system A add robot system C at Step 3, the auxiliary structure h1 can be eliminated from the original ASP. (c) Thus, the correct ASP, without the auxiliary structure h1, is obtained.

A A

(1) (3) (1) (2)

C B C B

(2) (4) (3)

h@ @1 D D (a) (b)

Figure 74 – Consider the configuration in Figure 72b and the assembly (1) (2) (3) (4) order A −−→ C −−→ h1 −−→ B −−→ D. (a) By letting robot system A add robot system B at Step 3, the auxiliary structure h1 can be eliminated from the original ASP. (b) Thus, the correct ASP, without the auxiliary structure, h1 is obtained. target structure. The unique exception is if the ASP starts at a hole. Thus, the initial hole must be allowed to connect a first robot system to the growing structure, otherwise, the growing structure will remain empty. This discussion is summarized in Rule 1 which will be included in the proposed ASP in order to assembly configurations with internal 154 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems holes. In the following text, any robot system representing a hole is referenced only as a hole and real robot systems are referenced only as robot systems. Rule 1: If a new robot system s is added to the growing structure, then s must connect with another robot system already in the growing structure. The only exception is if s is the first robot system added to growing structure. In order to apply the proposed ASP to configurations with in- ternal holes, a further rule must be introduced. However, as these rules are incorporated into the novel ASP for configurations with internal holes, Algorithm7, the correctness of these rules is discussed when the algorithm is proposed. Before introducing the second rule, some considerations are presen- ted about how to associate a hole with one or more appropriate robot systems. Consider the configuration in Figure 75a where each of the 17 modules is consider as an independent robot system, labeled A to Q. As previously stated, in order to apply the proposed ASP, the internal hole is modeled as a set of new robot systems. However, if the internal hole in Figure 75a is modeled as a singular robot system, as shown in Figure 75b, the proposed ASP cannot be applied. For a better under- standing, consider only the robot system C and the robot system h1 representing the hole, as shown in Figure 75c. These systems cannot be assembled in C → h1 or h1 → C orders. In fact, as shown respectively in Figures 75d and 75e, system C induces conflicting edges in h1 and system h1 induces conflicting edges in C. Thus, function deleteBranch will not allow C → h1 or h1 → C assembly orders. It is important to notice that, if h1 was in fact a robot system and not an internal hole, this result would be correct. However, h1 models an internal hole, thus if C → h1 and h1 → C are not possible, the modeling is not adequate. Thus, the internal hole in Figure 75a cannot be modeled as a singular robot system. In order to avoid similar problems, internal holes must be modeled by continuous modular system parallel to the x or y axis. Thus, the internal hole in Figure 75a can be modeled as three continuous robot systems parallel respectively to the x or y axis, as shown in Figures 76a and 76b. In order to introduce the second rule, consider again the con- figuration in Figure 76b. This configuration can be assembled in the sequence shown by the arrows in Figure 77. In this sequence, when 7.2. Novel algorithms for configurations with internal holes 155

M L K J I M L K J I

N H N H

O Internal Hole G O h1 G

P C F P C F

Q A B D E Q A B D E

(a) (b)

h1 h1 h1

E W W E C C C

(c) (d) (e)

Figure 75 – (a) A target structure with an internal hole. (b) If the internal hole is modeled as a singular robot system h1, the target structure cannot be assembled. In fact, robot system C cannot be assembled in C → h1 or h1 → C order. As shown respectively in (d) and (e), robot system C induces conflicting edges in h1 and vice versa.

hole h1 adds hole h2, hole h2 does not connect with any robot system already in the structure, but only with hole h1. Thus, if a hole can be added to the structure without violating the accessibility condition, it is not necessary that this hole connects with a robot system already in the target structure. This discussion is summarized in Rule 2 which is also included into the proposed ASP. In Rule 2, any robot system representing a hole is referenced only as a hole and real robot systems are referenced only as robot systems. 156 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

M L K J I M L K J I

N H N H

O h2 G O h1 h2 h3 G

y h h P 1 C 3 F P C F

Q A B D E Q A B D E

x (a) (b)

Figure 76 – The internal hole in Figure 75a can be modeled as three continuous robot systems parallel respectively to the x or y axis, as shown in (a) and (b), respectively.

M L K J I

N H h h h O 1 2 3 G Start P C F

Q A B D E

Figure 77 – This figure shows an application of Rule 2. When the tar- get configuration is assembled in the order shown by the arrows, hole h2 does not connect with any robot system already in the structure. In fact, h2 only connects with h1, which is another hole.

Rule 2: If a hole h is added to the growing structure, then h is not required to connect with any robot system already present in the growing structure. 7.2. Novel algorithms for configurations with internal holes 157

By modeling any internal hole as described above and applying Rules 1 and 2, the ASP can be extended to configurations with in- ternal holes. Thus, incorporating Rules 1 and 2 into AssemblyOrder, Algorithm4, the procedure in Algorithm7 is obtained. In Algorithm7, any robot system representing a hole is referenced only as a hole and real robot systems are referenced only as robot systems. In Algorithm7, if an element s has any holes as neighbors, those holes must be the last elements in s’s adjacent list, i.e. in G.adj[s], be- cause the model proposed in this thesis uses the holes as a last resource to transverse the configuration.

• Rule 1 is summarized in Lines 5 − 15 of Algorithm7. Suppose that a robot system s is trying to add a new robot sys- tem w. If s models a hole and w is not the first added robot system, Rule 1 requires that robot system w connects with an- other robot system z already present into the structure. Thus, in Line 6, the algorithm searches for such robot system z. If z is found, the parent of w must be robot system z. In fact, as s is a hole it cannot be w’s parent in the ASP. Thus, in Lines 7 and 8, w is added to G.T ree[z] and z is marked as w’s parent, respectively. Then, the algorithm can search for new neighbors of w, i.e. AssemblyOrder(G,w) is called in Line 9. If s is not a hole or w is the first added robot system, the usual proced- ure of AssemblyOrder must be performed, which is done in Lines 11 − 15.

• Rule 2 is summarized in Lines 11 − 15 of Algorithm7. Suppose that a robot system s is trying to add a hole w. Thus, by Rule 2, w is not required to connect with any robot system already in the growing structure. This implies that the usual procedure of AssemblyOrder must be performed, which is done in Lines 11 − 15.

In Section 7.2.1, application of Algorithm7 for configurations composed by robot systems and with internal holes is presented. Then, in the following subsections, the algorithm’s main properties are discussed.

7.2.1 Applying the novel algorithms for configurations with internal holes As for the case without internal holes, the ASP algorithms have been programmed using object-oriented language C++. In order to 158 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

Algorithm 7 AssemblyOrder(G,s)- Configurations with internal holes 1: Label s as discovered 2: for Each vertex w in G.adj[s] do 3: if Vertex w is labeled as undiscovered then 4: if w can be added to the structure (AddEdge(G,w) is true) then 5: if s is a hole and w is not a hole or the first added robot system then 6: if Exists a discovered robot system z ∈ G.adj[w] then 7: G.T ree[z] ← w 8: G.parent(w) = z 9: AssemblyOrder(G,w) 10: end if 11: else 12: G.T ree[s] ← w 13: G.parent(w) = s 14: AssemblyOrder(G,w) 15: end if 16: else 17: deleteBranch(G,s) 18: Label s as undiscovered 19: Return 20: end if 21: end if 22: end for 23: if Exists w in G.adj[s] marked as undiscovered then 24: deleteBranch(G,s) 25: Label s as undiscovered 26: Return 27: end if

obtain the class element G.adj, the target structure is modeled as an undirected graph in the adjacency list form: each robot systems is represented by a vertex and robot systems neighborhood relations are represented by edges. The other elements of class G, G.T ree[s] and G.parent, contain the ASP steps. Thus, they are initialized as empty elements. At the end of the ASP procedures, G.T ree presents a total order to assembly the target structure, i.e. the ASP provides a non- 7.2. Novel algorithms for configurations with internal holes 159 parallel sequence for adding the robot systems to the growing structure. It is important to remember that, for every element s, if s has any holes as neighbors, those holes must be the last elements in s’s adjacent list, i.e. in G.adj[s], because the model proposed in this thesis uses the holes as a last resource to transverse the configuration. Algorithm7 with the auxiliary procedures, Algorithm5 (ad- dEdge) and Algorithm6 (deleteBranch), constitute a complete and original method to assembly target structures composed by robot sys- tems and with or without internal holes. For example, Figure 77 shows an ASP for the configuration in Figure 75a, starting at hole h1.A further example is presented. Consider the configuration in Figure 78a which is composed by 8 robot systems, labeled A to H. Figure 78b to Figure 78i show the resulting ASP with robot system A as starting point. In the following subsections, the main properties of Algorithm7 are discussed.

7.2.2 Properties of Algorithm7 In this section, the termination, soundness and completeness of Algorithm7 are discussed.

7.2.2.1 Termination of Algorithm7 The termination of Algorithm7 follows directly from the termin- ation of Algorithm4. In fact, as holes are modeled as auxiliary robot systems, the unique difference between Algorithm7 and Algorithm4 is how the robot systems are connected to the holes thus, the conditions for termination are unaltered.

7.2.2.2 Soundness of Algorithm7 Algorithm7 is obtained from Algorithm4 by adding the condi- tions in Lines 5 − 15. Thus, in order to show that Algorithm7 is sound it can be shown that these conditions do not introduce accessibility issues or disconnect the graph. Consider that a robot system s tries to add a robot system w to a configuration C being assembled by Algorithm7. Thus, in Line 4, the accessibility condition for w is verified. Therefore, if w is added to the configuration, no accessibility conditions are created. Let us analyze the cases where s is a hole because the other cases are identical to Algorithm4. 160 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

G G G G H H E F H E F C H E F F C C D A B B C D D D AA A (a) (b) (c) (d)

(e) (f) (g)

(h) (i)

Figure 78 – ASP for the configuration in (a) with robot system A as starting point.

• If s is a hole and w is a hole, in Lines 12 to 14, s adds w to the ASP and only one edge is created between s and w.

• If s is a hole and w is not hole, w must connect to another robot system z in the ASP. If z exists, in Lines 6 to 8, z adds w to the ASP and only one edge is created between z and w. Otherwise, s is eliminated from the ASP in Lines 16 − 20. Thus, this process 7.3. Extension to general rectangular modules 161

does not disconnect the ASP or creates accessibility issues.

It is important to remark that, in both cases, when w is added to the ASP, only one edge is created, thus the ASP remains a tree without accessibility issues. Therefore, as the other cases are identical to Algorithm4, Al- gorithm7 returns a tree without accessibility issues.

7.2.2.3 Completeness of Algorithm7 Algorithm7 is not complete. In fact, by the same reasoning stated for Algorithm4, Algorithm7 might not found viable assembly sequences.

7.2.2.4 Complexity of Algorithm7 As stated for Algorithm4, in the worst scenario, Algorithm7 finishes when all possible vertices combinations are explored, i.e. when all spanning trees are visited. For a complete graph with n vertices the number of these trees is nn−2 thus, the complexity is O(nn−2). However, for the modular robot case, the configuration graph is usually not complete, therefore the number of these possibilities is lower and can be determined by the Kirchoff’s matrix tree theorem [66]. In the next section, application of Algorithm4 and Algorithm7 for configurations composed by general rectangular modules respect- ively without and with internal holes is presented.

7.3 EXTENSION TO GENERAL RECTANGULAR MODULES

Sections 7.1 and 7.2 presented the basic steps of the novel ASP for robot systems composed by regular rectangles, i.e. for squares ones. In this section, the proposed ASP will be extended for general rect- angular modules. The major differences between the square case and other rectangular patterns are how the modules are connected to its neighbors and how many neighbors a module owns. An approach for the six patterns presented in Figure 51, Section 5.1.3, cmm, p2, pmg, pgg,pmm, p4g, is herein introduced. Consider the pmm case, where the rectangular modules are con- nected by their long-long or short-short sides. For example, Figure 79a presents a configuration composed by rectangular modules arranged in the pmm pattern. Each module s has only four surrounding neighbors 162 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems as shown in Figure 79b. For example, module M in Figure 79a is sur- rounded by modules P,I,L and N. The proposed ASP can be directly applied in the pmm case. In fact, in the pmm case, any module s be- longing to a robot system can only be blocked by surrounding modules in two situations: when pairs of modules already exist at north-south or at east-west of s, respectively. Thus, the edges created by function AddEdge, as shown in Figure 79b, will cover both situations.

N T U W V X O P Q R S W E L M N F G H I J S A B C D E

(a) (b)

Figure 79 – (a) A target structure constituted by modules arranged in the pmm pattern. (b) Each module in the pmm pattern is surrounded by four others, thus, the edges constructed by function AddEdge are equivalent to the square case.

Pattern p4g is composed of the meta modules, each of which is composed of two rectangles sharing a long side. In order to apply the proposed ASP for the p4g case, it is only necessary to consider each meta module as a new module, as shown in Figure 80. Thus, the target structure in p4g can be viewed as a target structure in pmm from which the ASP can be directly applied. For the other patterns in Figure 51, a small change in function AddEdge must be performed. More precisely, it is necessary to modify the edges created by function AddEdge in order to check if an incoming robot system can be added to the growing structure. Consider the configuration in Figure 81a which is composed by rectangular modules arranged in the common brick wall pattern, cmm. Each module s belonging to a cmm pattern is surrounded by six other modules. For example, the six modules surrounding modules of module M are: H, I, N, Q, P and L. Recall that the ASP for modular boats of Seo, Yim e Kumar[10, 11] and the ASP of Paulos et al.[2] address the common brick wall pat- tern (cmm) and for this pattern, the connected modules are the ones sharing a long rectangular side. Thus, for example, modules L − M are mechanically docked, but modules H − M or M − Q are not. However, 7.3. Extension to general rectangular modules 163

pmm

p4g

Figure 80 – A target structure in p4g can be viewed as a target struc- ture in pmm if each meta module is considered as a new module, Paulos et al.[2].

A T B F O U C G L P H M Q N N I N R W W E D J S V E X S S

(a) (b)

Figure 81 – (a) A target structure constituted by modules arranged in the cmm pattern. (b) Each module in the cmm pattern is surrounded by six others, thus, the edges constructed by function AddEdge must consider all these surrounding modules. if modules H and Q have already been added to the growing structure, due to the accessibility condition, module M cannot be added to the structure. Thus, function AddEdge, which checks if a module can be added to the growing structure, must take into account all surrounding neighbors of M. More precisely, AddEdge must consider edges com- ing from all the surrounding neighbors of a given module s, even the diagonal ones, as shown in Figure 81b. It is important to notice that any pair of north-south or east- west edges in Figure 81b is originated from a pair of modules which do not allow the gray module addition. In other words, north-south or east-west edges in Figure 81b are originated from a pair of modules 164 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

A N,W C S, E B

Figure 82 – Robot systems A, B and C cannot be assembled in A → B → C order. In fact, edges created as in Figure 81b are able to capture this issue because there are north-south and east-west edges. Thus, function AddEdge will not allow this assembly order.

which blocks the gray one. Thus, the pairs of edges north-south or east-west constructed as in Figure 81b, can model cases in which an incoming module belonging to any robot system cannot be added to the growing structure. Figure 82 shows an example of this construction for a target structure composed by robot systems. Robot systems A, B and C in Figure 82 cannot be assembled in A → B → C order. Suppose that A and B have already been added to the growing structure (not shown in this picture) and that the ASP tries to add C. Function AddEdge will create the edges in Figure 82 according to the basic rules for edge construction in Figure 81b. As there exist north-south and east-west edge pairs in Figure 82, function AddEdge will not allow this incorrect assembly order. Figures 83b, 83c and 83d show examples of configurations con- structed with patterns p2, pmg or pgg, respectively. For these patterns, a similar construction as in Figure 81b can be considered because any module in these patterns is surrounded by six others as for the cmm case. Thus, AddEdge with the new edges will be capable of capturing accessibility issues. 7.4. Conclusions 165

A T F A T B O U B F O U C G L P C G L P H M Q H M Q I N R W I N R W D J S V D J S V E X E X

(a) (b)

T U O A T P Q W B F O U L R V X C G L P A F G M S B N H M Q C H I I N R W J D J S V D E X E

(c) (d)

Figure 83 – Configuration with modules arranged in : (a) cmm pattern. (b) pmg pattern. (c) pgg pattern.

7.4 CONCLUSIONS

This chapter introduced two novel ASP for configurations com- posed by robot systems and without or with internal holes, respectively. First, Section 7.1 presented a novel ASP for configurations without internal holes. This ASP is given by its main algorithm, Algorithm4 which is also an original contribution of this thesis. In Section 7.1, two original auxiliary procedures were also intro- duced: algorithm Algorithm5 (addEdge) which determines when a new robot system can be added to the growing structure and Algorithm6 (deleteBranch) which gives a strategy to delete a not allowed robot sys- tem from the growing structure. These auxiliary procedures are called by Algorithm4. Then, Section 7.2 presented a novel ASP for configuration with internal holes. This ASP is given by his main algorithm, Algorithm7 which is also an original contribution of this thesis. Also, in order to obtain this algorithm, Section 7.2 presented two novel rules which are also original contribution of this thesis. 166 Chapter 7. Two novel ASP for shape heterogeneous modular robot systems

First, only robot systems composed by squares were considered. Then, Section 7.3 presented an extension of all novel ASP herein pro- posed for configurations composed by general rectangular modules. The novel ASP proposed in this thesis are an improvement of the current algorithms found in literature. To the best of the author knowledge, this thesis is the first work that shows how to assembly con- figurations composed by shape heterogeneous modular robot systems. In the next chapter, a novel ASP for modular construction, i.e. aggregating module by module to assembly the target structure, is introduced. 167

8 NOVEL ASP FOR MODULAR CONSTRUCTION

In this chapter, a novel ASP for modular construction, i.e. ag- gregating module by module to assembly the target structure, is intro- duced. In order to obtain this ASP, a novel rule is introduced. This rule is incorporated into the ASP proposed in Section 7.2 resulting into a complete and novel method for modular construction. Before introducing the novel ASP, some considerations are presen- ted. Section 5.1 reviewed the ASP of Seo, Yim e Kumar[10, 11] and Paulos et al.[2]. During assembling, both ASP avoid situations where a site to be occupied is enclosed by existing robots in the structure. Also, both ASP avoid any situation where a site to be occupied can only be reached by passing through a gap at most as large as the edge of a robot. These situations are illustrated in Figure 41, Section 5.1. However, in order to achieve this goal, these ASP consider only target structures without narrow corridors, i.e. they only consider a restricted class of configurations. Also, applying the ASP of Seo, Yim e Kumar[11], which treats configurations with internal holes, it is not possible to verify if a given point can be chosen as the assembly process starting point. In fact, this ASP chooses the starting point for the assembly process. This characteristic can limit the assembly sequences possibilities and it can even prevent vertical assemblies because they must start in the ground, i.e. in an user defined point. Consider now the configurations in Figure 84. The ASP of Seo, Yim e Kumar[11] is not able to assemble any these configurations because these configurations have narrow corridors. However, except for the configuration in Figure 85d, the configurations can be assembled without violating the accessibility condition for any module. In other words, the configurations can be assembled without passing through any of the forbidden situations in the Figure 41, Section 5.1.1. 168 Chapter 8. Novel ASP for modular construction

h4

h1 h3 h1 h2

h2 h3

(a) (b)

h2 h1 h4 h h1 h3 3

h2 h5

(c) (d)

Figure 84 – These configurations can be assembled with the proposed ASP without violating the accessibility condition. These configurations cannot be assembled with the ASP of Seo, Yim e Kumar[11].

The novel ASP in Section 7.2 is able to assemble the first three configurations in Figure 84 without violating the accessibility condition for any module. In other words, this ASP is able to assemble these configurations without passing through any of the forbidden situations in the Figure 41. The assemble orders are shown by the arrows in Figures 85a, 85b, 85c, respectively. Also, the proposed ASP detects that does not exist a correct assembly sequence for the configuration in Figure 85d. 169

h4

h1 h3 h1 h2 Start

Start h2 h3

(a) (b)

Start h2 h1 h4

h1 h3 h3

h2 h5

(c) (d)

Figure 85 – The configurations in the first three cases can be assembled with the proposed ASP, without violating the accessibility condition. Also, the proposed ASP is able to detect that the configuration in the fourth case cannot be assembled without violating the accessibility condition.

However, the novel ASP proposed in Section 7.2 still does not evaluate some possible assemble sequences. For example, consider the sequence shown by the arrows in Figure 86. This sequence passes two times by holes h1, h2 and h3. For example:

• In step 5, hole h1 is discovered;

• In step 6, hole h1 discovers module A;

• In step 7, the ASP returns to hole h1 which is A’s parent;

• In step 8, hole h1 discovers module h2. 170 Chapter 8. Novel ASP for modular construction

5 9 10 14 15 4 21

20 3 h1 h2 h3 8 13 2 19

6 7 11 1216 1 18 A Start 17

Figure 86 – An example of the ASP in Section 7.2 with the new rule for modular construction.

The example in Figure 86 evidences that the ASP must allow the assembly sequence to return to a hole if this hole has already added a module to the growing structure. This rule is valid for modular construction, as shown in Section 8.1.1.2, and it will be aggregated to the proposed ASP in the next subsection.

8.1 NOVEL ALGORITHM FOR MODULAR CONSTRUCTION

In order to apply the ASP proposed in Section 7.2 to modular construction, holes must be allowed to add one or more modules to the growing structure wherever these additions are possible. As evidenced in Figure 86, in order to include this case, the ASP must allow the assembly sequence to return to a hole if this hole has already added a module to the growing structure. Thus, this hole can try to add another module to the growing structure. This novel rule is incorporated to Algorithm7, resulting in Al- gorithm8. More specifically, the rule is summarized in Lines 23 − 31 of Algorithm8. 8.1. Novel algorithm for modular construction 171

Algorithm 8 AssemblyOrder(G,s)- Configurations with internal holes 1: Label s as discovered 2: for Each vertex w in G.adj[s] do 3: if Vertex w is labeled as undiscovered then 4: if w can be added to the structure (AddEdge(G,w) is true) then 5: if s is a hole and w is not a hole or the first added robot system then 6: if Exists a discovered robot system z ∈ G.adj[w] then 7: G.T ree[z] ← w 8: G.parent(w) = s 9: AssemblyOrder(G,w) 10: end if 11: else 12: G.T ree[s] ← w 13: G.parent(w) = s 14: AssemblyOrder(G,w) 15: end if 16: else 17: deleteBranch(G,s) 18: Label s as undiscovered 19: Return 20: end if 21: end if 22: end for 23: if Exists w in G.adj[s] marked as undiscovered then 24: deleteBranch(G,s) 25: if G.parent(s) is a hole; then 26: if Exists a discovered robot system z ∈ G.adj[w] then 27: G.T ree[z] ← w 28: G.parent(w) = s 29: end if 30: Return 31: else 32: Label s as undiscovered 33: Return 34: end if 35: end if 172 Chapter 8. Novel ASP for modular construction

The novel lines in Algorithm8 are modifications of Lines 23−31 of Algorithm7. Also, Lines 23 − 31 of Algorithm7 are the same as Lines 16 − 20 of Algorithm4. For Algorithm4, these lines stated that: Given a robot system s, when the recursion explores all neighbors of s, if any of these neighbors is still not added to the structure, then s cannot also be added to the structure. A motivation for the rule in Algorithm4 is presented in Figure 55 in Section 7.1. This figure shows a target structure in which a robot system J surround his neighbors K and L in more then one direction. Thus, if J is assembled before K and L, no assemble sequence can be found. As this problem is not directly detected when J adds L or K, but only in successive steps, Lines 16−20 were introduced as a checking cycle which solved this problem. However, the present section concerns modular construction, thus, no module is able to surround his neighbors in more then one direction, as occurred by robot system J in Figure 55. This implies that the rule in Lines 16 − 20 of Algorithm4 can be modified. As previously stated, the modified rule is presented in Lines 23 − 31 of Algorithm8 where before deleting a module s, the novel algorithm checks if s’s parent is a hole. If the parent is a hole, the algorithm does not delete s and re- turns to the hole, allowing another modules to be added to the growing structure. It is important to notice that, even whit the new rule, Algorithm8 gives preference to sequences that does not return to previously added holes. In other words, in Algorithm8, the new rule is used as a last resource if a more direct sequence cannot be found. As a final remark, let us discuss the changes in Lines 7 − 8 with respect to Algorithm7. Consider that a hole s is trying to add a robot system w. By Rule 1, w must connect to a robot system z already added to the structure. Thus, in Lines 7−8 of Algorithm7, such robot system z is marked as the parent of w. However, Algorithm8 can go from a hole s to a module w, back to hole s and then add another module. Thus, the parent of w must be the hole s, otherwise the algorithm is not able to construct this sequence which passes more then once in the hole. The novel ASP for modular construction, Algorithm8, is able to assemble the first tree configurations in Figure 84. Some of the founded assemble orders are shown by the arrows in Figures 85a, 85b, 85c, respectively. Also, this ASP detects that does not exist a correct assembly sequence for the configuration in Figure 85d. The ASP for modular construction is also able to detect the assemble sequence in 8.1. Novel algorithm for modular construction 173

Figure 86 which the ASP for robot systems was not able to detect. A further example is shown in Figure 87.

6 789 10 24 Start 5 1 2 11 23

4 3 12 13 16 17 14

18 15 19 20 21 22

Figure 87 – A further example of the novel ASP for modular construc- tion .

It is important to notice that the proposed ASP does not guaran- tee that all possible assemble sequences will be found, but it can solve some situations that the principal ASP found in literature cannot solve. Also, there are no techniques in literature to assemble configurations composed by shape heterogeneous modular robot systems. More de- tails and discussions about the results and the limitations of the three proposed ASP will be presented in Chapter9. In the next subsections, the properties of the novel ASP for mod- ular construction are discussed.

8.1.1 Properties of Algorithm8 In this section, the termination, soundness and completeness of Algorithm8 are discussed.

8.1.1.1 Termination of Algorithm8 Algorithm8 differs from Algorithm7 in Lines 25 − 27. Thus, in order to show that Algorithm8 terminates, the condition in these lines must be analyzed. 174 Chapter 8. Novel ASP for modular construction

Consider a configuration C been assembled by Algorithm8 and consider that a robot system s, added to the ASP by a hole h1, cannot add some of his neighbors to configuration C. At the end of the neigh- borhood checking for s, there exists unassembled neighbors, thus the condition in Lines 23 − 27 is satisfied. Therefore, all the ASP branch starting at s is deleted in Line 24. Also, as the step of neighborhood checking for s has finished, function AssemblyOrder(G,s) is closed. Then, Algorithm8 returns to his previously open call, AssemblyOrder(G,h1). Thus, function AssemblyOrder(G,s) is closed before returning to AssemblyOrder(G,h1), where the neighborhood checking for h1 can be continued. Further- more, AssemblyOrder(G,h1) is closed when its cycle for in Line 2 is finished. In the other case, where a robot system s does not have a hole as a parent was analyzed for Algorithm7. In the worst scenario, the algorithm ends when all possible vertices combinations are explored, i.e. when all spanning trees are visited. For a complete graph with n vertices the number of these trees is nn−2. However, for the modular robot case, the configuration graph is usually not complete, therefore the number of these possibilities is lower and can be determined by the Kirchoff’s matrix tree theorem [66].

8.1.1.2 Soundness of Algorithm8 As stated for the termination analysis, Algorithm8 differs from Algorithm7 in Lines 23 − 31. Thus, in order to show that Algorithm8 is sound, the condition in these lines must be analyzed. Consider again a configuration C been assembled by Algorithm8. Consider that a robot system s, added to the ASP by a hole h1, cannot add some of his neighbors to configuration C. At the end of the neigh- borhood checking for s, there exists unassembled neighbors thus, the condition in Lines 23 − 31 is satisfied. Therefore, all the ASP branch starting at s is deleted in Line 24. Also, as the step of neighborhood checking for s ends, function AssemblyOrder(G,s) is closed. Then, Algorithm8 returns to his previ- ously open call, AssemblyOrder(G,h1). As, AssemblyOrder(G,h1) has examine the accessibility of s in Line 4, no accessibility issues are found when s is added to the structure. Furthermore, if s is a hole, only one edge is created between s and h1. If s is not a hole, by the condition in Lines 26 − 29, s must connect to a robot system z in the configuration C. In other words, only one edge is created between s and z. Therefore, the ASP remains a tree 8.2. Configurations in a vertical plane 175 because only one edge is created for each new element and it presents no accessibility issues.

8.1.1.3 Completeness of Algorithm8 Algorithm8 is not complete. In fact, by the same reasoning stated for Algorithm7, Algorithm8 might not find viable assembly sequences.

8.1.1.4 Complexity of Algorithm8 As already stated for Algorithm7 and for Algorithm4, in the worst scenario, Algorithm8 finishes when all possible vertices com- binations are explored, i.e. when all spanning trees are visited. For a complete graph with n vertices the number of these trees is nn−2, thus the complexity is O(nn−2). However, for the modular robot case, the configuration graph is usually not complete, therefore the number if these possibilities is lower and can be determined by the Kirchoff’s matrix tree theorem [66]. In the next section, the application of Algorithm8 for configur- ations in a vertical plane is presented.

8.2 CONFIGURATIONS IN A VERTICAL PLANE

In this subsection, the novel ASP for modular construction is applied to configurations arranged in a vertical plane. First, only con- figurations composed by rectangular modules are considered. Then, configurations composed by cubic modules are also treated. In order to assemble configurations arranged in a vertical plane, some considerations are introduced herein. Consider, for example, the configurations in Figures 88a and 88b.

• The floor must be considered as an auxiliary robot system, as shown in Figures 88a and 88b, where the floor is represented as robot system A. • The robot system representing the floor must be taken as the assembly process starting point. • In order to promote bottom-up sequences, for each adjacency list, the elements must be organized with increasing y-coordinates, i.e. elements with lower y-coordinate must appear first in the list. The only exception are holes. As previously stated, in order 176 Chapter 8. Novel ASP for modular construction

M

H I J K L H I J K L

F G F G

h h h3 D h1 E D 1 2 E

B C B C y Floor Floor A A x (a) (b)

Figure 88 – If the floor is represented by a robot system, configura- tions in (a,b) can be assembled by the proposed ASP in a bottom-up manner.

to apply Algorithm8 for configurations with internal holes, if an element s have any holes as neighbors, those holes must be the last elements in s’s adjacency list, i.e. in G.adj[s]. For example, for the configurations in Figures 88a and 88b the adjacency lists are shown in Figures 90a and 90b, respectively.

Whit these considerations, the configurations in Figure 88 can be assembled bottom-up applying Algorithm8. These assembly sequences are shown by the arrows in figures 89a and 89b. It is important to notice that the ASP provides bottom-up as- sembly sequences, thus greater stability and better distribution of load during construction are provided. The same approach can be applied for configurations composed by cubes arranged in a vertical plane, because, in this case, each cube has at most four neighbors at north, south, east or west. Figure 91 shows the backrest of a chair being assembled with the proposed ASP. It can be noticed that the assembly sequence presents discontinuities, i.e. there are successive steps in which non-neighbor modules are added to the structure. However, the configuration grows button-up, provid- ing greater stability during the assembly. 8.2. Configurations in a vertical plane 177

h1 h1 h2 h3

Floor Floor Start Start

(a) (b)

Figure 89 – The configurations can be assembled bottom-up by the pro- posed ASP, if the floor is represented by a robot system.

To the best of the author’s knowledge, this is the first work that obtains an ASP for target structures composed by rectangular or cubic modules, arranged in a vertical plane. Direct comparisons with liter- ature cannot be made, however some parallel with the reconfiguration problem can be stated. In the reconfiguration literature, there are techniques where the configurations are constructed in a continuous path. For example, the MeltSortGrow technique of Fitch, Butler e Rus[12] for meta- morphic robots. As previously stated, for this kind of robots, a change in the macroscopic morphology results from the locomotion of each module over its neighbors [13]. Thus, when dealing with this kind of robots, authors usually are concerned with mobility issues. In the MeltSortGrow technique, rather than transforming from the initial configuration directly to the goal configuration the authors generate an intermediate configuration that is easy to reach from any initial condition, and easy to transform into the goal configuration. In this case they choose a single line, or chain, as a simple intermediate configuration. However, as evidenced in Figure 92, this technique can lead to a less mechanically stable assembly sequence. In fact, during the reconfiguration process, legs are constructed after the parts of the main body, thus stability of the growing structure might be compromised 178 Chapter 8. Novel ASP for modular construction

A B C h1

B A D h1

C A E h1

D B F h1

E C G h1

F D H h1

G E L h1 H F I

I H J h1

J I K h1

K J L h1 L G K

h1 A B C D E F G I J K (a)

A B C h1 h2 h3

B A D h1

C A E h3

D B F h1

E C G h3

F D H h1

G E L h3 H F I

I H J h1

J I K M h2

K J L h3 L G K M J

h1 A B D F I J h2

h2 A J h1 h3

h3 A C E G K L h2 (b)

Figure 90 – Adjacency lists for the graph representing the configura- tions in Figures 88a and 88b, respectively. 8.2. Configurations in a vertical plane 179

(a) (b) (c)

(d) (e)

(f) (g) (h)

Figure 91 – The backrest of a chair being assembled with the proposed ASP. at some step. Also, some modules violate the accessibility condition considered in this thesis. Thus, despite the bigger computational complexity, our ASP 180 Chapter 8. Novel ASP for modular construction

Figure 92 – In the melt-grow technique of Fitch, Butler e Rus[12], configurations are constructed in a continuous path and not in a bottom-up manner. leads button-up sequences, what can be crucial for some assemblies. However, there is no guarantee that our ASP returns all possible as- semble sequences for a given configuration. But any sequence returned by the ASP does not violate the accessibility condition for any module. Also, it is important to notice that the technique herein intro- duced can be regarded as seeds for three-dimensional modular construc- tion. In order to assembly three-dimensional structures composed by cubes, for example, the technique can be extended considering all spa- tial neighborhood of each module, i.e. the neighbors in all six possible directions. However, in the three-dimensional case, it is important to consider a static equilibrium analysis. Next chapter provides a discussion about the implementation and results of the three proposed ASP.

8.3 CONCLUSIONS

This chapter introduced a novel ASP for modular construction, i.e. aggregating module by module to assembly the target structure. In order to obtain this ASP, this chapter introduced a novel rule which was incorporated to the previous ASP for robot systems, presented in Section 7.2. Thus, a novel main algorithm for modular construction, Algorithm8 was introduced. This algorithm is also an original contri- bution of this thesis. Whit Algorithm8 some advances compared to literature could be found. To the best of the author knowledge, this thesis is the first work that shows:

• How to assembly planar target structures with narrow corridors; 8.3. Conclusions 181

• How to assembly configurations with internal holes, without nar- row corridors, and choosing the ASP starting point; • How to assembly vertical planar structures.

183

9 IMPLEMENTATION AND RESULTS

The three ASP proposed in this thesis were implemented C++. The software takes as input the sites composing each robot system of the target structure and the graph representing the robot system connections. It returns an assembly plan that specifies a complete order for building the target structure. All computer simulations were performed in a 4GB, 1.6 GHz machine. First, the thesis considered configurations composed by robot systems. Then, the modular construction was also treated. In this section, the principal results for both of these cases are discussed.

9.1 CONFIGURATIONS COMPOSED BY ROBOT SYSTEMS

For configurations composed by robot systems, Section 7.1 and Section 7.2 presented two ASP given by their mains algorithms: Al- gorithm4 and Algorithm7. These ASP were designed for configura- tions without and with internal holes, respectively. First, in Section 7.1, Algorithm4 was applied for target struc- tures without holes and composed by robot systems. Considering the configuration in Figure 55, given an arbitrary choice of the starting robot system for the assembling process, the computational time was 8 ms on average for the ASP to compute a correct assembly sequence. However, this algorithm cannot be applied to configurations with in- ternal holes. Then, in Section 7.2, Algorithm7 was applied configurations with internal holes and composed by robot systems. Table3 presents the average time for the ASP to compute a correct assembly sequence for the examples in Section 7.2.

Table 3 – ASP computational time for configurations composed by ro- bot systems.

Target Configuration ASP result Computational time Figure 76a See Figure 77 0,3 ms Figure 78a See Figure 78 1,3 ms

Algorithm4 and Algorithm7 end when all possible vertices com- binations are explored, i.e. when all spanning trees are visited. For a complete graph with n vertices the number of these trees is nn−2 thus, 184 Chapter 9. Implementation and Results the complexity is O(nn−2). However, for the modular robot case, the configuration graph is usually not complete, therefore the number of these possibilities is lower and can be determined by the Kirchoff’s mat- rix tree theorem [66]. Thus, the average time depends mostly of the number of sequences evaluated during the assembly process. Furthermore, there is no guarantee that these ASP will return all possible assemble sequences for a given configuration. However, any sequence returned by these ASP does not violate the accessibility condition for any module. To the best of the author’s knowledge, this is the first work that shows how to assembly target structures composed by shape hetero- geneous modular robot systems, thus the results cannot be compared with literature.

9.2 MODULAR CONSTRUCTION

For modular construction, Section8 presented an ASP, given by its main algorithm, Algorithm8. This ASP can be applied for configurations with and without internal holes. Also, in Section 8.2 this ASP was extended for planar vertical structures. In Section8, Algorithm8 was applied for modular construction. Table4 presents the average time for the ASP in order to compute a correct assembly sequence for the planar examples in Section8 with their chosen starting points. As previously stated, Algorithm8 is able to assemble the first three configurations in Figure 84 and the configuration in Figure 87 without violating the accessibility condition for any module. These four cases cannot be treated with the ASP of Seo, Yim e Kumar[11] because they have narrow corridors. Also, Algorithm8 detected that does not exist an adequate ASP for the configuration in Figure 85d.

Table 4 – ASP computational time for the examples with narrow cor- ridors.

Target Configuration ASP result Computational time Figure 84a See Figure 85a 3,706 ms Figure 84b See Figure 85b 5,384 ms Figure 84c See Figure 85c 3,375 ms Figure 85d It does not exist. 29 ms Figure 87 See Figure 87 8,87 ms 9.2. Modular construction 185

There is no guarantee that the proposed ASP for modular con- struction will return all possible assemble sequences for a given config- uration. However, any sequence returned by this ASP does not violate the accessibility condition for any module. It is important to notice that for configurations without narrow corridors, the expected average time of the proposed ASP for modular construction is greater than the one given by Seo, Yim e Kumar[11]. In fact, the ASP proposed by Seo, Yim e Kumar[11] has polynomial-time complexity. However, in the ASP of Seo, Yim e Kumar[11], a start point to the assembly process cannot be chosen. On the other hand, the proposed ASP, Algorithm8, allows selecting a starting point. In Section 8.2, Algorithm8 was applied for configurations ar- ranged in a vertical plane. Table5 shows the computational time for the examples presented in that section. As previously stated, with the proposed ASP, the configuration grows bottom-up, providing greater stability and better distribution of load during construction in compar- ison with other techniques in literature, as, for example, the MeltSort- Grow reconfiguration technique of Fitch, Butler e Rus[12].

Table 5 – ASP computational time for the vertical examples.

Target Configuration ASP result Computational time Figure 88a See Figure 89a 0,3 ms Figure 88b See Figure 89b 0,6 ms Figure 91h See Figure 91 40 ms

Algorithm8 ends when all possible vertices combinations are explored, i.e. when all spanning trees are visited. For a complete graph with n vertices the number of these trees is nn−2 thus, the complexity is O(nn−2). Thus, the average time depends mostly on the number of sequences evaluated during the assembly process. To the best of the author’s knowledge, this is the first work that shows:

• How to assembly planar target structures with narrow corridors; • How to assembly configurations with internal holes, without nar- row corridors, and choosing the ASP starting point; • How to assembly vertical planar structures.

In these cases, the results cannot be compared with literature.

187

10 CONCLUSIONS

This thesis contributes to two strongly related problems: the enumeration and the assembly of modular robot configurations. It presents novel methods and results which allows enumerating and as- sembling modular robot configurations. Fist, a novel enumeration method for cubic modular robots was presented in this thesis. This novel method is an extension of an au- thor’s previous enumeration method for square modular robots [8]. Whit respect to the enumeration problem, not only novel results and models were presented, but also formal discussions about the pro- posed models were provided. The main focus of this work was to apply integrated tools of group and graph theory for enumeration of modular robot configurations. Then, this thesis presented three novel ASP for modular robots. These ASP are applicable for different situations and are able to as- sembly novel classes of configurations. In fact, with respect to the ASP for modular robots, the main focus of this work was to embrace larges classes of configurations not treated in literature. In the next sections, the main contributions of this thesis to both of these problems are presented.

10.1 CONTRIBUTIONS OF THIS THESIS

10.1.1 Enumeration of modular robot configurations Chapter4 introduced a novel method, original contribution of this thesis, for enumerating all nonisomorphic cubic modular robot con- figurations. The novel method is an extension of an author’s previous enumeration method, the Orbital Method [8], reviewed in Section 2.3.2. In order to perform this extension:

• Section 4.1 presented a novel way to determine a graph which captures the symmetries of a given cubic metamorphic robots.

• Two novel algorithms, Algorithms1 and 15, original contributions of this thesis, were introduced. These algorithms allow to determ- ine the graph representation directly from the configuration’s ID matrix.

• In Section 4.2 the results introduced by the author in the Sym- metry Method [7] were extended to cubic modules, allowing to 188 Chapter 10. Conclusions

decrease the number of isomorphic configurations generated dur- ing the enumeration process.

• The novel method was implemented in C++proportionating the enumeration of configurations up to 10 cubic modules. This con- stituted an advance compared to the number of modules achieved in literature [23].

10.1.2 ASP for modular robots Chapter6 presented novel contributions to the ASP of Seo, Yim e Kumar[11]:

• A class of configurations that satisfies the necessary conditions stated by Seo, Yim e Kumar[11], but for which their algorithm can return an incorrect ASP, was presented.

Chapter7 introduced two novel ASP, original contribution of this thesis, for modular robot configurations composed by robot systems.

• These two ASP are given by their original main algorithms which treat configurations without and with internal holes respectively: Algorithm4 and Algorithm7.

• Section 7.1.1 and Section 7.1.2 introduced two original auxiliary procedures, respectively: Algorithm5 (AddEdge), which determ- ines when a new robot system can be added to the growing struc- ture and Algorithm6 (deleteBranch), which gives a strategy to delete a not allowed robot system from the growing structure.

• Section 9.1 presented the implementation results. Also, the draw- back of the proposed ASP is presented: for n heterogeneous ro- bot systems, the worst case for the number of possible sequences evaluated is nn−2 considering a complete graph. However, for the modular robot case, the configuration graph is usually not com- plete, therefore the number of these possibilities is lower and can be determined by the Kirchoff’s matrix tree theorem [66]. Thus, the average time depends mostly of the number of sequences eval- uated during the assembly process.

• To the best of the author’s knowledge, this is the first work that shows how to assembly target structures composed by shape het- erogeneous modular robot systems. 10.2. Publications 189

Chapter8 introduced a novel ASP for modular construction, i.e. aggregating module by module to assembly the target structure. • The novel ASP for modular construction is given by its novel main algorithm: Algorithm8. It can be applied for configurations with and without internal holes. • Section 9.2 presented the implementation results. In this section a comparison with the principal enumeration methods in literature was presented. The proposed ASP has a bigger complexity when compared to literature, however it is able to assembly novel classes of configurations. To the best of the author’s knowledge, this thesis is the first work that shows: – How to assembly planar target structures with narrow cor- ridors; – How to assembly configurations with internal holes, without narrow corridors, and choosing the ASP starting point; – How to assembly vertical planar structures. All the ASP herein proposed satisfies the accessibility condition, i.e. any rectangular module cannot pass through a gap only as large as a side of a module between two physical robots already assembled in the structure.

10.2 PUBLICATIONS

This work yielded several papers for journals and conferences: • Enumeration problems: A bridge between planar metamorphic robots in engineering and polyforms in mathematics [22]. • Grupos, simetrias e a enumeração de configurações não isomorfas para robôs metamórficos planares [7]. • Enumeration of non-isomorphic metamorphic robot configura- tions in isomorphism tree generation [8]. • Assembly sequence planning for shape heterogeneous modular ro- bot systems [67]. Three papers are being submitted: the first about the enumera- tion problem and the other two about the ASP for robot systems and for modular construction, respectively. 190 Chapter 10. Conclusions

10.3 FURTHER WORKS

The following suggestions are presented for future work:

• Extension of the enumeration method for other types of modules. • Enumeration of configurations composed by non-homogeneous modules. • Analysis of the enumeration equivalence classes, covering mobil- ity, stability, mass distribution, among others. • Extension of the three proposed ASP for other types of modules and for different types of modules constraints. • Extension of the ASP for modular construction to three dimen- sional structures. In this case, static analysis should be integrated to the ASP. 191

BIBLIOGRAPHY

1 MURATA, S.; KUROKAWA, H. Self-reconfigurable robots. IEEE Robotics and Automation Magazine, IEEE, USA, v. 14, n. 1, p. 71–78, 2007. 2 PAULOS, J. et al. Automated self-assembly of large maritime structures by a team of robotic boats. IEEE Transactions on Automation Science and Engineering, IEEE, USA, v. 12, n. 3, p. 958–968, July 2015. 3 OUNG, R. et al. The distributed flight array. In: 2010 IEEE INTERNATIONAL CONFERENCE ON ROBOTICS AND AUTOMATION, 2010, Anchorage, AK, USA. 2010 IEEE International Conference on Robotics and Automation. New Jersey, USA: IEEE, 2010. p. 601–607. 4 CHEN, I. M.; BURDICK, J. W. Enumerating the nonisomorphic assembly configurations of modular robotic systems. In: 1993 IEEE/RSJ INTERNATIONAL CONFERENCE, 1993, Yokohama, Japan. Proceedings of the 1993 IEEE/RSJ International Conference on Intelligent Robots and Systems. New Jersey, USA: IEE, 1993. v. 3, p. 1985–1992. 5 PAMECHA, A. et al. Design and implementation of metamorphic robots. In: 1996 ASME DESIGN ENGINEERING TECHNICAL CONFERENCE AND COMPUTERS IN ENGINEERING CONFERENCE, 1996, Irvine, California. Proceedings of the 1996 ASME Design Engineering Technical Conference and Computers in Engineering Conference. New York, USA: ASME, 1996. 6 MARTINS, D.; SIMONI, R. Enumeration of planar metamorphic robots configurations. In: 2009 ASME/IFTOMM INTERNATIONAL CONFERENCE ON RECONFIGURABLE MECHANISMS AND ROBOTS, 2009, London, UK. 2009 ASME/IFToMM International Conference on Reconfigurable Mechanisms and Robots. New Jersey, USA: IEEE, 2009. p. 580–588. 7 SALVI, A. Z. et al. Grupos, simetrias e a enumeração de configurações não isomorfas para robôs metamórficos planares. Multi-Body Systems, Santa Fe, Argentina, XXXI, n. 15, p. 2833–2848, January 2012. 192 Bibliography

8 SALVI, A. et al. Enumeration of non-isomorphic metamorphic robots configurations in isomorphism tree generation. In: 14TH IFTOMM WORLD CONGRESS, 2015, Taipei, Taiwan. Proceedings of the 14th IFToMM World Congress. Taipei, Taiwan: IFTOMM, 2015. p. 15–24.

9 TARINI, M. et al. Polycube-maps. In: SIGGRAPH 2004 - THE 31ST INTERNATIONAL CONFERENCE ON COMPUTER GRAPHICS AND INTERACTIVE TECHNIQUES., 2004, California, USA. Proceedings of ACM SIGGRAPH 2004. New York, USA: ACM, 2004. p. 853–860.

10 SEO, J.; YIM, M.; KUMAR, V. Assembly planning for planar structures of a brick wall pattern with rectangular modular robots. In: 2013 IEEE INTERNATIONAL CONFERENCE ON AUTOMATION SCIENCE AND ENGINEERING, 2013, Madison, WI, USA. 2013 IEEE International Conference on Automation Science and Engineering. New Jersey, USA: IEE, 2013. p. 1016–1021.

11 SEO, J.; YIM, M.; KUMAR, V. Assembly sequence planning for constructing planar structures with rectangular modules. In: 2016 IEEE INTERNATIONAL CONFERENCE ON ROBOTICS AND AUTOMATION, 2016, Stockholm, Sweden. 2016 IEEE International Conference on Robotics and Automation. New Jersey, USA: IEEE, 2016. p. 5477–5482.

12 FITCH, R.; BUTLER, Z.; RUS, D. Reconfiguration planning for heterogeneous self-reconfiguring robots. In: 2003 IEEE/RSJ INTERNATIONAL CONFERENCE ON INTELLIGENT ROBOTS AND SYSTEMS, 2003, Nevada, USA. Proceedings 2003 IEEE/RSJ International Conference on Intelligent Robots and Systems. New Jersey, USA: IEEE, 2004. p. 2460–2467.

13 CHIRIKJIAN, G. Kinematics of a metamorphic robotic system. In: 1994 IEEE INTERNATIONAL CONFERENCE ON ROBOTICS AND AUTOMATION, 1994, California, USA. Proceedings of the 1994 IEEE International Conference on Robotics and Automation. New Jersey, USA: IEEE, 1994. p. 449–455.

14 DUMITRESCU, A.; SUZUKI, I.; YAMASHITA, M. High speed formations of reconfigurable modular robotic systems. In: 2002 IEEE INTERNATIONAL CONFERENCE ON ROBOTICS AND AUTOMATION, 2002, Washington, DC, USA. Proceedings 2002 Bibliography 193

IEEE International Conference on Robotics and Automation. New Jersey, USA: IEEE, 2002. p. 123–128. 15 CHIANG, C.; CHIRIKJIAN, G. Modular Robot Motion Planning Using Similarity Metrics. Autonomous Robots, Springer, v. 10, n. 1, p. 91–106, 2001. 16 ABRAMS, A.; GHRIST, R. State Complexes for Metamorphic Robots. The International Journal of Robotics Research, Sage Journals, v. 23, n. 7, p. 811–830, August 2004. 17 WALTER, J. E.; WELCH, J. L.; AMATO, N. M. Distributed reconfiguration of metamorphic robot chains. In: ACM SYMPOSIUM ON PRINCIPLES OF DISTRIBUTED COMPUTING, 2000, Portland, OR, USA. Proceedings of the nineteenth annual ACM symposium on Principles of distributed computing. New York, USA: ACM, 2000. p. 171–180. 18 RUS, D.; VONA, M. Crystalline Robots: Self-Reconfiguration with Compressible Unit Modules. Autonomous Robots, Springer, v. 10, n. 1, p. 107–124, 2001. 19 YOSHIDA, E. et al. A distributed reconfiguration method for 3d homogeneous structure. In: 1998 IEEE/RSJ INTERNATIONAL CONFERENCE ON INTELLIGENT ROBOTS AND SYSTEMS, 2010, Victoria, BC, Canada. Proceedings of 1998 IEEE/RSJ International Conference on Intelligent Robots and Systems. New Jersey, USA: IEEE, 1998. p. 852–859. 20 YIM, M. et al. Distributed Control for 3D Metamorphosis. Autonomous Robots, Springer, v. 10, n. 1, p. 41–56, 2001. 21 YIM, M. et al. Modular self-reconfigurable robots. In: MEYERS, R. A. (Ed.). Encyclopedia of Complexity and Systems Science. New York, USA: Springer-Verlag New York, 2009. p. 5618–5631. 22 SALVI, A. Z.; SIMONI, R.; MARTINS, D. Enumeration problems: A bridge between planar metamorphic robots in engineering and polyforms in mathematics. In: DAI, J. S.; ZOPPI, M.; KONG, X. Advances in Reconfigurable Mechanisms and Robots I. London, UK: Springer London, 2012. p. 25–34. 23 JINGUO, L. et al. Enumeration of the non-isomorphic configurations for a reconfigurable modular robot with square-cubic- cell modules. International Journal of Advanced Robotic Systems, Sage Journals, California, USA, January 2011. 194 Bibliography

24 CHITTA, S.; OSTROWSKI, J. Enumeration and motion planning for modular mobile robots. Department of Computer and Information Science, University of Pennsylvania, Technical Report, Penn Libraries, Pennsylvania, USA, 2006.

25 NATARAJAN, B. K. On planning assemblies. In: FOURTH ANNUAL SYMPOSIUM ON COMPUTATIONAL GEOMETRY, 1998, Illinois, USA. Proceedings of the Fourth Annual Symposium on Computational Geometry. New York, USA: ACM, 1998. p. 299–308.

26 KAVRAKI, L. E.; KOLOUNTZAKIS, M. N. Partitioning a planar assembly into two connected parts is np-complete. Information Processing Letters, Elsevier, London, UK, v. 55, n. 3, p. 159 – 165, August 1995.

27 JIMÉNEZ, P. Survey on assembly sequencing: a combinatorial and geometrical perspective. Journal of Intelligent Manufacturing, Springer-Verlag, Berlin, Germany, v. 24, n. 2, p. 235–250, September 2013.

28 WERFEL, J. et al. Distributed construction by mobile robots with enhanced building blocks. In: 2006 IEEE INTERNATIONAL CONFERENCE ON ROBOTICS AND AUTOMATION, 2006, Florida, USA. Proceedings 2006 IEEE International Conference on Robotics and Automation. New Jersey, USA: IEE, 2006. p. 2787–2794.

29 WERFEL, J.; INGBER, D.; NAGPAL, R. Collective construction of environmentally-adaptive structures. In: 2007 IEEE/RSJ INTERNATIONAL CONFERENCE ON INTELLIGENT ROBOTS AND SYSTEMS, 2007, San Diego, CA, USA. 2007 IEEE/RSJ International Conference on Intelligent Robots and Systems. New Jersey, USA: IEEE, 2007. p. 2345–2352.

30 WERFEL, J.; NAGPAL, R. Extended stigmergy in collective construction. IEEE Intelligent Systems, IEEE, New Jersey, USA, v. 21, n. 2, p. 20–28, March 2006.

31 BISHOP, J. et al. Programmable parts: a demonstration of the grammatical approach to self-organization. In: 2005 IEEE/RSJ INTERNATIONAL CONFERENCE ON INTELLIGENT ROBOTS AND SYSTEMS, 2005, Edmonton, Alta., Canada. 2005 IEEE/RSJ Bibliography 195

International Conference on Intelligent Robots and Systems. New Jersey, USA: IEEE, 2005. p. 3684–3691.

32 MCCARTHY, J. M. Introduction to Theoretical Kinematics. Massachusetts, EUA: The MIT Press, 1990.

33 ALPERIN, J.; BELL, R. Groups and Representations. New York, USA: Springer, New York, 1995.

34 BURROW, M. Representation theory of finite groups. New York, USA: Academic Press, New York, 1993.

35 ROTMAN, J. An Introduction to the Theory of Groups. New York, USA: Springer, 1995.

36 YAN H.S., H. C. Contract graphs of kinematic chains with multiple joints. Mathematical computacional modelling, v. 10, n. 9, p. 681–695, 1988.

37 MCKAY, B. Isomorph-Free Exhaustive Generation. J ALGORITHM, v. 26, n. 2, p. 306–324, 1998.

38 SIEK, J.; LEE, L.; LUMSDAINE, A. The Boost Graph Library: User Guide and Reference Manual. Boston, USA: Addison-Wesley, 2002.

39 SLOANE, N. (Ed.). nauty and Traces User’s Guide (Version 2.5). Available on:, c2017. Accessed on: 27 nov. 2017.

40 JAIN, B.; WYSOTZKI, F. Solving inexact graph isomorphism problems using neural networks. NEUROCOMPUTING, Elsevier, v. 63, p. 45–67, 2005.

41 CARLETTI, V.; FOGGIA, P.; VENTO, M. Performance comparison of five exact graph matching algorithms on biological databases. In: PETROSINO, A.; MADDALENA, L.; PALA, P. (Ed.). New Trends in Image Analysis and Processing – ICIAP 2013. Berlin, Heidelberg: Springer Berlin Heidelberg, 2013. p. 409–417.

42 MIYAZAKI, T. The complexity of McKay’s canonical labeling algorithm. In: Groups and Computation II: Workshop on Groups and Computation. New Jersey, USA: American Mathematical Society, 1997. p. 239–256. 196 Bibliography

43 MERLET, J. Parallel robots. Sophia-Antipolis, France: Springer, 2006. 44 SLOANE, N. (Ed.). The On-Line Encyclopedia of Integer Sequences, A000105. Available on:, c2017. Accessed on: 29 nov. 2017. 45 REDELMEIER, D. Counting polyominoes: yet another attack. Discrete Math, Elsevier, v. 36, n. 3, p. 191–203, 1981. 46 JENSEN, I. Counting polyominoes: A parallel implementation for cluster computing. In: ICCS: INTERNATIONAL CONFERENCE ON COMPUTATIONAL SCIENCE, 2003, Melbourne, Australia. Computational Science - ICCS 2003. New York, USA: Springer, 2003. p. 698–698. 47 XIAO, Z.; TAKAO, N. Algorithms for finding f-colorings of partial k-trees. In: 2010 IEEE INTERNATIONAL CONFERENCE ON ROBOTICS AND AUTOMATION, 1995, Nagoya, Japan. Algorithms and Computations: 6th International Symposium, ISAAC ’95 Cairns. USA: IEEE, 1995. p. 601–607. 48 MASSA, W.; GOULD, R. Crystal Structure Determination. Berlin, Germany: Springer Berlin Heidelberg, 2010. 49 SLOANE, N. (Ed.). The On-Line Encyclopedia of Integer Sequences, A038119. Available on:, c2017. Accessed on: 29 nov. 2017. 50 LUNNON, W. Symmetry of cubical and general polyominoes. In: READ, R. C. (Ed.). Graph Theory and Computing. Cambridge, Massachusetts: Academic Press, 1972. p. 101 – 108. 51 GONG, K. L. (Ed.). Polyominoes Home Page. Available on:, c2017. Accessed on: 30 nov. 2017. 52 SU, Q. A hierarchical approach on assembly sequence planning and optimal sequences analyzing. Robotics and Computer-Integrated Manufacturing, Pergamon Press, Inc., Tarrytown, NY, USA, v. 25, n. 1, p. 224–234, February 2009. 53 HSU, Y. Y. et al. A knowledge-based engineering system for assembly sequence planning. In: 36TH INTERNATIONAL MATADOR CONFERENCE. Proceedings of the 36th Bibliography 197

International MATADOR Conference. London, UK: Springer London, 2010. p. 123–126.

54 FAZIO, T. D.; WHITNEY, D. Simplified generation of all mechanical assembly sequences. IEEE Journal on Robotics and Automation, IEEE, New Jersey, USA, v. 3, n. 6, p. 640–658, December 1987.

55 GHANDI, S.; MASEHIAN, E. A breakout local search method for solving the assembly sequence planning problem. Engineering Applications of Artificial Intelligence, Elsevier, London, UK, v. 39, p. 245 – 266, March 2015.

56 WILSON, R. H.; LATOMBE, J.-C. Geometric reasoning about mechanical assembly. Artificial Intelligence, Elsevier, London, UK, v. 71, n. 2, p. 371 – 396, December 1994.

57 MELLO, L. S. H. d.; SANDERSON, A. C. And/or graph representation of assembly plans. In: FIFTH AAAI NATIONAL CONFERENCE ON ARTIFICIAL INTELLIGENCE, 1986, Philadelphia, Pennsylvania. Proceedings of the Fifth AAAI National Conference on Artificial Intelligence. USA: AAAI Press, 1986. p. 1113–1119.

58 LEE, S.; SHIN, Y. G. Assembly coplanner : Cooperative assembly planner based on subassembly extraction. In: MELLO,H.; LUIZ S.; LEE, S. Computer-Aided Mechanical Assembly Planning. Boston, MA: Springer US, 1991. p. 315–339.

59 HALPERIN, D.; LATOMBE, J.-C.; WILSON, R. H. A general framework for assembly planning: The motion space approach. Algorithmica, Springer-Verlag, Berlin, Germany, v. 26, n. 3, p. 577–601, April 2000.

60 DONG, T. et al. A knowledge-based approach to assembly sequence planning. The International Journal of Advanced Manufacturing Technology, Springer-Verlag, Berlin, Germany, v. 32, n. 11, p. 1232–1244, May 2007.

61 CHEN, W.-C. et al. A three-stage integrated approach for assembly sequence planning using neural networks. Expert Systems with Applications, Elsevier, London, UK, v. 34, n. 3, p. 1777 – 1786, April 2008. 198 Bibliography

62 WANG, J.; LIU, J.; ZHONG, Y. A novel ant colony algorithm for assembly sequence planning. The International Journal of Advanced Manufacturing Technology, Springer Berlin Heidelberg, Berlin, Germany, v. 25, n. 11, p. 1137–1143, June 2005.

63 PAN, H.; HOU, W. J.; LI, T. M. Genetic algorithm for assembly sequences planning based on heuristic assembly knowledge. In: INTERNATIONAL CONFERENCE ON FRONTIERS OF MANUFACTURING AND DESIGN SCIENCE, 2010, China. Frontiers of Manufacturing and Design Science. Switzerland: Trans Tech Publications, 2011. p. 3657–3661.

64 IBRAHIM, I. et al. An assembly sequence planning approach with a rule-based multi-state gravitational search algorithm. The International Journal of Advanced Manufacturing Technology, Springer London, London, UK, v. 79, n. 5, p. 1363–1376, July 2015.

65 SEO, J. Grasping and Assembling with Modular Robots. Tese (Doutorado), Filadelfia, PA, USA, 2014.

66 HARRIS JEFFRY L. HIRST, M. M. a. J. Combinatorics and Graph Theory. 2. ed. [S.l.]: Springer-Verlag New York, 2008. (Undergraduate Texts in Mathematics). ISBN 9781441927231,1441927239.

67 SALVI, A. Z.; SIMONI, R.; SIMAS, H. Assembly sequence planning for shape heterogeneous modular robot systems. In: CARVALHO, J.C.M.; MARTINS, D.; SIMONI, R.; SIMAS, H. Multibody Mechatronic Systems: Proceedings of the MUSME Conference held in Florianópolis, Brazil, October 24-28, 2017. Cham, Switzerland: Springer International Publishing, 2018. p. 128–137.

68 SIMONI, R. Contribuições para a enumeração e para a análise de mecanismos e manipuladores paralelos. Tese (Doutorado) — Federal University of Santa Catarina, 2010.

69 TSAI, L. Mechanism Design: Enumeration of Kinematic Structures According to Function. Abingdon, UK: Taylor and Francis, 2000. (Mechanical and Aerospace Engineering Series).

70 CORMEN, T. Introduction to Algorithms. Massachusetts, USA: MIT Press, 2009. Bibliography 199

71 GROSS, J.; YELLEN, J. Handbook of Graph Theory. Abingdon, UK: Taylor and Francis, 2004. 72 CARBONI, A. P. Analise estrural de cadeias cinematicas planas e espaciais. Dissertação (Mestrado) — Federal University of Santa Catarina, 2008.

201

A GRAPH AND GROUP THEORY

In order to enumerate and to assembly modular robotic system configurations this thesis employs group and graph theory tools. This chapter briefly review the basic definitions and the results utilized in this thesis.

A.1 GROUP THEORY TOOLS

Groups are abstract structures used in mathematics and science in general in order to capture the structure’s internals symmetries. In order to enumerate all distinct configurations of a modular robotic sys- tem, it is fundamental to know the structure’s symmetries. In this way, it is possible to prevent the generation of isomorphic structures during the enumeration process. Thus, group theory basics concepts herein reviewed are largely used in the first part of the thesis, which deals with enumeration. This section presents the essential definitions of group theory found in the literature [33–35, 68]. A binary operation ∗ on a set G is a function that associates with every ordered pair of elements (a, b) ∈ G × G, a unique element of G, denoted by a ∗ b, or simply, ab.

Definition 1 (Group). A group is a set G with a binary operation ∗ : G × G → G which satisfies the following conditions: (i) Associative Law: For all a, b and c in G, (a ∗ b) ∗ c = a ∗ (b ∗ c). (ii) Identity Law: There is an element e in G such that for all a in G, e ∗ a = a ∗ e = a. (iii) Inverse Law: For each a in G, there is an element a−1 in G such that a ∗ a−1 = a−1 ∗ a = e, where e is an identity element.

Example 1. (Z, +) is the group of integers under addition. The iden- tity, e, in this case is the number 0 and the inverse of x is −x. (Z, ×) is not a group. The problem lies with inverses under multiplication. Not only does 0 fail to have an inverse, numbers such as 2 have no inverse, 1 not within the system of integers at any rate, since 2 is not an integer. In fact, the only integers which do have multiplicative inverses within Z are 1 and −1.

Definition 2 (Subgroup). A set G’ is a subgroup of a group G if it is a subset of G and is a group using the operation defined on G. 202 Appendix A. Graph and Group Theory

Example 2. The rational numbers under addition form the group (Q, +) and (Z, +) is one of its many subgroups.

Example 3. Consider Mn the set of n × n real or complex matrices with the usual matrix multiplication. This is not a group because some of these matrices do not have inverse. However, if we consider only the invertible matrices, we have the general linear group GLn. This group has some interesting subgroups, for example: t −1 1. Orthogonal group: O(n) = {A ∈ Mn|A = A }. t −1 2. Special orthogonal group: SO(n) = {A ∈ Mn|A = A , det(A) = 1}

The SO(n) group is also called the rotation group, because, in dimen- sions 2 and 3, its elements are the usual rotations around a point (in dimension 2) or a line (in dimension 3). The elements of SO(2), for example, are the matrices   cos θ −sinθ A = , sinθ cos θ whit 0 ≤ θ < 2π. These matrices represent the rotations around the origin.

Definition 3. Let X be a nonempty set. 1.A permutation of a set X is a bijection from X to itself, in other words a function σ : X → X such that σ is a bijection.

2. The symmetric group of a set X, denoted by SX , is the group whose underlying set is the collection of all bijections from X to X and whose group operation is that of function composition. The symmetric group on a finite set X = {1, 2, . . . , n} is denoted as Sn. Let σ ∈ Sn, that is σ is a permutation on X = {1, 2, . . . , n}. Then, σ shuffles the elements of X. Subgroups of Sn are called per- mutation groups. Each σ ∈ Sn can be represented explicitly in array notation by writing  1 2 ··· n  σ = , σ(1) σ(2) ··· σ(n) where the top row represents the original elements and the bottom row represents what each element is mapped to. A.1. Group theory tools 203

Example 4. Let X = {1, 2, 3, 4} and

 1 2 3 4   1 2 3 4  α = , β = . 2 4 1 3 3 2 4 1

Then:

 1 2 3 4   1 2 3 4  αβ(1) = (1) = 2 4 1 3 3 2 4 1

 1 2 3 4  = (3) = 1 2 4 1 3

Example 5. The elements of S3 are the permutations on X = {1, 2, 3}. There are 3! = 6 possible permutations. They are:

 1 2 3   1 2 3   1 2 3  e = , β = , α = , 1 2 3 1 3 2 2 3 1

 1 2 3   1 2 3   1 2 3  α2 = , αβ = , α2β = . 3 1 2 2 1 3 3 2 1

A.1.1 Isomorphism and Automorphism

Definition 4. Let G1 and G2 be two groups.

1.A homomorphism of G1 in G2 is an application φ : G1 → G2 such that, for all x and y in G1

φ(x · y) = φ(x) · φ(y).

2. If φ is bijective, the application is an isomorphism.

3. If G1 = G2, the application is an automorphism.

+ Example 6. Consider the groups G1 = (R; +) and G2 = (R ; .). G1 is isomorphic to G2. In fact, the function φ is defined by: φ : G1 → x G2 such that φ(x) = 2 . This function is a bijection. Suppose that φ(a) = (b), then 2a = 2b, thus a = b. This implies that φ is an injection. For each y ∈ G2, take x = log2 y ∈ G1. Thus, φ(x) = y, implying that φ is a surjection. Finally, if a and b are two elements a+b a b of G1, then φ(a + b) = 2 = 2 2 = φ(a)φ(b), implying that φ is a homomorphism of G1 in G2. As φ is a homomorphism and it is bijective, φ is an isomorphism. 204 Appendix A. Graph and Group Theory

A.1.2 Actions and orbits

Definition 5 ((Left) group action). A left group action of a group G on a set X is a binary function G × X → X

(g, x) 7→ g · x which satisfies the following two axioms: (i) (gh) · x = g · (h · x) for all elements g, h in the group G and x in the set X. (ii) e · x = x for every element x in the set X (where e denotes the identity element of the group G). Analogously, the right group action is defined. From now on, we use the term action for left action, unless otherwise stated. Example 7. The symmetric group is a matrix group and the actions can be represented by a binary matrix operation. For instance,  0 1 0   a b c  σ = → 1 0 0 b a c   0 0 1 can be represented as (left group action)  b   0 1 0   a  φ =  a  =  1 0 0  ·  b  . c 0 0 1 c

Consider a group G acting on a set X. The orbit of an element x ∈ X is the set of elements in X to which x can be moved by the elements of G. Definition 6 (Orbit). Consider a group G acting on a set X. The orbit of the point x ∈ X is denoted by

Ox = {g · x | g ∈ G}.

The set of orbits of the set X under the action of the group G form a partition of the set X. The associated equivalence relation is defined by x ≈ y if and only if there exists an element g in the set G such that g · x = y. The orbits are equivalence classes under this relation; two elements x and y are equivalent if and only if their orbits are the same, i.e. Ox = Oy. A.2. Graph Theory 205

Example 8. Consider the SO(2) group, i.e. the planar rotation group, see Example3. This group acts in a point by rotating this point about the origin by an angle θ. The orbit of a point at distance r from the origin is the circle of radius r. Figure shows the orbit of point (1, 0) by π i π iπ i 3π iθ θ O π { , e 2 , e , e 2 } e θ i θ an angle = 2 , i.e. 2 = 1 , where = cos + sin . π , θ O π Figure shows the orbit of point (1 0) by an angle = 6 , i.e. 6 = i π i π i π i 2π i 5π iπ i 7π i 4π i 3π i 5π i 11π {1, e 6 , e 3 , e 2 , e 3 , e 6 , e , e 6 , e 3 , e 2 , e 3 , e 6 }.

y y

, (1, 0) (1 0) x x

(a) (b)

Figure 93 – Examples of orbits by the action of the SO(2) group over π π (0, 1). (a) Orbit of (1, 0) by an angle 2 ; (b) by an angle 6 .

A.2 GRAPH THEORY

In this section, some fundamental concepts of graph theory [66, 69–72] are reviewed. As previously stated, in order to enumerate all distinct configurations of a modular robotic system, it is fundamental to know the structure’s symmetries. This is done by considering a graph representing the structure and observing the action of the auto- morphism group on this graph. Thus, the graph basics concepts herein reviewed are largely used in the first part of the thesis, which deals with enumeration. Furthermore, the second part of the thesis, which deals with assembly sequence planning, is also based on graph theory concepts, mainly in graph traversals concepts, which are reviewed in the next section. A graph G = (V,E) consists of a finite set V (G) of vertices and a family E(G) of subsets of V (G) of size two called edges. Figure 94 shows examples of graphs. Each edge of a graph connects two vertices called the end points. Herein an edge is specified by its end points; that is, (i, j) or ei,j denote 206 Appendix A. Graph and Group Theory

10 1 9 8 2 5 2 5 7

3 4 3 4 6 11 (a) (Graph) (b) Subgraph of (a)

10

1 9 8

2 5 7

3 4 6 (c) Component of (a) (d) A tree that is also a com- ponent of (a)

Figure 94 – Examples of graphs, subgraphs trees and graph’s compon- ents. the edge connecting vertices i and j. An edge is said to be incident with a vertex if the vertex is an end point of that edge. The two end points of an edge are said to be adjacent. Two edges are adjacent if they are incident to a common vertex. For the graph shown in Figure 94a, e2,3 is incident at vertices 2 and 3. Edges e1,2, e2,3, and e2,5 are adjacent.

A.2.1 Degree of a vertex The degree of a vertex is defined as the number of edges in- cident with that vertex. A vertex of zero degree is called an isolated vertex. A vertex of degree two is called a binary vertex, a vertex of degree three is called a ternary vertex, and so on. For the graph shown in Figure 94a, the degree of vertex 2 is three, the degree of vertex 10 is one, and vertex 11 is an isolated vertex. A.2. Graph Theory 207

A.2.2 Walks and circuits A sequence of alternating vertices and edges, beginning and end- ing with a vertex, is called a walk. A walk is called a trail if all the edges are distinct and a path if all the vertices and, therefore the edges are distinct. In a path, no edge may be traversed more than once. The length of a path is defined as the number of edges between the begin- ning and ending vertices. If each vertex appears once, except that the beginning and ending vertices are the same, the path forms a circuit or cycle. For the graph shown in Figure 94a, the sequence (2, e2,3, 3, e3,4, 4, e4,5 , 5) is a path, whereas the sequence (2, e2,3, 3, e3,4, 4, e4,5, 5, e5,2, 2) is a circuit.

A.2.3 Connected Graphs, subgraphs and components Two vertices are said to be connected if there exists a path from one vertex to the other. A graph G is said to be connected if every vertex in G is connected to every other vertex by at least one path. For example, the graph shown in Figure 94b is connected, whereas the one shown in Figure 94a is not. A subgraph S of a graph G is a graph whose set of vertices and set of edges are all subsets of G.A connected component (or simply component) of a graph is the maximal subgraph whose vertices are all connected. A connected graph has a single component, and that is the graph itself. A disconnected graph will have at least two components. For example, the graph shown in Figure 94a has three components; the graph shown in Figure 94b is a subgraph, but not a component of Figure 94a; whereas the graphs shown in Figures 94c and 94d are components of Figure 94a.

A.2.4 Articulation points and bridges An articulation point or cut point of a graph is a vertex which increases the number of connected components when it is removed from the graph. Similarly, a bridge is an edge whose removal results in an increase of the number of components. For the graph shown in Figure 94a, vertices 7 and 9 are cut points, whereas e6,7, e7,8, e7,9, and e9,10 are bridges.

A.2.5 Directed and undirected graph When a direction is assigned to every edge of a graph, the graph is said to be a directed graph. Figure 95a presents an undirected 208 Appendix A. Graph and Group Theory graph and Figure 95b presents a direct graph.

5 5

4 1 4

2 1 2

3 3 (a) (b)

Figure 95 – (a) An undirected graph, (b) a directed graph.

A.2.6 Biconnected graph An undirected graph is said to be biconnected if there are at least two vertex disjoint paths from every vertex to every other vertex. A biconnected graph is connected and has no cut points. A biconnected component is defined as a maximal subset of edges such that its induced subgraph is biconnected. Figure 95a shows a graph which is not biconnected, however if, another edge is incident at vertex 2, then the graph becomes bicon- nected. For example, if edge e1,2 is also considered, then, the graph becomes biconnected.

A.2.7 Tree A tree is a connected graph that contains no circuits. Figure 96 shows a family of trees with six vertices.

Figure 96 – A family of trees with six vertices. A.2. Graph Theory 209

A.2.8 Graph isomorphism and automorphism

Two graphs, G1 and G2 are said to be isomorphic if there exists a bijection σ : V (G1) → V (G2) such that

(x, y) ∈ E(G1) ⇔ (σ(x), σ(y)) ∈ E(G2) . In other words, two graphs, G1 and G2 , are said to be isomorphic if there exists a one-to-one correspondence between their vertices and edges that preserve the incidence. If an isomorphism exists between two graphs G1 and G2, then the graphs are called isomorphic and we write G1 ' G2. Figure 97 shows two isomorphic graphs labeled in order to evidence the isomorphism between them.

A F H A F G B E G J E B H I J I

D C D C

Figure 97 – Two isomorphic graphs labeled in order to evidence the isomorphism between them.

The automorphism of a graph is the graph’s isomorphism with itself. The set of automorphisms with the operation of permutation composition defines a permutation group known as the graph’s auto- morphism group. The automorphism group of a graph G1 is denoted by Aut(G1). The graph’s automorphism group is a subgroup of the symmet- ric group and contains all possible permutations of the vertices that preserve the adjacency. For example, consider the graph in Figure 98a. This graph has four automorphisms:

 1 2 3 4 5 6   1 2 3 4 5 6  σ = , σ = 1 1 2 3 4 5 6 2 2 1 4 3 6 5

 1 2 3 4 5 6   1 2 3 4 5 6  σ = , σ = 3 5 6 3 4 1 2 4 6 5 4 3 2 1 210 Appendix A. Graph and Group Theory

5 6 5 6 6 5

3 4 3 4 4 3 1 2 1 2 2 1

(a) A Grid Graph (b) σ1 = e (c) σ2

1 2 2 1

3 4 4 3 5 6 6 5

(d) σ3 (e) = σ4

Figure 98 – All possible automorphisms of the graph in (a).

A multiplication table is shown in Table6. It can be concluded that every product is a group element; the associative law holds; σ1 is the identity element; and every element is its own inverse. Therefore, σ1, σ2, σ3 and σ4 with the operation of permutation composition form a group.

Table 6 – Operation table for the automorphism group of the graph in Figure 98a.

◦ σ1 σ1 σ1 σ1 σ1 σ1 σ2 σ3 σ4 σ2 σ2 σ1 σ4 σ3 σ3 σ3 σ4 σ1 σ2 σ4 σ4 σ3 σ2 σ1 A.2. Graph Theory 211

A.2.9 Actions and orbits Given a graph G, a bijective map σ : V (G) → V (G) defines a permutation. Assuming that V (G) has n elements, the set of these permutations endowed with the composition operation form the group Sn. The set of automorphisms of G endowed with the composition operation form a subgroup A of Sn. Thus, the definitions presented in Section A.1.2 can be applied to both groups. For example, consider the graph G in Figure 98a. Figures 98b,98c, 98d and 98e present the actions of automorphisms σ1 = e, σ2, σ3 and σ4 on graph G. As previously stated, a graph’s automorphism group contains all possible vertices permutations which preserve adjacency relations. Thus, {σ1, σ2, σ3, σ4} endowed with the composition operation form the automorphism group A of graph G. Let us determine the orbits by the action of group A on graph G. The orbit of a vertex v ∈ G is the set of vertices to which v can be moved by the elements of group A, thus:

Ov = {a · v | a ∈ A}, where a ∈ {σ1, σ2, σ3, σ4}. Consider, for example, vertex 1:

O1 = {a · 1 | a ∈ A}.

As σ1 · 1 = σ1(1) = 1, σ2 · 1 = σ2(1) = 2, σ3 · 1 = σ3(1) = 5 and σ4 · 1 = σ4(1) = 6, then O1 = {1, 2, 5, 6}. By analogous processes, the orbits by the action of the auto- morphism group A on graph G are:

• O1 = O2 = O5 = O6 = {1, 2, 5, 6};

• O3 = O4 = {3, 4}.

This example evidences that two orbits by a group action are either disjoint or coincident. Thus, usually only one representative of each distinct orbit is considered. For example, it can be said that the orbits by the action of the automorphism group A on graph G are only:

• O1 = {1, 2, 5, 6};

• O3 = {3, 4}. 212 Appendix A. Graph and Group Theory

As another example, consider the Stephenson Graph shown in Figure 99a. This graph has four automorphisms. Figures 99b, 99c, 99d and 99e present the actions of these automorphisms, denoted by φ1 = e, φ2, φ3 and φ4 on the graph in Figure 99a. Thus, the orbits by the action of the automorphism group on this graph are:

• O1 = O4 = {1, 4};

• O2 = O3 = {2, 3};

• O5 = O6 = {5, 6}.

3 4 3 4 3 4

5 6 5 6 6 5

2 1 2 1 2 1

(a) Stephenson Graph (b) φ1 = e (c) φ2

2 1 2 1

5 6 6 5

3 4 3 4

(d) φ3 (e) φ4

Figure 99 – Action of the automorphism group on the Stephenson graph.

A.3 GRAPH TRAVERSALS

The second part of this thesis, which deals with assembly se- quence planning, is based on graph traversals algorithms. This section presents the essential definitions of graph traversals found in the liter- ature [70, 71]. A.3. Graph Traversals 213

Many graph applications need to find all vertices reachable from a given set of vertices. A traversal is a systematic procedure for ex- ploring the graph by examining its vertices and edges in some specific order. Graph traversal algorithms typically begin with a start vertex (root) and attempt to visit the remaining vertices from there. Graph traversals must deal with a number of troublesome cases. For example, a vertex may not be reachable from the root, or the graph might contain cycles, in that case if the algorithm is not well designed, infinite loops might occur. A traversal is efficient if it visits all the vertices and edges in linear time.

A.3.1 Breadth-First Search Breadth-First Search, BFS, is a traversing algorithm that ex- plores a graph level-by-level. BFS starts at a chosen vertex s, marks s as discovered, and placed it at level 0. Then, BFS marks as discovered all vertices adjacent to s; these vertices are one edge way from s, thus, they are placed into level 1. Next, BFS explores new vertices, which are adjacent to level 1 vertices and not yet marked as discovered. These vertices are placed into level 2. This process continues until no new vertices are found in a level. An example of the BFS algorithm is shown in Figure 100. Fig- ure 100a represents the graph that is traversed using BFS. Figure 100b represents the flow of the BFS algorithm, with vertex A as root.

A Level 0 A

B C Level 1 B C

D E F G Level 2 D E F G

H I J K Level 3 H I J K (a) (b)

Figure 100 – Figure (b) represents the DFS procedure, with vertex A as root, for the graph in (a).

Assume that when BFS traverses a graph, the left edges are chosen before right edges. Thus, for the graph in Figure 100a, a 214 Appendix A. Graph and Group Theory breadth-first search starting at vertex A, will visit the vertices in the following order: A, B, C, D, E, F, G, H, I, J, K as highlighted in Fig- ure 100b.

The following pseudocode is the basic breadth-first search al- gorithm. Input: A graph G and a vertex v of G; Output: A collection of vertices reachable from v. If graph G is not connected, in order to traverse the entire graph, BFS must be started for all vertices until the entire graph is explored.

Algorithm 9 BFS(G,v) 1: Initialize a queue Q 2: Mark v as discovered 3: Q.enqueue( v ) 4: while Q is not empty do 5: w ← Q.dequeue( ) 6: for each vertex u adjacent to w do 7: if u is not discovered then 8: Mark it u as discovered 9: Q.enqueue( u ) 10: end if 11: end for 12: end while

A.3.2 Depth-First Search The Depth-First Search (DFS) is a systematic method of visiting the vertices of a graph. The strategy followed by depth-first search is to search “deeper” in the graph whenever possible, i.e. keeping going down a path until it is no longer possible. Its general step requires that, if a vertex v is currently being visited, the next explored vertex w must be a vertex adjacent to v which has not yet been visited. If no such vertex exists, DFS returns to the vertex visited just before v (v’s parent) and the search is repeated until every vertex reachable from v is visited. An example of the DFS algorithm is shown in Figure 101. Figure 101a represents the graph that will be traversed using DFS. Figure 101b represent the flow of the DFS algorithm, with vertex A as root. Assume that when DFS traverses a graph, the left edges are chosen before right edges, and that the search does not repeat previ- A.3. Graph Traversals 215

A A

B C B C

D E F G D E F G

H I J K H I J K (a) (b)

Figure 101 – Figure (b) represents the DFS procedure, with vertex A as root, for the graph in (a). ously visited vertices. Thus, for the graph in Figure 101a, a depth-first search starting at vertex A, will visit the vertices in the following order: A,B,D,H,E,I,J,C,F,K,G, as highlighted in Figure 101b.

The following pseudocode is the basic depth-first-search algorithm. Input: A graph G and a vertex v of G; Output: A collection of vertices reachable from v. If graph G is not connected, DFS must be started for all vertices until the entire graph is explored.

Algorithm 10 DFS(G,v) 1: Label v as discovered 2: for each vertex w adjacent to v do 3: if vertex w is not labeled as discovered then 4: Label w as discovered 5: Recursively call DFS(G,w) 6: end if 7: end for

Another way to think of depth-first-search is by saying that it is similar to breadth-first search except that it uses a stack instead of a queue.

217

B ALGORITHMS: LITERATURE REVIEW

This appendix presents two algorithms from Chapter2. These algorithms were introduced by the author in previous works on the enumeration of planar modular robot configurations. Algorithm 11 was reviewed in Section 2.3.1.4. It presents the Comparison test which checks if a configuration is a rotation, transla- tion, or reflection of another. The test follows a cascade structure and it is a part of the Symmetry Method. Details are presented in [7]. Next algorithms are part of the Orbital Method. Algorithm 12, reviewed in Section 2.3.2.1, presents the steps to obtain the Mgrafo matrix to any configuration in the ID form. Algorithm 13 and Al- gorithm 14, also reviewed in Sections 2.3.2.1, present the steps to ob- tain the total graph representation from the Mgrafo matrix. Details are presented in [8]. 218 Appendix B. Algorithms: literature review

Algorithm 11 Comparison test

1: if ID1 = ID2 then 2: The configurations are isomorphic, the test is finished. 3: else 4: Proceed. 5: end if 1 6: Name ID2 the reflection in Oy of ID2; 1 1 7: ID2 = ID2 and discard ID2; 8: if ID1 = ID2 then 9: The configurations are isomorphic, the test is finished. 10: else 11: Proceed. 12: end if 1 13: Name ID2 the reflection in Ox of ID2; 1 1 14: ID2 = ID2 and discard ID2; 15: if ID1 = ID2 then 16: The configurations are isomorphic, the test is finished. 17: else 18: Proceed. 19: end if 1 20: Name ID2 the reflexion in Oy of ID2; 1 1 21: ID2 = ID2 and discard ID2; 22: if ID1 = ID2 then 23: The configurations are isomorphic, the test is finished. 24: else 25: Proceed. 26: end if 1 27: Name ID2 the transposed of ID2; 1 1 28: ID2 = ID2 and discard ID2; 29: if ID1 = ID2 then 30: The configurations are isomorphic, the test is finished. 31: else 32: Proceed. 33: end if 1 34: Name ID2 the reflexion in Ox of ID2; 1 1 35: ID2 = ID2 and discard ID2; 36: if ID1 = ID2 then 37: The configurations are isomorphic, the test is finished. 38: else 39: Proceed. 40: end if 1 41: Name ID2 the reflexion in Oy of ID2; 1 1 42: ID2 = ID2 and discard ID2; 43: if ID1 = ID2 then 44: The configurations are isomorphic, the test is finished. 45: else 46: Proceed. 47: end if 1 48: Name ID2 the reflexion in Ox of ID2; 1 1 49: ID2 = ID2 and discard ID2; 50: if ID1 = ID2 then 51: The configurations are isomorphic, the test is finished. 52: else 53: The configurations are non-isomorphic, and the test is false. 54: end if 219

Algorithm 12 Mgrafo

1: INPUT: IDm×n 2: OUTPUT: Mm×n×4 = Mgrafo 3: for i = 0, to i = m − 1 do 4: for j = 0, to = n − 1 do 5: if IDi,j = 0 then 6: Mi,j,NORT H = Mi,j,EAST = 0; Mi,j,SOUT H = Mi,j,W EST = 0. 7: else 8: if IDij 6= 0 is the first nonzero element then 9: Mi,j,NORT H = 1, Mi,j,EAST = 2; Mi,j,SOUT H = 3, Mi,j,W EST = 4; Define Counter = 5. 10: else 11: if IDi−1,j = 1: then 12: Mi,j,NORT H = Mi−1,j,SOUT H ; 13: Mi,j,EAST = Counter and Counter = Counter + 1; 14: Mi,j,SOUT H = Counter and Counter = Counter + 1; 15: else 16: Mi,j,NORT H = Counter and Counter = Counter + 1; 17: Mi,j,EAST = Counter and Counter = Counter + 1; 18: Mi,j,SOUT H = Counter and Counter = Counter + 1; 19: if IDi,j−1 = 1 then 20: Mi,j,W EST = Mi,j−1,EAST ; 21: else 22: Mi,j,W EST = Counter and Counter = Counter + 1; 23: end if 24: end if 25: end if 26: end if 27: end for 28: end for

Algorithm 13 Graph I

1: INPUT: Mgrafo = Mm×n×4 2: OUTPUT: Configuration’s Graph I 3: for i = 0, to i = m − 1 do 4: for j = 0, to j = n − 1 do 5: Create edge (Mi,j,NORT H ,Mi,j,EAST ); 6: Create edge (Mi,j,EAST ,Mi,j,SOUT H ); 7: Create edge (Mi,j,SOUT H ,Mi,j,W EST ); 8: Create edge (Mi,j,W EST ,Mi,j,NORT H ); 9: if (Mi,j,NORT H 6= 0, Mi,j+1,NORT H 6= 0 and j 6= n − 1) then 10: Create the edge (Mi,j,NORT H ,Mi,j+1,NORT H ); 11: Create the edge (Mi,j,SOUT H ,Mi,j+1,SOUT H ); 12: end if 13: if (Mi,j,NORT H 6= 0, Mi+1,j,NORT H 6= 0 and i 6= m − 1) then 14: Create the edge (Mi,j,EAST ,Mi+1,j,EAST ); 15: Create the edge (Mi,j,W EST ,Mi+1,j,W EST ). 16: end if 17: end for 18: end for 220 Appendix B. Algorithms: literature review

Algorithm 14 Graph II

1: INPUT: Mgrafo = Mm×n×4 2: OUTPUT: Configuration’s Graph II 3: for i = 0, to i = m − 1 do 4: for j = 0, to j = n − 1 do 5: Create edges: (Mi,j,NORT H ,Mi,j,EAST ); 6: (Mi,j,EAST ,Mi,j,SOUT H ); 7: (Mi,j,SOUT H ,Mi,j,W EST ); 8: (Mi,j,W EST ,Mi,j,NORT H ); 9: if (Mi,j,SOUT H 6= 0, i 6= m − 1 and Mi+1,j,NORT H = 0) then 10: for c = i + 1 to c = m − 1 do 11: for b = 0, to b = n − 1 do 12: if (Mc,b,NORT H 6= 0, c 6= 0, b 6= j, Mc−1,b,SOUT H = 0) then 13: Create (Mi,j,SOUT H ,Mc,b,NORT H ) 14: end if 15: if (Mc,b,EAST 6= 0, b 6= n − 1,b < j, Mc,b+1,W EST = 0) then 16: Create (Mi,j,SOUT H ,Mc,b,EAST ) 17: end if 18: if (Mc,b,W EST 6= 0, b 6= 0, b > j, Mc,b−1,EAST = 0) then 19: Create (Mi,j,SOUT H ,Mc,b,W EST ); 20: end if 21: end for 22: end for 23: end if 24: if (Mi,j,EAST 6= 0, b 6= n − 1 and Mi,j+1,W EST = 0) then 25: for c = i + 1 to c = m − 1 do 26: for b = j + 1, to b = n − 1 do 27: if (Mc,b,NORT H 6= 0, c 6= 0, Mc−1,b,SOUT H = 0) then 28: Create (Mi,j,EAST ,Mc,b,NORT H ); 29: end if 30: if (Mi,j,W EST 6= 0, b 6= 0 and Mi,j−1,EAST = 0) then 31: Create (Mi,j,EAST ,Mc,b,W EST ); 32: end if 33: end for 34: end for 35: end if 36: if (Mi,j,W EST 6= 0, b 6= 0 and Mi,j−1,EAST = 0) then 37: for c = i + 1 to c = m − 1 do 38: for b = 0, to b = j − 1 do 39: if (Mc,b,NORT H 6= 0, c 6= 0, Mc−1,b,SOUT H = 0) then 40: Create (Mi,j,W EST ,Mc,b,NORT H ); 41: end if 42: if (Mi,j,EAST 6= 0, b 6= n − 1 and Mi,j+1,W EST = 0) then 43: Create (Mi,j,W EST ,Mc,b,EAST ); 44: end if 45: end for 46: end for 47: end if 48: end for 49: end for 221

C ALGORITHMS: THESIS CONTRIBUTIONS

This appendix presents a novel algorithm, original contribution of this thesis, Algorithm 15, explained in Section 4.1. This algorithm presents necessary steps to obtain the graph representation introduced in this thesis for cubic modular robots. More specifically, it presents the total steps to obtain graph’s edges from the Mgrafo matrix for cubic modular robots. 222 Appendix C. Algorithms: thesis contributions

Algorithm 15 Graph for a cubic modular robot

1: INPUT: Md×l×c×6 = Mgrafo 2: OUTPUT: Graph’s edges 3: Define Counter = 1. 4: for i = 0, to i = d − 1 do 5: for j = 0, to j = l − 1 do 6: for k = 0, to i = c − 1 do 7: if Mi,j,k,NORT H ! = 0 then 8: for b =NORTH;b <=BACK;b + + do 9: if b = NORTH or b = SOUTH then 10: Create (Mi,j,k,b,Mi,j,k,EAST ) 11: Create (Mi,j,k,b,Mi,j,k,W EST ) 12: Create (Mi,j,k,b,Mi,j,k,F RONT ) 13: Create (Mi,j,k,b,Mi,j,k,BACK ) 14: else if b = EAST or b = WEST then 15: Create (Mi,j,k,b,Mi,j,k,NORT H ) 16: Create (Mi,j,k,b,Mi,j,k,SOUT H ) 17: Create (Mi,j,k,b,Mi,j,k,F RONT ) 18: Create (Mi,j,k,b,Mi,j,k,BACK ) 19: else 20: Create (Mi,j,k,b,Mi,j,k,NORT H ) 21: Create (Mi,j,k,b,Mi,j,k,SOUT H ) 22: Create (Mi,j,k,b,Mi,j,k,EAST ) 23: Create (Mi,j,k,b,Mi,j,k,W EST ) 24: end if 25: end for 26: if i! = (d − 1) and Mi+1,j,k,NORT H ! = 0 then 27: Create (Mi,j,k,NORT H ,Mi+1,j,k,NORT H ) 28: Create (Mi,j,k,SOUT H ,Mi+1,j,k,SOUT H ) 29: Create (Mi,j,k,EAST ,Mi+1,j,k,EAST ) 30: Create (Mi,j,k,W EST ,Mi+1,j,k,W EST ) 31: end if 32: if j! = (l − 1) and Mi,j+1,k,NORT H ! = 0 then 33: Create (Mi,j,k,NORT H ,Mi,j+1,k,NORT H ) 34: Create (Mi,j,k,SOUT H ,Mi,j+1,k,SOUT H ) 35: Create (Mi,j,k,EAST ,Mi,j+1,k,EAST ) 36: Create (Mi,j,k,W EST ,Mi,j+1,k,W EST ) 37: end if 38: if k! = (c − 1) and Mi,j,k+1,NORT H ! = 0 then 39: Create (Mi,j,k,NORT H ,Mi,j,k+1,NORT H ) 40: Create (Mi,j,k,SOUT H ,Mi,j,k+1,SOUT H ) 41: Create (Mi,j,k,F RONT ,Mi,j,k+1,F RONT ) 42: Create (Mi,j,k,BACK ,Mi,j,k+1,BACK ) 43: end if 223

Algorithm 15 Graph for a cubic modular robot 44: . Edges between vertices in the same depth 45: if j! = 0, k! = (c−1), Mi,j,k,NORT H ! = 0, Mi,j−1,k,NORT H = 0 and Mi,j−1,k+1,W EST ! = 0 then 46: Create (Mi,j,k,NORT H ,Mi,j−1,k+1,W EST ) 47: end if 48: if j! = l−1, k! = (c−1), Mi,j,k,SOUT H ! = 0, Mi,j+1,k,NORT H = 0 and Mi,j+1,k+1,W EST ! = 0 then 49: Create (Mi,j,k,SOUT H ,Mi,j+1,k+1,W EST ) 50: end if 51: if j! = 0, k! = 0, Mi,j,k,NORT H ! = 0, Mi,j−1,k,NORT H = 0 and Mi,j−1,k−1,EAST ! = 0 then 52: Create (Mi,j,k,NORT H ,Mi,j−1,k−1,EAST ) 53: end if 54: if j! = l − 1, k! = 0, Mi,j,k,SOUT H ! = 0, Mi,j+1,k,NORT H = 0 and Mi,j+1,k−1,EAST ! = 0 then 55: Create (Mi,j,k,SOUT H ,Mi,j+1,k−1,EAST ) 56: end if 57: . Edges between vertices in the same line 58: if i! = d−1, k! = (c−1), Mi,j,k,BACK ! = 0, Mi+1,j,k,NORT H = 0 and Mi+1,j,k+1,W EST ! = 0 then 59: Create (Mi,j,k,BACK ,Mi+1,j,k+1,W EST ) 60: end if 61: if i! = 0, k! = (c−1), Mi,j,k,F RONT ! = 0, Mi−1,j,k,NORT H = 0 and Mi−1,j,k+1,W EST ! = 0 then 62: Create (Mi,j,k,F RONT ,Mi−1,j,k+1,W EST ) 63: end if 64: if i! = d − 1, k! = 0, Mi,j,k,BACK ! = 0, Mi+1,j,k,NORT H = 0 and Mi+1,j,k−1,EAST ! = 0 then 65: Create (Mi,j,k,BACK ,Mi+1,j,k−1,EAST ) 66: end if 67: if i! = 0, k! = 0, Mi,j,k,F RONT ! = 0, Mi−1,j,k,NORT H = 0 and Mi−1,j,k−1,EAST ! = 0 then 68: Create (Mi,j,k,F RONT ,Mi−1,j,k−1,EAST ) 69: end if 224 Appendix C. Algorithms: thesis contributions

Algorithm 15 Graph for a cubic modular robot 70: . Edges between vertices in the same column 71: if i! = (d−1), j! = 0, Mi,j,k,NORT H ! = 0, Mi,j−1,k,NORT H = 0 and Mi+1,j−1,k,F RONT ! = 0 then 72: Create (Mi,j,k,NORT H ,Mi+1,j−1,k,F RONT ) 73: end if 74: if i! = (d − 1), j! = (l − 1), Mi,j,k,SOUT H ! = 0, Mi,j+1,k,NORT H = 0 and Mi+1,j+1,k,F RONT ! = 0 then 75: Create (Mi,j,k,SOUT H ,Mi+1,j+1,k,F RONT ) 76: end if 77: if i! = 0, j! = 0, Mi,j,k,NORT H ! = 0, Mi,j−1,k,NORT H = 0 and Mi−1,j−1,k,BACK ! = 0 then 78: Create (Mi,j,k,NORT H ,Mi−1,j−1,k,BACK ) 79: end if 80: if i! = 0, j! = l − 1, Mi,j,k,SOUT H ! = 0, Mi,j+1,k,NORT H = 0 and Mi−1,j+1,k,BACK ! = 0 then 81: Create (Mi,j,k,SOUT H ,Mi−1,j+1,k,BACK ) 82: end if 83: end if 84: end for 85: end for 86: end for