• No results found

Automatic network layout us- ing Hilbert and Moore curves

N/A
N/A
Protected

Academic year: 2021

Share "Automatic network layout us- ing Hilbert and Moore curves"

Copied!
53
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

Bachelor Informatica

Universiteit van Amsterdam

Automatic network layout

us-ing Hilbert and Moore curves

Patrick van der Pal

June 16, 2015

Supervisor(s): Raphael Poss Signed:

Inf

orma

tica

Universiteit

v

an

Ams

terd

am

(2)
(3)

Abstract

In this project, eight algorithms have been developed to map multiple one-dimensional networks, with corresponding nodes, into a two-dimensional network, while the average distance is mini-mized for every network and the locality is optimally preserved. These algorithms may lead to higher performance in both chips and networks, because the propagation delay will be minimized. Each of the algorithms is destructive, meaning that first the nodes are set up, usually more than necessary. Once that is done, the second part of the algorithm cuts of the unnecessary nodes again. This approach shows promise with its results. These results approach the results of a theoretically optimal design. These results, also, show there is not a unique optimal solution, i.e. different situations need different algorithms.

(4)
(5)

Contents

1 Introduction 4

2 Theory 8

2.1 Hilbert vs. Moore Curves . . . 9

2.1.1 Hilbert Curves . . . 9

2.1.2 Moore Curves . . . 11

3 Method 12 3.1 Finding Patterns . . . 13

3.2 Algorithm Development . . . 15

3.2.1 The Building Blocks . . . 15

3.2.2 The Cutting Off of Nodes . . . 16

3.3 Analysis . . . 18

3.4 The Library . . . 19

4 Results 21 4.1 The One-Dimensional Reference . . . 23

4.2 A Naive Algorithm . . . 23

4.3 The First Texan . . . 25

4.4 Split Second . . . 26

4.5 The Third Visitor . . . 28

4.6 A Fourth For Bridge . . . 28

4.7 Five . . . 31

4.8 The Inn of the Sixth Happiness . . . 31

4.9 Shichinin No Samurai (Seven Samurai) . . . 33

4.10 Eight O’Clock Walk . . . 33

4.11 The Final Comparison . . . 35

5 Discussion 44 5.1 Righting Wrongs . . . 45

5.2 Directions for Future Work . . . 45

(6)
(7)

1

Introduction

“I’m losing the best of me, dressed up as myself, to live in the shadow of who I’m supposed to be”

– All Time Low. “Sick Little Games.” Nothing Personal. Hopeless Records, 2009. Compact Disc.

Within every department of Computer Science, Moore’s law is known. This law states that the number of transistors in a chip doubles roughly every two years. This prediction, made in 1965 by Gordon E. Moore in his paper ”Cramming more components onto integrated circuits”, still holds today. Following this prediction, David House, executive at Intel, stated that the chip performance would double every eighteen months.[1]

However, due to overheating problems of the chips and the fact that Moore’s law will cease to be correct at some time, because all smallness is obviously bound by atomic limits, new methods are vital to keep the increase of chip performance existent. One of these methods being explored is finding more efficient manners of designing the chips. Designing the chips had been necessary from the early start, but the importance of efficiency wasn’t very high back then. In recent times this importance has been rising, leading to more efficient designing methods. The extra effort put in into this field led to the realisation that these design problems were very similar to those of designing networks more efficiently. Since then the split between those two fields has been fading, leading to papers not focusing on one side of the mirror, but being more abstract in its purpose.

One particular type of design on this edge of both fields is when it is necessary to design two or more networks with shared nodes, such as the network in Figure 1.1. In cases like these, the locality is difficult to preserve for both the networks as well as limiting the maximum as well as the average distance between the nodes in both networks.

Context

One of the possibilities to improve these designs is to start using space-filling curves, such as Hilbert and Moore curves. Seeing as how these curves were first described in the 19th century, this shows the importance of this efficiency, but also the relevance of earlier research. For example, the original paper on Hilbert curves by David Hilbert is from 1891, ”Ueber die stetige Abbildung einer Linie auf ein Fl¨achenst¨uck”. In this short, but action-packed two-paged paper, Hilbert elaborates on his variation of Giuseppe Peano’s space-filling curve. Figure 1.2 shows the basis of Hilbert’s recursive algorithm.[2]

The paper that first described Moore curves is written in 1900 by Eliakim Hastings Moore and is called ”On Certain Crinkly Curves”. This article is split up into two parts, the first is called ”Continuous surface-filling curves” and discusses twelve mathematical problems concerning

(8)

Figure 1.2: Hilbert’s Algorithm

these continuous surface-filling curves. The second part is named ”Continuous curves having no tangents” and has 13 mathematical problems discussed. About Moore’s curves, these are discussed as the 4th problem of the first half of the article.[3]

Of course, there are firsts in every field and space-filling curves are no exception. However, both of these variants are not. In this field, the Peano curve is the first one, being defined in 1890 by Giuseppe Peano in an article called ”Sur une courbe, qui remplit toute une aire plane”. Unfortunately, this article confirms my lack of understanding of the French language. Luckily, Moore described the Peano curves in detail in his aforementioned article ”On Certain Crinkly Curves”.[4]

Problem Statement

The purpose of this thesis is to develop an algorithm that maps multiple one-dimensional net-works with corresponding nodes, focusing on those netnet-works with an amount of nodes different from 4n, into two-dimensional networks, in such a way that the average distance between the

nodes is minimized and preserving locality as best as possible, accomplishing all of this by using Hilbert or Moore curves.

Research Questions

During this thesis, I have developed eight different algorithms to answer the main research question: What algorithms are suitable for generating locality-preserving network layouts? An extra research question was set up, for I had to pay extra attention to those networks of which the number of nodes are not 4n. ”Which approach/algorithm is suitable to network layout, when

the number of nodes is not 4n?”

Plan of Approach

During the project, described in this thesis, I first started collecting the knowledge about the mentioned space-filling curves. The moment I have ascertained sufficient knowledge on the subject, I began the preparation of the first ideas for an algorithm. Once the eight algorithms were developed, I determined the efficiency by inspecting the constructed designs and compared the several analyses.

