<<

Universidade Estadual de Campinas Instituto de Computação INSTITUTO DE COMPUTAÇÃO

Rafael Ghussn Cano

Combinatorial Optimization Problems in Cartographic Data

Problemas de Otimização Combinatória em Visualização de Dados Cartográficos

CAMPINAS 2016 Rafael Ghussn Cano

Combinatorial Optimization Problems in Cartographic

Problemas de Otimização Combinatória em Visualização de Dados Cartográficos

Tese apresentada ao Instituto de Computação da Universidade Estadual de Campinas como parte dos requisitos para a obtenção do título de Doutor em Ciência da Computação.

Dissertation presented to the Institute of of the University of Campinas in partial fulfillment of the requirements for the degree of Doctor in .

Supervisor/Orientador: Prof. Dr. Cid Carvalho de Souza Co-supervisor/Coorientador: Prof. Dr. Pedro Jussieu de Rezende

Este exemplar corresponde à versão final da Tese defendida por Rafael Ghussn Cano e orientada pelo Prof. Dr. Cid Carvalho de Souza.

CAMPINAS 2016 Agência(s) de fomento e nº(s) de processo(s): FAPESP, 2012/00673-2

Ficha catalográfica Universidade Estadual de Campinas Biblioteca do Instituto de Matemática, Estatística e Computação Científica Ana Regina Machado - CRB 8/5467

Cano, Rafael Ghussn, 1989- C165c CanCombinatorial optimization problems in cartographic data visualization / Rafael Ghussn Cano. – Campinas, SP : [s.n.], 2016.

CanOrientador: Cid Carvalho de Souza. CanCoorientador: Pedro Jussieu de Rezende. CanTese (doutorado) – Universidade Estadual de Campinas, Instituto de Computação.

Can1. Otimização combinatória. 2. Programação inteira. 3. Heurística computacional. 4. Visualização de informação. I. Souza, Cid Carvalho de,1963-. II. Rezende, Pedro Jussieu de,1955-. III. Universidade Estadual de Campinas. Instituto de Computação. IV. Título.

Informações para Biblioteca Digital

Título em outro idioma: Problemas de otimização combinatória em visualização de dados cartográficos Palavras-chave em inglês: Combinatorial optimization Integer programming Computer heuristics visualization Área de concentração: Ciência da Computação Titulação: Doutor em Ciência da Computação Banca examinadora: Cid Carvalho de Souza [Orientador] Yoshiko Wakabayashi Manoel Bezerra Campêlo Neto Carlile Campos Lavor Flávio Keidi Miyazawa Data de defesa: 12-12-2016 Programa de Pós-Graduação: Ciência da Computação

Powered by TCPDF (www.tcpdf.org) Universidade Estadual de Campinas Instituto de Computação INSTITUTO DE COMPUTAÇÃO

Rafael Ghussn Cano

Combinatorial Optimization Problems in Cartographic Data Visualization

Problemas de Otimização Combinatória em Visualização de Dados Cartográficos

Banca Examinadora:

Prof. Dr. Cid Carvalho de Souza • Instituto de Computação – UNICAMP

Profa. Dra. Yoshiko Wakabayashi • Instituto de Matemática e Estatística – USP

Prof. Dr. Manoel Bezerra Campêlo Neto • Departamento de Estatística e Matemática Aplicada – UFC

Prof. Dr. Carlile Campos Lavor • Instituto de Matemática, Estatística e Computação Científica – UNICAMP

Prof. Dr. Flávio Keidi Miyazawa • Instituto de Computação – UNICAMP

A ata da defesa com as respectivas assinaturas dos membros da banca encontra-se no processo de vida acadêmica do aluno.

Campinas, 12 de dezembro de 2016 Acknowledgements

I first want to thank my advisors, Cid de Souza and Pedro de Rezende. I am truly grateful to them for taking a chance on me when I was still an undergraduate student. I thank them for all their dedication, patience, commitment and friendship, which were decisive to the success of my doctorate. Many people were important, especially during the beginning of my studies as a grad- uate student. Special thanks go to Guilherme Kunigami, who was already a master’s student when I was still taking basic courses. I enjoyed working with him and learned a lot by observing his work (I actually learned C++ by reading his code!). I thank Tallys Yunes for his contributions to our projects. His comments and insights have certainly enriched our papers. I also thank Alex Grilo for developing the visualization tool that contributed to many of our theoretical results. I thank Bettina Speckmann and Kevin Buchin for welcoming me during my research internship at the Eindhoven University of Technology (TU/e). I really enjoyed my time there and learned a lot from the . Special thanks go to Sander Verdonschot, who promptly helped me whenever I needed something related to rectangular cartograms. I also thank Thom Castermans, Willem Sonke and Astrid Pieterse for the collaboration in the mosaic cartograms project. Their talent and dedication were crucial to the outcome of our papers. I also need to mention my colleagues, both from Campinas and from Eindhoven. I had many good moments with them, talking, laughing and traveling to conferences (and, eventually, even working). I especially thank my childhood friends, Yuri Isayama and Leonardo Oliveira. It is always great to meet and talk to you. Surely, that helped me to relax and to take my mind off research for a while. I am also deeply grateful to my family and I thank them (in Portuguese) for all they have done for me. Obrigado a meus pais, Jonizeli e Arlete, pelo amor, instrução e apoio em todos os aspectos da vida. A minha irmã, Ana Paula, por ser uma melhor amiga dentro de casa, e a minha tia Angel pelos ensinamentos e pelo incentivo. Vocês sempre serão modelos para mim. Agradeço também a minhas avós, Ana e Afife, e a meus tios. Para concluir, registro, ainda, uma nota de agradecimento ao papagaio Lorê, que consciente de minhas obrigações, sempre fez questão de me acordar cedo para o trabalho (inclusive aos finais de semana). Finally, I thank God for all the opportunities that I had in the past few years. None of this would be possible, if not for him. Resumo

Conjuntos de dados podem ser representados de muitas maneiras. Tabelas são, prova- velmente, a forma mais simples de apresentação e mostram-se úteis quando se deseja consultar valores associados a objetos específicos. No entanto, se o objetivo é identi- ficar relações entre diferentes objetos, outras formas de representação podem ser mais adequadas. Para este fim, uma visualização em forma esquemática através de imagens e diagramas pode, frequentemente, revelar novos aspectos dos dados. Isto ocorre espe- cialmente em se tratando de dados cartográficos, isto é, dados associados a regiões ou localizações geográficas. Nestes casos, visualizações apropriadas podem evidenciar rela- ções e padrões espaciais anteriormente desconhecidos, possibilitando uma análise mais aprofundada dos fenômenos observados. A construção manual de mapas necessita de cartógrafos experientes e consome muito tempo. Portanto, é interessante o desenvolvimento de algoritmos que permitam a automa- ção desta tarefa. Cada tipo de visualização apresenta restrições e métricas de qualidade específicas. Originam-se, então, diversos problemas de otimização combinatória, os quais são, com frequência, computacionalmente difíceis. Esta tese propõe-se a estudar alguns destes problemas. Foram considerados quatro tipos de visualização para dados cartográ- ficos: mapas de símbolos proporcionais, mapas rotacionáveis, cartogramas em mosaicos e cartogramas retangulares. Mapas de símbolos proporcionais representam dados através de símbolos opacos, que podem se sobrepor. O problema abordado consiste em determinar a ordem na qual os símbolos devem ser desenhados de forma a maximizar sua visibilidade de acordo com métricas estabelecidas na literatura. Nossas contribuições incluem um novo modelo de programação linear inteira e uma análise poliédrica do mesmo, um algoritmo de branch- and-cut com rotinas eficientes de separação de desigualdades e procedimentos de lifting. Mapas rotacionáveis são mapas que permitem ao usuário executar rotações. Nosso estudo teve como objetivo encontrar soluções ótimas para um problema de rotulação. Como em problemas tradicionais, deseja-se colocar rótulos textuais no mapa sem que ocorram sobreposições. Porém, conforme o mapa é rotacionado, todos os rótulos devem permanecer alinhados na direção horizontal, o que pode causar o surgimento de novos conflitos. Em nosso trabalho, provamos várias propriedades de soluções ótimas e mostra- mos como reduzir em centenas de vezes o número de variáveis e restrições de um modelo de programação linear inteira da literatura. Finalmente, cartogramas são mapas usados para representar dados estatísticos sobre regiões (e.g., estados ou países). Cada região tem seu tamanho alterado de forma que sua área seja proporcional ao dado que se deseja retratar. Nós propomos o primeiro algoritmo para construção de cartogramas em mosaicos. Além disso, expandimos um método existente de construção de cartogramas retangulares com uma heurística que cria as chamadas regiões de mar. Abstract

Data can be represented in various ways. Tables are likely to be the simplest form of presenting it. Still, they are useful when it is necessary to retrieve data values associated with specific objects. However, if one is interested in identifying relations between different objects, other forms of representation might be more suitable. To that end, a visualization in and can often reveal new aspects of the data. This is true especially for cartographic data, i.e., data that is associated with locations or regions of a . In these cases, appropriate visualizations can exhibit spatial patterns and relations that were previously unknown, enabling a deeper analysis of the observed phenomena. Manually constructing requires experienced cartographers and is extremely time- consuming. Therefore, there is a need for algorithms to automate this task. Each type of visualization has specific constraints and quality metrics. These give rise to several combinatorial optimization problems, which are, frequently, computationally hard. This thesis aims at studying some of these problems. We consider four types of visualizations for cartographic data: proportional symbol maps, rotating maps, mosaic cartograms and rectangular cartograms. Proportional symbol maps represent data through opaque symbols, that might overlap. The problem we address consists in determining the order in which the symbols must be drawn, such that their visibility is maximized according to established metrics. Our contributions include a novel integer linear programming model and an analysis of the associated polytope, a branch-and-cut with fast separation routines, and lifting procedures. Rotating maps are maps that allow the user to rotate the view. The goal of our study was to find optimal solutions to a labeling problem. Just as in classic problems, labels must be placed on the map without overlap. However, as the map is rotated, all labels must remain horizontally aligned, and this may cause new conflicts to arise. In our work, we prove several properties of optimal solutions and show how to reduce the number of variables and constraints of an existing integer programming model by up to two orders of magnitude. Finally, cartograms are maps used to depict statistical data about regions (e.g., states or countries). Each region is scaled in such a way that its area becomes proportional to the associated numerical value. We propose the first algorithm for the construction of mosaic cartograms. In addition, we extend an existing method to build rectangular cartograms with a heuristic that creates so-called sea regions. List of Figures

1.1 Proportional symbol maps showing protests in Brazil on June 20, 2013. . . 15 1.2 Label overlaps created by a 45◦ clockwise map rotation...... 15 1.3 Different types of cartograms showing average income in Brazil...... 16

2.1 Proportional symbol map showing the population of cities in Europe. . . . 21 2.2 Definitions for symbol maps problems...... 22 2.3 A drawing that is not physically realizable...... 23 2.4 A physically realizable drawing and a stacking drawing...... 23 2.5 An arrangement and its induced order graph GO...... 25 2.6 Computing the face-transitive closure of a cycle...... 27 2.7 Closed walk obtained in the proof of Proposition 2.1...... 29 2.8 Cycle obtained in the proof of Proposition 2.2...... 31 2.9 Necessity of Condition 1 in the proof of Theorem 2.9...... 33 2.10 Necessity of Condition 2 in the proof of Theorem 2.9...... 34 2.11 A non-degenerate vertex and four arcs incident to it...... 35 2.12 Maximal arcs and the selection of an initial set of inequalities...... 36 2.13 Separation routine for the physically realizable model...... 38 2.14 of the first lifting heuristic...... 39 2.15 Illustration of the second lifting heuristic...... 41

3.1 Rotations may create overlaps that previously did not exist...... 52 3.2 Variables and constraints in the original and reduced formulations...... 62

4.1 Different types of cartograms for the US election 2012...... 70 4.2 A simple mosaic drawing on a hexagonal tiling...... 73 4.3 Constructing simple mosaic drawings via orderly spanning trees...... 73 4.4 Mosaic drawings for the US based on different orderly spanning trees. . . . 75 4.5 Guiding shapes for Italy with 20, 28 and 40 tiles...... 75 4.6 The move and reshape algorithm...... 76 4.7 Direction of the repulsion forces...... 77 4.8 Minimum cost flow model for configuration size corrections...... 78 4.9 Cartograms of the population of Europe with different mosaic resolutions. . 80 4.10 Hexagonal cartograms of the area of the US...... 80 4.11 Cartograms showing businesses without paid employees in the US...... 83 4.12 US Starbucks locations in 2009...... 83

5.1 Rectangular cartogram showing the population of countries in Europe. . . 88 5.2 Rectangular dual with sea regions visible...... 89 5.3 Straight skeleton for South America...... 91 5.4 Branch of the skeleton that will not be erased...... 91 5.5 Number of sea regions required by each configuration...... 92 5.6 Pruned skeleton and a cartogram showing population in South America . . 93 5.7 Europe cell phone lines...... 93 List of Tables

2.1 Effectiveness of the 2-cycle inequalities based on maximal arcs...... 43 2.2 Impact of lifting on duality gaps at the root node...... 44 2.3 Comparison of models GOM, AM and AM++ for the Max-Total SDP. . . 45 2.4 Comparison of models GOM, AM and AM++ for the Max-Total PRDP. . 46 2.5 Comparison of models GOM, AM and AM++ for the Max-Min PRDP. . . 47 2.6 Summary of the results for all models and problem variants...... 47

3.1 Experimental results for the reduced model...... 62 3.2 Complementary experimental results for the reduced model...... 68

4.1 Computational results for different cartogram construction methods. . . . . 81 4.2 Relation between mosaic resolution and cartographic error...... 82 Contents

1 Introduction 13 1.1 Types of Visualizations ...... 14 1.2 Contributions ...... 17 1.3 Recommended Theoretical Background ...... 17 1.4 Structure of the Thesis ...... 18

2 Proportional Symbol Maps 20 2.1 Introduction ...... 21 2.1.1 Problem description ...... 21 2.1.2 Related work ...... 23 2.1.3 Our contribution ...... 24 2.2 Integer Linear Programming Model ...... 25 2.2.1 Inequalities for stacking drawings ...... 25 2.2.2 Inequalities for physically realizable drawings ...... 26 2.3 Polyhedral Study ...... 27 2.3.1 Relationship between AM-SD and GOM-SD ...... 28 2.3.2 Facet-defining cycle inequalities ...... 32 2.4 Initial set of inequalities ...... 35 2.5 Separation routines ...... 36 2.6 Lifting ...... 38 2.7 Computational experiments ...... 41 2.7.1 Implementation details ...... 42 2.7.2 Problem instances ...... 42 2.7.3 Numerical results ...... 42 2.8 Conclusion ...... 47 Additional Comments ...... 50

3 Rotating Maps 51 3.1 Introduction ...... 52 3.2 Model ...... 53 3.3 Properties of Optimal Solutions ...... 54 3.4 Implementation and Experiments ...... 60 Additional Proofs and Results ...... 65

4 Mosaic Cartograms 69 4.1 Introduction ...... 70 4.2 Related Work ...... 71 4.3 Mosaic Drawings ...... 72 4.4 Computing Mosaic Cartograms ...... 74 4.4.1 Compute mosaic drawing (GM ) ...... 74 4.4.2 Move and reshape configurationsDT ...... 74 4.4.3 Correct sizes of configurations ...... 78 4.5 Experimental Evaluation ...... 80 4.6 Discussion and Future Work ...... 83

5 Rectangular Cartograms 87 5.1 Introduction ...... 88 5.2 Algorithmic outline ...... 90 5.3 Sea partitioning ...... 90 5.4 Experimental results ...... 92 5.5 Conclusion ...... 93

6 Conclusion 96 Chapter 1

Introduction

Data plays a significant role in modern society. With the rapid expansion of the internet in the 1990s and the introduction of smartphones in the late 2000s, it became possible for the general public to access the most various types of data virtually anywhere and anytime. A number of mobile apps are targeted specifically at delivering data, such as real-time traffic or weather, and price tracking. All of this enables people to make informed decisions and optimize the outcome of their everyday choices. The that results can be optimized through the analysis of relevant data is by no means restricted to a personal . The jargon “data-driven”, often (over)used in business contexts, shows the importance given by corporations to integrating available data into their decision-making process. High-level athletes can also enhance their performance by studying their rivals’ data. The Germany men’s national football team uses two applications, one designed to provide general on the opponents’ players, and another focused on helping their goalkeepers during penalty shootouts [13]. The Brazil national volleyball teams (both men’s and women’s) have statisticians working to provide similar data [16, 17]. The same trend can be observed in other sports. Having all this data only makes sense if it can be understood by the target audience. Not surprisingly, comprehension by the users is highly dependent on the form of presen- tation of the data. Tables are likely to be the simplest way of presenting it. Still, they are useful when it is necessary to retrieve values associated with specific objects. However, if one is interested in identifying relations between different objects, other forms of repre- sentation might be more suitable. To that end, a schematic visualization in images and diagrams can often reveal new aspects of the data. This is true especially for cartographic data, i.e., data that is associated with locations or regions of a map. In these cases, appropriate visualizations can exhibit spatial patterns and relations that were previously unknown, enabling a deeper analysis of the observed phenomena. Data visualization is the field that studies effective ways to graphically represent data. It has two complementary aspects that need to be addressed by researchers. Firstly, it is necessary to determine what constitutes an effective display of data. Naturally, the final goal is to communicate the desired information to people. However, the process through which humans perceive and grasp visual information is complex and depends on many factors, that range from visual and cognitive skills to cultural and social backgrounds. Research related to these issues generally tries to identify features that should (or should

13 CHAPTER 1. INTRODUCTION 14 not) be present in each type of visualization. These can be evaluated, e.g., through different kinds of user studies. Secondly, data visualization has a technical aspect. Manually constructing visualiza- tions requires experienced graphic and is extremely time-consuming. Besides, this approach is unfeasible to deal with any data that is subject to changes over relatively short periods of time. Therefore, there is a need for algorithms to automate this task. The features previously identified in tests must be translated into constraints and quality metrics, which are specific to each type of visualization. These give rise to several (combinatorial) optimization problems, which are, frequently, computationally hard. This thesis addresses the technical aspect of data visualization. In particular, we restrict ourselves to visualizations of cartographic data, so our main object of study are maps. We consider optimization problems related to the construction of four types of visualizations. Although, in some cases, we deal with infinite domains, these can be discretized, turning a continuous problem into a combinatorial one.

1.1 Types of Visualizations

We consider four types of visualizations for cartographic data: proportional symbol maps, rotating maps, mosaic cartograms and rectangular cartograms. We now present each one of them and give an overview of the issues associated with their construction.

Proportional Symbol Maps In a proportional symbol map, information is depicted through symbols placed on desired locations. The area of each symbol is proportional to the numerical data associated with each location. Although any type of symbol can be used, simple geometric shapes are usually preferred, with disks being the most frequent. An example is shown in Figure 1.1. The maps show data on protests that took place in Brazil on June 20, 2013. Each disk represents the protest in a city, and sizes indicate the number of participants. The maps were created using APIs provided by CartoDB [1] and Google Maps [2]. Figure 1.1(a) was originally published by the Brazilian news website G1 [7]. Figure 1.1(b) shows another map based on the same data, but with the disks drawn in a different order. It is notable how many disks were completely concealed in the original map, omitting a lot of information from the users. In the given example, information loss was caused by overlaps between disks, which occur depending on their position and size. Interestingly, although (some) overlaps can be avoided by rescaling all symbols, it is not desirable to completely eliminate them. The is that the more separated two symbols are, the more difficult it is for the user to visually compare their sizes. Cartographers have studied issues related to symbol sizing, but it is unclear how much they should overlap [14, 20]. At the time when the map in Figure 1.1(a) was published, the available API [1] was set to simply draw the disks following the order specified in the input. In our work, we address the problem of determining a better ordering of the disks, such that visible information is maximized, according to metrics established in the literature. The map in Figure 1.1(b) was constructed with our algorithm, which is described in detail in Chapter 2. CHAPTER 1. INTRODUCTION 15

(a) (b)

Figure 1.1: Proportional symbol maps showing protests in Brazil on June 20, 2013. (a) Original map published by G1 [7]; (b) Improved map after drawing disks in a different order.

Rotating Maps One of the challenges currently faced by information visualization researchers is the of effective visualizations for interactive systems. Recent techno- logical advancements disseminated the use of navigation systems and digital maps, which permit the user to pan, zoom or rotate the view. Here, we address a labeling problem on rotating maps, i.e., on maps that allow for continuous rotations. Just as in several classic labeling problems, we are given a set of textual labels at fixed positions on an input map. Our goal is to display as many labels as possible, without letting any two of them overlap at any time. What distinguishes our variant of the problem is that, as the map is rotated, labels must remain horizontally aligned. However, as shown in Figure 1.2, rotations may cause labels that were previously disjoint to overlap.

Roraima Amap´a

Roraima Acre Amazonas Amazonas Par´a Cear´a Maranh˜ao Rio Grande do Norte Para´ıba Piau´ı Pernambuco Acre Alagoas Amap´a Tocantins Rondˆonia Rondˆonia Sergipe Par´a Mato Grosso Bahia

Goi´as Mato Grosso Minas Gerais Maranh˜ao Esp´ıritoSanto Mato Grosso do Sul Tocantins Piau´ı Cear´a S˜aoPaulo Rio de Janeiro Mato GrossoGoi´as do Sul Paran´a Rio Grande do Norte Bahia Para´ıba Santa Catarina Paran´a Minas Gerais S˜aoPaulo SergipeAlagoasPernambuco Rio Grande do Sul Rio GrandeSanta do Catarina Sul Esp´ıritoSanto Rio de Janeiro

Figure 1.2: Label overlaps created by a 45◦ clockwise map rotation. CHAPTER 1. INTRODUCTION 16

A solution to the problem in question consists in determining, for each label, a set of angular intervals during which it is visible. Naturally, two labels cannot be visible at the same rotation angle α if they overlap at α. Additionally, as observed by Been et al. [6], labels must not flicker on the screen, because this causes an unpleasant effect that may disturb or distract users. In order to avoid that, each label can appear and disappear only a limited number of times during a full map rotation. Finally, although the problem is, by nature, continuous, there exists a simple discretization described by Gemsa et al. [15]. Our results concerning rotating maps are reported in Chapter 3.

Mosaic and Rectangular Cartograms Cartograms are a type of map typically used to show statistical data on a set of regions, such as countries or states. Each region is scaled so that its area becomes proportional to the numerical data to be displayed. It is not mandatory that regions maintain their original shape. In , they can be represented by very simple shapes. Figure 1.3 shows three cartograms depicting average income in each Brazilian state in 2014 [18]. The ones in Figures 1.3(a) and 1.3(b) are called mosaic cartograms. Each region consists of a set of simple tiles from a regular grid (in our example, from hexagonal and orthogonal grids, respectively). The cartogram in Figure 1.3(c) represents all regions by rectangles and, hence, is known as a rectangular cartogram.

AP RR RN PA MA AM CE PI PB TO AC PE RO MT AL GO BA SE

MG ES MS RJ SP

PR

SC

RS (a) (b) (c)

Figure 1.3: Different types of cartograms showing average income in Brazil. In (a) and (b), each tile represents approximately R$ 30.00.

A good cartogram must be recognizable to its users. Therefore, it is important to in- corporate features that resemble the original map. A common requirement for both types of cartograms is that they must preserve adjacencies, i.e., two regions must be adjacent in the cartogram if and only if they are also adjacent in the original map. Moreover, the relative positions of the regions should be similar to those found in reality. In Figure 1.3, this was achieved by placing, e.g., Santa Catarina (SC) to the north of Rio Grande do Sul (RS), and Amazonas (AM) to the west of Pará (PA). Finally, in mosaic cartograms, tiles must be chosen in such a way that the shape of each region in the cartogram resembles the shape in the original map. CHAPTER 1. INTRODUCTION 17

Often, it is not possible to satisfy all of these requirements while still assigning the desired areas to the regions of a cartogram. Thus, it is generally necessary to make compromises between different quality criteria. Some methods privilege the area of the regions, to the detriment of adjacencies and relative positions. Others accept small errors in the areas in exchange for higher recognizability. Our methods fall into the second case. In our cartograms, we choose to enforce only correct adjacencies. Other requirements (namely, relative positions, region shapes and areas) are optimized in a best-effort manner. Our work with mosaic and rectangular cartograms is described in Chapters 4 and 5, respectively.

1.2 Contributions

The main contributions of this thesis are listed below, separated by type of visualization.

Proportional Symbol Maps We propose new integer programming formulations for three variants of a combinatorial optimization problem, two of which are NP-hard (the complexity of the third one is open). We also prove a number of facial properties regard- ing the polytopes associated with the given formulations. In addition, we describe fast separation routines and lifting procedures. Currently, our branch-and-cut algorithm is, to the best of our , the fastest available to construct provably optimal symbol maps.

Rotating Maps We address an NP-hard labeling problem and study an integer pro- gramming model from the literature. We prove a number of properties of optimal solutions and show how to use them to significantly reduce the size of that model. In many cases, we are able to remove over 98% of the original variables and constraints. This approach led to improvements of up to three orders of magnitude in running times.

Mosaic Cartograms We propose the first fully automated method to construct mosaic cartograms. Our method enforces correct adjacencies and is general enough to handle different types of grids.

Rectangular Cartograms We address the problem of creating so-called sea regions. Sea regions are artificial regions created during the construction of the cartogram to improve the outline of land masses and, consequently, the cartogram’s recognizability. We describe the first heuristic to solve this problem and show how to incorporate it into an existing construction method.

1.3 Recommended Theoretical Background

The problems we consider are, in essence, quite different. Consequently, the methodolo- gies employed to address each one of them are varied. As already indicated, cartograms CHAPTER 1. INTRODUCTION 18 have several quality criteria. Thus, their construction constitutes a multi-objective op- timization problem, which we address heuristically. Moreover, the heuristics we propose are crafted specifically for each type of cartogram, and their comprehension only requires a basic algorithmic background. In the case of rotating maps, our study is focused on particular properties of a labeling problem. All the necessary concepts and results are provided in the chapter devoted to this type of visualization. Our work with proportional symbol maps differs from the others in the sense that it requires a deeper understanding of the theory of integer linear programming and polyhe- dral . Most of our proofs rely on standard techniques and concern the study of facial properties of polyhedra. Unfamiliar readers are referred to [5, 19, 21]. Our main result consists of a proof involving projections of polyhedra. Projection is a powerful tool to compare different formulations for the same problem. Suppose one formulation is expressed in terms of variables (w, x) Rp Rq, whereas the other only ∈ × uses variables x Rq. Consider the polyhedron ∈ Q := (w, x) Rp Rq : Aw + Bx b . { ∈ × ≤ } The projection of Q onto the x- is defined as

q p Projx(Q) := x R : w R with (w, x) Q . { ∈ ∃ ∈ ∈ }