Organisation of the Thesis

The chapters of this thesis try to maintain the sequence of the work done as much as possible. So, the first chapter, following this chapter, Theory, describes the space-filling curves, Hilbert and Moore curves, in greater detail. The next chapter, Method, describes how the algorithms are created, in chronological order. The next part of this chapter explains how the developed algorithms are compared with each other. The last part of this chapter describes the library

(9)

that is developed and how to use it. The ’Results’-chapter shows the designs, developed with the algorithms, and the comparisons, described in the previous chapter. The second-to-last chapter, Discussion, explains the results from the previous chapter and discusses improvements that can be made to this entire project. The final chapter, Conclusion, tries to answer the research questions, posed in this chapter.

(10)
(11)

2

Theory

“Another night, I’m on another broken avenue. My bag is ripped and worn, then again now so am I.”

– Marianas Trench. “Cross My Heart.” Masterpiece Theatre. 604 Records, 2009. Compact Disc.

On every research project, theory is important. But on a mostly theoretical project, such as this one, this significance of theory increases. One might even say that this is the most important chapter of all, because without knowing one’s essentials, one will lose one’s way in the maze that is this project.

2.1

Hilbert vs. Moore Curves

So, without further ado, let’s introduce both Hilbert and Moore curves. Both these curves are continuous fractal space-filling curves. To start of simple, let’s start with the definition of a simple curve. In 1887 Camille Jordan, a French mathematician, introduced the following definition, which is still considered the precise description to this day:

“A curve (with endpoints) is a continuous function whose domain is the unit interval [0, 1].”

As the next step, there is the space-filling curve. This one is actually quite obvious, as this fills up a Euclidean space, such as the 2-dimensional plane or the 3-dimensional space.

Finally, as shown in Figure 2.1, a fractal curve is a curve that shows a repeating pattern on any scale. In this case, the scale relates to the Euclidean space.

2.1.1

Hilbert Curves

The Hilbert curve is, as said, a continuous fractal space-filling curve, first described by and named after the German mathematician David Hilbert in March, 1891. Hilbert got his article

(12)

Figure 2.2: Hilbert’s Algorithm

published in the 38th issue of the German mathematics journal called Mathematische Annalen, only fourteen months after the release of an article about, most likely, the first continuous fractal space-filling curves in the same journal by Italian Giuseppe Peano.[2]

Its most used property is its preserving of locality when it is used as a mapping function to map from 1D to 2D and vice verse. The locality-preserving behavior of Hilbert curves is better than that of Z-order curves, because the distance between each node in a Hilbert curve does not fluctuate, whereas that distance in a Z-order curve does fluctuate. And this is, simply said, the major reason Hilbert curves are used preferably over Z-order curves.

Algorithm

During this project, the mapping from 1D to 2D will most likely be the most important, therefore let’s elaborate on that algorithm. Since the Hilbert curve is a fractal curve, the algorithm is recursive, which can be seen in Figure 2.2. This means that the algorithm uses a repetition of the same process, where every repetition uses the results of the previous repetition, apart from the first step.

Hilbert describes the first step as follows. Let’s divide both the original line and the original square in four equal parts, as shown in Figure 2.2.1. Now comes the recursive part and that is where this explanation splits from Hilbert’s paper. Hilbert applies the same step on each of the four parts again, with the addition that the order of the squares is to be selected so that each successive square is with one side to the previous.

For a more scientific approach, see this description from Nicholas J. Rose that leaves only one path through every square, but only while the beginning and ending are at fixed positions, namely the lower-left and the lower-right corner respectively:[5]

“Let I = {t | 0 ≤ t ≤ 1} denote the unit interval and Q = {(x; y) | 0 ≤ x ≤ 1; 0 ≤ y ≤ 1} the unit square. For each positive integer n we partition the interval I into 4n subintervals of length 4−n and the square Q into 4n subsquares of side 2−n. We construct a one-to-one correspondence between the subintervals of I and

the subsquares of Q subject to two conditions:

Adjacency Condition Adjacent subintervals correspond to adjacent subsquares (with an edge in common).

Nesting Condition If at the n-th partition, the subinterval Inkcorresponds to a

sub-square Qnk then at the (n + 1)-st partition the partition the 4 subintervals of Ink

must correspond to the 4 subsquares of Qnk.”

While this method is less prone to interpretation, the following method is, with the accom-panying image of Figure 2.2, probably more intuitive. First, copy the results from the previous

(13)

Figure 2.3: Moore’s Algorithm

step four times. Then, rotate the two copies on the bottom with 90 degrees, the left one in a clockwise and the right one in a counter-clockwise direction. Finally, connect the end of one part to the beginning of the next one in a clockwise manner.

Noted should be that a Hilbert curve is symmetrical, which gives an extra alleyway to inves-tigate. It’s not a reason to directly assume that we can immediately use networks of size 4n/2,

because the ending is in an usually undesirable position.

2.1.2

Moore Curves

As mentioned, the Moore curve is also a continuous fractal space-filling curve. Described in 1900 by and named after Eliakim Hastings Moore, an English Mathematician, the Moore curve is a direct variant of the Hilbert curve. The difference being the locations of the beginning and the end of the curve, it can be used as a direct replacement of the Hilbert curve, which will probably come in handy in constructing the design algorithm later on in this thesis.

Algorithm

As Figure 2.3 shows, Moore curves are quite similar to Hilbert Curves. To clarify, take a look at the following images in Figure 2.4. To construct the n-th iteration of the Moore curve, take the (n − 1)-st iteration of the Hilbert Curve, copy it four times and arrange them as shown in Figure 2.4.3. The advantage of the Moore curve relative to the Hilbert curve is most relevant for circular networks, since the curve ends right next to the beginning.

(14)
(15)

3

Method

“I’m outdated, overrated. Morning seems so far away.”

– Mayday Parade. “I Swear This Time I Mean It.” Anywhere but Here. Fearless Records, 2009. Compact Disc.

With the previous chapters clearing up what this project entails exactly, namely using Hilbert and Moore curves to set up designs for networks of sizes different from 4n, it is time to start

working on the algorithm that should design these networks. Along with every algorithm, this algorithm requires preparation before the writing itself starts. An important aspect of this preparation has been finished by understanding the Hilbert and Moore curves. This chapter will describe how to find patterns in setting up these curves. This will help to show useful parts that can be used in this new designing algorithm.

3.1

Finding Patterns

In the section describing and explaining the Moore curve, Figure 2.4 was used for extra clarifi-cation. An attentive and inquisitive reader might have noticed a pattern, the accumulation of pairs of Hilbert curves. This property of the Moore curve might be an interesting angle, the images, shown in Figure 3.1 and 3.2, show new variations of the Moore curve. A limitation in the range of possibilities, not set by the scope of this project, but by choice, is that constructive algorithms are left out of this project, only the destructive algorithms are studied. I.e. in this project, this pattern is used to set up an amount of nodes bigger than the requested amount of nodes, while nodes will be removed when necessary. This choice has been made as a result of the amount of computing power that is required for a constructive algorithm.

The use of these building blocks, along with the property of both the Hilbert curves and the Moore curves that their size is always 4n, creates a situation where only one, two or three

building blocks are needed. In the case where three building blocks contain not enough nodes to create the design, the algorithm will increase the size of each building block. I.e. four building blocks of a certain iteration are equal in size with one building block of the next iteration.

(16)

Figure 3.2: Variations of the Moore Curve 2

While this increases the amount of possible network designs using Hilbert and Moore curves, it is nowhere near enough for a useful algorithm. A simple method to solve this problem is to cut the unnecessary nodes off of the design, until the requested amount of nodes is reached. However, it seems inefficient to just cut off nodes randomly. Luckily, the first iteration of the Hilbert curve

(17)

has a salient property making it easier to cut off a pair of nodes. In this first iteration, the first node is connected to the second node, the second to the third and the third to the fourth. Also, the distance from the first node to the fourth node is 1. So, when the first node and the fourth node are connected directly, the second node and the third node can be cut off, as shown in the upper half of Figure 3.3. The lower half of Figure 3.3 shows that this cutting mechanism, when correctly used, preserves the space-filling property of the curve. The conditions for this correct usage of this technique are detailed below.

A last restriction in the scope of the project is the necessity of the beginning and the ending of the curve to be next to each other, while also in the middle of the ’bottom’. Just like the regular Moore curve.

3.2

Algorithm Development

With the patterns found and understood, it is time to put all of this into a usable algorithm. The algorithm consists of two major parts. The first is setting up the two stacks of Hilbert curves, while the second part incorporates the removal of the most unnecessary nodes.

3.2.1

The Building Blocks

The first thing on the to-do list is setting up the right amount of building blocks, made up of Hilbert curves, but what is the right amount of building blocks? This can only be calculated once the size of the building blocks is known. The size of the building blocks depends on one thing only, the total number of nodes wanted in the design. The building blocks’ size is the highest power of four so that a single building block has still fewer nodes than the final design will have.

An Uneven Amount of Building Blocks

Now that the size of each building block is known, the amount of necessary building blocks can be calculated. The only question one has to ask is the following one: Do I allow an uneven number of building blocks? If not, the next step is to divide the calculated amount by two and put up two stacks, with the height of the calculated number, of Hilbert curves as explained earlier. If one does allow an uneven number of building blocks, the algorithm becomes more complex, because it leaves an extra building block after stacking the two stacks. One solution is to use a building block made of a Moore curve, instead of a Hilbert curve, and place it on top of both stacks, in the middle. Whether one of the two approaches has an edge over the other remains to be seen, until both methods have been tested.

Algorithm 1 Initialize an uneven amount of Building Blocks Require: nrNodes > 0

listOfNodes = []

nrIterations = blog4nodesc

nrBuildingBlocks = dnrNodes/4nrIterationse

for BuildingBlock in [1; bnrBuildingBlocks/2c] do listOfNodes.extend (hilbertCurve(nrIterations)) shift (offset )

end for

if nrBuildingBlocks mod 2 6= 0 then

listOfNodes.extend (mooreCurve(nrIterations)) shift (offset )

end if

for BuildingBlock in [1; bnrBuildingBlocks/2c] do listOfNodes.extend (hilbertCurve(nrIterations)) shift (offset )

(18)

To start off the algorithm, three variables are being initialized, nrIterations and nrBuilding-Blocks, as well as listOfNodes, this is a list of tuples that will contain the coordinates of each node.

The next step is to create the left stack of Hilbert curves, used is a for-loop with a number of bnrBuildingBlocks/2c iterations. Within this for-loop, two functions are used. The first is hilbertCurve(nrIterations), which returns a list of nodes, sorted from the beginning to the end of the curve. The second function is called shift(offset). shift(offset) shifts the location so that the next call to hilbertCurve(nrIterations) the nodes have the correct coordinates.

Then on top of both stacks is placed a Moore curve, but only when the amount of building blocks is uneven, or nrBuildingBlocks mod 2 6= 0. To finish up the algorithm the right stack of Hilbert curves is placed, again with a for-loop with bnrBuildingBlocks/2c iterations. An Even Amount of Building Blocks

This algorithm initializes listOfNodes, nrIterations and nrBuildingBlocks at the start as well. Also, this variation uses the same functions, shift(offset) and hilbertCurve(nrIterations). Again, the next step is to create the left stack of Hilbert curves, using a for-loop. However, this time the number of iterations is not rounded down, i.e. bnrBuildingBlocks/2c. This time the division is rounded up, or dnrBuildingBlocks/2e. Because the uneven numbered block at the top is not allowed in this variant of the algorithm, an extra block is needed, which is achieved by rounding up, instead of down. The single Moore curve on top of both stacks is not required, so the right stack is created immediately, using a for-loop, again, with dnrBuildingBlocks/2e iterations. Algorithm 2 Initialize an even amount of Building Blocks

Require: nrNodes > 0 listOfNodes = []

nrIterations = blog4nodesc

nrBuildingBlocks = dnrNodes/4nrIterationse for BuildingBlock in [1; dnrBuildingBlocks/2e] do

listOfNodes.extend (hilbertCurve(nrIterations)) shift (offset )

end for