The most interesting property is that the linear relaxations of Q and Projx(Q) have the same value. Now that the first formulation is expressed only in terms of x, it can be compared to the second one. In our work, we prove that an integer programming formulation proposed by us is a projection of another one from the literature. We also show how to strengthen this formu- lation with lifting procedures. We, thus, conclude that by improving the new formulation with lifted inequalities, stronger bounds can be obtained. For more details on projections, we refer the reader to [3, 4].

1.4 Structure of the Thesis

This thesis is organized as a compilation of papers that were published or submitted to publication as part of the author’s doctoral program. Following the rules of the University of Campinas, all reproduced text is presented without modification, except for minor layout and formatting changes. Chapters 2–5, correspond to the selected papers. Each of them starts with a brief comment summarizing its contents and providing information on the vehicle of publication and co-authorship. These chapters also have their own bibliography section. Citations in other chapters refer to the global bibliography placed on the final pages of this document. Chapter 2 presents an article on proportional symbol maps published on Discrete Optimization [12]. Our work with rotating maps is described in Chapter 3, which cor- responds to text that was submitted to publication in an international conference. The text in Chapter 4 is a reproduction of a paper on mosaic cartograms presented at the 17th CHAPTER 1. INTRODUCTION 19

Eurographics/IEEE—VGTC Symposium on Visualization (EuroVis 2015) and published in a special issue of Computer Forum [11]. Chapter 5 contains a paper presented at the 30th European Workshop on Computational (EuroCG 2014) [8]. Finally, concluding remarks and directions for future work are given in Chapter 6. Chapter 2

Arc-Based Integer Programming Formulations for Three Variants of Proportional Symbol Maps

In this chapter, we present novel integer linear programming formulations for three vari- ants of a proportional symbol maps problem. Two of them are known to be NP-hard, whereas the complexity of the third is open. In our main theoretical result, we show that the new formulation is a projection of another one from the literature and, therefore, gives the same dual bounds. We also describe lifting procedures, which make the new formu- lation stronger than the previous. Additionally, since the new model has an exponential number of inequalities, we provide fast separation routines. We implemented a branch- and-cut algorithm and tested it on real-world instances. Computational results confirmed that the method is, indeed, the fastest currently available to construct (provably) optimal symbol maps. The text that follows is a reproduction of an article published on Discrete Optimiza- tion [12]. It is co-authored with Cid C. de Souza1, Pedro J. de Rezende1 and Tallys Yunes2. To avoid modifying the original text, some explanatory comments were included after the references. A preliminary version of this article was presented at the VII Latin- American Algorithms, Graphs and Optimization Symposium (LAGOS 2013). It appeared in the form of an extended abstract in a special issue of Electronic Notes in [9].

Abstract Proportional symbol maps are a cartographic tool that employs scaled symbols to represent data associated with specific locations. The symbols we consider are opaque disks, which may be partially covered by other overlapping disks. We address the problem of creating a suitable drawing of the disks that maximizes one of two quality metrics: the

1Institute of Computing, University of Campinas, Brazil. Supported by Conselho Nacional de Desen- volvimento Científico e Tecnológico (CNPq) #477692/2012-5, #311140/2014-9, #302804/2010-2, and Fundação de Amparo à Pesquisa do Estado de São Paulo (Fapesp) #2007/52015-0, #2012/00673-2. 2School of Business Administration, University of Miami, USA.

20 CHAPTER 2. PROPORTIONAL SYMBOL MAPS 21 total and the minimum visible length of disk boundaries. We study three variants of this problem, two of which are known to be NP-hard and another whose complexity is open. We propose novel integer programming formulations for each problem variant and test them on real-world instances with a branch-and-cut algorithm. When compared with state-of-the- models from the literature, our models significantly reduce computation times for most instances.

2.1 Introduction

Proportional symbol maps are a cartographic tool to visualize data associated with specific locations (e.g., earthquake magnitudes and city populations). Symbols whose area is proportional to the numerical values they represent are placed at the locations where those values were collected. Although symbols can be of any geometric shape, opaque disks are the most frequently used and, for that reason, the focus of our study. Figure 2.1 shows an example in which the area of each disk is proportional to the population of a city in central Europe.

Figure 2.1: Proportional symbol map showing the 300 largest cities in Germany, France, Belgium and the Netherlands.

Depending on the size and the position of the disks, some of them may be (partially) obscured. Although the literature contains studies on symbol sizing, it is unclear how much they should overlap (see [4, 12]). When large portions of a disk are covered, it is difficult to deduce its size and the location of its center. Therefore, the order in which the disks are drawn affects the amount and quality of information that can be inferred from a symbol map.

2.1.1 Problem description Let S be a set of n disks in the plane and be the arrangement formed by the boundaries A of the disks in S, as illustrated in Figure 2.2(a). An intersection point of the boundaries of two or more disks defines a vertex of . The portion of the boundary of a disk that A connects two vertices and contains no other vertices in between is called an arc. A maximal CHAPTER 2. PROPORTIONAL SYMBOL MAPS 22 connected region delimited by arcs with no vertices in its interior is a face of .A drawing A of S is a subset of the arcs and vertices of that is drawn on top of the filled interiors of A the disks in S. An example is shown in Figure 2.2(b).

v r f

(a) (b) (c)

Figure 2.2: (a) An arrangement with vertex v, arc r, and face f; (b) a drawing of the disks in ; (c) a drawing in whichA visible boundary is more important than visible area. A Cabello et al. [2] observed that the quality of a drawing depends on the visible bound- ary of the disks rather than on their visible area. As depicted in Figure 2.2(c), a disk that has no visible boundary transmits little or no information, because it is not possible to determine its size or the position of its center. Based on this remark, the authors considered two quality metrics: the minimum visible boundary length of any disk and the total visible boundary length over all disks. The Max-Min and Max-Total problems consist in maximizing the former and the latter values, respectively. Not every subset of the arcs and vertices of yields a suitable drawing for use in a A symbol map. Two types of drawings can be used, namely, physically realizable drawings and stacking drawings. A drawing is physically realizable if, for each face f of , there D A exists a (strict) total order on the disks that contain f such that the following conditions hold.

1. An arc r on the boundary of a disk d is visible in if and only if, for every disk j r D that contains r in its interior, d is above j (denoted interchangeably by d j or r r j d ). ≺ r 2. Total orders associated with distinct faces are consistent with each other, i.e., two disks i and j stand in the same relationship to each other in all total orders associated with faces that are contained in both i and j.

Informally, this definition states that a drawing is physically realizable if it can be con- structed from whole symbols, cut out from sheets of paper. The disks can be interleaved and warped, but cannot be cut. Figure 2.3 shows an example of a drawing that is not physically realizable. Since arcs a, b and c are visible, in order to satisfy Condition 1 we must have 1 2, 2 3 and 3 1. But any total order assigned to face f will contradict one of these relationships, precluding the satisfaction of Condition 2. It should be noted that physically realizable drawings do not necessarily exhibit a total order among all disks. This allows us to create drawings that have a somewhat cyclic structure, as the one shown in Figure 2.4(a). The imposition of the need for a CHAPTER 2. PROPORTIONAL SYMBOL MAPS 23

2 2

a f b 1 3 1 3 c

(a) (b)

Figure 2.3: (a) A drawing that is not physically realizable and (b) the underlying arrange- ment. total order results in the second type of drawings. Stacking drawings are a restriction of physically realizable drawings in which there exists a total order relation on S, i.e., they correspond to the disks being stacked up in layers, starting with the ones on the bottom layer. An example is given in Figure 2.4(b).

(a) (b)

Figure 2.4: (a) A physically realizable drawing that does not exhibit a total order (i.e., that is not a stacking drawing); (b) a stacking drawing.

We can now formally state our problem: given a set S of opaque disks, construct a physically realizable drawing or a stacking drawing of S that maximizes the Max-Min or the Max-Total metric. As in [8], we refer to the Physically Realizable Drawing Problem as PRDP and to the Stacking Drawing problem as SDP.

2.1.2 Related work Cabello et al. [2] are the first to study proportional symbol maps problems algorithmically. They identify and formally define the two types of drawings and the two quality metrics considered here. The authors prove that the PRDP is NP-hard for both objective func- tions. In addition, they describe a greedy algorithm to optimally solve the Max-Min SDP in O(n2 log n) time. Computational results reported in that work show that this algorithm also performs relatively well as a heuristic for the Max-Total SDP. Nevertheless, in gen- eral, it does not produce optimal solutions for the latter problem, whose computational complexity remains open. CHAPTER 2. PROPORTIONAL SYMBOL MAPS 24

Kunigami et al. [9] propose two integer linear programming models for the Max-Total SDP. The one that performs better, which is later referred to as Graph Orientation Model (GOM) [6], is extended in [8] to solve both versions of PRDP. They are the first to find provably optimal solutions for these three variants. The GOM model is based on two sets of binary variables: an arc variable x for each r R (to indicate whether r is visible r ∈ in the solution) and an auxiliary ordering variable w for each pair of disks i, j S (to ij ∈ indicate the relative order between i and j). The authors also introduce decomposition techniques that greatly contribute to reduce the size of input instances. Two other papers address the Max-Total SDP from different perspectives. Cano et al. [3] develop a GRASP heuristic, which is hybridized with path-relinking and variable neighborhood search. Both sequential and parallel implementations are described and experimentally evaluated. Additionally, a set of instances is presented that cannot be solved by either one of the models from [9]. In a more theoretical work, Nivasch et al. [11] provide bounds on the Max-Total value for stacking drawings of unit disks whose centers form a dense point set.

2.1.3 Our contribution In this work, we address the three problem variants to which no polynomial time algorithm is known, namely, the Max-Total SDP and PRDP, and the Max-Min PRDP. Our goal is to find provably optimal solutions in reasonable time via integer linear programming (ILP). As mentioned in Section 2.1.2, the GOM model is an extended formulation that 2 uses O(n ) auxiliary wij variables. In spite of having a polynomial number of constraints, the large number of extra variables increases the computation time needed to solve its linear relaxations. Therefore, lighter models are required to solve the more challenging instances, such as the ones from [3]. We propose a novel natural formulation, which is able to solve several instances that are beyond the capabilities of existing state-of-the-art exact algorithms. Since it uses only arc variables, we refer to it as Arc Model (AM). We prove that, for SDP, AM is a projection of GOM and, consequently, provides the same dual bounds. As it often happens with natural formulations, the new model has an exponential number of inequalities, so we also describe fast separation routines for both types of drawings. Thanks to the effectiveness of these routines and to the reduction in the number of variables, the linear relaxations of our model can be solved significantly faster. Moreover, it is relatively straightforward to strengthen inequalities of the new formu- lation by applying lifting procedures. This has a substantial impact on both the quality of the dual bounds and the number of nodes explored in the enumeration tree. This is an interesting development especially because none of the inequalities in the GOM model can be lifted; as shown in [8, 9], they are all facet-defining. To the best of our knowledge, the improved model is currently the strongest known in the literature to deal with symbol maps problems. Computational experiments show that it is up to 82 times faster than the GOM model for some benchmark instances. The remainder of the text is organized as follows. Section 2.2 describes the AM model and Section 2.3 contains some polyhedral results. In Section 2.4 we deal with the more CHAPTER 2. PROPORTIONAL SYMBOL MAPS 25 practical issue of selecting an initial set of inequalities to start solving the problem. Sep- aration routines and lifting procedures are presented in sections 2.5 and 2.6, respectively. Computational results for several real-world instances are reported in Section 2.7. Sec- tion 2.8 concludes the paper and gives some directions for future research.

2.2 Integer Linear Programming Model