for BuildingBlock in [1; dnrBuildingBlocks/2e] do listOfNodes.extend (hilbertCurve(nrIterations)) shift (offset )

end for

3.2.2

The Cutting Off of Nodes

Now that the stacks of building blocks have been set up, it is time to cut of the unnecessary nodes. The cutting off of nodes can be accomplished in two different manners. One method is to randomly pick a node and simply cut it off. The second one is the cutting mechanism explained earlier, where two nodes are cut off at the same time.

Both methods, luckily, have a way of being improved to help preserve the space-filling property of the curve as well as the stability of the algorithm’s results. Before immediately removing the first suitable node or pair of nodes, calculate the distance from the nodes to the middle of the plane, spanned by the curve. With this method, only the nodes on the outskirts of the plane will be removed, which prevents holes from opening up near the center of the curve.

This establishes four categories, all of which need to be molded into an algorithm. The first category consists of a non-deterministic algorithm, which is able to handle both an even as well as an uneven number as an input. The obvious advantage of this category is the fact that the algorithm is able to design networks of every size, both even and uneven amounts of nodes. A first problem of this algorithm is the fact that the curve might lose its space-filling property. The other downside is the fact that it is non-deterministic, which is highly unwanted in this project. The algorithms in the second category can still handle even and uneven numbers as input, but they will be deterministic. It keeps the same advantage as the first category of being able to

(19)

handle every positive integer as an input. The main problem of the first category is also solved. However, a new problem has risen, namely that in the results of this algorithm the curve might cross itself. In this project that is not an option.

Category number three holds the non-deterministic algorithm that only handles even num-bers. This algorithm is non-deterministic, can’t handle uneven amount of nodes and might lose its space-filling property. So why would this category even be an option? It cuts off nodes in pairs, which is very effective when Hilbert and Moore curves are used.

The final category is deterministic of nature, but its algorithms won’t accept uneven numbers as input. Losing all possibilities where the amount of nodes is uneven is a big downside. However, it has the same effectiveness as the third category, cutting off nodes in pairs, without being non-deterministic.

Randomly Cutting Off Single Nodes

The algorithm that randomly cuts off single nodes is a very simple one. Every time the algorithm is run, a random item of the list listOfNodes is deleted.

Algorithm 3 Randomly Cutting Off Single Nodes Require: listOfNodes 6= ∅

listOfNodes.delete(randint ())

Optimally Cutting Off Single Nodes

This algorithm starts by calculating the midpoint of the entire set of nodes, returning an x-value and a y-x-value. The next step is to setup a for-loop, with len(listOf N odes) iterations. Every iteration, the distance from the i-th node to the earlier calculated midpoint and saves this distance into a new list listOf N ominees. This distance is calculated by using the function distance(point1, point2), which returns a float. When every iteration of the for-loop is run, the node that lies farthest from the midpoint is selected and deleted.

Algorithm 4 Optimally Cutting Off Single Nodes Require: listOfNodes 6= ∅

listOfNominees = []

averageX , averageY = midpoint (listOfNodes) for i in [1; len(listOfNodes)] do

distance = distance(listOfNodes[i ], (averageX , averageY )) listOfNominees.append ((i , distance))

end for

index = maxValue(listOfNominees)

listOfNodes.delete(listOfNominees[index ][0])

Cutting Off Pairs of Nodes

This algorithm begins with a for-loop with len(listOf N odes)−3 iterations. len(listOf N odes)− 3, because the algorithm needs to look three nodes ahead to properly do its calculation. Every iteration, four consecutive nodes are checked for its distance from the first node to the fourth node. This calculation is done by the same distance(point1, point2)-function as before. If this distance is equal to one, the second and the third node are deleted from the list listOf N odes. This is achieved by removing the i + 1-th node, twice. By the time of the second removal, the first node is already removed and this gives the second node the old position of the first node. Optimally Cutting Off Pairs of Nodes

This algorithm starts with calculating the coordinates of the midpoint, again. Then, within the for-loop, the distance from the first to the fourth node of every four consecutive nodes is

(20)

Algorithm 5 Cutting Off Pairs of Nodes Require: listOfNodes 6= ∅

for i in [1; len(listOfNodes) − 3] do

distance = distance(listOfNodes[i ], listOfNodes[i + 3]) if distance = 1 then listOfNodes.delete(i + 1) listOfNodes.delete(i + 1) break end if end for

calculated by the well-known distance(point1, point2). Following up on that, if this distance is, indeed, one, the distance from the pair of nodes that might be deleted, i.e. the second and the third node of the four consecutive nodes, to the earlier calculated midpoint will be calculated. This latest distance will be stored in a list listOf N ominees. When every iteration of the for-loop is run, the pair of nodes that lies farthest from the midpoint is selected and deleted.

Algorithm 6 Optimally Cutting Off Pairs of Nodes Require: listOfNodes 6= ∅

listOfNominees = []

averageX , averageY = midpoint (listOfNodes) for i in [1; len(listOfNodes) − 3] do

distance = distance(listOfNodes[i ], listOfNodes[i + 3]) if distance = 1 then

newX = (listOfNodes[i + 1][0] + listOfNodes[i + 2][0])/2 newY = (listOfNodes[i + 1][1] + listOfNodes[i + 2][1])/2 distance = distance((newX , newY ), (averageX , averageY )) listOfNominees.append ((i , distance))

end if index = maxValue(listOfNominees) listOfNodes.delete(listOfNominees[index ][0]) listOfNodes.delete(listOfNominees[index ][0]) end for

3.3

Analysis

The reason both the Hilbert curve and the Moore curve are being used to design the networks is their property of preserving locality. To be able to pass proper judgment on the efficiency of the design, both a method to visualize this preserving of locality and a different design algorithm for comparison are needed.

The visualisation method to be used in this thesis is to collect statistics on the distances in the network on the various levels, i.e. level 1 contains the distances between all nodes. Level 2 contains the distances between every other node, or skipping one node with every step. Level 3 skips two nodes with every step, and so on.

Every level within the network will be analysed with the following statistics. These statistics

(21)

will, complemented with a visual of the actual design, give a complete view of the effectiveness of the several algorithms and eases the comparison between them.

The statistics will mostly measure the effectiveness of the curve’s space filling property. The average distance between the nodes on a certain level gives a quick peek, but without the maxi-mum distance and the median value of all the distances, it might give a misrepresenting view of the effectiveness. Lastly, a convex hull, containing the design, is created. A convex hull is the smallest convex shape containing all of the points. An object is convex if for every pair of points within the object, the straight line between the points is also within the object. The area of the convex hulls are calculated to produce a wider picture, showing to what extent the algorithm is efficient for chip design.

3.4

The Library

All of the work, done in this project, lead to a library containing several functions. This section will discuss these.

createDesign ’createDesign’ is a function that, as expected, creates a design. It takes the number of nodes and the used algorithm as parameters. The first step is setting up a list of nodes. After that, these nodes are plotted, using the ’matplotlib’ library.

analyzeDesign ’analyzeDesign’ takes, just as ’createDesign’, the number of nodes and the used algorithm as parameters. With these parameters, a list of nodes is set up in the same way as with the ’createDesign’ function. Afterwards the analysis of this design is done, producing a convex hull of the design and an overview of the analysis, consisting of the average distance, the maximum distance and the median value of all the distances.

designOverview ’designOverview’ is a combination of ’createDesign’ and ’analyzeDesign’. First, it calls ’createDesign’. Then, it calls ’analyzeDesign’. So, as its parameters, it takes the same ones as these two functions, the number of nodes and the used algorithm.

analysisOverview ’analysisOverview’ produces a graph where the average distance of each level is compared with the maximum distance of each level in a one-dimensional network, i.e. the maximum distance of level 10 in a one-dimensional network is 10. The same is done with the maximum distance and the median value of all the distances. This comparison is then displayed as a percentage. The function’s parameters are a minimum number of nodes, a maximum number of nodes and the used algorithm.

analyzeAlgorithm ’analyzeAlgorithm’ produces a graph with three plots, while the x-axis shows the level and the y-axis shows the distance. Its three parameters are a minimum number of nodes, a maximum number of nodes and the used algorithm. The three plots display averages of all the average distances, the maximum distances and the median values of all the distances of the designs within the range of number of nodes.

algorithmOverview ’algorithmOverview’ does almost the same as ’analysisOverview’, with the differences that the plot of the maximum distance and the median value of all the distances are removed. In their place, the percentages, based on the average distances are compared between the four algorithms in the chosen category. Below is stated which category holds which algorithms. This function’s parameters are a minimum number of nodes, a maximum number of nodes and the used algorithm.

An Example

(22)

c r e a t e D e s i g n ( 4 0 , 1 ) a n a l y z e D e s i g n ( 4 0 , 1 )

(23)
(24)
(25)

4

Results

“This is loud. This is cold. This is endless and I know growing up has just begun.”

– Yellowcard. “Be the Young.” When You’re Through Thinking, Say Yes. Hopeless Records, 2010. Compact Disc.

This chapter will contain a section for each algorithm, where every algorithm will first be compared to the square root of the number of nodes. This square root can be seen as the result of an optimal design, where all the nodes are put into the form of a square. Intuitively, this gives an optimal design.

However, before analyzing the designs produced by the eight new algorithms, this chapter will start with two analyses of different designs. The first is the 1D network design, shown in Figure 1.1 on page 5, while the second analysis will show why naive algorithms are less sufficient in this project.

The final section of this chapter will contain a comparison of each algorithm to determine which algorithm is best to use in which situation.

In this chapter, every algorithm and its results will be explained with a single example, namely a design of 40 design. The amount of nodes is specifically chosen so that there will be a difference between the algorithms that allow an uneven amount of building blocks and those that do not. For those interested in more examples, a library is available online.1

4.1

The One-Dimensional Reference

Before starting with the eight algorithms and its results, it is important to know how the situation is without these algorithms. To give an impression, Figure 4.1 shows the metrics, used upon the 1D network, represented in Figure 1.1, on page 5. The only difference being that the network in Figure 1.1 has 16 nodes, while the example used to set up the graph in Figure 4.1 has 40 nodes, just as the networks from the eight algorithms.

The metrics shows the average distance, the maximum distance and the median value of all the distances as the same value for each level. This is the worst possible design, and the rest of this chapter will demonstrate how the algorithms from chapter three will minimize these distances.

4.2

A Naive Algorithm

The next step is to show once again why these complex algorithms are necessary. Why not use a naive algorithm, such as the design in Figure 4.2? Figure 4.3, gives the answer. This analysis shows a big difference maximum distances among the different levels. The more complex algorithms will be more stable in its distances, the maximum distance, the average distances and the median value of all the distances.

(26)

Figure 4.1: Analysis of the One-Dimensional Design

(27)

Figure 4.3: Analysis of the Naive Design

4.3

The First Texan

The first algorithm that will be analyzed and compared is the algorithm made up of an uneven amount of building blocks. Also, it uses the default version of the ’Cutting Mechanism’. The

1https://github.com/PvdPal/ANL

(28)

Figure 4.5: Final Design with 40 Nodes for Algorithm 1

first step of the algorithm is to set up the correct amount of building blocks, as done in Figure 4.4. This shows the first step of the algorithm creating a design with a size of 40 nodes. The largest iteration of 4n smaller than 40 is 42, or 16. So three building blocks are needed to be set up.

The second step of the algorithm is cutting off enough nodes to reduce the 48 nodes from the building blocks to the 40 nodes wanted in the first place. Since the ’Cutting Mechanism’ cuts off pairs of nodes, four pairs should be cut from the building blocks. In the example of this algorithm, shown in Figure 4.5, the following four pairs are cut off: Pair1 = {{3, 1}, {2, 1}}, Pair2 = {{0, 0}, {0, 1}}, Pair3 = {{0, 2}, {0, 3}} and Pair4 = {{1, 3}, {2, 3}}.

The analysis is as explained in the previous chapter. On every level, the average distance, the maximum distance and the median value of all the distances are calculated and shown in the graph in Figure 4.20. The convex hull has an area of 35,5 and is displayed in Figure 4.28.

4.4

Split Second