The following notation will be used in the description of the model. Given a set of disks S and the associated arrangement , let R and F be the set of arcs and faces of . For A A each arc r R, we denote by ` the length of r and by d the disk in S whose boundary ∈ r r contains r. In addition, given an arc r (face f), let Sr (Sf ) denote the set of disks that contain arc r (face f) in their interior. For each arc r R, we define a binary variable x that is equal to 1 if r is visible in ∈ r the drawing, and equal to 0 otherwise. For the Max-Total problem, the objective is to P maximize r R `rxr. As in [8], for the Max-Min problem we must maximize an additional continuous variable∈ z, which is added to the model together with constraints (2.1). X z ` x , i S (2.1) ≤ r r ∀ ∈ r R : dr=i ∈ 2.2.1 Inequalities for stacking drawings We begin with the formulation for stacking drawings, which is conceptually simpler. Note that when an arc r is visible in a drawing, it induces an order among dr and every disk in Sr, i.e., dr must be drawn above every disk that contains r. To capture all of these relations, we define an induced order graph GO = (V (GO),E(GO)) as a directed multigraph with a vertex v V (G ) for each disk i S, and a directed edge e = (v , v ) i ∈ O ∈ rj dr j for each arc r R and disk j S . Each edge indicates the required relative order between ∈ ∈ r pairs of disks when some arc is visible. An example is shown in Fig. 2.5.

2 e e e c2 2 f3 eb2 ei1 en2 eg3 b r n ej1 em2 j q s f m es2 eg4 1 a F1 c F2 k 3 1 er2 eh4 3 p i g t eq2 ei4 h d l ec4 et3 eq1 ed4 es3 el4 o ep1 4 em4 4 (a) (b)

Figure 2.5: (a) An arrangement with four disks and (b) its graph GO.

Let be the set of all directed cycles in G . Given a cycle C , let R be the set C O ∈ C C of arcs that give rise to the edges of C, i.e., R = r : e C, for some j S . If all C { rj ∈ ∈ } the arcs in RC were simultaneously visible in a solution, they would induce a cyclic order CHAPTER 2. PROPORTIONAL SYMBOL MAPS 26 among the corresponding disks. But no (strict) total order may contain cycles, which implies that at least one arc from RC cannot be visible. Thus, (2.2) must be satisfied. X x C 1, C (2.2) r ≤ | | − ∀ ∈ C r RC ∈ It should be noted that (2.2) are not only necessary but also sufficient to model the SDP constraints. To see that, suppose we are given an optimal solution x∗ that satisfies (2.2). Let GO[x∗] denote the subgraph of GO obtained by deleting the edges erj for which xr = 0. Note that GO[x∗] is acyclic, otherwise x∗ would violate one of the inequalities (2.2). Therefore, we can run a topological sort on GO[x∗] and use the resulting order of the vertices as the stacking order in a drawing of the disks. An arc r will be visible in this drawing if and only if xr∗ = 1.

2.2.2 Inequalities for physically realizable drawings We now turn our attention to physically realizable drawings. Although some cycles are allowed, we still have to guarantee that total orders exist for the faces of and that they A are all consistent. In particular, this means that transitivity applies to (and only to) sets of disks that contain a common face. So, suppose we are given a set of arcs T R and ⊆ we want to decide whether they can be visible together in a physically realizable drawing. The most direct way of doing this is to start with the relative orders induced by the arcs in T and then to enforce transitivity whenever it is applicable. Any conflicts in the orders among the disks detected during this process are an indication that the arcs in T cannot be visible simultaneously. This motivates the main definition of this section.

Let us first introduce some notation. We denote by GO[X] the subgraph of GO induced by the set of objects X. For a set of vertices or edges, the standard definition applies. When X is a set of disks in S, G [X] is the subgraph induced by the vertices v : i X . O { i ∈ } Finally, when X is a set of arcs in R, GO[X] is the subgraph induced by the edges e : r X . { rj ∈ } Now, let HO = GO[T ], where T is the set of arcs mentioned previously. We define the face-transitive closure H∗ of H as its minimal supergraph such that for each face f F , O O ∈ HO∗ [Sf ] is transitively closed. The existence of a cycle in any subgraph HO∗ [Sf ] implies that, if the arcs in T are all visible, it is not possible to assign a total order to the disks that contain face f. In order to describe the model, we are interested in determining which cycles are allowed in physically realizable drawings. This way, we take H to be a cycle C O ∈ C and consider its face-transitive closure C∗. Following the previous discussion, the arcs in

RC can all be visible in a solution if and only if all subgraphs C∗[Sf ] are acyclic. Let b be the set of cycles that do not satisfy this condition. For PRDP, we must replace C ⊆ C inequalities (2.2) by (2.3). X xr C 1, C b (2.3) ≤ | | − ∀ ∈ C r RC ∈ CHAPTER 2. PROPORTIONAL SYMBOL MAPS 27

Next, we show how to compute the face-transitive closure of a graph. Although the algorithm is not required for actually solving real instances, it is the basis for the separa- tion routine that will be presented in Section 2.5. Initially, consider two faces f, f 0 F ∈ and suppose that S S . Note that H [S ] is an induced subgraph of H [S ]. Thus, f ⊂ f 0 O f O f 0 if the latter is transitively closed, so is the former. It follows that we only need to take a face f F into account if it is maximal with respect to this property, i.e., if there exists ∈ no other face f 0 such that S S . The face-transitive closure of H can be obtained f ⊂ f 0 O by repeatedly computing the transitive closure of the subgraphs HO[Sf ] for each maximal face f until all of them are transitively closed. Figure 2.6 illustrates the steps to compute the face-transitive closure of a cycle C formed by arcs b, f, l, and p from the arrangement in Figure 2.5(a). There are two maximal faces F1 and F2, and the algorithm must compute the transitive closure of

C[SF1 ] and C[SF2 ] until they are both transitively closed. The final result C∗ shows that C is not physically realizable. In particular, this means that all feasible solutions to that arrangement are stacking drawings.

C∗[SF1 ] C∗[SF2 ] C∗[SF1 ] C∗[SF2 ] eb2 2 ef3 eb2 2 ef3

1 3 1 3

ep1 4 el4 ep1 4 el4

(a) (b)

C∗[SF1 ] C∗[SF2 ] C∗[SF1 ] C∗[SF2 ] eb2 2 ef3 eb2 2 ef3

1 3 1 3

ep1 4 el4 ep1 4 el4

(c) (d)

Figure 2.6: (a) Cycle C formed by arcs b, f, l, and p from Figure 2.5(a); result after computing the transitive closures of (b) C[SF1 ] and (c) C[SF2 ]; (d) C∗ is completed after computing the transitive closure of C[SF1 ] for the last time.

2.3 Polyhedral Study

We now prove some polyhedral results. The following notation will be used. Given a model M, we denote by M-PRD and M-SD the specific variants designed to solve PRDP CHAPTER 2. PROPORTIONAL SYMBOL MAPS 28

and SDP, respectively. Also, let PM and PeM be the polyhedra defined by the convex hull of all integer feasible solutions of M and by the linear relaxation of M, respectively.

2.3.1 Relationship between AM-SD and GOM-SD In the main theorem of this section, we prove that AM-SD is a projection of GOM-SD. Several other facial results follow directly from that fact. For ease of reference, we start by reproducing the GOM-SD model. For each r R, let the binary variable x be equal ∈ r to 1 if r is visible in the drawing, and to 0 otherwise. Also, for every pair of distinct disks i, j S, let w be a binary variable that is equal to 1 if i is placed above j, and to 0 ∈ ij otherwise. The objective for each of the problem variants is the same as in AM. For SDP, the following constraints must be satisfied:

x w , r R, j S (2.4) r ≤ drj ∀ ∈ ∈ r w + w 1, i, j S, i < j (2.5) ij ji ≤ ∀ ∈ w + w w 1, i, j, k S, i = j = k = i. (2.6) ij jk − ik ≤ ∀ ∈ 6 6 6 We now present two auxiliary results that will be useful for proving our propositions.

Let D = (V,E) be a complete directed graph. We associate a binary variable wuv with each directed edge (u, v) E. The acyclic subgraph polytope [5], which we denote by PAC, ∈ is defined as the convex hull of the integer feasible points that satisfy inequalities (2.7): X w C 1, directed cycles C in D (2.7) uv ≤ | | − ∀ (u,v) C ∈

Similarly, the partial order polytope [10], which we denote by PPO, is defined as the convex hull of the integer feasible points that satisfy inequalities (2.8) and (2.9):

w + w 1, u, v V, u = v (2.8) uv vu ≤ ∀ ∈ 6 w + w w 1, t, u, v V, t = u = v = t (2.9) tu uv − tv ≤ ∀ ∈ 6 6 6

Proposition 2.1. Given w PeAC, there exists a vector w0 w such that w0 PeAC and ∈ ≥ ∈ w0 PePO. ∈

Proof. We show how to transform the initial vector w into another vector w0 that satisfies the conditions stated in the proposition. In particular, we will create a vector w0 that satisfies inequalities (2.8) at equality.

Initially, note that there can be no pair of vertices u and v such that wuv + wvu > 1, otherwise the inequality (2.7) associated with the cycle (u, v), (v, u) would be violated. { } Thus, w satisfies all inequalities (2.8). To guarantee that w0 w, we construct it by ≥ increasing the value of some elements of w. Let m be the number of inequalities (2.8) that are not satisfied at equality by w. We will show by induction on m that, given w PeAC, w0 can always be constructed in such a way that it also belongs to PeAC and ∈ satisfies (2.8) at equality. Inequalities (2.9) will be addressed later to show that w0 PePO. ∈ For m = 0, we can simply set w0 := w. For m > 0, there exist two vertices u CHAPTER 2. PROPORTIONAL SYMBOL MAPS 29

min and v such that wuv + wvu < 1. Among all cycles in D that contain (u, v), let Cuv be the one whose corresponding inequality (2.7) has the smallest slack, i.e., such that min P min s := C 1 min w is minimum. Analogously, let C be the cycle uv uv (k,l) Cuv kl vu | | − − ∈ min P that contains (v, u) with the smallest slack svu := Cvu 1 (k,l) Cmin wkl. Define | | − − ∈ vu δ := min s , 1 w w and δ := 1 w w δ . uv { uv − uv − vu} vu − uv − vu − uv Let wb be the vector obtained from w by adding δuv to wuv and δvu to wvu, i.e., w = w + δ , w = w + δ and w = w for all k, l = u, v . Note that buv uv uv bvu vu vu bkl kl { } 6 { } w +w = 1, so w still satisfies all inequalities (2.8); also, m 1 of them are not satisfied buv bvu b − at equality. Therefore, if we show that wb satisfies all inequalities (2.7), we can apply the induction hypothesis to wb and obtain the desired vector w0. Vectors w and wb differ only in wbuv and wbvu. Consequently, the only inequalities (2.7) that can be violated by wb are the ones that contain these variables. Due to our choice min min Cuv and Cvu , it suffices to show that both of those associated with these cycles are min satisfied by wb. Clearly, the one associated with Cuv remains satisfied, so suppose the min one for Cvu is violated. Algebraically, that means X X w = δ + w > Cmin 1 . bkl vu kl | vu | − (k,l) Cmin (k,l) Cmin ∈ vu ∈ vu The last inequality can be rewritten as δ > s 0, which implies δ = s (otherwise vu vu ≥ uv uv δvu would be 0). Since wuv + wvu + δuv + δvu = 1, we get:

wuv + wvu + suv + svu < 1 . (2.10)

Consider now the two paths π := Cmin (u, v) and π := Cmin (v, u) from v to u vu uv − uv vu − and from u to v, respectively. As shown in Figure 2.7, the union of these paths3 results in a closed walk, which may be decomposed into a set of one or more cycles. Each one Cwalk of them is associated with one cycle inequality (2.7) that must be satisfied by w (recall that w PeAC). Adding these inequalities yields: ∈ X X w + w Cmin + Cmin 2 . (2.11) kl kl ≤ | uv | | vu | − |Cwalk| − (k,l) πuv (k,l) πvu ∈ ∈

u

πvu πuv

v

Figure 2.7: Closed walk produced by the union of the paths πvu and πuv. These paths are not always vertex-disjoint, so π π need not be a cycle. vu ∪ uv 3See Comment 2.1. CHAPTER 2. PROPORTIONAL SYMBOL MAPS 30

But the left-hand side of inequality (2.11) may be rewritten as follows: X X wkl + wkl =

(k,l) πuv (k,l) πvu    ∈  ∈ X X  wkl +  wkl wuv wvu = − − (k,l) Cmin (k,l) Cmin ∈ uv ∈ vu Cmin + Cmin w w s s 2 . (2.12) | uv | | vu | − uv − vu − uv − vu − Using expression (2.12) together with inequality (2.10) and the fact that 1, |Cwalk| ≥ we conclude that inequality (2.11) cannot be satisfied. Therefore, there is at least one inequality (2.7) that is violated by w, contradicting our initial assumption that w PeAC. min ∈ Thus, the inequality associated with Cvu is also satisfied by wb and our induction proof is complete.

So far, we have proved that we may indeed construct w0 w such that w0 PeAC and ≥ ∈ w0 satisfies all inequalities (2.8) at equality. It remains to show that inequalities (2.9) are also satisfied by w0. Note that, since all inequalities (2.7) are satisfied by w0, for any three distinct vertices t, u, v V we must have w0 + w0 + w0 2. But w0 + w0 = 1, which ∈ tu uv vt ≤ tv vt leads to w0 + w0 w0 1, that is the desired inequality. tu uv − tv ≤

Proposition 2.2. PePO PeAC. ⊆

Proof. We must show that every point w PePO satisfies the cycle inequalities (2.7). ∈ Suppose that this is not true and let w PePO be a point that violates at least one cycle ∈ inequality. Let C be the shortest cycle in D whose corresponding inequality (2.7) is violated, i.e., such that X w > C 1 (2.13) kl | | − (k,l) C ∈ Note that, since all inequalities (2.8) are satisfied, C 3. Let t, u, v be three consecutive | | ≥ vertices in C. Since w PePO, we must have ∈ w + w w 1 . (2.14) tu uv − tv ≤

Consider now the cycle C0 obtained by taking all the edges of C, except for (t, u) and (u, v) that are replaced by (t, v), as shown in Figure 2.8. Using (2.13) and (2.14) we get: X w > C 1 + w w w C0 1 . (2.15) kl | | − tv − tu − uv ≥ | | − (k,l) C ∈ 0

This shows that the cycle inequality associated with C0 is also violated, which contradicts our initial assumption and completes the proof.

We can now prove the results stated in the main text. Given a polytope P , we denote its projection onto the x-space by Projx(P ). CHAPTER 2. PROPORTIONAL SYMBOL MAPS 31

u

t v

Figure 2.8: Cycle C0 obtained from C after replacing (t, u) and (u, v) by (t, v).

Theorem 2.3. The polyhedra PeAM SD and PAM SD are the projections of PeGOM SD and − − − PGOM SD onto the x-space, respectively. −

Proof. We begin by proving that PeAM SD = Projx(PeGOM SD). It suffices to show that − − x PeAM SD if and only if there exists a vector w such that (w, x) is a feasible point of ∈ − PeGOM SD. − Suppose x PeAM SD. We build a vector w such that (w, x) PeGOM SD as follows. ∈ − ∈ − For each pair of distinct disks i and j, let r be the arc with maximum xr among the ones that are in the boundary of i and also contained in the interior of j. Each of the inequalities (2.4) can be satisfied by setting wij to xr. If w violates any of the inequalities (2.7), there must also be an inequality (2.2) that is violated4. However, since x PeAM SD, we conclude that w PeAC. Finally, by Proposition 2.1, there exists w0 w ∈ − ∈ ≥ such that w0 belongs to PePO. Since w0 w, all inequalities (2.4) are still satisfied by ≥ (w0, x). Also, inequalities (2.5) and (2.6) must be satisfied, because w0 PePO. Thus, ∈ (w0, x) is a feasible point of PeGOM SD. − Conversely, suppose that x / PeAM SD. We assume that 0 x 1, otherwise the proof ∈ − ≤ ≤ is trivial. This implies that at least one of the inequalities (2.2) is violated. Let C be a cycle in GO such that the associated inequality (2.2) is not satisfied. In order to satisfy inequalities (2.4), for each arc x R , we must set w x for every disk j S . But r ∈ C drj ≥ r ∈ r this means that w must violate at least one of the inequalities (2.7). Therefore, there exists no w PeAC such that (w, x) satisfies inequalities (2.4). We then apply Proposition 2.2 ∈ and conclude that PeAM SD = Projx(PeGOM SD). − − R 5 Now, we note that Projx(PGOM SD) = PeAM SD Z| | and the equality PAM SD − − ∩ − = Projx(PGOM SD) follows. − We now use the following results due to Balas and Oosten [1]. Consider the polytope Q := (w, x) Rp Rq : Aw + Bx b . We partition the rows of (A, B, b) into = {= = ∈ × ≤ } (A ,B , b ) and (A≤,B≤, b≤), where the former represents the equality subsystem of Q. = Let F := (w, x) Q : αw + βx = β0 be a facet of Q. Also, define r∗ := rank(A ) and { α  ∈ } rF∗ = rank A= .

Theorem 2.4 (Balas and Oosten [1]). dim(Proj (Q)) = dim(Q) p + r∗ x − 4See Comment 2.2. 5See Comment 2.3. CHAPTER 2. PROPORTIONAL SYMBOL MAPS 32

Theorem 2.5 (Balas and Oosten [1]). Given a facet F of Q, Projx(F ) is a facet of

Projx(Q) if and only if rF∗ = r∗. Because the GOM models do not have an equality subsystem, A= is vacuous, so we have r∗ = 0 and rF∗ = rank(α). Thus, a facet of PeGOM SD projects into a facet of PeAM SD − − if and only if α = 0.

Proposition 2.6. The dimension of PAM SD is R . − | | Proof. As showed by Kunigami et al. [8], the dimension of the polytopes defined by the GOM models is S ( S 1) + R . We then use Theorem 2.4 and the result follows. | | | | − | | The inequalities in the next propositions have all been proved to be facet-defining for the GOM models by Kunigami et al. [8]. The results follow directly from this fact together with Theorem 2.5.

Proposition 2.7. Given an arc r R, the inequality x 0 always defines a facet of ∈ r ≥ PAM SD. The inequality xr 1 defines a facet if and only if Sr = . − ≤ ∅ Consider a pair of arcs r, s R that form a 2-cycle in G (i.e., such that d S ∈ O r ∈ s and d S ). For both SDP and PRDP, r and s cannot be visible simultaneously in a s ∈ r solution because either dr covers s or ds covers r. Let GR be an undirected graph with a vertex v for each arc r R and an edge v , v for each pair of arcs r and s that form r ∈ { r s} a 2-cycle in GO.

Proposition 2.8. Given a maximal clique K in GR, the inequality X x 1 r ≤ r : vr K ∈ defines a facet of PAM SD. − To conclude this section, it is not clear if the proof of Theorem 2.3 can be adapted for PRDP. To do that, we would have to guarantee that all cycles used in Proposition 2.1 are in b, which does not seem trivial. However, since PAM SD is full-dimensional and C − PAM SD PAM PRD, PAM PRD is also full-dimensional. Moreover, the inequalities in − ⊆ − − propositions 2.7 and 2.8 are also valid for PRDP and, therefore, define facets of PAM PRD. −

2.3.2 Facet-defining cycle inequalities Inequalities (2.2) and (2.3) are generally not facet-defining and lifting procedures to strengthen them are discussed in Section 2.6. In this section, we present necessary and sufficient conditions under which these inequalities are, indeed, facet-defining. The result is valid for both types of drawings.

Theorem 2.9. Consider a cycle C (resp. C b). The following conditions are ∈ C ∈ C necessary and sufficient for the cycle inequality associated to C to define a facet of PAM SD − (resp. PAM PRD): − CHAPTER 2. PROPORTIONAL SYMBOL MAPS 33

1. The subgraph GO[RC ] contains a single cycle from (resp. b); C C

2. For each arc s0 / R there exists an arc s R such that the subgraph G [R ∈ C ∈ C O C − s + s0 ] has no cycles from (resp. b). { } { } C C Proof. Necessity: Suppose condition 1 is not satisfied (see Figure 2.9 for an example).

Let C0 = C be another cycle from (resp. b) contained in GO[RC ]. Clearly, RC RC 6 C C 0 ⊆ and inequality (2.16) is valid. X x C0 1 (2.16) r ≤ | | − r R ∈ C0 Now, for each r R R , we add inequality x 1 to (2.16) to obtain ∈ C − C0 r ≤ X X x + x C0 1 + C C0 r r ≤ | | − | | − | | r R r RC R ∈ C0 ∈ − C0 which can be rewritten as X x C 1 . r ≤ | | − r RC ∈ The last inequality is precisely the one associated with cycle C. Since it was obtained by adding other valid inequalities, it cannot be facet-defining.

2 3 4 2 eb3 ec4 4 e 1 a b 5 ea2 d5 3 c d h 1 ec7 5 f g e eh1 7 ee6 8 8 eg8 ef7 6 7 6 (a) (b)

Figure 2.9: (a) An arrangement with a cycle C induced by arcs a–h; (b) the corre- ∈ C sponding graph GO[RC ] that satisfies condition 2 but not 1 for stacking drawings.

Suppose now that condition 2 is not satisfied for some arc s0 / R (see Figure 2.10 for ∈ C an example). This means that for every arc s R , G [R s + s0 ] contains a cycle ∈ C O C − { } { } from (resp. b). Note that to satisfy the cycle inequality associated with C at equality, C C C 1 arcs from R must be visible simultaneously. Thus, we conclude that equality will − C never be achieved if s0 is visible, which implies that the following inequality is valid: X x + x C 1 . s0 r ≤ | | − r RC ∈ The latter inequality is stronger than the original cycle inequality which, therefore, cannot be facet-defining. Sufficiency: Suppose that both conditions are satisfied. We will show that inequal- ity (2.17) defines a facet of PAM SD (resp. PAM PRD). − − CHAPTER 2. PROPORTIONAL SYMBOL MAPS 34

1 2 ea2 a 1 2 es′2 d s′ ed1 5 eb3 b ed5 c ec5 es′4 5 3 4 3 4 ec4 (a) (b)

Figure 2.10: (a) An arrangement with a cycle C induced by arcs a–d and another arc s0 / R ; (b) the corresponding graph G [R + s0 ]. Although G [R ] satisfies condition ∈ C O C { } O C 1, there exists no s RC such that GO[RC s + s0 ] satisfies condition 2 for either types of drawings. ∈ − { } { }

X x C 1 (2.17) r ≤ | | − r RC ∈ Consider inequality (2.18) and assume that it is valid for PAM SD (resp. PAM PRD). − − X α x α (2.18) r r ≤ 0 r R ∈

Let C and α be the faces of PAM SD (resp. PAM PRD) induced by (2.17) and (2.18), F F − − respectively. Suppose that . We will show that (2.18) is a multiple of (2.17) and, FC ⊆ Fα therefore, (2.17) is facet-defining. Note that, by condition 1, any subset of C 1 arcs from R can be visible simul- | | − C taneously in a solution. Thus, for each arc s R we may create a valid solution that ∈ C belongs to by assigning x = 1 for all r R s and x = 0 to all other variables. Fα r ∈ C − { } r Each of these solutions can be replaced in (2.18) and we obtain X αr = α0 . (2.19)

r RC s ∈ −{ } Adding all equations (2.19) for each s R yields: ∈ C X C α = | | α . (2.20) r ( C 1) 0 r RC ∈ | | − Now, for each s R , we subtract the corresponding equation (2.19) from (2.20) to obtain ∈ C α α = 0 , s ( C 1) | | − which is the desired value for the coefficients.

We are left to show that for every other s0 / R , α = 0. By condition 2, there ∈ C s0 exists an arc s R such that the subgraph G [R s + s0 ] has no cycles from ∈ C O C − { } { } C CHAPTER 2. PROPORTIONAL SYMBOL MAPS 35

(resp. b). A valid solution that belongs to α can be created by setting xr = 1 for all C F r R s + s0 and assigning zero to all other variables. We replace this new solution ∈ C −{ } { } in (2.18) and obtain X αr = α0 . (2.21)

r RC s + s ∈ −{ } { 0} We can finally combine (2.21) with equation (2.19) and the result follows.

2.4 Initial set of inequalities

Since there might be an exponential number of inequalities (2.2) and (2.3), it is necessary to select a subset of them to form the initial model that will be loaded into the ILP solver. In our implementation, we use those associated with 2-cycles, which only comprise a polynomial number of inequalities and are valid for both types of drawings. However, graph G is often quite dense and the number of 2-cycles is quadratic in R , yielding O | | O(n4) constraints. Thus, we cannot include them all because the model becomes too big. Note that the simple alternative of starting with an empty model has the same effect: all 2-cycle inequalities will be violated and added by our separation routines. We next describe a way to select a subset of these constraints that still provide good dual bounds. Our strategy is based on the following inequalities studied by Kunigami et al. [9]. Consider a non-degenerate vertex of the arrangement (i.e., one that is an intersection point of exactly two disks), as shown in Figure 2.11. Note that every disk that contains arc c must also contain arc a. Therefore, if a is visible in a drawing, so is c. By symmetry, the same observation holds for arcs b and d. This allows us to write the inequalities (2.22).

We remark that both polyhedra PAM SD and PAM PRD are monotone and, consequently, − − these inequalities are not valid in general. However, they must hold for any optimal solution and can be used to speed up the resolution of the models.

x x a ≤ c x x (2.22) b ≤ d

d c a b

Figure 2.11: A non-degenerate vertex and four arcs incident to it.

We now examine the two disks i and j shown in Figure 2.12 and the named arcs on their boundaries. Note that any pair formed by a named arc from i and another from j corresponds to a 2-cycle in GO, potentially leading to 49 inequalities. Nevertheless, CHAPTER 2. PROPORTIONAL SYMBOL MAPS 36 only the ones associated with arcs r and s need to be included in the model. Using constraints (2.22), we obtain:

x x x x , r ≥ r1 ≥ r3 ≥ r5 x x x x , r ≥ r2 ≥ r4 ≥ r6 x x x x , s ≥ s1 ≥ s3 ≥ s5 x x x x . s ≥ s2 ≥ s4 ≥ s6

i

r1 r r2 r3 r4 r5 r6

s6 s5 s4 s3 s2 s s1

j

Figure 2.12: Two disks i and j and seven arcs on the boundary of each one of them, which give rise to 49 2-cycles in GO.

Thus, including the inequality x + x 1 together with (2.22) we guarantee that all r s ≤ 48 other constraints will also be satisfied. We say that arcs r and s dominate arcs rk and s (k = 1, 2,..., 6), respectively, because in any feasible solution we must have x x k r ≥ rk and x x . We refer to arcs which are not dominated by any other (such as r and s) s ≥ sk as maximal arcs.

Each 2-cycle in GO corresponds to a 2-clique in GR (defined in Section 2.3). Therefore, using Proposition 2.8, we conclude that an inequality associated with one of these cycles defines a facet if and only if the corresponding clique K in graph GR is maximal. To take advantage of this fact, before inserting an inequality into the solver, we run a fast greedy procedure that iteratively increases K. This is done in two steps: initially, only maximal arcs are inserted in K; after this is no longer possible, all other arcs are allowed. The algorithm works by computing, at each iteration, the set VC of candidate vertices (i.e., those that are adjacent to every member of K). Then, it chooses the candidate that has the largest number of neighbors in VC , updates K, and continues until a maximal clique is obtained.

2.5 Separation routines

Let x∗ be the optimal solution to the linear relaxation of the arc model at some node in the branch-and-bound tree. For each type of drawing, the objective of the separation routine is to find a cycle C or C bsuch that the corresponding cycle inequality (2.2) ∈ C ∈ C CHAPTER 2. PROPORTIONAL SYMBOL MAPS 37 or (2.3) is violated, i.e., such that X x∗ > C 1 . (2.23) r | | − r RC ∈ Before we proceed, let us associate with each edge e E(G ) a weight w(e ) = rj ∈ O rj 1 x∗. Also, to simplify the notation, given a subgraph H of G , we define w(H ) := − r O O O P w e . We can rewrite (2.23) as (2.24). erj HO ( rj) ∈ w(C) < 1 (2.24)

For SDP, all cycles in GO lead to valid inequalities, so we simply need to find one that satisfies (2.24). The algorithm we use was first presented by Grötschel et al. [5] for the acyclic subgraph polytope. We can determine if such a cycle exists by using a shortest path algorithm. For each pair of vertices v , v V (G ), we compute a shortest path i j ∈ O from vi to vj and another from vj to vi. If the sum of the weights of the paths is less than one, we join them to obtain the required cycle. If no such pair of vertices exist, all cycle inequalities are satisfied. Thus, (2.2) can be separated in polynomial time. For PRDP, care must be taken to ensure that only cycles from b are prohibited. We C do this with a weighted version of the algorithm that computes face-transitive closures.

Recall that in the original procedure, given a subgraph HO of GO, we repeatedly compute the transitive closure of H [S ] for each maximal face f F . This is equivalent to the O f ∈ following: given two vertices v , v V (H ), if there is a path π from v to v in a i j ∈ O ij i j subgraph HO[Sf ], we must add an edge (vi, vj). For the separation routine, we do exactly the same, with the additional detail that the newly created edge is assigned a weight w(i, j) := w(πij). If the edge already exists, we need only update its weight, choosing the smallest value between the current w(i, j) and w(πij). This procedure is repeated until there are no more changes in the weights of the edges. It is not clear how many iterations might be necessary until this happens, so the computational complexity of this algorithm is open. Nevertheless, our experiments showed that it performs very well in practice.

We can determine that a cycle C is not physically realizable if some subgraph C[Sf ] has a cycle. Note that this implies that the transitive closure of C[Sf ] must also contain a 2-cycle, because the transitive closure of a cycle is a complete graph and at least a pair of reverse edges will occur. Similarly, in the separation routine, we can identify a violated inequality if there is a 2-cycle with weight less than 1. To recover the original set of arcs that gave rise to the cycle, we store, with each new edge (vi, vj), the set of arcs in the path πij that led us to create it. Naturally, this set must be updated whenever the weight of an edge changes. The procedure is illustrated in Figure 2.13. The arrangement of four disks is the same as in Figure 2.5(a). For the sake of clarity, this example only takes into account the arcs that give rise to the new inequality. Nevertheless, the actual algorithm must be applied to all arcs of the arrangement. The graph on the right shows the weights obtained after running the separation routine. We may take any 2-cycle to create a valid constraint, so for this example we choose the one between disks 2 and 4. Its weight is 0.6, so the associated inequality is indeed violated. Arcs f and l induce the path 2–3–4, which leads CHAPTER 2. PROPORTIONAL SYMBOL MAPS 38 us to create edge (2, 4). Likewise, edge (4, 2) was created due to arcs p and b. This yields the inequality x + x + x + x 3. b f l p ≤

2 C∗[SF1 ] C∗[SF2 ] xb = 0.7 xf = 1.0 0.32 0.0 b f 0.3 0.6 1 F1 F2 3 1 0.4 0.2 3 p 0.5 0.4 l xp = 0.9 xl = 0.8 0.1 4 0.2 4 (a) (b)

Figure 2.13: (a) An arrangement with four arcs b, f, l, and p, and the values of the associated variables; (b) the weighted graph obtained after running the separation routine for PRDP.

During the execution of the branch and cut algorithm, we often come across several inequalities that are satisfied with a very small slack. When this is the case, it is possible that these inequalities become violated after the execution of lifting procedures. To take advantage of this fact, we replace the right hand side of (2.23) by C 2 and modify the | | − separation routines so that they look for cycles of weight w(C) < 2. All inequalities found are subjected to lifting procedures (described in Section 2.6) and are added to the ILP solver only if they are violated. This strategy led to a significant improvement in both dual bounds and execution times.

2.6 Lifting

In this section, we present efficient methods to strengthen inequalities (2.2) and (2.3). The discussion that follows is applicable for both types of drawings. Consider a cycle C in G formed by a set of arcs R (as defined in Section 2.2.1). We assume that C O C ∈ C or C b depending on the problem variant being addressed, so the cycle inequality ∈ C P x C is valid. Let R R R be the set of candidates for lifting. A r RC r 1 l := C ∈ ≤ | | − − lifting procedure must compute, for each arc r R , a non-negative integral coefficient ∈ l αr, such that inequality (2.25) is satisfied by all feasible solutions x. X X x + α x C 1 (2.25) r r r ≤ | | − r RC r Rl ∈ ∈ Lifting procedures usually have two main concerns. Firstly, one wishes to make the coefficients as large as possible, so the resulting inequalities become stronger. However, computing the absolute best values is often a difficult problem. Secondly, there may be many different sets of coefficients that lead to strong inequalities. To deal with the first issue, we use two fast heuristics that guarantee the validity of the lifted inequalities but not the optimality of the coefficients. As for the second issue, we opt to speed up the CHAPTER 2. PROPORTIONAL SYMBOL MAPS 39 process by creating a single constraint for each cycle C. Our heuristics rely mainly on identifying pairs of arcs r, s R that form 2-cycles in G . Setting any of them visible ∈ O automatically forces the other one to be covered, so we say that r blocks s, and vice versa. The first heuristic is based on the following observation: if two arcs cannot be visible simultaneously, their coefficients can be determined independently. Therefore, we can compute each αr as if xr were the only lifted variable. More precisely, we want to assign a value to α such that r X α x + x C 1 (2.26) r r r0 ≤ | | − r RC 0∈ is satisfied by every feasible solution x. This clearly holds if xr = 0, so suppose xr = 1. r There must be at least αr + 1 arcs from RC covered in x. Let BC be the set of arcs in RC that are blocked by r. We can guarantee that inequality (2.26) is valid by setting α := Br 1. r | C | − After this is done for all arcs in Rl, we need to choose a subset of arcs such that at most one of them is visible in any solution. Recall that graph GR (defined in Section 2.3) has a vertex for each arc of the arrangement and its edges indicate pairs that block each other.

It follows that a clique in GR leads to a set of arcs with unrelated lifting coefficients. We then apply the greedy algorithm from Section 2.4 to find a clique K in GR, taking care to include a vertex vr only if αr > 0. Finally, we are able to generate the lifted inequality P x P α x C . r RC r + vr K r r 1 ∈ ∈ ≤ | | − The procedure is illustrated in Figure 2.14. Arcs a through d induce a cycle between disks 1–4, which are shown with solid boundary. The dashed disks 5 and 6 introduce two arcs e and f that block each other and, thus, have unrelated lifting coefficients. We have Be = b, c and Bf = a, c, d , which yields the valid lifted inequality x + x + x + x + C { } C { } a b c d x + 2x 3. e f ≤ 1 a

e b 4 f 2 5 d 6 c 3 Figure 2.14: A cycle formed by arcs a, b, c and d, and two other arcs e and f whose coefficients can be lifted with the first heuristic.

In the second heuristic, we try to lift the coefficients of arcs that do not necessarily block each other. Let us rewrite (2.25) as (2.27).

X X α x (1 x ) 1 (2.27) r r ≤ − r − r Rl r RC ∈ ∈ We start by showing how to assign values to each αr in such a way that the relaxed CHAPTER 2. PROPORTIONAL SYMBOL MAPS 40 inequality X X α x (1 x ) (2.28) r r ≤ − r r Rl r RC ∈ ∈ is satisfied by every feasible solution. Once this is done, a valid constraint can be obtained by decrementing the values of (some) coefficients. Two points should be noted about inequality (2.28). Firstly, the summation on its right-hand side is simply the number of arcs from RC that are hidden in a given solution x. Secondly, each visible arc r R contributes with α units to its left-hand side. Thus, ∈ l r to satisfy (2.28), each visible arc r R must be compensated by at least α covered arcs ∈ l r from RC . The main idea behind our heuristic is to select, for each r R , a set of arcs from R ∈ l C that are blocked by r (and, therefore, hidden whenever r is visible). We refer to this set r as the compensating set of r and denote it by MC . The value of each coefficient αr is then set to M r . If two lifting candidates can be visible simultaneously, their compensating | C | sets must be disjoint; otherwise, they may share some common elements. Next, we show that if this condition is obeyed, our choice of coefficients guarantees that (2.28) holds for all feasible solutions. Initially, observe that if an arc r R is visible, at least the arcs in M r must be ∈ l C covered. Hence, inequality (2.29) is always satisfied. [ X M r (1 x ) (2.29) C ≤ − r r Rl r RC x∈r=1 ∈

We now analyze the left-hand side of (2.29). Since we assume that the preceding condition is obeyed, all sets in the union are disjoint. This allows us to write [ X M r = M r . C | C | r Rl r Rl x∈r=1 x∈r=1

But the last summation just adds the coefficients of visible arcs. Thus, it is equal to P α x and the result follows. r Rl r r ∈So far we are able to satisfy only (2.28) but not (2.27). A straightforward solution would be to decrement all positive coefficients by one. However, it is possible to do better than this. If we can make sure that equality never occurs in (2.29), inequality (2.27) will r be automatically satisfied. One way to do this is to prohibit one arc from each BC from being included in any compensating set. This way, each time arc r is visible, there is at least one hidden arc that is not accounted for in the left-hand side of (2.29). More precisely, we want to select a set of arcs H R such that H Br = for all r R . C ⊆ C C ∩ C 6 ∅ ∈ l This is simply the statement of a hitting set problem.

We are now able to describe our algorithm. We first select the arcs r Rl such that r ∈ BC 2. There is no need to consider the others because our heuristic cannot assign a | | ≥ r positive coefficient to any of them. We then construct the set BC for each selected arc r. A hitting set HC is found using a greedy heuristic that selects, at each stage, the element that is contained in the largest number of sets that have not yet been hit. We make HC CHAPTER 2. PROPORTIONAL SYMBOL MAPS 41 minimal by excluding unnecessary elements. s Next, we start building the compensating sets. Given an arc s RC HC , let Bl ∈ −s denote the set of arcs from Rl that block s. We need to choose an arc from Bl and insert s into its compensating set. We wish to create an inequality with a large violation, so our strategy is to select the arc r with largest xr. Recall that we are allowed to insert s in more than one compensating set as long as the associated arcs cannot be visible together s in a feasible solution. So, instead of picking a single arc from Bl , we select a set of arcs such that any two of them block each other. Again, such a set of arcs corresponds to a clique in graph GR and we can compute it the same way we did in the first heuristic. Finally, we generate the lifted inequality P x + P M r x C 1. r RC r r Rl C r ∈ ∈ | | ≤ | | − The procedure is depicted in Figure 2.15. Arcs a through d induce a cycle between disks 1–4, which are shown with solid boundary. The dashed disks 5, 6 and 7 introduce three e f arcs e, f and g whose coefficients we want to lift. We have BC = a, b, c , BC = c, d and g { } { } BC = b, c . Thus, a possible hitting set is HC = c . For the remaining arcs, we have a { } b d { } Bl = e , Bl = e, g and Bl = f . We can now create the compensating sets. Arcs a { } { } e{ } f and d can only be inserted in MC and MC , respectively. Arc b can be inserted in either e g MC or MC , but not both because e and g do not block each other. For this example, we choose to insert it into M g . Finally, the compensating sets are M e = a , M f = d and C C { } C { } M g = b , which results in the lifted inequality x + x + x + x + x + x + x 3. C { } a b c d e f g ≤ 6 1 a 4 f 7 b e g 2 d c

5 3

Figure 2.15: A cycle formed by arcs a, b, c and d, and three other arcs e, f and g whose coefficients can be lifted with the second heuristic.

As we show in Section 2.7, these lifting heuristics contribute a great deal to improving the dual bounds generated by our formulations. Although no guarantees are given in general as for the dimension of the faces induced by the lifted inequalities, it can be easily shown that those obtained for figures 2.14 and 2.15 are, indeed, facet-defining (the proof is omitted for the sake of brevity).

2.7 Computational experiments

We assess the effectiveness of our solution approach through a series of computational experiments with 60 real-world instances. Firstly, we evaluate the performance of our strategy to select the initial set of inequalities. Secondly, we measure the impact of lifting CHAPTER 2. PROPORTIONAL SYMBOL MAPS 42 on both the dual bounds and the total running times. Finally, we compare models AM and GOM for the three problem variants addressed in this paper. For the sake of brevity, the tables show the results for the most challenging instances. Our complete set of instances is available in our web page [7].

2.7.1 Implementation details

The procedures were implemented in C++ and compiled with GCC 4.4.3. We build the arrangements with CGAL 4.0 using exact arithmetic. The ILPs are solved with CPLEX 12.4. We apply a branch-and-cut algorithm and use the conventional search supplied by CPLEX. We limit the time spent by the solver to at most five hours per component. The experiments were run on an Intel Xeon X3430, 2.40GHz CPU with 8GB RAM. All instances are decomposed in a preprocessing phase with the techniques from [8]. We solve all components and then recombine them to create an optimal solution for the whole instance. For the Max-Total variants, solution values and gaps are calculated disregarding arcs that are visible in every feasible drawing. Primal solutions for the Max- Total and the Max-Min problems are generated with the GRASP heuristic from [3] and with the greedy algorithm from [2], respectively. As observed by Kunigami et al. [8], it is sometimes possible to bypass the resolution of integer programs when solving the Max-Min PRDP. If an instance (or a component thereof) has a face that is contained in every disk, all physically realizable solutions must also be stacking drawings. This allows us to use the polynomial time algorithm from Cabello et al. [2]. Besides that, not all components need to be solved optimally. We just need an optimal solution to the one that determines the Max-Min value. For the others, it often suffices to find a good heuristic solution, which can once again be done with the algorithm from [2].

2.7.2 Problem instances We test our model on three sets of instances. The first set was presented by Cabello et al. [2] and contains four instances: City 156 and City 538, which represent the 156 and 538 largest American cities, respectively; and Deaths and Magnitudes, which represent the death count and the Richter scale magnitude of 602 earthquakes worldwide, respectively. The two other sets were used in [3, 8] and contain 28 instances each. They were generated from data on the population of cities from several countries. We refer to them as Population-S1 and Population-S2. They are both based on the same data, but with different proportionality constants between the area of the disks and the numerical values they represent. The instances in Population-S2 are scaled in such a way that the area of each disk is twice as large as that in the analogous instance from Population-S1.

2.7.3 Numerical results We first address the issue of selecting the initial set of inequalities that are loaded into the ILP solver. We compare the technique based on maximal arcs with the alternative of using all 2-cycle inequalities. We remark that, as mentioned in Section 2.4, the latter is CHAPTER 2. PROPORTIONAL SYMBOL MAPS 43 similar to starting with an empty model. It should also be noted that the techniques are the same for both stacking and physically realizable drawings. For this reason, it is not necessary to show the results for each problem variant. In the text that follows, duality gaps are calculated with respect to Max-Total SDP optimal values. 2.1 shows the results obtained after solving the linear relaxation of the initial set of inequalities. For each instance, we report the number of disks and arcs, the duality gap, the number of inequalities in the linear program and the time spent solving the relaxation. Columns All and Max refer to the model with all 2-cycle inequalities and to the reduced one based on maximal arcs, respectively. We also present the ratios between the results of the two alternatives.

% Gaps Number of Inequalities Relaxation times Instance S R | | | | All Max. All Max. Ratio All Max. Ratio City 538 538 7,516 0.26% 0.87% 870,660 54,037 16.1 9,878 68 145.3 Magnitudes 602 13,289 0.13% 0.79% 597,763 47,520 12.6 98 4 24.5 Brazil-S1 150 2,568 0.00% 0.47% 147,597 9,975 14.8 54 1 54.0 France-S1 135 3,230 0.55% 2.57% 735,188 24,256 30.3 4,226 17 248.6 Greece-S1 102 3,482 0.87% 4.85% 694,198 27,412 25.3 5,341 19 281.1 Italy-S1 300 4,366 0.00% 0.35% 246,154 20,036 12.3 206 4 51.5 Japan-S1 150 3,544 0.00% 0.79% 269,272 18,101 14.9 231 4 57.8 Portugal-S1 150 5,070 0.01% 0.72% 636,866 36,380 17.5 1,691 21 80.5 USA(West)-S1 87 3,717 0.00% 0.84% 559,128 27,880 20.1 2,992 20 149.6 Brazil-S2 150 3,294 0.02% 0.20% 265,447 13,697 19.4 97 2 48.5 France-S2 135 3,354 0.77% 1.32% 769,642 21,661 35.5 >5h 14 >1,285.7 Germany-S2 150 3,299 0.00% 0.32% 241,062 21,506 11.2 276 10 27.6 Greece-S2 102 3,335 0.17% 3.67% 587,597 21,048 27.9 4,140 12 345.0 Italy-S2 300 6,725 0.04% 0.30% 580,512 34,109 17.0 962 14 68.7 Japan-S2 150 4,954 0.00% 0.23% 592,618 36,592 16.2 3,520 29 121.4 Poland-S2 300 4,736 0.01% 0.21% 293,886 25,358 11.6 372 8 46.5 Portugal-S2 150 6,656 0.00% 0.15% 1,306,159 55,218 23.7 9,083 56 162.2 Spain-S2 300 6,497 0.06% 0.58% 297,607 25,093 11.9 82 3 27.3 Switzerland-S2 186 4,945 0.04% 0.61% 259,127 24,870 10.4 553 12 46.1 USA(West)-S2 87 4,465 0.00% 0.88% 871,332 33,588 25.9 4,698 32 146.8

Table 2.1: Results for the initial linear relaxation using the model with all 2-cycle in- equalities and the reduced one based on maximal arcs. Times are given in seconds.

Using the reduced set of constraints increased the duality gaps by only 0.60% on average. The largest increase occurred for instance Greece-S1 and, still, it was less than 4.00%. On average, the reduced model has 8.5 times fewer inequalities and the relaxation is solved 23.2 times faster. The most remarkable reduction occurs for instance France-S2, which runs more than 1285 times faster with an increase of only 0.55% in the duality gap. Due to the effectiveness of this strategy, all experiments that follow use this reduced set of inequalities. In the next experiment, we evaluate the impact of lifting on the dual bounds produced by our model. For each instance, we solve the root node of the branch-and-bound tree, which involves solving a linear relaxation and then executing our separation routines. CHAPTER 2. PROPORTIONAL SYMBOL MAPS 44

This procedure is repeated until no more violated inequalities are found. Automatic cut generation routines were disabled during this experiment. The results are shown in Table 2.2. The original arc model is denoted by AM, whereas the improved formulation obtained after the inclusion of lifting is denoted by AM++. We report the duality gaps after solving the root node of the enumeration tree.

Max-Total SDP Max-Total PRDP Max-Min PRDP Instance S R | | | | GOM/AM AM++ AM AM++ AM AM++ City 538 538 7,516 0.57% 0.02% 0.56% 0.02% 60.18% 59.20% Magnitudes 602 13,289 0.59% 0.04% 0.59% 0.05% 109.42% 107.17% Egypt-S1 98 2,033 0.95% 0.04% 0.95% 0.11% 62.51% 60.95% France-S1 135 3,230 2.40% 0.00% 2.40% 0.00% 83.77% 75.45% Greece-S1 102 3,482 3.81% 0.00% 3.81% 0.00% 81.91% 74.21% Italy-S1 300 4,366 0.23% 0.01% 0.23% 0.01% 58.15% 55.72% Japan-S1 150 3,544 0.24% 0.00% 0.24% 0.00% 71.10% 68.44% Portugal-S1 150 5,070 0.60% 0.00% 0.60% 0.00% 49.22% 46.90% USA(West)-S1 87 3,717 0.38% 0.00% 0.38% 0.00% 50.63% 47.30% Canada-S2 150 2,790 0.57% 0.05% 0.57% 0.05% 35.36% 34.57% France-S2 135 3,354 1.08% 0.01% 1.08% 0.01% 97.60% 87.39% Greece-S2 102 3,335 2.99% 0.00% 2.99% 0.00% 86.20% 80.59% Israel-S2 150 4,222 1.03% 0.26% 1.03% 0.25% 44.48% 44.48% Italy-S2 300 6,725 0.15% 0.06% 0.21% 0.12% 75.57% 70.82% Poland-S2 300 4,736 0.11% 0.02% 0.11% 0.01% 45.75% 14.59% Russia-S2 150 3,145 0.36% 0.02% 0.36% 0.02% 39.49% 0.00% Switzerland-S2 186 4,945 0.45% 0.00% 0.45% 0.00% 67.54% 64.52%

Table 2.2: Duality gaps after solving the root node of the branch-and-bound tree with and without lifting.

The results show that the behavior for both Max-Total problems is very similar. Al- though AM leaves a small gap, it can still lead to a relatively costly branching. The addition of lifting makes all gaps drop to less than 0.26% and 18 instances that would otherwise need branching can be be optimally solved at the root node. As for the Max- Min PRDP, due to the need of a continuous variable to model the objective function, duality gaps are significantly larger. Nevertheless, the lifting procedures are still able to reduce the gaps for many instances. In the final experiment, we run models GOM, AM and AM++ on all instances for the three problem variants. We enable automatic cut generation routines to evaluate the performance of the models in conjunction with the most advanced features provided by the solver. The results are shown in tables 2.3, 2.4 and 2.5. Optimal values are given in column Opt. For each model, we report the total running time (in seconds), the number of cuts NC added by our separation routines and the number of nodes NN solved in the branch-and-bound tree. Some preliminary tests indicated that the GOM model also benefits from the inclusion of the initial set of inequalities described in this work. To establish a fair comparison between the models, the results that follow incorporate these improvements. To further analyze the speedup enabled by each model, Table 2.6 shows, for each pair CHAPTER 2. PROPORTIONAL SYMBOL MAPS 45

GOM AM AM++ Instance S R Opt. | | | | Time NN Time NC NN Time NC NN City 538 538 7516 503.27 15725 612 3851 4194 336 332 2753 1 Magnitudes 602 13289 12174.09 315 126 42 298 25 22 991 1 France-S1 135 3230 964.07 5039 276 435 596 50 61 1531 1 Greece-S1 102 3482 1102.55 5755 244 495 885 68 70 2361 1 Japan-S1 150 3544 1911.18 249 20 17 479 1 12 896 1 Portugal-S1 150 5070 1707.01 304 12 39 122 12 29 425 1 USA(West)-S1 87 3717 1290.14 709 34 124 416 4 37 694 1 Denmark-S2 310 3942 4289.57 120 32 30 1033 10 13 1433 1 Egypt-S2 98 3043 2316.98 208 10 39 312 3 17 834 1 France-S2 135 3354 1821.45 1618 50 177 311 16 39 1177 1 Greece-S2 102 3335 1806.11 3024 285 418 891 195 43 1927 1 Israel-S2 150 4222 2935.95 299 91 30 420 4 16 1276 1 Italy-S2 300 6725 4775.34 262 8 53 433 18 37 1041 1 Japan-S2 150 4954 3096.87 362 1 52 223 1 50 839 1 Norway-S2 150 2881 2090.14 144 49 36 1828 43 15 2840 1 Poland-S2 300 4736 9045.2 157 1 27 968 1 22 4518 1 Portugal-S2 150 6656 2727.82 577 1 72 56 1 70 321 1 Switzerland-S2 186 4945 5818.56 545 28 48 141 1 27 514 1 USA(East)-S2 150 4524 3508.58 119 20 6 206 1 6 584 1 USA(West)-S2 87 4465 1953.22 506 1 67 847 1 57 992 1

Table 2.3: Comparison of models GOM, AM and AM++ for the Max-Total SDP. Times are given in seconds. of models, the average, maximum and minimum ratio of their running times. To focus on the hardest instances, the results disregard those that can be solved in less than 10 seconds by both models. Average values are computed as the geometric mean of the running time ratios. For both Max-Total variants, the results show that AM performs better than GOM for all instances. The reduction in the number of variables compensates for the exponen- tial number of inequalities and the arc-based formulation achieves a (geometric) average speedup of 5.9 and 6.0 for the SDP and PRDP variants, respectively. The addition of lifting allows AM++ to run 1.9 times faster than AM for both types of drawings. Be- sides, all but two instances are solved in the root node of the branch-and-bound tree. The greatest improvements occurred for instances France-S1 and Greece-S1, for which AM++ is over 82 times faster than GOM for SDP. It is interesting to note that, as shown in Table 2.2, AM is never able to completely solve the problem on the root node of the search tree. However, in this experiment, this was possible due to the inclusion of automatic cut generation routines. Nevertheless, it can be seen in tables 2.3 and 2.4 that even when the number of nodes is one for both AM and AM++, the latter is still faster. This happens because our specialized lifting procedures are more effective than the generic cuts added by the solver. As for the Max-Min PRDP, the arc models also perform better, though not as much as in the other variants. Models AM and AM++ achieve faster running times than GOM CHAPTER 2. PROPORTIONAL SYMBOL MAPS 46

GOM AM AM++ Instance S R Opt. | | | | Time NN Time NC NN Time NC NN City 538 538 7516 503.27 15378 538 2326 4882 377 260 3984 1 Magnitudes 602 13289 12174.09 439 315 42 654 12 24 1482 1 France-S1 135 3230 964.07 5034 276 369 954 50 63 2722 1 Greece-S1 102 3482 1102.55 5475 290 546 1488 100 70 3028 1 Japan-S1 150 3544 1911.18 219 10 17 642 1 12 818 1 Portugal-S1 150 5070 1707.01 306 24 40 224 28 29 544 1 USA(West)-S1 87 3717 1290.14 709 34 123 556 4 37 804 1 Canada-S2 150 2790 2922.57 108 37 9 360 8 6 756 1 France-S2 135 3354 1821.45 1366 22 142 436 14 39 1858 1 Germany-S2 150 3299 2894.92 151 4 18 258 1 18 616 1 Greece-S2 102 3335 1806.11 2877 285 221 688 138 43 2678 1 Israel-S2 150 4222 2935.95 402 94 32 440 8 16 988 1 Italy-S2 300 6725 4775.34 259 16 40 444 1 34 986 1 Japan-S2 150 4954 3096.87 340 1 53 340 1 50 1118 1 Norway-S2 150 2881 2090.16 153 44 21 382 8 9 804 1 Poland-S2 300 4736 9045.2 117 1 23 314 1 21 476 1 Portugal-S2 150 6656 2727.82 542 1 72 100 1 70 366 1 Switzerland-S2 186 4945 5818.56 630 32 61 220 1 26 640 1 USA(East)-S2 150 4524 3508.58 97 10 7 226 1 7 534 1 USA(West)-S2 87 4465 1953.22 512 1 63 660 1 58 1208 1

Table 2.4: Comparison of models GOM, AM and AM++ for the Max-Total PRDP. Times are given in seconds. in 48 and 47 instances out of 60, respectively. On average, AM is 1.99 times faster than GOM and AM++ is 1.04 times faster than AM. This shows that using lifted inequalities is not always worthwhile. The reason is that the dual bounds for this version of the problem are a lot weaker than the ones for the Max-Total variants. As a consequence, the algorithm is highly dependent on branching and many linear relaxations must be solved. Since lifting increases the number of non-zeros in the ILP matrix, it might be better to use the weaker but sparser AM model. A single instance (Switzerland-S2) could not be solved by any of the models within the imposed time limit. The optimal value shown in Table 2.5 was verified after almost 54 hours of computation with the AM model, which is the one that presented the best prospects after the initial five hours. For the three problem variants, the number of cuts added by our separation routines range from a couple of hundreds to a few thousands. A comparison with the initial number of inequalities reported in Table 2.1 indicates that the size of the models is not significantly affected by the inclusion of these constraints. For most instances, AM++ adds considerably more cuts than AM. This behavior is expected because, as explained in Section 2.5, our lifting heuristics are applied not only to violated inequalities (2.2) and (2.3), but also to those that are satisfied with a small slack. CHAPTER 2. PROPORTIONAL SYMBOL MAPS 47

GOM AM AM++ Instance S R Opt. | | | | Time NN Time NC NN Time NC NN City 538 538 7516 0.76 6929 449 1607 1066 1437 1469 1148 1028 Egypt-S1 98 2033 9.44 184 705 971 180 18584 923 460 7854 France-S1 135 3230 6.45 >5h 13,488 3319 400 18120 1507 2932 8382 Greece-S1 102 3482 8.88 >5h 466 15722 478 54531 3754 3092 12490 Italy-S1 300 4366 6.18 1890 1021 1662 154 9120 450 956 1782 Japan-S1 150 3544 8.73 2216 1091 403 518 799 672 958 2873 Switzerland-S1 186 3047 15.94 1170 1901 242 80 1944 1223 352 10809 USA(West)-S1 87 3717 9.31 >5h 715 678 360 756 3463 1262 2498 Brazil-S2 150 3294 15.82 473 44 35 256 18 45 590 48 Canada-S2 150 2790 10.68 131 27 11 256 1 11 374 1 Egypt-S2 98 3043 13.92 943 458 2099 588 3155 1788 676 3710 France-S2 135 3354 8.34 >5h 3,897 7286 682 12208 912 3766 1107 Germany-S2 150 3299 12.36 5144 2900 13088 878 49253 >5h 1746 56,016 Greece-S2 102 3335 11.75 4314 11942 970 556 2735 >5h 2116 144,981 Indonesia-S2 150 3478 8.43 663 1284 2498 422 21540 1320 1050 8083 Israel-S2 150 4222 11.16 883 11578 66 206 804 92 224 2059 Italy-S2 300 6725 7.33 16941 2485 5956 712 3918 2552 1656 1216 Japan-S2 150 4954 13.64 522 1 103 188 1 153 762 1 Switzerland-S2 186 4945 17.78 >5h 9,123 >5h 754 15,859 >5h 2166 11,743 USA(West)-S2 87 4465 12.05 13205 5057 17916 532 39147 >5h 1674 8,803

Table 2.5: Comparison of models GOM, AM and AM++ for the Max-Min PRDP. Times are given in seconds.

GOM/AM AM/AM++ GOM/AM++ Problem Avg. Max. Min. Avg. Max. Min. Avg. Max. Min. Max-Total SDP 5.85 19.58 1.56 1.92 11.61 0.45 9.21 82.23 1.22 Max-Total PRDP 5.95 14.95 1.28 1.89 8.95 0.66 9.40 80.38 1.14 Max-Min PRDP 1.99 26.54 0.19 1.04 7.99 0.05 2.09 19.74 0.20

Table 2.6: Summary of the results for all models and problem variants.

2.8 Conclusion

We study three variants of a proportional symbol maps problem and propose a novel ILP model in terms of arc variables only. We show that our model for stacking drawings is a projection of another one previously described in the literature. In addition, we describe a strategy to select the initial set of inequalities that greatly improves computation times not only with our models but also with another one from the literature. We also describe fast separation routines and effective lifting procedures. When compared with state-of-the-art models, our formulations significantly reduce computation times for most instances. In particular, for the Max-Total variants, 57 out of 60 instances can now be solved in less than a minute. Several directions exist for future research. From a theoretical , two in- teresting possibilities are deciding on the computational complexity of the Max-Total CHAPTER 2. PROPORTIONAL SYMBOL MAPS 48

SDP and determining whether the AM model for PRDP is also a projection of GOM for that variant. Other include the study of new facet-defining inequalities and the development of branching techniques based on geometric properties of the problem. Fi- nally, current methods still require large computation times to solve the Max-Min PRDP exactly, so there is still a lot of room for improvement. Bibliography

[1] E. Balas and M. Oosten. On the dimension of projected polyhedra. Discrete Applied Mathematics, 87(1–3):1–9, 1998.

[2] S. Cabello, H. Haverkort, M. van Kreveld, and B. Speckmann. Algorithmic aspects of proportional symbol maps. Algorithmica, 58(3):543–565, 2010.

[3] R. G. Cano, G. Kunigami, C. C. de Souza, and P. J. de Rezende. A hybrid GRASP heuristic to construct effective drawings of proportional symbol maps. & , 40(5):1435–1447, 2012.

[4] B. Dent. Design. McGraw-Hill, 5th edition, 1999.

[5] M. Grötschel, M. Jünger, and G. Reinelt. On the acyclic subgraph polytope. Math- ematical Programming, 33(1):28–42, 1985.

[6] G. Kunigami. Proportional symbol maps. Master’s thesis, Institute of Computing, University of Campinas, Brazil, 2011.

[7] G. Kunigami, R. G. Cano, P. J. de Rezende, and C. C. de Souza. Proportional symbol maps – benchmark instances, 2011. www.ic.unicamp.br/~cid/Problem-instances/ Symbol-Maps.

[8] G. Kunigami, P. J. de Rezende, C. C. de Souza, and T. Yunes. Generating optimal drawings of physically realizable symbol maps with integer programming. The Visual Computer, 28(10):1015–1026, 2012.

[9] G. Kunigami, P. J. de Rezende, C. C. de Souza, and T. Yunes. Optimizing the layout of proportional symbol maps: Polyhedra and computation. INFORMS Journal on Computing, 26(2):199–207, 2014.

[10] R. Müller. On the partial order polytope of a digraph. Mathematical Programming, 73:31–49, 1996.

[11] G. Nivasch, J. Pach, and G. Tardos. The visible perimeter of an arrangement of disks. In W. Didimo and M. Patrignani, editors, Proceedings of the 20th International Symposium on , volume 7704 of Lecture Notes in , pages 364–375. Springer-Verlag, 2013.

[12] T. A. Slocum, R. B. McMaster, F. C. Kessler, and H. H. Howard. Thematic Cartog- raphy and Geographic Visualization. Prentice Hall, 2nd edition, 2003.

49 ADDITIONAL COMMENTS 50

Additional Comments

min Comment 2.1. Figure 2.7 is imprecise. The loop on the left cannot exist, because Cuv min and Cvu are defined as (proper) cycles, with no repetitions of vertices or edges. Thus, πvu and πuv are indeed paths.

Comment 2.2. Note that inequalities (2.7) are defined over the set of all cycles of a complete directed graph, whereas inequalities (2.2) are associated only with the cycles of

GO. Therefore, these sets of cycles might differ, and some inequalities (2.7) may have no corresponding inequality (2.2). However, the claim in the text is still true. To see why, observe that if a cycle C is present in D but not in GO, then there exist two disks that do not overlap (and thus no edge exists between them in GO) and whose corresponding vertices are consecutive in C. In this case, when building vector w, we may set wij := wji := 0. But this means that the left-hand side of the inequality (2.7) associated with C will have at least one variable set to 0 and, thus, cannot be violated.

Comment 2.3. There is a notation problem here because Projx(PGOM SD) is a polytope − R whereas PeAM SD Z| | is a discrete set of points. The intended meaning is to take the − ∩ R R convex hull of PeAM SD Z| |, which yields Projx(PGOM SD) = conv(PeAM SD Z| |). − ∩ − − ∩ Chapter 3

Fast Optimal Labelings for Rotating Maps

In the following, we address a dynamic labeling problem on rotating maps. Our study is based on an integer linear programming model from the literature. The main results originated from an intuitive idea that the model had too many variables, and most of them were unnecessary. We prove several properties of optimal solutions that confirm our initial hypothesis, and use them to significantly reduce the size of the model. We implemented and tested the reduced formulation on real-world instances from a known benchmark. The results showed reductions of up to two orders of magnitude in the number of variables and constraints, and up to three orders of magnitude in running times. This chapter corresponds to the paper presented at the 11th International Conference and Workshops on Algorithms and Computation (WALCOM 2017). It is co-authored with Cid C. de Souza1 and Pedro J. de Rezende1. Due to the conference’s page limit, we omitted some proofs and computational results from the main text. They were added after the references for completeness.

Abstract We study a dynamic labeling problem on rotating maps, i.e., maps that allow for continuous rotations. As the map is rotated, labels must remain horizontally aligned. Rotations may cause labels that were previously disjoint to overlap. For each label, we must determine a set of active ranges (i.e., angular ranges during which the label is visible) such that at any rotation angle all active labels are disjoint. The objective is to maximize the sum of the angular length of all active ranges. We prove a number of properties of optimal solutions which allow us to significantly reduce the size of an integer programming model from the literature. We report the results of several experiments using two existing benchmarks with 180 real-world instances. We obtained reductions of over 100 times in the number of variables and constraints of the model. The compact formulation solved all but 5 instances to optimality in under a minute.

1Institute of Computing, University of Campinas, Brazil. Supported by Fundação de Amparo à Pesquisa do Estado de São Paulo (FAPESP), grant 2012/00673-2, and Conselho Nacional de Desenvolvi- mento Científico e Tecnológico (CNPq), grants #155498/2016-9, #311140/2014-9 and #304727/2014-8.

51 CHAPTER 3. ROTATING MAPS 52

3.1 Introduction

Labeling problems are well-studied in the optimization literature. The input consists of a map and several points of interest. Each point is associated with a textual label that identifies or describes it. Labels must be placed on the map close to their associated point and without overlap. Classic problems usually aim at producing static maps to be used in print. However, with the recent dissemination of navigation systems and digital maps, a new branch of labeling problems has arisen. These are referred to as dynamic labeling problems since they are inserted in a context that allows the user to interact with the map. Here, we focus on rotating maps, i.e., maps that permit continuous rotations. Each label is anchored at a point that is specified in the input. We assume that each anchor point lies on the boundary of its associated label. As the map is rotated, all labels remain horizontally aligned and anchored at their associated points (see Fig. 3.1). This may cause labels that were previously disjoint to overlap. We handle such cases by omitting one or more labels at specific angular intervals. Therefore, we must determine, for each label, a set of active ranges (i.e., maximal angular intervals during which the label is visible) such that, at any rotation angle, all active labels are disjoint. The goal is to maximize the total angular length of the active ranges of all labels for a full rotation of the map.

Figure 3.1: Rotations may create overlaps that previously did not exist.

Been et al. [1] observed that naive (dynamic) labeling algorithms may cause unpleasant visual effects. Good maps must not allow labels to pop or jump during monotonous navigation. In rotating maps, this happens if a label has too many active ranges. In such cases, labels appear to flicker on the screen as the map is rotated. Gemsa et al. [2, 3] solve this issue by letting each label have only a limited number of active ranges. They refer to this setting as the kR-model, where k denotes the maximum number of active ranges allowed per label. In some applications, the occlusion of anchor points might be undesirable, since they may convey useful information even if their associated labels are inactive. This motivates the following distinction. If two labels ` and `0 intersect at some rotation angle α, we say that they have a soft conflict at α. If, in addition, ` contains `0’s anchor point, then ` also has a hard conflict with `0 at α. Note that soft conflicts define a symmetric relation, whereas hard conflicts (generally) do not. One may optionally require that hard conflicts be avoided. Gemsa et al. [3] were the first to study this problem. They prove that it is NP-hard to find an optimal solution in the 1R-model with hard conflicts. They also provide efficient approximation algorithms. The first Integer Linear Programming (ILP) formulation for CHAPTER 3. ROTATING MAPS 53 this problem was given by the same authors in [2]. They experimented with an extensive benchmark of real-world instances, several of which could only be addressed heuristically. Our contribution: we prove a number of properties of optimal solutions that allow us to significantly reduce the ILP formulation proposed in [2]. We obtained reductions of up to 100 times in the number of variables and constraints of the model. The compact formulation was able to optimally solve 178 out of 180 instances. Moreover, we found 12 optimal solutions that were previously unknown. The text is organized as follows. Section 3.2 presents the said ILP formulation. Section 3.3 proves several properties of optimal solutions. Section 3.4 discusses some implementation details and reports our computational results.

3.2 Model

Let L = ` , . . . , ` be a set of n rectangular, axis-aligned, non-overlapping, closed labels { 1 n} in the plane. Let P = p , . . . , p be a set of points in the plane such that each p { 1 n} i corresponds to the anchor of label `i and lies on its boundary. Given two labels ` and `0, the conflict set C(`, `0) is defined as the set of all rotation angles at which ` and `0 overlap, i.e., C(`, `0) = α [0, 2π) ` and `0 have a conflict at α .A conflict range is { ∈ | } a maximal contiguous range in C(`, `0). We refer to the endpoints of maximal conflict ranges as conflict events. Let E be an ordered set that contains all conflict events and, additionally, the values 0 and 2π. For 0 j E 1, we denote by e the j-th element of E. An interval ≤ ≤ | | − j between two consecutive elements of E is an atomic interval. For 0 j E 2, we ≤ ≤ | | − denote by E[j] the j-th atomic interval, i.e., the interval between ej and ej+1. Given the circular nature of the problem, in all further references, indices of conflict events and atomic intervals should be taken modulo E and E 1, respectively. Gemsa et al. [2, 3] | | − showed that there always exists an optimal solution in which all active ranges correspond to unions of atomic intervals. This allowed the authors to present the following ILP formulation. j j For 1 i n and 0 j E 2 we define two sets of binary variables xi and bi . ≤j ≤ ≤ ≤ | | − j Variable xi has value 1 if label `i is active during E[j] and 0 otherwise. Variable bi takes value 1 when `i is inactive during E[j 1] and active during E[j]. The objective function Pn P E 2 j − to be maximized is | |− x E[j] , where E[j] represents the angular length of i=1 j=0 i · | | | | E[j]. The following constraints must hold:

j j j 1 x b x − 1 i n, 0 j E 2; (3.1) i − i ≤ i ≤ ≤ ≤ ≤ | | − E 2 |X|− bj k 1 i n; (3.2) i ≤ ≤ ≤ j=0 xj + xj 1 0 j E 2 and ` , ` in conflict on E[j]. (3.3) i k ≤ ≤ ≤ | | − ∀ i k j 1 Inequalities (3.1) guarantee that if a new active range starts at E[j] (i.e., if xi− = 0 j j and xi = 1), then bi must be set to 1. Inequalities (3.2) limit the number of active ranges of each label to at most k. Inequalities (3.3) prevent pairs of overlapping labels from CHAPTER 3. ROTATING MAPS 54 being simultaneously active. In the text that follows, we will refer to inequalities (3.3) as conflict inequalities. Finally, hard conflicts can be incorporated by simply fixing the appropriate activity variables at zero.

3.3 Properties of Optimal Solutions

Our goal is to show how to reduce the ILP from [2] without affecting its correctness. We first need a few auxiliary results. In order to simplify the discussion that follows, we assume that all conflict events occur at distinct rotation angles and, thus, all atomic intervals have positive length. We also assume that L is defined as a set of non-overlapping labels, so no conflicts exist at rotation angle 0. It should be noted that the techniques described here would work even if these assumptions are not satisfied. Let G[j] be the conflict graph for the j-th atomic interval, i.e., an undirected graph with a vertex for each label and edges indicating pairs of labels that are in conflict on E[j].

Conflict event ej+1 either starts or ends a conflict range, so the transition from G[j] to G[j +1] consists of either the insertion or the deletion of a single edge, respectively. These transitions cause labels to change their state in the solution. Our results derive from the observation that conflict events usually have a somewhat local effect, often leaving the state of distant labels unchanged. We formalize this notion by analyzing the connected components of conflict graphs. Given a connected component C of G[j], we say that C is unaffected on atomic interval E[j] if the edge inserted or deleted in the transition from G[j 1] to G[j] was not incident − to any vertices of C. Note that this implies that C is also a connected component of G[j 1]. If C does not satisfy the previous condition, we say that it is affected on E[j]. − We now define two basic operations that we will use extensively to manipulate so- lutions in our proofs. Given a set of labels S L, a solution (x, b) to the ILP from ⊆ Sect. 3.2, and an atomic interval E[γ], a backward copy operation (denoted backward- copy(S, (x, b),E[γ])) creates a new solution (x,b b) in which the state of each label in S is copied from atomic interval E[γ] to E[γ 1]. More formally, backward-copy(S, (x, b), − E[γ]) constructs (x,b b) by assigning:

 γ  j j 1 xi if `i S and max(0, xbi xbi− ) if `i S and j = γ 1 j  ∈ j  − ∈ − xbi = j = γ 1 bi = 0 if `i S and j = γ  j −  j ∈ xi otherwise; bi otherwise.

Analogously, a forward copy operation (denoted forward-copy(S, (x, b),E[γ])) copies the state of each label in S from atomic interval E[γ] to E[γ + 1]:

 γ  j j 1 xi if `i S and max(0, xbi xbi− ) if `i S and j = γ + 2 j  ∈ j  − ∈ xbi = j = γ + 1 bi = 0 if `i S and j = γ + 1  j  j ∈ xi otherwise; bi otherwise. The reader may want to keep in mind that in the following proofs each operation that employs variable values of the ILP solution has a corresponding effect on the geometry CHAPTER 3. ROTATING MAPS 55 of the label conflicts. Proposition 3.1 shows that solutions produced by either of the two operations always satisfy inequalities (3.1) and (3.2). Proposition 3.1. Let S L be a set of labels and (x, b) be a feasible solution to the ILP ⊆ from Sect. 3.2. Then, for any atomic interval E[γ], (x,b b) = backward-copy(S, (x, b), E[γ]) and (x0, b0) = forward-copy(S, (x, b),E[γ]) satisfy inequalities (3.1) and (3.2). Proof. It is easy to verify that, by construction, inequalities (3.1) are always satisfied. As for inequalities (3.2), note that a copy operation can only extend an existing active range or merge two active ranges. In both cases, the number of active ranges does not increase, and the result follows.

Next, we deal with conflict inequalities. Given a connected component C of a conflict graph, denote by L(C) the set of labels associated with the vertices of C. Proposition 3.2. Let C be an unaffected component of a conflict graph G[γ]. Let (x, b) be a feasible solution to the ILP from Sect. 3.2. Then (x,b b) = backward-copy(L(C), (x, b), E[γ]) and (x0, b0) = forward-copy(L(C), (x, b),E[γ 1]) satisfy all conflict inequalities. − Proof. Since C is an unaffected component of G[γ], a conflict involving the labels in L(C) exists on E[γ 1] if and only if it also exists on E[γ]. Thus, copying the state of these − labels from E[γ] to E[γ 1] (or vice versa) cannot violate any conflict inequalities. − Proposition 3.3. Let C be an affected component of a conflict graph G[γ]. Let (x, b) be a feasible solution to the ILP from Sect. 3.2. Let (x,b b) = backward-copy(L(C), (x, b), E[γ]) and (x0, b0) = forward-copy(L(C), (x, b),E[γ 1]). Let ` and ` be the two labels − t u that caused conflict event eγ. Then:

1. If eγ starts a conflict range, xb satisfies all conflict inequalities and x0 may violate at γ γ most one, namely x0 + x0 1; t u ≤ 2. If eγ ends a conflict range, x0 satisfies all conflict inequalities and xb may violate at γ 1 γ 1 most one, namely x − + x − 1. bt bu ≤ Proof. We prove the result for xb. The proof for x0 is analogous. The only values that may differ between x and x are the ones for E[γ 1], so it suffices to analyze conflicts for that b − interval. Note that the only pair of labels that may have a conflict either on E[γ 1] or − E[γ] (but not both) is ` and ` . All other conflicts are present on E[γ 1] if and only if t u − they are also present on E[γ]. Let `i and `k be two labels that have a conflict on E[γ 1]. If γ 1 γ 1 γ 1 γ 1 − neither `i nor `k belongs to L(C), xbi − = xi − and xbk− = xk− . Thus, the corresponding conflict inequality must be satisfied by xb (otherwise x would not be feasible). If both `i γ 1 γ γ 1 γ γ 1 γ 1 and `k belong to L(C), xbi − = xi and xbk− = xk. Thus, xbi − + xbk− > 1 implies that this conflict is not present on E[γ] (otherwise x would not be feasible). This can only happen if ` , ` = ` , ` and, specifically, if e ends a conflict range. { i k} { t u} γ Now, suppose ` L(C) and ` / L(C). Note that if a conflict exists between ` and i ∈ k ∈ i ` on E[γ 1], then either (i) this conflict is also present on E[γ] or (ii) ` , ` = ` , ` k − { i k} { t u} and e ends a conflict range. Case (i) implies ` L(C) because the vertices for ` and γ k ∈ i `k would be connected by an edge in G[γ]. Case (ii) is precisely the conflict that may be violated, so the proof is complete. CHAPTER 3. ROTATING MAPS 56

The results in Propositions 3.1–3.3 are summarized in Lemmas 3.4 and 3.5. We actu- ally prove slightly stronger results that will be useful in our remaining proofs.

Lemma 3.4 (Backward Copy Lemma). Let C be a component of a conflict graph G[γ]. Let (x, b) be a feasible solution to the ILP from Sect. 3.2. Let Z L(C) be a (possibly ⊆γ 1 empty) set of labels that are inactive on E[γ 1], i.e., `i Z, x − = 0. Let (x,b) = − ∀ ∈ i b backward-copy(L(C) Z, (x, b),E[γ]). Let ` and ` be the two labels that caused conflict \ t u event eγ. Then:

1. If C is unaffected on E[γ], (x,b b) is feasible;

2. If C is affected on E[γ] and eγ starts a conflict range, (x,b b) is feasible;

3. If C is affected on E[γ] and eγ ends a conflict range, (x,b b) may violate at most one γ 1 γ 1 inequality, namely x − + x − 1. bt bu ≤ Proof. If Z = , the result follows directly from Propositions 3.1–3.3. Otherwise, by ∅ Proposition 3.1, (x,b b) satisfies all inequalities (3.1) and (3.2). Now, consider the solution (x0, b0) = backward-copy(L(C), (x, b),E[γ]). Note that if two values differ between xb and x0, the one in x must be 0. This implies x x0 (where the comparison is taken b b ≤ between corresponding entries). Thus, every conflict inequality satisfied by x0 must also be satisfied by xb, and the result follows. Lemma 3.5 (Forward Copy Lemma). Let C be a component of a conflict graph G[γ]. Let (x, b) be a feasible solution to the ILP from Sect. 3.2. Let Z L(C) be a (possibly empty) γ ⊆ set of labels that are inactive on E[γ], i.e., `i Z, x = 0. Let (x,b) = forward- ∀ ∈ i b copy(L(C) Z, (x, b),E[γ 1]). Let ` and ` be the two labels that caused conflict event \ − t u eγ. Then:

1. If C is unaffected on E[γ], (x,b b) is feasible;

2. If C is affected on E[γ] and eγ ends a conflict range, (x,b b) is feasible;

3. If C is affected on E[γ] and eγ starts a conflict range, (x,b b) may violate at most one inequality, namely xγ + xγ 1. bt bu ≤ Proof. Analogous to the proof of the Backward Copy Lemma.

The next results show that, for optimal solutions, the number of active labels on consecutive intervals cannot vary much. Given a solution (x, b) and a component C of an atomic interval E[γ], we define

γ X γ X γ 1 δ (x) = x x − , C i − i `i L(C) `i L(C) ∈ ∈ γ i.e., δC (x) represents the variation in the number of active labels in L(C) from atomic interval E[γ 1] to E[γ]. − CHAPTER 3. ROTATING MAPS 57

Lemma 3.6. Let C be a component of a conflict graph G[γ]. Let (x∗, b∗) be an optimal solution to the ILP from Sect. 3.2. Then:

γ 1. If C is unaffected on E[γ], δC (x∗) = 0;

γ 2. If C is affected on E[γ] and e starts a conflict range, δ (x∗) 1, 0 ; γ C ∈ {− } γ 3. If C is affected on E[γ] and e ends a conflict range, δ (x∗) 0, 1 . γ C ∈ { } γ γ 1 γ Proof. Case 1. Suppose , i.e., P ∗ − P ∗ . Consider the δC (x∗) = 0 `i L(C) xi = `i L(C) xi 6 ∈ 6 ∈ solutions provided by backward-copy(L(C), (x∗, b∗),E[γ]) and forward-copy(L(C), (x∗, b∗),E[γ 1]). By the two Copy Lemmas, both solutions are feasible. One of these − alternatives gives a solution with a higher number of active labels during either E[γ 1] − or E[γ]. Thus (x∗, b∗) cannot be optimal.

Case 2. Let `t and `u be the two labels that caused conflict event eγ. Initially, suppose γ γ γ δC (x∗) 2. We must have xt∗ = 0 or xu∗ = 0 (otherwise x∗ would not be feasible). ≤ − γ Suppose w.l.g. x∗ = 0. Let (x,b) = forward-copy(L(C) `u , (x∗, b∗),E[γ 1]). Since u b \{ } − xγ = 0, the Forward Copy Lemma guarantees that (x,b) is feasible. Moreover, δγ (x) bu b C b ≥ 1, so (x,b b) has more visible labels than (x∗, b∗) on E[γ], and hence attains a better − γ objective value. Consequently, (x∗, b∗) cannot be optimal. Now, suppose δ (x∗) 1. By C ≥ the Backward Copy Lemma, (x,b b) = backward-copy(L(C), (x∗, b∗),E[γ]) is feasible. Also, it has more visible labels on E[γ 1] than (x∗, b∗). Thus, (x∗, b∗) cannot be optimal. − Case 3. Analogous to the proof of Case 2.

In our next proofs, it will be necessary to execute copy operations sequentially on consecutive atomic intervals. We indicate this by passing a list of intervals as parameters to backward- and forward-copy. Formally, given a set of labels S L, a solu- ⊆ tion (x, b) and a list of consecutive atomic intervals Q = E[j ], E[j + 1], ..., E[j ] , h 1 1 2 i backward-copy(S, (x, b),E[j2],...,E[j1 + 1],E[j1]) produces a list of solutions by set- ting (x[0], b[0]) = (x, b) and, for 0 λ Q 1, (x[λ + 1], b[λ + 1]) = backward- ≤ ≤ | | − copy(S, (x[λ], b[λ]),E[j λ]). The last solution is returned as the result. forward- 2 − copy(S, (x, b),E[j1],E[j1 + 1],...,E[j2]) is defined analogously (note, however, that the order of the intervals is reversed). The following definition will also be useful. Let C be a component of a conflict graph G[γ]. The lifespan of C (denoted (C)) is a maximal set of consecutive intervals LS E[j ],E[j + 1],...,E[γ],...,E[j 1],E[j ] that contains E[γ] and such that C is { 1 1 2 − 2 } a component of G[j1],...,G[γ],...,G[j2]. Here, we consider that two components are distinct even if only their edge sets differ. This implies that, if C is affected in some conflict graph G[j], then it cannot be a component of G[j 1]. Therefore, C is unaffected − on E[j1 + 1],...,E[γ],...,E[j2]. Moreover, suppose C is also unaffected on E[j1]. Then, C must be a component of E[j 1], and since (C) is maximal, E[j 1] (C). This can only be true if 1 − LS 1 − ∈ LS E[j 1] = E[j ] (recall that interval indices are taken modulo E 1), which implies 1 − 2 | | − (C) contains all atomic intervals and C is unaffected in all of them. Due to the fact LS that all labels are disjoint at rotation angle 0, C must consist of a single isolated label that can be made visible over the full map rotation. We assume that such a trivial case CHAPTER 3. ROTATING MAPS 58 is treated in a preprocessing step. Thus, in the remainder of this text, we consider that

C is affected on E[j1] and unaffected on every other interval of its lifespan. We can now present our main results. We say that a solution is harmonious if for every j 1 j label `i of each unaffected component C of G[j] (0 j E 2) we have xi− = xi and j ≤ ≤ | | − bi = 0. In other words, in a harmonious solution, a label `i may change its state during the j-th atomic interval only if the component to which it belongs in G[j] is affected.

Theorem 3.7. The ILP from Sect. 3.2 always has a harmonious optimal solution.

Proof. Let (x∗, b∗) be an optimal solution. For each `i L and for 0 j E 2, we j j j 1 j ∈ ≤ ≤ | | − assume b∗ = max(0, x∗ x∗ − ), i.e., b∗ is set to 1 only if strictly necessary to satisfy i i − i i inequalities (3.1). Note that, if (x∗, b∗) does not satisfy this condition, there exists a label j j j 1 j ` and an interval E[j] such that b∗ = 1 and max(0, x∗ x∗ − ) = 0. But, then, setting b∗ i i i − i i to 0 does not violate inequalities (3.1) and, since this reduces its value, inequalities (3.2) must also remain satisfied.

Now, suppose that for some atomic interval E[γ] there exists a label `i that belongs to an unaffected component C of G[γ]. In addition, suppose that the state of `i changed in γ 1 γ (x∗, b∗) on E[γ], i.e., x∗ − = x∗ . Let (C) = E[j1],...,E[γ],...,E[j2] . Let (x,b) = i 6 i LS { } b backward-copy(L(C), (x∗, b∗), E[j2], ..., E[γ], ..., E[j1 + 1]). By the Backward Copy Lemma, (x,b b) is feasible. Also, by Lemma 3.6, the copy operations do not change the number of visible labels on any atomic interval, so (x,b b) is optimal. Finally, for all labels j 1 j j `i L(C) and all intervals E[j] (C) on which C is unaffected, x − = x and b = 0. ∈ ∈ LS bi bi i To complete the proof, note that, if (x,b b) is still not harmonious, the process described here for component C can be repeated independently for any other unaffected component. Once this is done for all unaffected components of all atomic intervals, the resulting solution will be harmonious.

Theorem 3.7 shows that there always exists an optimal solution in which the state of labels in all unaffected components remains unchanged. Next, we provide a similar result for affected components. Let be a set containing all affected components of all atomic A intervals, i.e., = C C is an affected component of some G[j], 0 j E 2 . We A { | ≤ ≤ | | − } remark that it is possible that two affected components of two distinct conflict graphs have exactly the same set of vertices and edges. However, since they do not belong to the same conflict graph, they are represented by distinct elements in . A Let C be an affected component of a conflict graph G[j ]. Let (C) = ∈ A 1 LS E[j ],E[j + 1],...,E[j ] be C’s lifespan. Since (C) is maximal, conflict event e { 1 1 2 } LS j2+1 affects at least one vertex of C, i.e., the transition from G[j2] to G[j2 + 1] either inserts or deletes an edge incident to a vertex of C. Graph G[j2 + 1] may have one or two affected components, both distinct from C. Let D be an affected component of G[j + 1]. ∈ A 2 We say that C is a parent of D and, conversely, D is a child of C. Alternatively, the parents of D are precisely the components of G[j2] that contain the vertices of D. Here, two observations are in order. First, note that a component can have up to two parents and two children. Second, we do not intend to establish a partial order on the elements of (this is not possible due to the circular nature of the problem). We only wish to A determine how components interact with each other to form new ones. CHAPTER 3. ROTATING MAPS 59

We want to show that there always exists an optimal solution in which the state of most labels in a well-chosen set of affected components does not change. Let C ∈ A be an affected component of G[j]. Let `t and `u be the two labels that caused conflict event ej. Generally, we cannot guarantee that the state of `t and `u will remain the same (actually, it often changes). However, the other labels in L(C) may keep their previous state. Theorem 3.8 formalizes this result. We define a component graph G as a simple A undirected graph with a vertex v for each component C and an edge v , v for C ∈ A { C D} each pair of components C,D such that C is either a parent or a child of D. ∈ A Theorem 3.8. Let be a set of components such that their associated vertices form I ⊆ A an independent set in G . There always exists a harmonious optimal solution (x∗, b∗) to A the ILP from Sect. 3.2 such that the following is satisfied for all elements of : if C is I ∈ I an affected component of G[γ], and `t and `u are the two labels that caused conflict event γ 1 γ γ e , then for each ` L(C) ` , ` we have x∗ − = x∗ and b∗ = 0. γ i ∈ \{ t u} i i i