This section describes the second algorithm that, as the first algorithm, is made up of an uneven amount of building blocks. However, the ’Cutting Mechanism’ it uses is optimized. This means that the first step of the algorithm is exactly the same as with the first algorithm, three building blocks of 16 nodes each (Figure 4.6).

Here, the second step of the algorithm, is where the algorithm differs from the first one. Still four pairs of nodes have to be cut off, but the pairs themselves are in different locations in the curve, as seen in Figure 4.7. Namely: Pair1 = {{0, 0}, {0, 1}}, Pair2 = {{2, 6}, {2, 7}}, Pair3 = {{5, 7}, {5, 6}} and Pair4 = {{7, 1}, {7, 0}}.

The analysis, as it should be, contains the same metrics as with the analysis of the first algorithm. However, some small differences within the graph can be noticed, especially near the higher levels (the right side of the graph). The area of the convex hull is quite similar with a size of 35,0. However, in contrast to that of the first algorithm, this convex hull is symmetrical.

(29)

Figure 4.6: Setting up the Building Blocks for Algorithm 2

(30)

4.5

The Third Visitor

The third section contains the third algorithm, which is the first algorithm that does not allow an uneven amount of building blocks. The second part of this algorithm uses the default (not optimized) version of the ’Cutting Mechanism’. As a result, the first step is different from the previous two algorithms’ first steps. As can be seen in Figure 4.8, this example consists of four building blocks containing 16 nodes each, resulting in a total of 64 nodes.

In order to reach the desired 40 nodes, 24 nodes, or 12 pairs of nodes, need to be cut off. Fig-ure 4.9 shows the 12 pairs to be: Pair1 = {{3, 1}, {2, 1}}, Pair2 = {{0, 0}, {0, 1}}, Pair3 = {{0, 2}, {0, 3}}, Pair4 = {{1, 3}, {2, 3}}, Pair5 = {{3, 5}, {2, 5}}, Pair6 = {{0, 4}, {0, 5}}, Pair7 = {{0, 6}, {0, 7}}, Pair8 = {{1, 7}, {2, 7}}, Pair9 = {{3, 7}, {4, 7}}, Pair10 = {{7, 7}, {7, 6}}, Pair11 = {{5, 7}, {6, 7}} and Pair12 = {{7, 5}, {7, 4}}.

The analysis, based on the average distance, the maximum distance and the median value of all the distances, of the third algorithm shows similarities with the analysis of the first algorithm, but seems less stable when it comes to the difference between the succeeding levels (Figure 4.22). Despite the similarities, Figure 4.30 shows that the convex hull is almost symmetrical. Also, the convex hull has an area of 34,5.

4.6

A Fourth For Bridge

The fourth algorithm returns to the optimized ’Cutting Mechanism’ and keeps the disallowance of the uneven amounts of building blocks intact. Again, this means that the 4 building blocks of 16 nodes each, shown in Figure 4.10, will have to lose 12 pairs of nodes to reach its goal of 40 nodes.

As shown in Figure 4.11, the following 12 pairs are the ones deleted: Pair1 = {{0, 0}, {0, 1}}, Pair2 = {{2, 0}, {1, 0}}, Pair3 = {{0, 2}, {0, 3}}, Pair4 = {{0, 4}, {0, 5}}, Pair5 = {{0, 6}, {0, 7}}, Pair6 = {{1, 7}, {2, 7}}, Pair7 = {{3, 7}, {4, 7}}, Pair8 = {{7, 7}, {7, 6}}, Pair9 = {{5, 7}, {6, 7}}, Pair10 = {{7, 5}, {7, 4}}, Pair11 = {{7, 1}, {7, 0}} and Pair12 = {{6, 0}, {5, 0}}.

The first analysis, in Figure 4.23, again, seems unstable at first glance. The convex hull,

(31)

Figure 4.9: Final Design with 40 Nodes for Algorithm 3

(32)

Figure 4.11: Final Design with 40 Nodes for Algorithm 4

despite its high asymmetrical value, has an area of 31,5 (Figure 4.31).

(33)

Figure 4.13: Final Design with 40 Nodes for Algorithm 5

4.7

Five

With the fifth algorithm, the uneven amount of building blocks return. New is the method to remove the unnecessary nodes. This method removes single nodes from the building blocks at random until the target of 40 nodes is reached. As seen earlier with the first and the third algorithms, this algorithm has 3 building blocks, as seen in Figure 4.12.

After the removal of the eight unnecessary nodes, Figure 4.13 shows the final design. In this example, these nodes are: Node1 = {2, 0}, Node2 = {1, 3}, Node3 = {2, 3}, Node4 = {2, 2}, Node5 = {3, 4}, Node6 = {5, 3}, Node7 = {6, 3} and Node8 = {6, 1}.

The analysis, based on 100 runs of the algorithm, in Figure 4.24 shows a rather unstable graph, while the convex hull in Figure 4.32 has an area of 39,5.

Remember, this algorithm produces different results every time the algorithm is run. In other words, these given results may not be replicated.

4.8

The Inn of the Sixth Happiness

This sixth algorithm, as the second algorithm, allows an uneven amount of building blocks. However, relative to the second algorithm, this algorithm removes single nodes instead of pairs of nodes. With respect to the fifth algorithm, the single nodes are not removed at random, but based on their distance from the midpoint of the plane in which the curve is located.

Figure 4.15 shows the eight nodes that had to be removed from the three building blocks to reach the goal of 40 nodes: Node1 = {0, 0}, Node2 = {0, 1}, Node3 = {2, 7}, Node4 = {3, 7}, Node5 = {4, 7}, Node6 = {5, 7}, Node7 = {7, 1} and Node8 = {7, 0}.

As Figure 4.25 shows the distances are fairly stable across the several levels, apart from the higher levels. The convex hull, with an area of 34,0, is, again, symmetrical.

(34)

Figure 4.14: Setting up the Building Blocks for Algorithm 6

(35)

4.9

Shichinin No Samurai (Seven Samurai)

The seventh and the second-to-last algorithm is build upon even amounts of building blocks, not allowing uneven amounts of building blocks. The second step is, again, randomly cutting off single nodes. This means that the 64 nodes, four building blocks of 16 nodes each, will have 24 single nodes cut off.