Proof. Let (x∗, b∗) be a harmonious optimal solution and suppose it does not satisfy the desired condition. Let C be an affected component of G[γ], and ` and ` be the ∈ I t u two labels that caused conflict event eγ. We will show that there exists a harmonious optimal solution (x,b) in which the state of the labels in L(C) `t, `u is the same on b \{ } E[γ 1] and E[γ]. We will do that by executing copy operations on (x∗, b∗), either from − E[γ 1] to E[γ] or from E[γ] to E[γ 1]. By Lemma 3.6, if eγ starts a conflict range, γ − γ − δ (x∗) 1, 0 , otherwise, δ (x∗) 0, 1 . We treat these four cases separately. The C ∈ {− } C ∈ { } feasibility of all solutions considered here follows from the two Copy Lemmas. We omit further references for brevity. γ γ γ Case 1: eγ starts a conflict range and δC (x∗) = 1. We must have xt∗ = 0 or xu∗ = 0. γ − Suppose w.l.g. xu∗ = 0. Let (x0, b0) = forward-copy(L(C) `u , (x∗, b∗),E[γ 1]). γ γ \{ } − Since x0 = 0, (x0, b0) is feasible. Also, δ (x0) 1, so it has the same objective value as u C ≥ − (x∗, b∗) and is optimal. However, we modified some variables for E[γ], so (x0, b0) may not be harmonious (especially if C is unaffected on E[γ+1]). Let E[γ],E[γ+1],...,E[j ] be the { 2 } lifespan of C. Solution (x,b) = forward-copy(L(C), (x0, b0),E[γ],E[γ+1],...,E[j2 1]) b − is feasible and harmonious (recall that C is unaffected on E[γ + 1],...,E[j2]). Finally, by Lemma 3.6, it is also optimal. γ Case 2: eγ starts a conflict range and δC (x∗) = 0. Let (x0, b0) = backward- γ copy(L(C), (x∗, b∗),E[γ]). Since δC (x0) = 0, (x0, b0) is optimal, but (possibly) not harmo- nious. Let D be a parent of C. Let E[j ],E[j + 1],...,E[γ 1] be the lifespan of ∈ A { 1 1 − } D. Solution (x,b) = backward-copy(L(D), (x0, b0),E[γ 1],E[γ 2],...,E[j1 + 1]) is b − − feasible (because D is unaffected on E[j + 1],...,E[γ 1]) and, by Lemma 3.6, optimal. 1 − If C has only one parent, it is also harmonious. Otherwise, let D0 be the other parent. Labels ` and ` belong to distinct components in G[γ 1] (otherwise, there would be t u − a single parent), and L(C) = L(D) L(D0). This means that the first backward copy ∪ operation changed the state of all labels in L(C), but the others only addressed the labels in L(D). Thus, we must also apply backward copy operations to the labels in L(D0) on the intervals that belong to the lifespan of D0. Once this is done, the solution obtained will be both harmonious and optimal. γ Case 3: eγ ends a conflict range and δC (x∗) = 0. Analogous to Case 1. CHAPTER 3. ROTATING MAPS 60

γ Case 4: eγ ends a conflict range and δC (x∗) = 1. Analogous to Case 2. In all four cases, we obtain a harmonious optimal solution in which the state of the labels in L(C) remains unchanged (except for `t and `u), so it satisfies the desired con- dition for component C. It remains to be shown that this procedure can be executed independently for all components in . Observe that we needed to execute copy opera- I tions on the intervals that belong to C’s lifespan (Cases 1 and 3) and also to its parents’ lifespan (Cases 2 and 4). Therefore, if we apply the same procedure to C’s parents, we might overwrite some variables that had already been set. However, we can execute it independently for other components as long as we do not pick a parent and its child. This is equivalent to choosing components that form an independent set in G , so the proof is A complete.

3.4 Implementation and Experiments

Implementation. The results from Sect. 3.3 can be used to significantly reduce the size of the ILP model. Let be a set of components that form an independent set I ⊆ A in G . Let C be a component of conflict graph G[γ] and let `i be a label in L(C). If A C is unaffected on E[γ], Theorem 3.7 allows us to add the following equality constraints γ 1 γ γ to the model: x − = x and b = 0. Otherwise, if C is affected on E[γ] and C , i i i ∈ I Theorem 3.8 allows us to add the same constraints, except if `i is one of the labels that caused conflict event eγ. When it is the case that this pair of equalities is included in the model, two variables γ γ 1 γ may be removed: bi and either xi − or xi (but not both). Additionally, some constraints γ γ γ 1 might become redundant. Clearly, x b x − is always satisfied and can be removed. i − i ≤ i Also, some conflict constraints become unnecessary. If `i has a conflict with `k on both γ 1 γ E[γ 1] and E[γ], and if x − = x , then we only need the conflict constraint for either − k k E[γ 1] or E[γ]. − In our implementation, we used CPLEX to solve the ILPs. We tested two approaches to reduce the size of the formulations. Initially, we loaded all variables and constraints to the solver, including the equality constraints we just described. Next, we let CPLEX’s presolve procedure remove all unnecessary variables and constraints. This option led to satisfactory results for models with less than a million variables and constraints, which are usually associated with instances that have up to 250 labels. However, for larger instances, CPLEX needed a prohibitive amount of memory and most of the computation time was spent presolving, and not actually solving the model. Therefore, we implemented our own lightweight presolve procedure, taking advantage of the fact that we know a priori the main simplifications to be performed. We then loaded only the reduced model to CPLEX. Our procedure is able to presolve even the largest instances in less than a second, so we used it in all experiments. Finally, regarding the choice of set , observe that, although any independent set in I G leads to a correct model, some sets might allow more variables to be removed than A others. In particular, given a component C , it is easy to calculate how many variables ∈ A will be removed if C is included in . We would like to select the set that leads to the I CHAPTER 3. ROTATING MAPS 61 deletion of the maximum possible number of variables. Therefore, we select by solving I a weighted maximum independent set problem on G . We formulated this problem as an A ILP and used CPLEX to solve it. Because G is sparse, the time necessary to solve this A auxiliary model is approximately four orders of magnitude smaller than the time needed for the actual labeling problem. Thus, it is acceptable to solve this problem optimally.

Experiments. We now evaluate the performance of the reduced ILP formulation, ob- tained after performing the simplifications just described. Experiments were run on an Intel Xeon CPU X3470, 2.93 GHz, with 8 GB RAM. Integer programs were solved with CPLEX 12.5.1 using traditional search with a single thread. The code was written in C++ and compiled with gcc 5.4.0. We considered two problem variants: one that only handles soft conflicts, and another that takes both soft and hard conflicts into account. We experimented with models 1R, 2R and 3R (recall that model kR allows at most k active ranges per label). We used two sets of maps constructed from real-world data and made available by Gemsa et al. [2]. The first set was built from data on cities from six countries (France, Germany, United Kingdom, Italy, Japan and USA) using map scales of 65pixel =b 20km, 50km and 100km. The second set is based on data from restaurants in four cities (Berlin, London, New York and Paris) and uses map scales of 65pixel =b 20m, 50m, and 100m. The two benchmarks have a total of 30 input maps, yielding 2 3 30 = 180 distinct instances. · · As in [2], we attempt to decompose each input map before building the ILP models. We construct a conflict graph for a full rotation of the map, i.e., each label is represented by a vertex and two labels are connected by an edge if they have a conflict at any rotation angle. Clearly, connected components in this graph can be solved separately. In all experiments, we allowed a time limit of one hour per component before interrupting the resolution of the hardest problems. In Fig. 3.2 we , for each input map, the number of variables (left) and constraints (right) in the original (abscissa) and in the reduced formulation (ordinate). The reductions with and without hard conflicts differ for the same map, so we also distinguish data points by conflict type. In all cases, a notable reduction can be observed. The most impressive case occurred for Paris at scale 100m, with a reduction of over 99% of variables and constraints for both soft and hard conflicts. On average, we eliminated 86.6% of the variables and 80.2% of the constraints from the original model when using only soft conflicts. With hard conflicts, these values are 86.2% and 88.1% respectively. In general, these percentages increase with the size of the largest connected component.

Table 3.1 shows running times for the original model (To) and for the reduced formu- lations obtained by applying Theorem 3.7 alone (T1) and Theorems 3.7 and 3.8 together (T1,2). We also give the ratios To/T1 and To/T1,2. Additionally, for each instance we report the total number of labels (n), the number of labels in the largest connected component

(nlcc), and the fraction of variables (%var) and constraints (%con) eliminated from the original formulation. Column s h indicates whether the soft or the hard conflict model | is considered. Some instances could not be solved by the original formulation within the given time limit. With soft conflicts, for instances London-50 1R and Paris-100 3R the solver was halted while still leaving duality gaps of 3.55% and 50.59%, respectively. With CHAPTER 3. ROTATING MAPS 62

Figure 3.2: Variables and constraints in the original and reduced formulations.

Map n (n ) kR s h %var %con T T T T /T T /T lcc | o 1 1,2 o 1 o 1,2 USA-100 288 (213) 2R s 97.2 95.3 3228 44 29 73.9 111.9 France-100 69 (69) 1R s 93.0 90.1 1614 26 10 61.0 162.4 Berlin-100 2628 (416) 3R s 98.5 97.7 4231 4 2 1073.7 1940.6 London-50 1620 (175) 1R s 94.7 92.0 – 90 34 – – Paris-100 2141 (952) 3R s 99.3 99.0 – 40 13 – – London-50 1620 (175) 2R h 94.4 95.4 97 2 1 49.7 122.2 London-100 1457 (371) 2R h 97.5 98.2 773 3 1 292.9 581.5 USA-100 288 (213) 1R h 97.2 97.9 540 1 1 568.7 1039.0 Berlin-100 2628 (416) 1R h 98.5 98.7 1869 3 2 716.0 1099.2 Paris-100 2141 (952) 3R h 99.3 99.5 – 6 3 – –

Table 3.1: Experimental results. Times are given in seconds. hard conflicts, for instance Paris-100 3R there remained a gap of 43.75%. As expected, the size reductions in the ILPs had a direct effect on execution times and the more compact formulation was faster for all instances. At scales 20km and 20m, components are very small and both versions of the ILP performed relatively well. However, at other scales, the reduced model performed significantly better. The best speedup occurred for the Berlin map at scale 100m with the 3R soft-conflict model, for which the reduced formulation was 1940 times faster. Only two instances could not be solved by the reduced formulation, namely London and Paris, at scale 100m, with the 1R soft-conflict model. In both cases, there was a gap of 0.03% when the time limit was reached. For the same instances, the original model left gaps of 30.78% and 51.27% (respectively).

The times presented in columns T1 and T1,2 of Table 3.1 allow us to assess the individual contribution of Theorems 3.7 and 3.8 to the final results. Reductions that come from unaffected components clearly produce the most impressive speed-ups. There are two main for this. Firstly, Theorem 3.7 allows us to remove all variables associated with unaffected components, whereas Theorem 3.8 is restricted to subsets of affected components that form independent sets in G . Moreover, no more than two components A of any conflict graph may be affected. Nevertheless, by using Theorem 3.8, running times CHAPTER 3. ROTATING MAPS 63 can be reduced by up to an additional factor of three. Concluding Remarks. The reduced model had improvements of up to three orders of magnitude in running times. All but two instances were solved within the time limit, and all but five in less than a minute. We solved components with up to 952 labels and found 12 optimal solutions that were previously unknown. Bibliography

[1] K. Been, E. Daiches, and C. Yap. Dynamic map labeling. IEEE Transactions on Visualization and , 12(5):773–780, 2006.

[2] Andreas Gemsa, Martin Nöllenburg, and Ignaz Rutter. Evaluation of labeling strate- gies for rotating maps. ACM Journal of Experimental , 21(1):1.4:1–1.4:21, 2016.

[3] Andreas Gemsa, Martin Nöllenburg, and Ignaz Rutter. Consistent labeling of rotating maps. Journal of , 7(1):308–331, 2016.

64 ADDITIONAL PROOFS AND RESULTS 65

Additional Proofs and Results

We now present the proofs that were omitted from the main text. Additionally, we give alternative proofs to Propositions 3.1 and 3.2. We also report a few complementary computational results.

Proposition 3.1. Let S L be a set of labels and (x, b) be a feasible solution to the ILP ⊆ from Sect. 3.2. Then, for any atomic interval E[γ], (x,b b) = backward-copy(S, (x, b), E[γ]) and (x0, b0) = forward-copy(S, (x, b),E[γ]) satisfy inequalities (3.1) and (3.2).

Proof. We prove the result for (x0, b0). The proof for (x,b b) is analogous. Note that for all labels ` / S we simply copy the values from (x, b). Therefore, inequalities (3.1) i ∈ and (3.2) must remain satisfied by (x0, b0). In addition, for ` S, one can easily verify i ∈ that inequalities (3.1) are satisfied. It remains to be shown that inequalities (3.2) are also satisfied for all labels `i S. Since the only values for `i that may differ between b and b0 γ+1 γ+2 ∈ γ+1 γ+2 γ+1 γ+2 are bi0 and bi0 , it suffices to show that bi0 + bi0 bi + bi . By construction, γ+1 γ+2≤ γ+1 γ+2 we have bi0 = 0, so we must only guarantee that bi0 bi + bi . The only way γ+2 γ+1 ≤γ+2 γ+2 this inequality could be violated is if bi0 = 1 and bi = bi = 0. However, bi0 = 1 γ+2 γ+1 γ+2 γ+2 would imply xi0 = 1 and xi0 = 0. Again, by construction, we have xi = xi0 = 1 γ γ γ+1 γ+1 γ+1 γ+2 and xi = xi0 = xi0 = 0. So, whatever the value of xi , either bi or bi would have to be set to 1, which leads to a contradiction and completes the proof.

Proposition 3.2. Let C be an unaffected component of a conflict graph G[γ]. Let (x, b) be a feasible solution to the ILP from Sect. 3.2. Then (x,b b) = backward-copy(L(C), (x, b), E[γ]) and (x0, b0) = forward-copy(L(C), (x, b),E[γ 1]) satisfy all conflict inequalities. − Proof. We prove the result for (x0, b0). The proof for (x,b b) is analogous. The claim is clearly true for all pairs of labels in every atomic interval other than E[γ], since the values of all variables are the same as in x. For interval E[γ], the only variables that had their values modified are the ones associated with the labels in L(C). But C is an unaffected connected component of G[γ] and, thus, also a connected component of G[γ 1]. This − implies that every conflict involving the labels in L(C) during E[γ] is also present during

E[γ 1]. Thus, if x satisfies all conflict inequalities, x0 must satisfy them as well. − Proposition 3.3. Let C be an affected component of a conflict graph G[γ]. Let (x, b) be a feasible solution to the ILP from Sect. 3.2. Let (x,b b) = backward-copy(L(C), (x, b), E[γ]) and (x0, b0) = forward-copy(L(C), (x, b),E[γ 1]). Let ` and ` be the two − t u labels that caused conflict event eγ. Then:

1. If eγ starts a conflict range, xb satisfies all conflict inequalities and x0 may violate at γ γ most one, namely x0 + x0 1; t u ≤ 2. If eγ ends a conflict range, x0 satisfies all conflict inequalities and xb may violate at γ 1 γ 1 most one, namely x − + x − 1. bt bu ≤

Proof. We prove the result for x0. The proof for xb was given in the main text. The only values that may differ between x and x0 are the ones for E[γ], so it suffices to analyze ADDITIONAL PROOFS AND RESULTS 66 conflicts for that interval. Note that the only pair of labels that may have a conflict either on E[γ 1] or E[γ] (but not both) is ` and ` . All other conflicts are present on − t u E[γ 1] if and only if they are also present on E[γ]. Let `i and `k be two labels that − γ γ γ γ have a conflict on E[γ]. If neither `i nor `k belongs to L(C), xi0 = xi and xk0 = xk. Thus, the corresponding conflict inequality must be satisfied by x0 (otherwise x would γ γ 1 γ γ 1 not be feasible). If both `i and `k belong to L(C), xi0 = xi − and xk0 = xk− . Thus, γ γ x0 + x0 > 1 implies that this conflict is not present on E[γ 1] (otherwise x would not i k − be feasible). This can only happen if ` , ` = ` , ` and, specifically, if e starts a { i k} { t u} γ conflict range. Finally, if ` L(C) and ` / L(C), then there can be no conflict between i ∈ k ∈ them on E[γ], so the proof is complete. Lemma 3.5 (Forward Copy Lemma). Let C be a component of a conflict graph G[γ]. Let (x, b) be a feasible solution to the ILP from Sect. 3.2. Let Z L(C) be a (possibly ⊆γ empty) set of labels that are inactive on E[γ], i.e., `i Z, x = 0. Let (x,b) = ∀ ∈ i b forward-copy(L(C) Z, (x, b),E[γ 1]). Let ` and ` be the two labels that caused \ − t u conflict event eγ. Then:

1. If C is unaffected on E[γ], (x,b b) is feasible;

2. If C is affected on E[γ] and eγ ends a conflict range, (x,b b) is feasible;

3. If C is affected on E[γ] and eγ starts a conflict range, (x,b b) may violate at most one inequality, namely xγ + xγ 1. bt bu ≤ Proof. If Z = , the result follows directly from Propositions 3.1–3.3. Otherwise, by ∅ Proposition 3.1, (x,b b) satisfies all inequalities (3.1) and (3.2). Now, consider the solution (x0, b0) = forward-copy(L(C), (x, b),E[γ 1]). Note that if two values differ between − x and x0, the one in x must be 0. This implies x x0 (where the comparison is taken b b b ≤ between corresponding entries). Thus, every conflict inequality satisfied by x0 must also be satisfied by xb, and the result follows.

Lemma 3.6. Let C be a component of a conflict graph G[γ]. Let (x∗, b∗) be an optimal solution to the ILP from Sect. 3.2. Then:

γ 1. If C is unaffected on E[γ], δC (x∗) = 0; γ 2. If C is affected on E[γ] and e starts a conflict range, δ (x∗) 1, 0 ; γ C ∈ {− } γ 3. If C is affected on E[γ] and e ends a conflict range, δ (x∗) 0, 1 . γ C ∈ { } Proof. The proof for Cases 1 and 2 was given in the main text. We only address Case 3. γ Let `t and `u be the two labels that caused conflict event eγ. Initially, suppose δC (x∗) 2. γ 1 γ 1 ≥ We must have xt∗ − = 0 or x∗u − = 0 (otherwise x∗ would not be feasible). Suppose w.l.g. γ 1 γ 1 x∗ − = 0. Let (x,b) = backward-copy(L(C) `u , (x∗, b∗),E[γ]). Since x − = 0, the u b \{ } bu Backward Copy Lemma guarantees that (x,b b) is feasible. Moreover, (x,b b) has more visible labels than (x∗, b∗) on E[γ 1], and hence attains a better objective value. Consequently, − γ (x∗, b∗) cannot be optimal. Now, suppose δ (x∗) 1. By the Forward Copy Lemma, C ≤ − (x,b) = forward-copy(L(C), (x∗, b∗),E[γ 1]) is feasible. Also, it has more visible b − labels on E[γ] than (x∗, b∗). Thus, (x∗, b∗) cannot be optimal. ADDITIONAL PROOFS AND RESULTS 67

Theorem 3.8. Let be a set of components such that their associated vertices form I ⊆ A an independent set in G . There always exists a harmonious optimal solution (x∗, b∗) to A the ILP from Sect. 3.2 such that the following is satisfied for all elements of : if C I ∈ I is an affected component of G[γ], and `t and `u are the two labels that caused conflict γ 1 γ γ event e , then for each ` L(C) ` , ` we have x∗ − = x∗ and b∗ = 0. γ i ∈ \{ t u} i i i

Proof. Let (x∗, b∗) be a harmonious optimal solution and suppose it does not satisfy the desired condition. Let C be an affected component of G[γ], and ` and ` be the ∈ I t u two labels that caused conflict event eγ. By Lemma 3.6, if eγ starts a conflict range, γ γ δ (x∗) 1, 0 , otherwise, δ (x∗) 0, 1 . We treat these four cases separately. The C ∈ {− } C ∈ { } feasibility of all solutions considered here follows from the two Copy Lemmas. We omit further references for brevity. The proof for the two cases in which eγ starts a conflict range was given in the main text. We address the other two cases. γ Case 3: eγ ends a conflict range and δC (x∗) = 0. Let (x0, b0) = forward-copy(L(C), γ (x∗, b∗),E[γ 1]). Since δ (x0) = 0, (x0, b0) is optimal, but (possibly) not harmonious. Let − C E[γ],E[γ + 1],...,E[j2] be the lifespan of C. Solution (x,b) = forward-copy(L(C), { } b (x0, b0),E[γ],E[γ + 1],...,E[j 1]) is both feasible and harmonious. Finally, by Lem- 2 − ma 3.6, it is also optimal. γ γ 1 γ 1 Case 4: eγ ends a conflict range and δC (x∗) = 1. We must have xt∗ − = 0 or xu∗ − = 0. γ 1 Suppose w.l.g. x∗u − = 0. Let (x0, b0) = backward-copy(L(C) `u , (x∗, b∗),E[γ]). γ 1 γ \{ } Due to xu0 − = 0, (x0, b0) is feasible. Additionally, since δC (x0) = 1, it has the same objective value as (x∗, b∗), so it is optimal. However, it may not be harmonious. Since ` and ` have a conflict on E[γ 1], they belong to the same component of G[γ 1]. t u − − Thus, C has only one parent, which we denote by D. Let E[j ],E[j + 1],...,E[γ 1] { 1 1 − } be the lifespan of D. Solution (x,b) = backward-copy(L(D), (x0, b0),E[γ 1],E[γ b − − 2],...,E[j1 + 1]) is harmonious and, by Lemma 3.6, also optimal. Table 3.2 is the full version of Table 3.1. It contains all instances that required more than a minute to be solved by the original formulation (except for the two instances that could not be solved even by the reduced formulation, which were reported separately in the main text). Note that columns for the formulation obtained by applying Theorem 3.7 alone were omitted. Instead, we show, in the last column, the duality gap left by the original formulation in the test cases that could not be solved within the given time limit. ADDITIONAL PROOFS AND RESULTS 68

Map n (n ) kR s h %var %con T T T /T %Gap lcc | o 1,2 o 1,2 UK-50 68 (66) 1R s 88.3 83.6 – 205 – 0.46 Italy-50 111 (87) 1R s 95.6 93.5 156 2 98.9 Japan-50 80 (69) 1R s 93.5 90.5 69 1 96.2 USA-50 359 (88) 1R s 90.7 85.4 825 38 21.7 UK-50 68 (66) 2R s 88.3 83.6 240 11 22.1 UK-50 68 (66) 3R s 88.3 83.6 70 6 11.8 France-100 69 (69) 1R s 93.0 90.1 1614 10 162.4 UK-100 37 (37) 1R s 77.4 69.5 890 96 9.3 Italy-100 68 (68) 1R s 92.2 89.4 1161 15 78.4 USA-100 288 (213) 1R s 97.2 95.3 – 1212 – 29.97 France-100 69 (69) 2R s 93.0 90.1 107 4 25.0 USA-100 288 (213) 2R s 97.2 95.3 3228 29 111.9 USA-100 288 (213) 3R s 97.2 95.3 475 12 39.4 London-50 1620 (175) 1R s 94.7 92.0 – 34 – 3.55 Paris-50 2325 (244) 1R s 96.3 93.8 1596 6 249.0 London-50 1620 (175) 2R s 94.7 92.0 552 5 114.0 Paris-50 2325 (244) 2R s 96.3 93.9 170 4 46.0 Berlin-100 2628 (416) 1R s 98.5 97.7 – 39 – 33.48 NYC-100 602 (88) 1R s 91.2 87.1 1012 16 64.4 Berlin-100 2628 (416) 2R s 98.5 97.7 – 11 – 0.01 London-100 1457 (371) 2R s 97.6 96.4 – 47 – 30.33 Paris-100 2141 (952) 2R s 99.3 99.0 – 47 – 50.64 Berlin-100 2628 (416) 3R s 98.5 97.7 4231 2 1940.6 London-100 1457 (371) 3R s 97.6 96.4 – 10 – 0.01 Paris-100 2141 (952) 3R s 99.3 99.0 – 13 – 50.59 USA-100 288 (213) 1R h 97.2 97.9 540 1 1039.0 USA-100 288 (213) 2R h 97.2 97.9 101 1 201.5 London-50 1620 (175) 1R h 94.4 95.4 97 1 123.3 Paris-50 2325 (244) 1R h 96.1 96.2 106 1 109.7 London-50 1620 (175) 2R h 94.4 95.4 97 1 122.2 Paris-50 2325 (244) 2R h 96.1 96.2 75 1 109.7 Berlin-100 2628 (416) 1R h 98.5 98.7 1869 2 1099.2 London-100 1457 (371) 1R h 97.5 98.2 1802 2 928.7 Paris-100 2141 (952) 1R h 99.3 99.5 – 4 – 46.09 Berlin-100 2628 (416) 2R h 98.5 98.7 852 1 660.8 London-100 1457 (371) 2R h 97.5 98.2 773 1 581.5 Paris-100 2141 (952) 2R h 99.3 99.5 – 4 – 43.98 Berlin-100 2628 (416) 3R h 98.5 98.7 323 1 316.3 London-100 1457 (371) 3R h 97.5 98.2 522 2 318.4 Paris-100 2141 (952) 3R h 99.3 99.5 – 3 – 43.75

Table 3.2: Full table of results. Times are given in seconds. Chapter 4

Mosaic Drawings and Cartograms

In this work, we propose the first fully automated method to construct mosaic cartograms. Our procedure consists of two main steps. First, a force-directed heuristic finds suitable positions for each region in the cartogram while maintaining correct adjacencies. Then, using a network flow model, we make small improvements to the regions by changing some of their tiles, in such a way that shapes become more recognizable. Additionally, this last step tries to assign the correct number of tiles to each region. We experimentally validate our approach using varied data sets, and also compare our cartograms to those produced by other methods. This chapter contains the article presented at the 17th Eurographics/IEEE—VGTC Symposium on Visualization (EuroVis 2015). It was published in a special issue of Com- puter Graphics Forum [11]. It is co-authored with Kevin Buchin1, Thom Castermans1, Astrid Pieterse1, Willem Sonke1 and Bettina Speckmann1. Some results were also pre- sented at the 31st European Workshop on Computational Geometry (EuroCG 2015) [10].

Abstract Cartograms visualize quantitative data about a set of regions such as countries or states. There are several different types of cartograms and – for some – algorithms to automatically construct them exist. We focus on mosaic cartograms: cartograms that use multiples of simple tiles – usually squares or hexagons – to represent regions. Mosaic cartograms communicate well data that consist of, or can be cast into, small integer units (for example, electorial college votes). In addition, they allow users to accurately com- pare regions and can often maintain a (schematized) version of the input regions’ shapes. We propose the first fully automated method to construct mosaic cartograms. To do so, we first introduce mosaic drawings of triangulated planar graphs. We then show how to modify mosaic drawings into mosaic cartograms with low cartographic error while main- taining correct adjacencies between regions. We validate our approach experimentally and compare to other cartogram methods.

1Department of Mathematics and Computer Science, TU Eindhoven, the Netherlands.

69 CHAPTER 4. MOSAIC CARTOGRAMS 70

Figure 4.1: US election 2012, electorial college votes. Diffusion cartogram by Mark Newman (University of Michigan), square mosaic cartogram from Wikipedia, square and hexagonal mosaic cartograms computed by our algorithm.

4.1 Introduction

Thematic maps are an effective way to visualize attributes or concepts which are associated with geographic locations. There is a variety of thematic maps that depict quantitative data about a set of regions such as countries or states: choropleth maps, proportional sym- bols maps, necklace maps, flow maps, and cartograms. Quantitative geo-referenced data is nowadays globally available, and hence automated methods to create thematic maps and other geo-visualizations for this type of data become increasingly more important. In this paper we focus on a specific type of cartogram which uses multiples of simple tiles – usually squares or hexagons – to represent regions. In absence of a dedicated name in the literature (they are usually referred to simply as cartograms or – wrongly – as rectangular cartograms), we call such cartograms mosaic cartograms. Cartograms show a data value per input region by scaling each region such that its area is proportional to its data value. Mosaic cartograms show data in multiples of tiles, hence the input data must consist of, or be cast into, small integer units. Mosaic cartograms using squares have been popularized by the New York Times, usu- ally in the context of the US elections, but also to show changing demographics (“The Changing Face of American Catholics” [2]). Mosaic cartograms using hexagons are less frequent, good examples are the in the “Indices of Deprivation 2010” pub- lished by the Leicestershire County Council [1] and the UK census maps by Thomas and Dorling [23]. Quality criteria. There are several quality criteria for cartograms. One of the most important is the cartographic error [12, 13], which is defined for each region as A | c − A /A , where A is the area of the region in the cartogram and A is the specified area s| s c s depending on the data value to be shown. In a mosaic cartogram a region is represented by an edge-connected set of tiles, which we call a configuration. Each configuration must be simple, that is, contain no holes. The mosaic resolution measures the average number of tiles used per region. We consider the following quality criteria in this paper:

Average and maximum cartographic error • Correct adjacencies of configurations: two configurations are adjacent if and only if • the corresponding input regions are adjacent Shape of the regions • Relative positions of the regions • CHAPTER 4. MOSAIC CARTOGRAMS 71

Mosaic resolution • It is generally challenging to simultaneously satisfy all criteria well. We decided to enforce correct adjacencies in our algorithm, that is, we produce only mosaic cartograms which have exactly the same configuration adjacencies as the corresponding regions of the input map. There is a clear trade-off between mosaic resolution and recognizability of the map. A low mosaic resolution, that is a small to medium number of tiles per region, allows users to explicitly count tiles and compare regions. A high mosaic resolution makes it easier to preserve shapes and relative positions, and to achieve zero cartographic error. Fortunately, our method is often able to create cartograms with low, or even zero, cartographic error for relatively low mosaic resolutions. We have to note, though, that some rounding error is implicit in our method: whenever the input data does not consist of small integers, it first needs to be converted. Most handmade mosaic cartograms neither preserve the adjacencies of all input regions nor their shapes. A common semi-automated approach is to take a map or a contiguous area cartogram and to overlay it with a suitable grid. This requires a rather high mosaic resolution, since otherwise rounding errors will easily destroy or create adjacencies. Fur- thermore, mosaic cartograms created in this way usually do not have zero cartographic error. Results and organization. We propose the first method to create mosaic cartograms fully automatically. Our cartograms have correct adjacencies, can achieve low mosaic resolution, low or zero cartographic error, and preserve shapes and relative positions of regions rather well. To compute our cartograms we introduce mosaic drawings of triangulated planar graphs (Section 4.3). To compute mosaic cartograms, we start with a mosaic drawing of the (augmented) dual of the input map. We then use an iterative method to grow (or shrink) the configurations according to the input data. While doing so, we maintain the correct adjacencies at all times. The details of our algorithm can be found in Section 4.4. In Section 4.5 we validate our approach experimentally using various data sets and maps, also in comparison with the currently best methods for contiguous area and rectangular cartograms. We conclude with a discussion in Section 4.6.

4.2 Related Work

Cartograms. The most common cartograms are contiguous area cartograms. Here the regions are deformed in such a way that adjacencies are kept. Various methods to con- struct cartograms of this type have been proposed [12, 13, 14, 16, 17, 24]. Contiguous area cartograms perform well if the data values are positively correlated to the land areas of the input regions, but producing good cartograms if this is not the case remains a challenge. A cartogram should convey the values per region, so the user should easily be able to estimate region sizes. The size of regions in contiguous area cartograms is generally hard to judge. To remedy this situation several types of cartograms depict regions us- ing simple geometric shapes. Circular cartograms [11] represent each region by a circle CHAPTER 4. MOSAIC CARTOGRAMS 72 which is scaled such that its area is proportional to the data value. Similarly, rectangu- lar cartograms [21] represent each region by a rectangle. Demer cartograms use squares instead of circles. The shapes (circles, squares, or rectangles) are placed without overlap such that two shapes touch if the corresponding regions are adjacent. Relative positions between regions are preserved as well as possible. Circular and Demer cartograms remain a challenge to produce: the circles and squares are often placed via iterative methods and might be moved far from their original position and in arbitrary directions, making it difficult to find the circle (or square) of a particular region. Algorithms to construct rect- angular cartograms [4, 5, 18, 22] use graph-theoretic approaches to preserve adjacencies and relative positions. However, the rectangular shape imposes limitations on the possible layout. Therefore, other related approaches which loosen the adjacency requirements but keep some spatial proximity of the rectangles are rectangular map approximations [15] and spatial treemaps [26]. The rectangular shape is not very recognizable and furthermore, rectangular car- tograms exist only for maps with a dual graph that does not contain separating 3-cycles (no countries with only three neighbors). Mumford et al. [9] hence initiated the study of rectilinear cartograms where each region is represented by a rectilinear polygon. They showed that for any triangulated planar graph and any set of positive input weights, a rectilinear cartogram of bounded complexity, with correct adjacencies and with zero car- tographic error, exists. Alam et al. [3] proved that complexity 8 (each region has at most 8 vertices) is sufficient. This bound is tight, since complexity 8 is necessary to represent every triangulated planar graph. Mumford et al. [10] also developed a practical method for rectilinear cartograms, the resulting maps use mostly rectangles and require only few shapes of higher complexity. Hexagon mosaic maps, closely related in name to mosaic cartograms, are in fact a type of thematic map which uses (parts of) hexagonal tilings as an abstract thematic overlay to show broad patterns [6].

4.3 Mosaic Drawings

We define mosaic drawings for plane triangulated graphs, that is, planar graphs with a given embedding where every interior face is a triangle. Mosaic drawings are drawn on a tiling of the plane. Of particular interest are the uniform, and especially the regular tilings, although other types of tilings might also result in intriguing drawings. There are three types of regular tilings: the triangular, the square, and the hexagonal tiling. The triangular tiling uses two different rotations of the basic triangular shape and hence is visually a little more complex than the square or the hexagonal tiling. We call a set of edge-connected tiles of a tiling a configuration. We say that a T configuration C is simple if the tiles in C are simply connected (C has no holes). Two configurations C and C are adjacent if and only if there is at least one tile t C and 1 2 1 ∈ 1 at least one tile t2 C2 such that t1 and t2 are edge-connected. A mosaic drawing (G) ∈ DT of plane triangulated graph G = (V,E) on represents every vertex v V by a simple T ∈ configuration C(v) of edge-adjacent tiles from in such a way that two vertices v and u T CHAPTER 4. MOSAIC CARTOGRAMS 73 of G are connected by an edge e = (v, u) if and only if the configurations C(v) and C(u) are adjacent. We say that a mosaic drawing is simple if the union of all configurations is simply connected, that is, the drawing has no holes (see Fig. 4.2). Mosaic drawings can be seen as a type of contact representation, since they do not draw edges explicitly, but imply them by the contact of the configurations. There is an extensive body of work on contact representations in the Graph Drawing community, surveying it here goes beyond the scope of this paper.

Figure 4.2: A simple mosaic drawing on a hexagonal tiling.

Square and hexagonal grids. To show that any plane triangulation has a simple mosaic drawing on a square and hexagonal tiling we use a method which is based on orderly spanning trees [7] (see Fig. 4.3). Orderly spanning trees are spanning trees with certain desirable order relations between the nodes. Chiang et al. [7] show how to compute an orderly spanning tree ST for a planar triangulation G. They then construct a (vertical) visibility drawing for ST , which is stretched into a 2-visibility drawing of G. Finally they grow horizontal branches to fill up gaps. The result is a square mosaic drawing of G. Since at most three regions meet at each intersection, we can directly shear the same drawing onto a hexagonal grid and so obtain a hexagonal mosaic drawing with the same complexity.

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

Figure 4.3: Constructing simple mosaic drawings for square and hexagonal grids via an orderly spanning tree (adapted from [7]). CHAPTER 4. MOSAIC CARTOGRAMS 74

4.4 Computing Mosaic Cartograms

Our input is a map M represented as a planar subdivision and a graph GM which is the (weak) dual of M. We assume that GM is a planar triangulation, or otherwise simply tri- angulate GM . Each vertex v of GM has a positive integral weight w(v) which corresponds to the data value that is to be represented in the cartogram. The face of M associated with v is denoted by F (v). A mosaic cartogram for GM is a simple mosaic drawing of G where each configuration C(v) consists of exactly w(v) tiles for each vertex v V . M ∈ The starting point for our approach is a simple mosaic drawing (GM ) for a given DT tiling . The steps that follow transform (GM ) in such a way that the final result is T DT still a simple mosaic drawing. In particular, every operation we execute guarantees that all adjacencies are maintained and all configurations remain connected (although they might sometimes contain holes at an intermediate step). The transformation process has two main steps. First, given the initial mosaic drawing

(GM ), we use an iterative method to grow (or shrink) the configurations in (GM ) DT DT according to the input data. While doing so, we maintain the correct adjacencies at all times. We use so-called guiding shapes – configurations which represent the desired final state of each configuration C(v) – to slowly nudge each configuration towards the correct number of tiles and the correct shape. Second, we finalize the cartogram by correcting the size of each configuration while trying to preserve the previously computed shapes as much as possible. The algorithm can be summarized as follows.

begin MosaicCartograms Compute mosaic drawing (GM ) (Sect. 4.4.1) Move and reshape configurationsDT (Sect. 4.4.2) Correct sizes of configurations (Sect. 4.4.3)

4.4.1 Compute mosaic drawing (GM ) DT We compute a simple mosaic drawing (GM ) of GM using the drawing algorithm based DT orderly spanning trees [7] (see Fig. 4.3). Unfortunately, the orderly spanning trees created by Chiang et al. [7] have a tendency to “curl inwards”. The resulting mosaic drawings often do not retain any of the relative positions of the input nodes and are hence a rather poor starting point for mosaic cartograms (see Fig. 4.4 left). However, the spanning trees induced by a Schnyder labeling are also orderly spanning trees [19] and lead to mosaic drawings which do capture a significant part of the relative positions of the input (see Fig. 4.4 right top).

4.4.2 Move and reshape configurations

Guiding shapes. Given a vertex v of GM , a guiding shape S(v) is a configuration that represents the desired final state of C(v) (see Fig. 4.5). S(v) has the exact number of tiles that must be in C(v) and its outline resembles as much as possible the outline of F (v). We compute guiding shapes as follows. CHAPTER 4. MOSAIC CARTOGRAMS 75

Figure 4.4: US: mosaic drawing based on Chiang et al. [7] (left) and on Schnyder labeling (top right), area cartogram with 1 square 5000 km2. ≈

Figure 4.5: Guiding shapes for Italy with 20, 28 and 40 tiles.

Let a( ) be the area of each tile of and let n (v) be the desired number of tiles for T T S S(v). We compute a guiding shape for v by first scaling F (v) so that its area becomes a( ) n (v), which is the target area for S(v). We denote the scaled shape by F 0(v). We T · S overlay F 0(v) with the tiling and assign to S(v) a set of nS(v) connected tiles which have the largest intersections with F 0(v). We observe that the exact placement of F 0(v) has an influence on the result, especially for low-resolution cartograms. Therefore, we repeat this procedure for several slightly translated copies of F 0(v) to obtain different candidates for S(v). We then choose the one with minimum symmetric difference with respect to F 0(v). Iteratively moving and reshaping. As shown below, this iterative procedure gradually transforms the mosaic drawing seeking to minimize the symmetric difference between each configuration and its associated guiding shape.

begin MoveAndReshape( (GM )) while termination conditionDT not reached do Transform configurations of (GM ) Move guiding shapes DT

Figure 4.6 illustrates the execution of the move and reshape algorithm. Each guiding shape S(v) is placed on the grid in such a way that it contains at least one tile from CHAPTER 4. MOSAIC CARTOGRAMS 76 configuration C(v). The transformation step tries to assign the tiles contained in each each S(v) to C(v). Although configurations can never overlap, guiding shapes might. Thus, different configurations often compete for the same tiles (see steps 2 and 4 in Fig. 4.6). After assigning tiles to each configuration C(v) we move the guiding shapes (steps 3 and 5 in Fig. 4.6) to minimize overlap.

Figure 4.6: The move and reshape algorithm executed on an instance containing Portugal, Spain and France.

Reshaping. We reshape configurations with two basic operations. Given a tile t ∈ T and a vertex v of GM , set(t, v) assigns t to C(v) (and, consequently, removes t from any other configuration) and unset(t) removes t from (GM ). An operation is valid if DT after its execution all adjacencies remain correct and all configurations remain connected (holes are permitted in this step to give more freedom to the algorithm). Let ∆(v) be the symmetric difference between C v and S v , and let G P v . We ( ) ( ) ∆( M ) = v GM ∆( ) ∈ execute all valid operations that cause ∆(GM ) to decrease. Given two vertices u and v of G and a tile t C(u), the value of ∆(G ) remains M ∈ M constant after executing set(t, v) if t S(u) S(v). To decide whether or not to ∈ ∩ execute the operation, we consider the symmetric difference normalized by the desired

final size of the configurations ∆norm(v) = ∆(v)/nS(v). We want to reduce the largest normalized distance. Thus, we execute the operation only if it decreases the value of max(∆norm(u), ∆norm(v)). Moving. Once no more reshaping is possible, we move the guiding shapes with a force- directed algorithm. Each guiding shape S(v) is represented by a point p(v) which is initially placed on the barycenter of S(v). We define a time step tstep and iteratively compute the force f~(v) acting on p(v) during each time interval. In each iteration, we update the position of p(v) and every time the tile that contains p(v) changes, we move the guiding shape S(v) accordingly (see ForceDirectedAlgorithm). Each point p(v) is affected by attraction and repulsion forces. Two points p(u) and p(v) attract each other if and only if u and v are adjacent in GM . We define distance(S(u),S(v)) as the length of the shortest path in that connects any tile in S(u) to any tile in S(v) if T S(u) S(v) = , or 1 otherwise. The direction of the force follows the line that contains ∩ ∅ the barycenters of S(u) and S(v). Its intensity is given by 100 distance(S(u),S(v)). · A pair of points p(u) and p(v) is affected by repulsion forces whenever there is an overlap between S(u) and S(v). Reversing the construction of the guiding shapes, each CHAPTER 4. MOSAIC CARTOGRAMS 77

begin ForceDirectedAlgorithm while not all forces are null and no guiding shapes have been moved do foreach v G do ∈ M Compute f~(v) Let t be the tile that contains p(v) ∈ T p(v) = p(v) + tstep f~(v) · Let t0 be the new tile that contains p(v) ∈ T if t = t0 then 6 Let m be a translation that takes t to t0 Apply m to all tiles in S(v) tile t S(v) can be mapped to a point q (t) in the input map M (see Fig. 4.7). A ∈ v tile t which is contained in S(u) S(v) is mapped to two different points q (t) and ∩ u qv(t). The relative position of qu(t) and qv(t) determines the direction of the repulsion P qu(t) qv(t) force: − . The intensity of the repulsion force for p(v) depends on t S(u) S(v) qu(t) qv(t) the number∈ of∩ overlapping|| − tiles|| in S(u) and S(v), which we denote by card(S(u) S(v)). ∩ Let k = card(S(u) S(v))/n (v). The intensity of the repulsion force that acts on p(v) uv ∩ S is given by 500 (1 + k ) if u and v are adjacent in G , and 200 (1 + k ) otherwise. · uv M · uv

t qu(t) qv(t)

Figure 4.7: Tile t mapped to two points in the input map M and the corresponding direction of the repulsion forces.

To avoid guiding shapes moving too far from their associated configurations, we stop the moving procedure as soon as the first guiding shapes move. Furthermore, to avoid convergence towards a bad position, we randomly change the position of every guiding shape S(v) for which ∆norm(v) 1 for more than 50 time intervals. ≥ Termination. MoveAndReshape stops if the system converges to a rest point in which all forces are null. Since we cannot guarantee convergence, we also set a maximum number of iterations after which the procedure is interrupted. If the target mosaic resolution is high we run MoveAndReshape several times with increasing mosaic resolution for the guiding shapes, using the result of the previous run as input for the next. We initially use guiding shapes with an average of 10 tiles per configuration and increase sizes by a factor of √2 until the target resolution is reached. CHAPTER 4. MOSAIC CARTOGRAMS 78

4.4.3 Correct sizes of configurations

The previous step creates a mosaic drawing (GM ) with correct adjacencies and con- DT figurations C(v) which are as good a match as possible with their guiding shapes S(v). We now show how to correct the size and shape of each configuration to obtain a simple mosaic cartogram with low or zero cartographic error. We say that a tile t is a sea ∈ T tile if it is not part of C(v) in (GM ) for any v GM . All the other tiles are land DT ∈ tiles. We model the correction of configuration sizes as a Minimum Cost Flow Problem (MCFP) which pushes excess land tiles out towards the sea and pulls in extra sea tiles to grow configurations in need. Let D = (N,A) be a directed graph in which each node i N has capacity u (the ∈ i maximum amount of flow allowed through i) and supplies bi units of flow to the network (if b is negative, it actually demands flow from the network). Each arc (i, j) A has i ∈ capacity uij (the maximum amount of flow allowed through (i, j)) and cost cij (the cost per unit of flow on (i, j)). A land tile t C(v) is a boundary land tile if it has at least ∈ one neighbor t0 / C(v). Similarly, a sea tile is a boundary sea tile if it has at least one ∈ neighbor which is a land tile. All other tiles are called inner tiles. The set of boundary tiles of a configuration C(v) is denoted by B(v). The set of boundary sea tiles is denoted by Bsea. Each tile t is represented by a node n in D. Nodes that represent adjacent tiles ∈ T t are connected with incoming and outgoing arcs (see Fig. 4.8). Let s C(u) and t C(v) ∈ ∈ be two adjacent land tiles. A unit of flow from ns to nt represents the operation of adding tile s to C(v) and removing it from C(u). This is equivalent to performing the operation set(s, v) (see Sect. 4.4.2). If s is a land tile and t is a sea tile, adding s to the sea is the same as executing the operation unset(s).

ci j = 0 ui j = 1 ci j = 1 ui j = ∞ ci j = 2

Figure 4.8: A mosaic drawing, guiding shapes as overlay, and the associated MCFP instance. The feasibility node is omitted for simplicity. Boundary nodes are represented by circles and supply nodes by squares. Sea nodes are white. The supplies are bred = bgreen = 0, bblue = 1 and b = 1. − nsea If s and t belong to the same configuration, any flow between the corresponding vertices is irrelevant. That is, we do not need to represent inner tiles in D. Moreover, since flow on an arc is analogous to the operations set and unset, we add an arc to D only if the corresponding operation is valid. Finally, a tile t can be assigned only to one unique configuration. Thus, we allow at most one unit of flow through node nt and any incident arcs also have a capacity of one. CHAPTER 4. MOSAIC CARTOGRAMS 79

We also add one supply node nv per configuration C(v). This supply node encodes the amount of tiles to be added to or removed from C(v). Because of the capacity restrictions we impose on boundary nodes, it is possible that no feasible flow exists. Hence we add a “feasibility node” with infinite capacity and arcs with infinite cost to and from every other node. We can now describe all nodes and arcs of D:

Boundary nodes: a node n for each boundary tile t with capacity u = 1 and • t nt supply bnt = 0;

Supply nodes: a node n for each vertex v of G and a node nsea for the sea. All • v M supply nodes have infinite capacity. Let nC (v) be the number of tiles in C(v) and nS(v) be the number of tiles in S(v). Given a vertex v of GM , the supply of nv is b n v n v . The supply of n is b P n v n v . nv = C ( ) S( ) sea nsea = v GM S( ) C ( ) − ∈ −

Feasibility node: one node nfeas with infinite capacity and zero supply to guarantee • that the instance will always have a feasible flow.

Given two boundary nodes n and n , we add arcs (n , n ) and (n , n ) if and only • s t s t t s if s and t are not in the same configuration and if the corresponding set/unset operations are valid. Both arcs have capacity of one (costs are discussed below).

Given a supply node n and a boundary node n , we add arcs (n , n ) and (n , n ) • v t v t t v if and only if t C(v). Both arcs have infinite capacity and zero cost. ∈

Given any node n of D, we add arcs (n, nfeas) and (nfeas, n), both with infinite • capacity and infinite cost.

Since all arcs incident to nfeas have infinite cost, they will be used only as a last resort. But the capacity restrictions we impose on boundary nodes often force the use of some of these arcs. After solving the flow problem we execute the operations according to the flow on the arcs between boundary nodes. If the cartographic error is greater than zero, we rebuild the model with the modified drawing and repeat until either we obtain a cartogram with zero cartographic error, or the flow model cannot make any more changes. We want to prevent the model from deforming the shapes of the configurations. If we need to choose a tile t to be added to some configuration C(v), we would like to choose it such that t S(v) (or, if not possible, not too far from S(v)). Similarly, if we need ∈ to remove a tile t from C(v), we would like to choose one that is not contained in S(v) (or, if not possible, not too deep inside S(v)). Hence we assign costs to the arcs between boundary nodes to encourage this behavior. Specifically, for a guiding shape S(v) and a tile t / S(v), we define distance(t, S(v)) as the length of a shortest path in from t to ∈ T any tile of S(v). For t S(v), we define depth(t, S(v)) as the length of a shortest path ∈ in from t to any tile t0 / S(v). Let s C(u) and t C(v) be two adjacent boundary T ∈ ∈ ∈ tiles. The cost of the arc (n , n ) is initially zero. If s S(u), we add depth(s, S(u)) to s t ∈ the cost, otherwise we subtract distance(s, S(u)). If t S(v), we subtract depth(t, S(v)) ∈ from the cost, otherwise we add distance(t, S(v)). CHAPTER 4. MOSAIC CARTOGRAMS 80

Figure 4.9: Europe population in 2010: 1 hexagon per 2 million, 413 hexagons (left), 1 hexagon per 500.000, 1629 hexagons (middle), 1 hexagon per 125.000, 6517 hexagons (right).

4.5 Experimental Evaluation

We created a proof-of-concept implementation in Java. Computing the small mosaic cartograms takes less than a minute, the larger, high resolution ones, take 10-15 min. The mosaic resolution has a clear influence on the look & feel of the cartograms. Fig. 4.9 shows three hexagonal mosaic cartograms of the population of Europe (including the European parts of Russia). The leftmost cartogram has the lowest possible resolution to include all countries. It is rather schematic and the shapes of small countries are not recognizable. As the resolution increases, all shapes improve. However, individual hexagons are not identifiable (let alone countable) in the highest resolution cartogram. The middle realizes a reasonable trade-off between shape and resolution. In the limit – if the mosaic resolution tends to infinity – mosaic cartograms essentially turn into contiguous area cartograms.

Figure 4.10: US area. 1 hexagon Rhode Island 4001 km2, 1928 hexagons (left); standard federal regions I–IV removed,≈ 2 resp. 1 hexagons≈ Indiana 94326 km2, 130 and 67 hexagons (right top resp. right bottom). Cut line indicated≈ in left≈ figure.

Our algorithm often produces mosaic cartograms with zero cartographic error even for low mosaic resolutions. Of course it is interesting to see how low we can go. In Fig. 4.10 we show three hexagonal mosaic cartograms of the area of the contiguous United States. The top figure is the smallest resolution we can use without losing the smallest state. CHAPTER 4. MOSAIC CARTOGRAMS 81

Since the East Coast contains many of the smallest states, we remove standard federal regions I–IV . Now Indiana is the smallest state. If we use 1 hexagon for Indiana, then our algorithm is not able to solve without error. In particular, in Fig. 4.10 bottom right all adjacencies are still correct, but three hexagons are allocated incorrectly: Arkansas, Oklahoma and Missouri would like one hexagon less. If we give 2 hexagons to Indiana, then our algorithm finds a solution without error. Table 4.1 lists the results of a quantitative comparison of our mosaic cartograms with the currently best methods for contiguous area [14] and rectangular cartograms [5]. The contiguous area cartograms are computed with the diffusion method by Gastner and Newman [14], for brevity we refer to them as diffusion cartograms. We use the cart program [20] provided by Newman with a sample grid resolution of 3200 1600 points × over the map area.

average maximum average data set cartographic error cartographic error symm. diff. RC DF MH MO RC DF MH MO DF MH MO US Census data (2010) resident population 2000 0.05 0.04 0.01 (0.001) 0.02 (0.002) 0.34 0.25 0.33 (1) 0.50 (1) 0.75 0.42 0.43 RP < 5 years (%) 0.04 0.02 0.00 (0.000) 0.00 (0.000) 0.16 0.09 0.00 (0) 0.00 (0) 0.55 0.30 0.34 RP total females (%) 0.03 0.02 0.00 (0.000) 0.00 (0.000) 0.16 0.08 0.00 (0) 0.00 (0) 0.55 0.32 0.32 businesses without empl. 0.00 0.01 0.01 (0.001) 0.03 (0.003) 0.03 0.05 0.50 (1) 1.00 (2) 0.42 0.42 0.47 population (per sq. mile) 0.08 0.01 0.04 (0.002) 0.11 (0.008) 0.65 0.05 1.00 (1) 1.00 (3) 0.41 0.53 0.56 World Factbook data (Europe, 2013) GDP real growth rate 0.11 0.03 0.06 (0.028) 0.03 (0.045) 0.60 0.46 1.50 (18) 0.96 (23) 0.58 0.82 0.70 electricity – production 0.00 0.06 0.05 (0.002) 0.12 (0.006) 0.03 0.75 1.00 (1) 1.00 (1) 0.86 0.43 0.47 exports 0.01 0.05 0.13 (0.007) 0.32 (0.045) 0.03 0.43 2.00 (2) 4.00 (20) 0.80 0.56 0.58 population 0.00 0.04 0.00 (0.000) 0.04 (0.004) 0.01 0.18 0.00 (0) 1.00 (1) 0.62 0.41 0.54 current account balance 0.05 0.04 0.14 (0.012) 0.28 (0.019) 0.49 0.60 3.00 (3) 3.00 (3) 0.84 0.65 0.68

Table 4.1: Average cartographic error, maximum cartographic error and average sym- metric difference for rectangular cartograms (RC), diffusion cartograms (DF) and mosaic cartograms on the hexagonal grid (MH) and the orthogonal grid (MO). The values for rectangular cartograms are taken from Buchin et al. [5]; the average of 20 runs is used. Mosaic cartograms were constructed with mosaic resolution 20, that is, with an average of 20 tiles per region. Values for symmetric differences are normalized by the size of each region.

The data sets ([8] and [25]) are a subset of those used in [5] and showcase a variety of simple and hard instances. To be consistent with the rectangular cartogram method, we represent each region by a contiguous shape, even if it is in fact the union of several disjoint shapes (Michigan or Greece). All three methods keep correct adjacencies. We measured the quality of shape by computing the average symmetric difference of the (scaled) original regions and the corresponding regions in the cartogram, after aligning the region centroids. Diffusion cartograms tend to have a slightly larger symmetric difference than mosaic cartograms, but overall, the performance of the methods is comparable. The mosaic cartograms were computed with a low mosaic resolution. Hence small regions can create CHAPTER 4. MOSAIC CARTOGRAMS 82 a large cartographic error, for example, by using two instead of one hexagon. Hence we included in brackets the maximum number of wrongly allocated hexagons for the worst region (under the maximum), and the total number of wrongly allocated hexagons divided by the total number of hexagons (under the averages). Mosaic cartograms on the orthogonal grid often have a significantly higher error than mosaic cartograms on the hexagonal grid. This might be explained by the fact that tiles in the hexagonal grid have six neighbors and adjacencies can hence more easily be maintained without having to allocate undesired tiles to a region. Table 4.2 shows the results of further experiments with hexagonal and orthogonal grids. For each instance, we started by creating a cartogram with a mosaic resolution of 5. Then we increased the resolution in increments of 5 until a mosaic cartogram with zero cartographic error was obtained. The experiment was interrupted at a resolution of 150 if no error-free cartogram was found.

data set R10 R5 R0 MH MO MH MO MH MO US Census data (2010) resident population 2000 5 10 10 15 25 30 RP < 5 years (%) 5 5 5 5 5 10 RP total females (%) 5 5 5 5 5 5 businesses without empl. 5 10 10 15 30 30 population (per sq. mile) 10 20 10 - 40 - World Factbook data (Europe, 2013) GDP real growth rate 50 60 50 60 50 80 electricity – production 5 20 5 20 40 40 exports 10 35 30 55 60 140 population 10 10 10 10 15 45 current account balance 20 35 35 55 50 150

Table 4.2: Minimum resolution RE to obtain a cartogram with at most E incorrect tiles on the hexagonal grid (MH) and the orthogonal grid (MO).

We excluded rectilinear cartograms from the comparison in Table 4.1. Rectilinear cartograms always have correct adjacencies and zero cartographic error. Furthermore, it is unclear how to measure the quality of the region shapes, given that rectilinear cartograms use mostly rectangles, with some thin connectors to guarantee correct adjacencies. In Fig. 4.11 we show the same data sets in all four methods to allow for visual comparison. Fig. 4.12 visually compares diffusion and mosaic cartograms on a challenging data set. The diffusion cartogram exhibits the characteristic bulby and spiky artifacts, whereas the mosaic cartogram has many well-shaped regions. However, to preserve correct adjacencies, some regions in the mosaic cartogram have to grow tentacles (Indiana), while others are separated by thin channels (Texas and Arizona). Some of the smaller regions also essentially turn into thin, hardly recognizable “snakes”. CHAPTER 4. MOSAIC CARTOGRAMS 83

ME MT ND VT NH WA MTND ME WA WY SD ID VT NH ID WI OR MN WI NE MN MI OR NY MI MA SD CO WY IA IL IN UT KS NE NVUT IA OH CT RI MA NV OK CO KS MO OH PA PA NY IL CA KY NJ OK WV IN OH MO MD AR VA MD DE CA WV AZ NM NM NJ CT RI DE TN VA TX AR KY AZ NC TN NC TX SC LAMS LA SC GA MS AL GA AL FL FL

ME VTNH

WA NY MA MI OR MN WI ND ID MT CT RI WY SD NE IA PA NV UT OH NJ CO KS IL IN MD CA WV MO DE OK KY VA AZ NM NC AR TN SC TX MS AL GA LA

FL

Figure 4.11: Businesses without paid employees in the US: rectilinear (top left) [10], rectangular (top right) [5], contiguous area (bottom left) [14], and mosaic cartogram (bottom right). The mosaic cartogram uses 1 square per 10.000 businesses. See Table 4.1 for statistics.

4.6 Discussion and Future Work

We presented the first method to construct mosaic cartograms fully automatically. Our cartograms have correct adjacencies and zero or very low cartographic error. They pre- serve the shapes of the input regions well, even for low mosaic resolutions. Mosaic car- tograms visually clearly outperform rectilinear cartograms. They are a very good alterna- tive to rectangular cartograms, combining the ease of area determination with improved region shapes. Our mosaic cartograms also compare well with diffusion cartograms, ob- taining comparable error and shape preservation bounds. In cases in which shapes need to drastically change to achieve low cartographic er-

2000 VT NH ME VT NH ND ME WA MT WA SD WY MA WY SD MA NY OR NY ND 1500 CT MN WI MI MN ID CT OR MT WI MI RI ID PA PA IA NJ NE IA RI NE OH NV UT NJ NV OH CA IL MD CO MD CO IN IL IN KS DE 1000 KS VA DE CA WV MO OKMO VA AZ KY KY TN NC NC LA SC WV AZ AR TN SC TX AL GA GA UT TX AL 500 NM OK NM MS FL LA MS FL AR

Figure 4.12: US Starbucks locations in 2009. The mosaic map uses 1 hexagon per location. CHAPTER 4. MOSAIC CARTOGRAMS 84 ror, our method still shows some undesirable behavior. Firstly, our guiding shapes seem too rigid. In US cartograms the coastal states typically have to be enlarged. Our current guiding shapes aim to achieve this by moving these states but keeping their shape fixed. It might, however, be better to allow some non-uniform scaling in these cases. For instance, in Fig. 4.11 and 4.12 “fattening” California would allow to place Oregon and Washington north of California. Secondly, the last step of the algorithm is intended to make minor corrections to the sizes of configurations, but can result in long, thin extensions of re- gions if larger corrections are necessary. This problem in particular occurs if the mosaic resolution is high, and therefore many small mosaics need to be transferred in this step. See Fig. 4.12, where several of the smaller regions have long thin extensions to guarantee correct adjacencies. Note that the diffusion method has the same problem: New Mexico (NM) connects to Utah (UT) and Oklahoma (OK) via narrow (essentially, zero-width) corridors. In a mosaic cartogram, however, any such corridor will have at least the width of the tiles, which gives more visual emphasis to this issue. An obvious direction for future work are other types of tilings, most notably the triangular tiling. Our method in principle extends to any uniform tiling, however, one first has to prove similar results for the existence of mosaic drawings on these tilings. It would also be interesting to develop a method suitable for morphs between different data sets. We cannot simply use our current method with one cartogram as the input for the other, since our guiding shapes move rather abruptly, tearing holes into the intermittent drawings. This behavior is necessary to avoid local minima, but is completely unsuitable for smooth morphs.

Acknowledgements. R. Cano is supported by FAPESP under projects 2012/00673-2 and 2013/23571-3. K. Buchin and B. Speckmann are supported by the Netherlands Or- ganisation for Scientific Research (NWO) under project no. 612.001.106 and 639.023.208, respectively. Bibliography

[1] URL http://www.lsr-online.org/uploads/id2010---headline-results- 080411.pdf. Accessed 2015/03/06.

[2] URL http://www.nytimes.com/interactive/2008/04/13/us/ 20080412_CATHOLIC_GRAPHIC.html. Accessed 2015/03/06.

[3] Md. Jawaherul Alam, Therese C. Biedl, Stefan Felsner, Michael Kaufmann, Stephen G. Kobourov, and Torsten Ueckerdt. Computing cartograms with optimal complexity. Discrete & Computational Geometry, 50(3):784–810, 2013.

[4] K. Buchin, B. Speckmann, and S. Verdonschot. Optimizing regular edge labelings. In Proc. 18th International Symposium on Graph Drawing (GD 10), LNCS 6502, pages 117–128, 2011.

[5] Kevin Buchin, Bettina Speckmann, and Sander Verdonschot. Evolution strategies for optimizing rectangular cartograms. In Proc. 6th International Conference on Geo- graphic (GIScience), volume 7478 of Lecture Notes in Computer Science, pages 29–42. Springer, 2012.

[6] Daniel B. Carr, Anthony R. Olsen, and Denis White. Hexagon mosaic maps for display of univariate and bivariate geographical data. Cartography and Geographic Information Systems, 19(4):228–236, 1992.

[7] Yi-Ting Chiang, Ching-Chi Lin, and Hsueh-I Lu. Orderly spanning trees with appli- cations. SIAM Journal on Computing, 34(4):924–945, 2005.

[8] CIA World Factbook. URL http://web.archive.org/web/20120313123513/ https://www.cia.gov/library/publications/the-world-factbook/. accessed 2015/03/06.

[9] M. de Berg, E. Mumford, and B. Speckmann. On rectilinear duals for vertex-weighted plane graphs. Discrete Mathematics, 309(7):1794–1812, 2009.

[10] M. de Berg, E. Mumford, and B. Speckmann. Optimal BSPs and rectilinear car- tograms. International Journal of Computational Geometry and Applications, 20(2): 203–222, 2010.

[11] D. Dorling. Area Cartograms: their Use and Creation, volume 59 of Concepts and Techniques in Modern . University of East Anglia, Environmental Publi- cations, Norwich, 1996.

85 BIBLIOGRAPHY 86

[12] J. A. Dougenik, N. R. Chrisman, and D. R. Niemeyer. An algorithm to construct continous area cartograms. Professional Geographer, 3:75–81, 1985.

[13] H. Edelsbrunner and E. Waupotitsch. A combinatorial approach to cartograms. Computational Geometry: Theory and Applications, 7:343–360, 1997.

[14] M. Gastner and M. Newman. Diffusion-based method for producing density- equalizing maps. Proceedings of the National Academy of of the United States of America (PNAS), 101(20):7499–7504, 2004.

[15] Roland Heilmann, Daniel A. Keim, Christian Panse, and Mike Sips. Recmap: Rect- angular map approximations. In Proceedings of the IEEE Symposium on Information Visualization (INFOVIS), pages 33–40, 2004.

[16] D. Keim, S. North, and C. Panse. Cartodraw: A fast algorithm for generating contiguous cartograms. IEEE Transactions on Visualization and Computer Graphics, 10:95–110, 2004.

[17] C. Kocmoud and D. House. A constraint-based approach to constructing continu- ous cartograms. In Proceedings International Symposium on Spatial Data Handling (SDH), pages 236–246, 1998.

[18] Marc van Kreveld and Bettina Speckmann. On rectangular cartograms. Computa- tional Geometry: Theory and Applications, 37(3):175–187, 2007.

[19] K. Miura, M. Azuma, and T. Nishizeki. Canonical decomposition, realizer, Schny- der labeling and orderly spanning trees of plane graphs. International Journal of Foundations of Computer Science, 16(1):117–141, 2005.

[20] Mark Newman. Cart: Computer for making cartograms. URL http:// www-personal.umich.edu/~mejn/cart/. Accessed 2015/04/10.

[21] E. Raisz. The rectangular statistical cartogram. Geographical Review, 24:292–296, 1934.

[22] B. Speckmann, M. van Kreveld, and S. Florisson. A linear programming approach to rectangular cartograms. In Proceedings 12th International Symposium on Spatial Data Handling (SDH), pages 527–546, 2006.

[23] Bethan Thomas and Danny Dorling. Advances in the human cartography of the uk. The Cartographic Journal, 41(2):109–115, 2004.

[24] W. Tobler. Pseudo-cartograms. The American Cartographer, 13:43–50, 1986.

[25] USA Census Bureau. URL http://web.archive.org/web/20111020043143/http: //quickfacts.census.gov/qfd/download/DataSet.txt. accessed 2015/03/06.

[26] Jo Wood and Jason Dykes. Spatially ordered treemaps. IEEE Transactions on Visualization and Computer Graphics, 14:1348–1355, 2008. Chapter 5

Sea Regions for Rectangular Cartograms

Rectangular cartograms are interesting forms of visualization due to the simplicity of the shapes that are employed. On the one hand, the outline of the original regions is lost in the cartogram. On the other, visually comparing the size of regions is a lot easier with rectangles than with other more complex shapes. This makes this kind of visualization especially appealing. However, the loss of the regions’ outline must be compensated, so that recognizability is preserved. One way to do this is by carefully choosing sea regions. Sea regions, as the name suggests, represent seas and oceans. They are artificial regions added during the construction of the cartogram to improve the outline of land masses. The heuristic presented here is the first automated method for the creation of sea regions. In this work, we show how to incorporate it into an existing construction method. This chapter corresponds to the paper presented at the 30th European Workshop on Computational Geometry (EuroCG 2014) [8]. It is co-authored with Kevin Buchin1, Pedro J. de Rezende2, Cid C. de Souza2 and Bettina Speckmann1.

Abstract In a rectangular cartogram, each region of a map is represented by a rectangle whose area is proportional to some statistical data of interest. Current techniques for constructing rectangular cartograms partition a large rectangle (the map) into a set of smaller rectangles which correspond to land or sea regions. The position and size of sea rectangles determine the outline of land masses. Therefore, sea regions have a direct impact on the recognizability and, thus, on the visual quality of cartograms. In this paper, we describe the first algorithm for the automated creation of sea regions for rectangular cartograms and present results obtained with our method.

1Department of Mathematics and Computer Science, TU Eindhoven, the Netherlands. K.B. and B.S. are supported by the Netherlands Organisation for Scientific Research (NWO) under project nos. 612.001.207 and 639.023.208, respectively. 2Institute of Computing, University of Campinas, Brazil. Supported by CNPq, FAPESP and FAEPEX/UNICAMP.

87 Evolution Strategies for Optimizing Rectangular Cartograms

Kevin Buchin1, Bettina Speckmann1,⋆, and Sander Verdonschot2

1 Department of Mathematics and Computing Science, TU Eindhoven, Eindhoven, The Netherlands [email protected], [email protected] 2 School of Computer Science, Carleton University, Ottawa, Canada [email protected]

Abstract. A rectangular cartogram is a type of map where every region is a rectangle. The size of the rectangles is chosen such that their areas represent a geographic variable such as population or GDP. In recent years several algorithms for the automated construction of rectangular cartograms have been proposed, some of which are based on rectangu- lar duals of the dual graph of the input map. In this paper we present a new approach to efficientlyCHAPTER search 5. within RECTANGULAR the exponentially CARTOGRAMS large space of 88 all possible rectangular duals. We employ evolution strategies that find rectangular duals which5.1 can Introduction be used for rectangular cartograms with correct adjacencies andCartograms (close to) are zero a well-known cartographic tool for error. visualizing This is statistical a con- data associated with geo- siderable improvementgraphic upon previousregions. Usually, methods regions that represent have to countries, either relaxstates or counties, and they are adjacency requirementsdeformed or deal in with the cartogram larger errors. in such a We way present that their extensive area is proportional to the numerical experimental results fordata a large related variety to them. of It data is not sets. necessary that the regions keep their original outline; in fact, it is acceptable to represent them by simple geometric shapes. Although regions are Keywords: Rectangularnot drawn cartogram, with their evolution true sizes or strategy, shapes, recognizability regular edge should be preserved. labeling. There are several types of cartograms. Here, we are interested in rectangular car- tograms (see Fig. 5.1). As the name suggests, in this kind of cartogram all relevant regions are represented by rectangles. This has the advantage that areas are easily es- 1 Introduction timated. However, it also means that most regions will have little resemblance to their actual shapes, and care should be taken to make the cartogram as recognizable as possible.

value-by- IS NO Cartograms [3,13], also called SE FI area maps, are a useful and intuitive DK EE

RU tool to visualize statistical data about LV IE GB LT NL a set of regions like countries, states, PL BY or counties. The size (area) of a region BE + SK LU DE in a cartogram corresponds to a par- UA + MD CZ RO HU ticular geographic variable. A common FR BG MK variable is population: in a population CH AT RS KO ME TR SI GR cartogram, the sizes of the regions are BA IT ES AL PT HR proportional to their population. The MT CY sizes of the regions in a cartogram are not the true sizes and hence the regions Fig. 1.FigureThe population5.1: Europe population. of Europe 2011 ⋆ Supported by the NetherlandsThe Organisation quality of a cartogram for Scientific depends Researchon several factors, (NWO) which under are summarized in the project no. 639.022.707. following list:

Cartographic error: for each region A, let A denote the actual area of the region in N. Xiao et al. (Eds.): GIScience 2012,• LNCS 7478, pp. 29–42, 2012. c c Springer-Verlag Berlin Heidelberg 2012the cartogram and As denote the intended area of that region given by the numerical data to be conveyed. The cartographic error is defined as A A /A ; | c − s| s Preserved adjacencies: two rectangles should be adjacent if and only if the corre- • sponding regions are adjacent in the original map;

Aspect ratio of the rectangles: large aspect ratios make it harder to visually compare • the areas of two rectangles and should be avoided;

Relative positions: rectangles should be placed in such a way that their relative • position resembles that of the original map (e.g., the rectangle for the Netherlands should be west of the one for Germany). CHAPTER 5. RECTANGULAR CARTOGRAMS 89

NO SE FI IS

EE LV DK LT RU IE GB NL BY PL BE DE

CZ SK UA CH AT HU FR SI RO HR BA CS IT BG

AL MK TR PT ES GR

Figure 5.2: Rectangular dual with sea regions visible.

It is not always possible to optimize all criteria simultaneously. Thus, often cartograms have (some) regions with non-zero cartographic error and incorrect adjacencies. Related work. Van Kreveld and Speckmann [9] presented the first algorithm to com- pute rectangular cartograms. Their method is able to construct cartograms with small cartographic error, at the cost of slightly disturbed adjacencies. Speckmann et al. [7] later improved on these results using an iterative linear programming method. Buchin et al. [2] coupled an evolutionary algorithm with the approach described in [7] and showed that the resulting heuristic produces high quality cartograms with only correct adjacencies. Inoue et al. [4] computed rectangular cartograms with a different strategy. They first triangulate the regions and later transform the triangles to obtain the desired area. However, this leads to large cartographic errors. Heilmann et al. [3] presented an algorithm that always gives the correct areas, but might greatly disturb adjacencies. Results and Organization. The algorithms developed over the sequence of papers [2, 7, 9] use the dual graph of a map as input. This dual graph needs to be augmented with additional “sea vertices” to ensure a reasonable shape of the final cartogram. These sea vertices correspond to rectangular “sea regions” in the final cartogram – see Fig. 5.2 for an example of a rectangular dual of an augmented dual graph of Europe with outlined sea regions. The augmentation with sea vertices or regions has so far been performed manually. However, it is desirable that also the augmentation step becomes part of the automatic pipeline, to adapt the number and location of sea regions to particular data sets and visualization needs. Here, we propose a first algorithm to automatically create sea regions to augment a given input map. In the following section, we sketch the general method underlying the algorithms of [2, 7, 9]. We describe our approach in Section 5.3 and show experimental results in Section 5.4. CHAPTER 5. RECTANGULAR CARTOGRAMS 90

5.2 Algorithmic outline

The algorithms in [2, 7, 9] all follow the same general method to generate rectangular cartograms. Initially, the adjacencies in the original map are represented in a face graph F , which contains a vertex for each region and an edge between two vertices if the cor- responding regions are adjacent. The regions of the input map are considered to be connected, so the face graph is always planar. Given a face graph F , its rectangular dual is defined as a partition of a rectangle R into a set of non-overlapping rectangles such that i) no four rectangles in meet at R R the same point; ii) each r is associated with one vertex of F ; and iii) two rectangles ∈ R in share a common boundary if and only if there is an edge between the corresponding R vertices in F . A rectangular dual is then constructed with the help of a regular edge labeling (REL) of F , as described by Kant and He [5]. An REL contains information on the relative positions between pairs of rectangles and uniquely determines the rectangular dual (up to equivalence). There can be exponentially many RELs for a given face graph. In the most recent approach [2], an evolutionary algorithm is used to select a suitable REL based on the statistical data that is to be visualized. Then, a rectangular dual is built with the algorithm described in [5]. The final step assigns the desired area to each region of the rectangular dual. This is done by rearranging the segments in the rectangular dual in such a way that adjacencies are not altered. The currently best approach to do so is based on iterative linear programming [7]. Not every face graph F has a rectangular dual. Koźmiński and Kinnen [6] and Ungar [8] independently proved that a face graph F has a rectangular dual with four rectangles on the boundary if and only if (i) every interior face of F is a triangle and the exterior face is a quadrangle; and (ii) F does not have separating triangles, i.e., triangles with vertices in their interior as well as in their exterior. Hence, it is usually necessary to preprocess maps to ensure that the face graph satisfies the conditions above. In addition, as mentioned before, it often improves the visual quality significantly to augment the face graph with additional sea vertices (or the rectangular dual with sea regions) to ensure a suitable shape of the cartogram. These preprocessing and augmentation steps are so far performed manually.

5.3 Sea partitioning

In the following, we describe our approach for the automated creation of sea regions. We view the input map as a polygon with holes: the outer rectangular border of the map is the polygon and the continents and islands are the holes. We then compute the straight skeleton [1] of the polygon and use its cells as the basis to create sea regions (see Fig. 5.3). Next, we prune the skeleton. This is done for two reasons. First, the number of regions needs to be reduced to speed up the construction of the cartogram. Second, we must ensure that the corresponding face graph has a rectangular dual, which is not always true for the original skeleton. In particular, separating triangles often arise from sequences of two or more convex vertices on the boundary of a country. CHAPTER 5. RECTANGULAR CARTOGRAMS 91

VE CO EC GF SR

PE BR BO + PY

CL UY AR

Figure 5.3: Straight skeleton for South America.

By definition, the rectangular dual cannot have four rectangles that meet in a point. This will occur if, after adding the edges of the straight skeleton, some vertex is left with degree more than three. To satisfy this first requirement, we identify these vertices and remove the branches from the skeleton that are incident to it. In the next step, we try to reduce the number of sea regions as much as possible without affecting the quality of the final cartogram. To do this, for each country that has skeleton branches incident to its boundary, we select a vertex whose branch will not be erased (see Fig. 5.4). As a result, most land regions become adjacent to two or no sea regions.

v

Figure 5.4: A vertex v on the boundary of a country whose corresponding branch will not be erased.

This strategy must be altered in two cases. In a rectangular cartogram, every region except the four boundary regions must have at least one neighbor in each direction. This implies that islands must be surrounded by at least four sea regions. Moreover, countries that have only one adjacent land region, like Portugal, need to be adjacent to at least three sea regions. In these cases, we select more than one vertex on the country’s coastline whose branch will not be erased. As mentioned in Section 5.1, recognizability must be preserved in cartograms. This goal can be partially achieved by choosing suitable relative positions for the rectangles. CHAPTER 5. RECTANGULAR CARTOGRAMS 92

Consider the cartogram in Fig. 5.1. As expected, Belgium, Luxembourg and the Nether- lands are placed north of France. Besides that, they are also aligned with the right vertical segment of the rectangle for France, which makes the cartogram more similar to the original map. These details can be captured by the objective function of the evolutionary algorithm proposed by Buchin et al. [2]. In particular, a good measure in this case is the angle deviation of the region centroids. Nevertheless, when creating the sea regions, we must guarantee that the desired configuration for a group of regions can be realized in the cartogram. We next show that our strategy allows for all configurations but one, which is treated separately.

A A A B B B C C C (a) (b) (c)

A A A B B B C C C (d) (e) (f)

Figure 5.5: (a)–(e) five basic configurations that can be realized with only two sea regions; (f) the only configuration that needs an extra rectangle.

Suppose we are given three land regions A, B, and C such that A, B and B,C are { } { } pairwise adjacent, as shown in Fig. 5.5. In addition, we assume that sea regions are placed to the right of A, B, and C. Our strategy creates one sea region adjacent to A, B and { } another to B,C . Disregarding symmetries, there are six possible configurations for the { } land regions. In five of them, two sea regions suffice to create the cartogram. However, the sixth configuration is realizable only with an extra rectangle. In these cases, we create an extra region adjacent to B. As an example, note the sea regions adjacent to Brazil in Figs. 5.6(a) and 5.6(b).

5.4 Experimental results

The algorithms for the construction of the cartograms were implemented in Java. Straight skeletons were computed with a C++ interface for CGAL 4.0.2. We use two maps in our experiments: South America (12 countries) and Europe (42 countries). We experimented with several data sets which include information on demographics, economics and services. Fig. 5.6(a) shows the subdivision for South America after pruning the skeleton. The pruning algorithm reduced the number of sea regions from 259 to 13 in less than a second. Fig. 5.6(b) shows the final cartogram for population data. The cartographic error for all land regions is less than 0.1%. CHAPTER 5. RECTANGULAR CARTOGRAMS 93

CO VE VE CO GF SR EC GF SR EC PE PE BR BO BR + PY BO + PY CL UY AR CL UY AR

(a) (b)

Figure 5.6: (a) Sea regions for South America after pruning the skeleton; (b) South America population.

Fig. 5.7 shows the number of cell phone lines in Europe. The skeleton creates 845 sea regions, which are later reduced to 44 after pruning. Again, the cartographic error for all land regions is less than 0.1% and the sea regions are created in less than a second.

IS NO

IE SE FI

EE GB LV RU DK LT

NL BY DE BE + LU PL

FR CH AT CZ SK UA

SI HU RO + MD HR RS ES BG IT MK BA KO TR PT ME GR AL

MT CY

Figure 5.7: Europe cell phone lines.

5.5 Conclusion

We presented the first algorithm for the creation of sea regions for rectangular cartograms. Our method is based on computing and pruning the straight skeleton of the polygon sur- rounding the input map. Our pruning strategy not only is fast, but also achieves a CHAPTER 5. RECTANGULAR CARTOGRAMS 94 significant reduction in the number of sea regions created by the skeleton. First experi- ments show that the cartograms generated with this algorithm are visually pleasing and have a very low cartographic error. Bibliography

[1] O. Aichholzer, F. Aurenhammer, D. Alberts, and B. Gärtner. A novel type of skeleton for polygons. Journal of Universal Computer Science, 1(12):752–761, 1995.

[2] K. Buchin, B. Speckmann, and S. Verdonschot. Evolution strategies for optimizing rectangular cartograms. In N. Xiao, M. Kwan, M. F. Goodchild, and S. Shekhar, editors, Proceedings of the 7th International Conference on Geographic Information Science (GIScience 2012), volume 7478 of Lecture Notes in Computer Science, pages 29–42. 2012.

[3] R. Heilmann, D. A. Keim, C. Panse, and M. Sips. Recmap: Rectangular map ap- proximations. In Proceedings of the IEEE Symposium on Information Visualization (INFOVIS), pages 33–40, 2004.

[4] R. Inoue, K. Kitaura, and E. Shimizu. New solution for construction of rectilinear area cartogram. In Proceedings of the 24th International Cartography Conference, 2009.

[5] G. Kant and X. He. Regular edge labeling of 4-connected plane graphs and its appli- cations in graph drawing problems. Theoretical Computer Science, 172(1-2):175–193, 1997.

[6] K. Koźmiński and E. Kinnen. Rectangular duals of planar graphs. Networks, 15(2): 145–157, 1985.

[7] B. Speckmann, M. van Kreveld, and S. Florisson. A linear programming approach to rectangular cartograms. In A. Riedl, W. Kainz, and G. A. Elmes, editors, Progress in Spatial Data Handling: Proceedings of the 12th International Symposium on Spatial Data Handling, pages 529–546. Springer Berlin Heidelberg, 2006.

[8] P. Ungar. On diagrams representing maps. Journal of the London Mathematical Society, s1-28(3):336–342, 1953.

[9] M. van Kreveld and B. Speckmann. On rectangular cartograms. Computational Ge- ometry: Theory and Applications, 37(3):175–187, 2007.

95 Chapter 6

Conclusion

Effective graphical representations can significantly improve people’s understanding of data sets. This makes data visualization a highly active field of research. The need to automatically construct visualizations gives rise to a number of interesting combinatorial optimization problems. Solving these problems is definitely not a trivial task, especially because they are often computationally hard. The goal of this thesis was to study some of these problems. In particular, we focused on visualizations of cartographic data. The problems related to proportional symbol maps and rotating maps were addressed with integer programming techniques, through which we developed efficient exact algorithms. In the case of mosaic and rectangular cartograms, heuristics were employed to find good solutions with low computation times. For proportional symbol maps, we addressed three variants of a combinatorial problem, two of which are NP-hard, and another whose complexity remains unknown. Our main contribution was a new integer programming model. We proved several facial properties of the associated polytope and showed that it corresponds to the projection of another model from the literature. We also proposed fast separation routines and lifting procedures, which were used to implement a branch-and-cut algorithm. Computational experiments confirmed that the method is the fastest currently available. The results were published in [9, 12]. Some directions for future research include, e.g., further studies concerning the Max-Min problem for physically realizable drawings, which still exhibits high running times with our model. Another direction would be to investigate problems involving partially transparent symbols, which would reduce information loss due to overlap. From a theoretical perspective, the complexity of the Max-Total problem for stacking drawings clearly constitutes a challenge. Moreover, approximation results are few in the literature, so they would also be of interest. In our study of rotating maps, we proved a number of properties of optimal solutions and showed how to use them to significantly reduce the size of an integer programming model from the literature. With the proposed techniques, it was possible to reduce the number of variables and constraints by up to two orders of magnitude. Reductions in running times were even more impressive, reaching up to three orders of magnitude. A paper on the topic has been submitted for publication in an international conference. Here, we restricted ourselves to maps under continuous rotations. However, many interactive systems also allow the user to pan and scale the view. Dynamic labeling problems are

96 CHAPTER 6. CONCLUSION 97 relatively new, so these features have only been considered separately. However, in the future, we would like to address problems that combine two or more of them. Our work with mosaic cartograms led to the first automatic construction method for this type of visualization. It is based on three central features: firstly, it always enforces correct adjacencies; secondly, it uses guiding shapes to control the shape of regions; and thirdly, a minimum cost network flow model is employed to finalize the construction. The resulting cartograms have low cartographic error and high recognizability. The method has been described in [10, 11]. Possible extensions include using different tilings (other than hexagonal and square) and developing more flexible guiding shapes. Finally, our contributions to rectangular cartograms were mainly concerning sea re- gions. We proposed the first heuristic to automate their creation and showed how to integrate it into an existing cartogram construction procedure. The algorithm was pub- lished in [8]. Subsequent studies should focus on enhancing the method, so that it becomes possible to handle more complex instances. Bibliography

[1] CARTO. URL https://carto.com/. Accessed on 2016/10/30.

[2] Google Maps. URL https://maps.google.com/. Accessed on 2016/10/30.

[3] E. Balas. Projection, lifting and extended formulation in integer and combinatorial optimization. Annals of Operations Research, 140(1):125–161, 2005.

[4] E. Balas and M. Oosten. On the dimension of projected polyhedra. Discrete Applied Mathematics, 87(1–3):1–9, 1998.

[5] M. S. Bazaraa, J. J. Jarvis, and H. D. Sherali. Linear Programming and Network Flows. Wiley, 2nd edition, 1990.

[6] K. Been, E. Daiches, and C. Yap. Dynamic map labeling. IEEE Transactions on Visualization and Computer Graphics, 12(5):773–780, 2006.

[7] G1 Brasil. Mapa dos protestos — Infográfico, 2013. URL http://g1.globo.com/ brasil/protestos-2013/infografico/platb/. Accessed on 2013/06/29.

[8] K. Buchin, R. G. Cano, P. J. de Rezende, C. C. de Souza, and B. Speckmann. Sea re- gions for rectangular cartograms. In 30th European Workshop on Computational Ge- ometry (EuroCG 2014), Book of Abstracts, 2014. URL www.cs.bgu.ac.il/~eurocg14.

[9] R. G. Cano, C. C. de Souza, P. J. de Rezende, and T. Yunes. Arc-based integer programming formulations for three variants of proportional symbol maps. Electronic Notes in Discrete Mathematics, 44:251–256, 2013.

[10] R. G. Cano, K. Buchin, T. Castermans, A. Pieterse, W. Sonke, and B. Speck- mann. Mosaic drawings and cartograms. In 31st European Workshop on Compu- tational Geometry (EuroCG 2015), Book of Abstracts, pages 153–156, 2015. URL eurocg15.fri.uni-lj.si.

[11] R. G. Cano, K. Buchin, T. Castermans, A. Pieterse, W. Sonke, and B. Speckmann. Mosaic drawings and cartograms. Computer Graphics Forum, 34(3):361–370, 2015. doi: 10.1111/cgf.12648.

[12] R. G. Cano, C. C. de Souza, P. J. de Rezende, and T. Yunes. Arc-based integer programming formulations for three variants of proportional symbol maps. Discrete Optimization, 18:87–110, 2015. doi: http://dx.doi.org/10.1016/j.disopt.2015.09.001.

98 BIBLIOGRAPHY 99

[13] CNBC. Euro 2016: SAP and German football team worked to develop big data analytics, 2016. URL http://www.cnbc.com/2016/07/07/euro-2016-sap-and- german-football-team-worked-to-develop-big-data-analytics.html. Ac- cessed on 2016/11/02.

[14] B. Dent. Cartography — Thematic Map Design. McGraw-Hill, 5th edition, 1999.

[15] A. Gemsa, M. Nöllenburg, and I. Rutter. Consistent labeling of rotating maps. In F. Dehne, J. Iacono, and J.-R. Sack, editors, 12th International Symposium on Algorithms and Data Structures (WADS 2011), volume 6844 of LNCS, pages 451–462. Springer, 2011.

[16] Globoesporte.com. Trabalho, chinelo e óculos: as paixões de Robertinha, a es- tatística da seleção, 2011. URL http://globoesporte.globo.com/volei/noticia/ 2011/07/trabalho-chinelo-e-oculos-paixoes-de-robertinha-estatistica- da-selecao.html. Accessed on 2016/11/02.

[17] Globoesporte.com. ‘O Zé tem um olho clínico absurdo’, diz estatístico da se- leção de vôlei, 2012. URL http://globoesporte.globo.com/sp/ribeirao- preto-e-regiao/noticia/2012/08/o-ze-tem-um-olho-clinico-absurdo-diz- estatistico-da-selecao-de-volei.html. Accessed on 2016/11/02.

[18] IBGE — Instituto Brasileiro de Geografia e Estatística. Renda domiciliar per capita, 2014. URL http://saladeimprensa.ibge.gov.br/noticias?view=noticia&id= 1&busca=1&idnoticia=2833. Accessed on 2016/10/31.

[19] G. L. Nemhauser and L. A. Wolsey. Integer and Combinatorial Optimization. John Wiley and Sons, 1988.

[20] T. A. Slocum, R. B. McMaster, F. C. Kessler, and H. H. Howard. Thematic Cartog- raphy and Geographic Visualization. Prentice Hall, 2nd edition, 2003.

[21] L. A. Wolsey. Integer programming. John Wiley and Sons, 1998.