Figure 4.17 shows which of the 64 nodes are cut off, namely these 24: Node1 = {3, 1}, Node2 = {0, 1}, Node3 = {0, 3}, Node4 = {1, 3}, Node5 = {2, 2}, Node6 = {3, 3}, Node7 = {3, 4}, Node8 = {3, 5}, Node9 = {0, 6}, Node10 = {1, 7}, Node11 = {2, 6}, Node12 = {3, 6}, Node13 = {5, 6}, Node14 = {5, 7}, Node15 = {7, 6}, Node16 = {7, 4}, Node17 = {6, 4}, Node18 = {5, 5}, Node19 = {4, 5}, Node20 = {4, 4}, Node21 = {4, 3}, Node22 = {4, 2}, Node23 = {7, 3} and Node24 = {7, 0}.

Quick note: Node10 = {1, 7} does not seem to be removed, but actually is.

The analysis, based on 100 runs of the algorithm, in Figure 4.26 shows a high instability between levels. The convex hull, shown in Figure 4.34, has an area of 47,5.

Remember, this algorithm produces different results every time the algorithm is run. In other words, these given results may not be replicated.

4.10

Eight O’Clock Walk

The last algorithm does not allow an uneven amount of building blocks, only even amounts of building blocks. Cutting off nodes is done one by one, based on the distance from the nodes to the midpoint of the plane in which the curve is located. Again, 24 of the 64 nodes set up by the four building blocks have to be cut off.

Figure 4.19 shows these nodes cut off: Node1 = {3, 0}, Node2 = {2, 0}, Node3 = {1, 0}, Node4 = {0, 0}, Node5 = {0, 1}, Node6 = {1, 1}, Node7 = {1, 2}, Node8 = {0, 2}, Node9 = {0, 3}, Node10 = {0, 4}, Node11 = {0, 5}, Node12 = {1, 6}, Node13 = {0, 6}, Node14 = {0, 7}, Node15 = {1, 7}, Node16 = {2, 7}, Node17 = {6, 7}, Node18 = {7, 7}, Node19 = {7, 6}, Node20 = {7, 1}, Node21 = {7, 0}, Node22 = {6, 0}, Node23 = {5, 0} and Node24 = {4, 0}.

(36)

Figure 4.17: Final Design with 40 Nodes for Algorithm 7

Figure 4.27 shows rather stable graphs for graph of the average distance, the graph of the maximum distance as well as the graph of the median values of all the distances, while Figure 4.35 shows the convex hull, with an area of 30,5.

(37)

Figure 4.19: Final Design with 40 Nodes for Algorithm 8

4.11

The Final Comparison

To only judge these algorithms based on a single number of nodes, this analysis would not be complete. However, to show the results based on these metrics for every possible size, this chapter would grow beyond unreadable. Therefore, this section shows a different type of graphs, namely 3D plots. These 3D plots have the same axes as the 2D plots in the previous sections, with one additional axis showing the different amounts of nodes. These plots will be a first step towards the final comparison of the eight algorithms. This final comparison will have the eight 3D plots all added to a single 3D coordinate system, and will be shown from below to transform the graph into a heat map. This heat map will show, with a different color corresponding with a different algorithm, which algorithm best to use for which combination of number of nodes and level optimization.

The eight planes in Figures 4.36 to 4.43 contain the information necessary to determine which algorithm is best to use in which situation. One problem, determining this based on these eight planes is difficult, might even be impossible. The heat map in Figure 4.44 shows exactly which algorithm is the best choice in every situation. The color bar on the right side of the heat map shows which color in the heat map corresponds with which algorithm, where ’0’ stands for the empty spaces in the heat map. These empty spaces do not have results.

However, since these results do not take into account the fact that the curves, produced by algorithms 5 to 8, have a tendency to self-intersect and superpose, which can cause ’unfair’ advantages, because the resulting paths are then unrealistically shorter. Figure 4.45 shows the heat map with just the results from algorithms 1 to 4.

(38)

Figure 4.20: Algorithm 1 Figure 4.21: Algorithm 2 Figure 4.22: Algorithm 3 Figure 4.23: Algorithm 4

(39)

Figure 4.24: Algorithm 5 Figure 4.25: Algorithm 6 Figure 4.26: Algorithm 7 Figure 4.27: Algorithm 8

(40)

Figure 4.28: Algorithm 1 Figure 4.29: Algorithm 2 Figure 4.30: Algorithm 3 Figure 4.31: Algorithm 4

(41)

Figure 4.32: Algorithm 5 Figure 4.33: Algorithm 6 Figure 4.34: Algorithm 7 Figure 4.35: Algorithm 8

(42)

Figure 4.36: Algorithm 1 Figure 4.37: Algorithm 2 Figure 4.38: Algorithm 3 Figure 4.39: Algorithm 4

(43)

Figure 4.40: Algorithm 5 Figure 4.41: Algorithm 6 Figure 4.42: Algorithm 7 Figure 4.43: Algorithm 8

(44)

Figure 4.44: The First Heat Map

(45)

Figure 4.45: The Second Heat Map

(46)
(47)

5

Discussion

“The days turned into months. The months, they turned into years.”

– The Higher. “The (Runaway) Artist.” It’s Only Natural. Epitaph Records, 2009. Compact Disc.

This chapter will, firstly, explain how to read the heat maps in Figures 4.44 and 4.45. For example, take a look at Figure 4.45. When a network with 90 nodes is desired, which is known to have most traffic on level 20, the second heat map shows that, since the intersection of these two values is green, the second algorithm is the best choice. With a network of that size, the second algorithm is always the best choice, no matter on which level the most traffic is, since the column of 90 nodes is entirely green.

However, when we take a look at 160 node-sized networks, the column is not entirely made of one color, which means that the choice for the best algorithm is based on the level optimization. For example, if the most traffic is still on level 20, algorithm 2 would still be the best choice. However, when most of the traffic is on level 60, for example, algorithm 2 would be surpassed in efficiency by algorithm 4.

When we take all eight algorithms into account, such is the case in Figure 4.44, the heat map is even more complex, which shows that the choice for the right algorithm to use is not only dependant on the number of nodes, but also on the level. This brings the number of surprises by the results to two, next to the fact that there is no algorithm single-handedly the best choice, no matter the circumstances.

The third surprise is the fact that the choice for the best algorithm is unpredictable, i.e. not based on a simple formula with the number of nodes and the level as variables. These surprises compromise the ability to properly answer the research questions, drafted at the beginning of this project, with a single answer. Instead, different situations need the different algorithms.

5.1

Righting Wrongs

The unsolved problem is caused by removing single nodes without checking for the preservation of the space-filling property of the curve, which is the case in algorithms 5 to 8. This, in turn, causes the curve, in some situations, to intersect itself. This effect is unwanted, especially when the algorithms are used for chip-design, where these intersections are difficult to handle, for it requires multiple chip layers, which may, unpredictably, increase the overall cost. An example of a solution for this problem might be to use a shortest-path algorithm on all the nodes that are involved with the intersecting. However, a proper solution would need to be designed to avoid efficiencies

5.2

Directions for Future Work

Not only flaws are segments with room for improvement, every segment of the algorithm can be improved, or at least investigated further. This section shows four components that might be further looked into.

(48)

Figure 5.1: Z-order Algorithm

Destructive vs. Constructive Algorithms

The first component is not implemented because of a choice, made at the beginning of the project. It was decided then to limit the project to only the destructive algorithms, subsequently causing the constructive algorithms to be left out. While it can not be said with certainty, it will certainly be an interesting approach for further research to find out which approach is more efficient for network design.

Differences between 2D and 3D

A second interesting approach might be the conversion from 2D to 3D. Herman Haverkort, from the Eindhoven University of Technology, has written a paper on higher dimensional Hilbert curves.[6] These higher dimensional Hilbert curves can be rearranged into different 3D space-filling curve variations, just as the Moore curve is for the Hilbert curve in 2D. Intuitively, this might minimize the distances even further between the nodes.

Relevance of Other Types of Curves

Another approach is to use different types of space-filling curves. So, instead of using Hilbert and Moore curves, Peano and Z-order curves could be used. Using these different curves will, obviously, produce different designs, which will have different results at the analysis.

In the timespan of this project, some experimentation has been done with Z-order curves. During these experiments, two problems were encountered. The first was found during tests with the removal of single nodes, the other with the removal of pairs of nodes. The first problem was that, when the algorithm removed single nodes from the curve, the amount of self-intersections rose highly compared to the algorithms, based on Hilbert and Moore curves. The second problem was that in the curve made up of the building blocks, before the removal started, there were not enough pairs of nodes that met the conditions for removal using the Cutting Mechanism.

However, to determine if these results will be for the better, even after these problems are solved, more research into the matter is necessary.

Relevance of Other Topologies

A fourth possibility for future research is changing the topology. So, instead of squares, one might try to use triangles as a building block for the coordinate system. However, this change of topology means that Hilbert and Moore curves, for example, will no longer be useful, since these curves only have value in the standard coordinate system.

(49)
(50)
(51)

6

Conclusion

“I think I’ll go to Boston. I think that I was tired. I think I need a new town to leave this all behind.”

– Augustana. “Boston.” All the Stars and Boulevards. Epic Records, 2005. Compact Disc.

The purpose of this thesis was to develop an algorithm to map multiple one-dimensional networks to a two-dimensional network. This was achieved by setting up a combination of Hilbert and Moore curves, and then adjusting it until it satisfies the desires by the cutting of nodes. Afterwards, the different algorithms were analyzed, based on their intra-level distances.

Based on these results, the strongest and most important statement could be that the optimal design, the square root of the amount of nodes, can be approached with these algorithms. With more research done in the future, leading to better optimized algorithms, the results may even reach these optimal values.

The first of two other advantages of these algorithms is a better utilization of chip design with favourable locality properties. The second advantage is the algorithms’ automated method to construct the layout of complex latency constraints, a task where, up to now, human participation is often required.

However, as said during the discussion, not every algorithm performs as well as they were meant to perform, referring to the self-intersecting problem. Once this is solved, by a proper solution, either the one proposed or another, each of these algorithms demonstrate their ability to approximate the results of an optimal design.

The opportunities, created by the algorithms developed in this thesis, may result in more proficient designs, for both chips and networks. These designs, as a result, may, in turn, lead to faster chips and networks, simply because the propagation delay lowers in both chips and networks.

(52)
(53)

Bibliography

[1] Gordon E. Moore, Cramming more components onto integrated circuits, 1965. [2] David Hilbert, Ueber die stetige Abbildung einer Linie auf ein Fl¨achenst¨uck, 1891. [3] Eliakom Hastings Moore, On Certain Crinkly Curves, 1900.

[4] Giuseppe Peano, Sur une courbe, qui remplit toute une aire plane, 1890. [5] Nicholas J. Rose, Hilbert-Type Space-Filling Curves, 2010.

Referenties

GERELATEERDE DOCUMENTEN

They are as follows: z-score is the distance to insolvency (measured as the natural logarithm of [ROA+CAR]/st.dev.[ROA]), NPL ratio is the ratio of non-performing loans to total

algemene conclusies zijn dan ook dat er in de bovenste laag van het veen wel enkele antropogene indicatoren aanwezig zijn (beduidend meer niet-boompollen dan in de rest van het

Publisher’s PDF, also known as Version of Record (includes final page, issue and volume numbers) Please check the document version of this publication:.. • A submitted manuscript is

Publisher’s PDF, also known as Version of Record (includes final page, issue and volume numbers) Please check the document version of this publication:.. • A submitted manuscript is

Enter BRABANTIO, OTHELLO, IAGO, RODERIGO, and Officers DUKE OF VENICE.. Valiant Othello, we must straight employ you Against the general

Necessary and sufficient conditions in terms of openings In the previous section we defined the notions of opening en minimal opening and derived a number of properties which

Given a closed orientable surface S, the fundamental group π 1 (S) is isomorphic to the covering isometry group Γ of S, by the isomorphism that maps the homotopy class of a curve c

§5. Axiom and implicit definition. In his Grundlagen, Hilbert famously claims that a certain group of his axioms for geometry defines the notion of betweenness; 64 in a letter to