• No results found

Optimisation Methods for Bluetooth ScatternetFormation

N/A
N/A
Protected

Academic year: 2022

Share "Optimisation Methods for Bluetooth ScatternetFormation"

Copied!
64
0
0

Loading.... (view fulltext now)

Full text

(1)

IN

DEGREE PROJECT MATHEMATICS, SECOND CYCLE, 30 CREDITS

STOCKHOLM SWEDEN 2017,

Optimisation Methods for Bluetooth Scatternet

Formation

NICLAS FUGLESANG GEUKEN

(2)
(3)

Optimisation Methods for

Bluetooth Scatternet Formation

NICLAS FUGLESANG GEUKEN

Degree Projects in Optimization and Systems Theory (30 ECTS credits) Degree Programme in Applied and Computational Mathematics (120 credits) KTH Royal Institute of Technology year 2017

Supervisor at KTH: Carlos Fischione

(4)

TRITA-MAT-E 2017:65 ISRN-KTH/MAT/E--17/65--SE

Royal Institute of Technology School of Engineering Sciences KTH SCI

SE-100 44 Stockholm, Sweden

(5)

Contents

Abstract . . . 4

1 Introduction 6 1.1 Outline . . . 8

2 State of the Art 9 2.1 Introduction . . . 9

2.2 Network Formation . . . 9

2.3 Network Optimisation . . . 10

2.4 This Report . . . 11

3 Problem Formulation 13 3.1 The Problem . . . 13

3.2 The Objective . . . 15

4 Theoretical Background 17 4.1 Graphs . . . 17

4.2 Distributed Algorithms . . . 18

4.3 Maximal Independent Subsets . . . 19

4.4 Assignment Problems and Auctions . . . 20

4.5 Spanning Tree Construction . . . 25

5 Algorithms 28 5.1 Master Selection . . . 28

5.2 Assignment . . . 31

5.3 Spanning Tree Formation . . . 34

5.4 Performance Analysis . . . 40

6 Numerical Analysis 43 6.1 Solution Availability . . . 43

(6)

6.2 Brute Force Comparison . . . 45

7 Conclusions and Future Work 49

7.1 Conclusions . . . 49 7.2 Future Work . . . 50

Bibliography 52

(7)

List of Figures

1.1 Smart Office scenario . . . 7

3.1 A graph where there is no possible solution . . . 14

5.1 Flowchart showing a summary of the algorithm . . . 29

5.2 Example of a network found using these methods . . . 37

5.3 Example of a network found using these methods . . . 38

5.4 Example of graph where degree constraints is a problem . . . 41

6.1 Percentage of runs that work compared to graph size . . . 44

6.2 Brute force comparison; 5 nodes . . . 47

6.3 Brute force comparison; 6 nodes . . . 47

6.4 Brute force comparison; 7 nodes . . . 48

List of Algorithms

1 Auction Algorithm for regular assignment . . . 22

2 GHS (Gallager-Humblet-Spira) . . . 26

3 Simple distributed algorithm to find a MIS . . . 30

4 Distributed Auction Algorithm for Slave i . . . 35

5 Distributed Auction Algorithm for Master k . . . 36

6 Algorithm to form a DCSP . . . 40

(8)
(9)

Abstract

The Bluetooth scattnernet formation problem is to find a network on a graph under constraints inspired by the limitations of Bluetooth technology. The problem is presented along with a summary of the current state of research.

A method of finding solution is proposed that takes the problem and splits it into three parts where every part is solved using a distributed algorithm.

The approach uses methods from network optimisation to first find a max- imal independent subset that makes up the masters of the network, then an assignment of slaves to masters using an auction algorithm and finally a minimal spanning tree that connects the clusters around the masters to- gether. It’s shown that a solution can’t always be found and it is investigated how often the algorithm finds a solution. The method is then compared to a brute force solution to asses how close to the best possible network the algorithm comes. It was found that for smaller graphs the algorithm lands not far from the best solution. Informal arguments are made regarding op- timality and complexity of the method and suggestions for further research are made.

(10)
(11)

Sammanfattning

Bluetooth scatternet formations-problemet ¨ar att hitta ett n¨atverk p˚a en graf givet vissa bivillkor inspirerade av begr¨ansningarna i Bluetoothteknolo- gin. Problemet presenteras tillsammans med en sammanfattning av nul¨aget i forskningen kring bluetoothn¨atverk. En metod f¨or att hitta l¨osningar till problemet f¨oresl˚as som tar problemet och delar upp det i tre delar d¨ar varje del l¨oses med en distribuerad algoritm. Tillv¨agag˚angss¨attet anv¨ander metoder fr˚an n¨atverksoptimering f¨or att f¨orst hitta et maximals oberoende delm¨angd av n¨atverket som utg¨or m¨astarnoderna, sedan g¨ors en tilldelning av slavar till m¨astare genom en auktionsalgoritm och till sist tas ett minimalt uppsp¨annande tr¨ad fram som kopplar ihop alla kluster kring m¨astarna. Det visar sig att en l¨osning inte alltid finns och det unders¨oks hur ofta algorit- men hittar en l¨osning. Metoden j¨amf¨ors sedan med en metod som anv¨ander Brute Force f¨or att bed¨oma hur n¨ara den b¨asta l¨osningen metoden lyckas komma. Det visas att f¨or sm˚a grafer lyckas algoritmen komma n¨ara det b¨asta n¨atverket. Informella argument g¨ors g¨allande optimalitet och komplexitet och f¨orlag f¨or vidare studier ges.

(12)
(13)

Chapter 1

Introduction

According to Google Trends the number of searches for ”Internet of Things”

has risen from 5 million in 2007 to about 100 million in 2017 so far [2]. This rise only reflects the rising popularity of appliances that are connected to each other and the rest of the world. In the past, this would imply a fair load of cables. Nowadays we use wireless connections to replace cables, par- ticularly for communications. The most widely used technology for wireless communications in small networks is Bluetooth.

Bluetooth has been around since about 1999. Bluetooth was first developed by Intel, Ericsson, IBM, Nokia and since then many more then 30000 corpo- rations has joined the development and more then 2.5 billion products with bluetooth communications capabilities were shipped in 2013 [3].

The growth of connected appliances means that more and more building will have networks built up of these devices, and this motivates the need for research on how to build and maintain these network. A scenario that exemplifies this scenario is the one shown in Figure 1.1.

When more and more machines are connected it is increasingly relevant to be able to form a network where the machines are not only connected, but connected well. What it means that a network is connected well is subjective, but one example is maximizing the lifetime of the network, that is until one or more nodes in the network dies. This is more or less the same as minimizing the energy-consumption from the connection, since energy consumed is drained from the batteries. We might also want to maximize the capacity of the network, so the rate of data that can be sent from one

(14)

Figure 1.1: Smart office IoT scenario (top), and the corresponding Bluetooth scatternet topology (bottom). Picture from Ok et.el [1]

part of the network to another is greater. In the end, the users of the devices in the networks want to be able to use the devices without charging them frequently and have fast and stable connections.

Mathematical optimisation is used to find these optimal solutions and the fact that the appliances in the network are independent and don’t rely on a central unit to control them, means that distributed methods to find the optimal solutions are perfectly suitable for this kind of problems.

In the future the mathematics developed and used for Bluetooth might be applied to more modern problems, for example 5G. The mathematics devel- oped in this area is applicable to all problems that can be modeled like a network of devices, so even though Bluetooth is the scope here, the general picture is far greater.

In this thesis an algorithm is developed that is based on works on network optimisation. The Bluetooth scatternet formation problem is modeled and a method to find such a network is developed that is based on three different methods. The first selects the masters, the second assigns every device to a master and the third connects everything together into a network where every device has a path to any other device. The algorithm is based on works that find maximal independent networks, optimal assignments and minimal spanning trees. Since all three are distributed algorithms the final

(15)

algorithm is also distributed.

This results in an algorithm that succeeds in finding networks that fulfill all constraints for smaller graphs but for graphs with increasing number of nodes fails to consistently produce valid solutions. The performance is then compared with a method that finds a solution by brute force and for smaller graphs it’s found that the algorithm doesn’t end up far from the best possible result.

1.1 Outline

The outline of this report:

1. The first part is an introduction.

2. The second part is a summary of modern and current research into the problem of forming Bluetooth scatternets.

3. The third part concerns the formulation of the problem and some properties of the problem are studies. How and Why the problem is split into three parts is explained.

4. The fourth part is a brief explanation of the theory behind the methods used in this report.

5. The fifth part describes the algorithm used to solve the problem and that make up the algorithm at large.

6. The sixth part describes the numerical experiments done to test the performance of this algorithm, specifically how often it works and how close to optimal it can get.

7. The last part is some conclusions and examples on future studies that can be done to continue the work done here.

(16)

Chapter 2

State of the Art

2.1 Introduction

A Bluetooth network is made up of several devices that communicate in widely different ways, some send instant messages to each others, and some continuously stream video or sound to others, different needs require differ- ent models and methods.

In Figure 1.1 we see an example of a scenario where a scatternet is made up a a coffeemachine, a projector, a printer and various other devices in an office building. A network that many are famoliar with is the network of a smartphone and one or more speakers where the phone is the master and the speakers are the slaves.

In real life networks are not static and devices enter and exit at different times. The matter of connecting devices to each other are handled differ- ently when forming a static network compared to when handling dynamic networks. This report considers static networks where all devices are present and are to be connected to each other in a single network, called a scatternet.

2.2 Network Formation

There are many algorithms to form scatternets. A few examples are ”BlueS- tar”, ”BlueMIS I”, ”BlueMIS II” and ”BlueMesh” [4]. All these have differ-

(17)

ent advantages and disadvantages, some produce networks with many slaves per network or does it relatively slowly. There are a few ways to measure the quality of a scatternet, for example one could prefer fewer masters and many slaves or one could measure how long the network is alive, that is how long it takes for the first node to run out of power. The large number of preferences when building Bluetooth networks has led to a large number of algorithms that build such networks [5].

In ”BSF-UED: A New Time-Efficient Bluetooth Scatternet Formation Al- gorithm Based on Unnecessary-Edges Deletion” [5] Jedda et.al. introduce a scatternet formation algorithm that build on others methods but add heuris- tics that limit the degree on the masters. The algorithm thus amends an issue of building networks that connects too many slaves to a master.

The paper by Mohit et.al. [6] builds a new algorithm called ”Topology formation considering role suitability” (TFRS) where the aim is to maximize the lifetime of the network. In their paper a metric called role suitability is used to assign roles of master, slave and relay among the devices. The metric is computed from characteristics such as energy level, mobility and computational capacity.

2.3 Network Optimisation

The Bluetooth scatternet formation problem has been handled from an op- timisation perspective in [7] where the authors formulate the problem as a linear optimisation problem. This means a centralised approach is used and the method is applicable when a central processing unit is used or a leader is elected beforehand.

In this report the Bluetooth scatternet formation problem is seen as a net- work optimisation problem and methods related to network optimisation is used to construct networks. More specifically auction algorithm are used to solve assignment problems and a spanning tree algorithm to form spanning trees.

Assignment problems consists of taking one entity and finding a correspond- ing object to assign it to. Much research has been done on assignments in- cluding Nobel prize winning research by Lloyd Shapley and Alvin Roth. [8].

Bertsekas et.al developed the theory on auctions that is used in this work

(18)

[9]. These methods has been improved and used to develop association of devices in millimeter wave networks, for example in the works by Yuzhe et.al. [10], [11] and [12]. There the classical algorithm for auction has been improved with regard to fairness, relaying and resource allocation.

A graph where any two nodes have a path between them yet form no cycles is called a spanning tree. There has been much research on spanning tree and their special cases, including minimal spanning tree, where the cost of the edges included is minimal and the degree constrained spanning tree, where nodes have a limit on their degree. Many scatternet formation algorithms considers spanning trees, such as Bluetree by Zeruba et.al [13]. There are numerous heuristics that approximate degree constrained spanning trees, for example the ant-based solution used in Bui et.al. [14].

Another important structure is the dominating set, and a special case of dominating set called the maximal independent subset, where the nodes in a graph are partitioned into a subset such that every node is a neighbor to the subset. This often form a backbone to the network as it is impor- tant that every node has one master it can connect to. Some works that take advantage of this structure are the work on BlueMIS, by Zaguia et.al [15].

2.4 This Report

This report concerns one particular method of constructing scatternets. We decompose the problem into three sub-problems, each that use a different technique from the ones described above. The methods used are inspired from papers on network optimization and Bluetooth scatternet formation.

And a summary of the references are made in Table 2.1. This report con- tributes with a combination of those methods that together make up an approach to solving the Bluetooth scatternet formation problem.

There are several matters that are not considered in this report that could be of importance when constructing a scatternet. A real life Bluetooth network might have vulnerabilities and therefore the network could be build so as to take privacy into account as well as having backup connections. Then no connections can ruin the whole network by loosing connectivity. We might also take into account resources and how the resources are allocated between nodes. In real life applications some randomness and noise must also be handled.

(19)

Paper: [5] [6] [7] [10] [13] [15] [16] [17] This

Centralised Algorithm · · X · X · · · ·

Distributed Algorithm X X · X X X X X X

Optimisation · · X X · · X X X

Complexity · · · X · · X X X

Spanning trees · · · · X · X · X

Assignment by Auction · · · X · · · · X

Maximal Independent Subset X · · · · X · · X

Non-homogeneous Devices · X · · · X

Table 2.1: A comparison of some properties of this work and previous works.

X means that that paper considers that property and a · means it does not.

Centralised algorithm The algorithm is centralised and performed by one device.

Distributed algorithm The algorithm is distributed and performed lo- cally at each node.

Optimisation The author has calculated how close to some optimum their method comes.

Complexity The author considers the complexity of their method.

Maximal Independent subset Some devices are grouped into a maximal independent subset.

Assignment by auction The devices are formed into piconets by an auc- tion algorithm.

Spanning Trees Devices are formed into a tree structure.

Non-homogeneous devices The devices used are weighted differently.

(20)

Chapter 3

Problem Formulation

In this chapter the problem of finding a scatternet is presented. The prop- erties of this problems that motivates a method to find solutions are dis- cussed.

3.1 The Problem

The problem of finding a scatternet is modelled as a graph according to the following definition

Definition 3.1. A network of Bluetooth devices is an undirected graph G(V, E) where each device i is a node in V . A possible connection between device i and device j is an edge (i, j) in E. Each node i has a corresponding capacity bi and each edge has a weight aij.

In this report the problem of finding a network of these devices is defined as follows

Problem 3.1. Given a network of bluetooth devices G(V, E) find a con- nected sub-graph G0(V, E0), such that E0 ⊂ E, where the vertices V are each assigned a role in {S, M, G} such that every node in S has degree 1, every node in G has degree 2, every node in M has degree less than 7 and every node share one edge with a node in M .

The variables to be decided here are then xij ∈ {0, 1} where xij = 1 means that the edge shared by node i and node j is included in the solution. We

(21)

also need to pick the role of each node i, this is the same as deciding the maximum degree of node i. The role M is a decision variable that is a subset of nodes that partitions the nodes into master and slaves, G are the nodes that are gateways, a special kind of slave that can connect to one additional master and/or gateway. Since this looks like a complicated problem we don’t want to waste our time finding a polynomial time algorithm, thus

Theorem 3.1. Problem 3.1 is NP-hard.

Proof. Since one of the constraints is that no node has degree more then 7, solving this problem would find a spanning tree with no degree higher then 7. If the solution is not a tree then we have a cycle and can delete the costliest edge in the cycle and get a spanning tree. This means that solving this problem also finds a degree constrained spanning tree. Since finding a degree constrained spanning tree is an NP-hard problem [14] for every degree, we can conclude that solving our problem is also NP-hard.

This means that we can’t find an algorithm that solves this problem in polynomial time, unless P = N P . We instead go for a more heuristic approach where we split the problem into three parts and solve each part independently.

1

2 3

4

5 6

7

8 9

Figure 3.1: A Graph where Problem 3.1 has no solution due to the constraint on the degrees.

Another problem that we have to face is

(22)

Theorem 3.2. Problem 3.1 does not always have a solution.

Proof. Consider a star with eight or more leaves and one center node, such as the one in figure 3.1. To find a network that is connected on this graph, the central vertex must be included and all of it’s edges, but that would violate the constraint regarding the degrees, no matter what roles are assigned.

This simple example shows that we can not always hope to find a solu- tion, and we can expect that there are more cases where a solution is not possible.

3.2 The Objective

The problem modeled as an optimisation problem require us to measure the value of a particular configuration. There is no definite way to do that and in this report the objective value is calculated in a manner that is compatible with the processes used to find the solution. This means that every edge is given a weight and the objective function is calculated as the sum of the weights of the edges chosen to be part of the network.

f (xij, M, G) =X

(i,j)

aijxij (3.1)

The problem is two-part, the first is selecting the roles of the devices and the second is choosing the connecting edges. Here partitioning of nodes in M and the rest is done before the edges are picked, but a solution might be in a way that does everything in parallel. The complete optimisation problem is then

min f (x, M, G) (3.2)

s.t. x, M, G solves Problem 3.1 (3.3) The literature this is based on uses general weights for everything with the one exception that they all share a common sign [9]. We here assume that the costs all have the same sign. We will not use any special costs for the

(23)

edges but some examples on how they might be chosen are these:

Example 3.1. For applications the costs can be chosen depending on what is to be optimised with regard to. We could define the cost of an edge between node i and node j as

aij = −1

2(bi+ bj) (3.4)

so that when we pick edges we give priority to edges that has one node in a high-energy device.

Example 3.2. Another way is to set the weight of an edge to

aij = − min{Ni, Nj} (3.5) where Ni is the number of neighbors of node i. A selection of this type might produce a network that aims to lower the amount of piconets.

(24)

Chapter 4

Theoretical Background

The theoretical background in this report builds on graph as the framework and algorithms that are done on graphs. Here some important concepts from graph theory are introduces along with teh concept of distributet processes.

The algorithm used to find a solution to Problem 3.1 are build on algortihm developed in previous work and are a quick summary of those algorithms and their main properties are given.

4.1 Graphs

The broader scope of this project concerns optimisation of networks, and here networks means graphs. This is optimisation where we let edges and nodes have values and then find combinations of these edges and or nodes that gives us an optimal value while still fulfilling certain constraints.

Some terms that are used in this report are graphs, degree and connected- ness.

Definition 4.1. A graph G(V, E) is a set of nodes (or vertices) V and a set of pairs of nodes E, called edges. Furthermore the nodes and the edges can have weights, number associated with each node or edge.

Definition 4.2. The amount of edges with one end in node v is called the degree of node v.

Definition 4.3. A graph G is connected if for every node v and u there is a path between u and v. That is a series of edges such that goes from u to

(25)

v.

One important structure on graphs in this report is the spanning tree.

Definition 4.4. A Spanning tree S of a graph G is a connected sub-graph such that every node in G is in S and S contains no cycles. In other words, for every two nodes in S there is only one path between them. The spanning tree where the sum of weights in the tree is the smallest is called the minimal weight spanning tree, or MST.

If the graph we produce is a spanning tree we know that there is a path between any two nodes, so any nodes in the tree can communicate. In many cases though this can produce graphs that violate the constraints and there- fore we look at the special case where the degrees in the spanning tree are limited

Definition 4.5. A degree constraint spanning tree is a spanning tree such that every node i has no more then ci connecting edges.

Finding a degree constraint spanning tree is a classical NP-hard problem.

[14]

4.2 Distributed Algorithms

An algorithm is distributed if the entities involved act independently from each other except when passing messages. The opposite are centralized algorithms where all information is known to every entity. This property means that the algorithm used so solve problems must behave differently then their centralized counterparts. In many cases the classical algorithms can be modified to be distributed.

Some examples of tasks that can be solved in a distributed manner is leader elections, where some entities elect a leader among themselves without any one entity managing the election, consensus, where a number of nodes agree on something, and production of graph structure like spanning trees or ver- tex coloring [18].

When an algorithm is distributed the algorithm must be run on every entity in parallel, where something happens at each node at the same time. This can include sending messages to other nodes and doing something when a message is received.

(26)

A node in a distributed algorithm on a graph can behave in different ways.

One algorithm could be done at each node until it decides to stop, it could perform its procedure forever or it could do it when it receives a specific signal. The timings of the algorithm might also differ as some perform its procedures in parallel, where all nodes runs at the same time and wait for signal when they need to or in a synchronised fashion and sometimes they run completely on their own or even competes with other nodes [18].

In this work every procedure used is distributed and is designed to work by independent nodes that only communicate by sending messages to each other. No information on the network as a whole is required and the nodes are only assumed to know about their neighbors.

4.3 Maximal Independent Subsets

An important structure on graphs for this problem is the maximal indepen- dent subset.

Definition 4.6. A subset S of a graph is independent if no two nodes in S are adjacent. A subset S of a graph G is a Maximal Independent subset (MIS) if it is independent and no node in G can be added to it without breaking independence.

Another important graph subset is the dominating set.

Definition 4.7. A subset S of a graph G is a dominating set (DS) if every node v in G is a neighbor of a node in S or v ∈ S.

We can note here that every MIS is also a dominating set. Since we need every slave to connect to one master, we require the set of masters to form a DS, so that every non-master is a neighbor to at least one master. If the masters don’t form a DS, then there are slaves that cannot reach a single master and can thus not connect to the network or two masters are adjacent, which is a waste as two masters cannon connect directly.

Lemma 4.1. Every node in the MIS is at most three edges away from another.

Proof. Suppose that there is a node u in the MIS that can’t reach another by three edges. Call the closest node in the MIS v then there are four edges

(27)

or more between u and v. Going from u there the first edge reach a node that can only neighbor one node in the MIS, u. The next step reach a node that does not border a node in the MIS, since there are two steps to the closest such node v. This contradicts the definition of the MIS.

This lemma demonstrates why we can construct a subtree over the MIS that connects all nodes in it with one or two nodes between them. These gateway nodes can form bridges between two nodes in the MIS by one jump, one edge to two masters, or one edge to a master and one to another gateway.

This motivates the choice of a MIS to decide the role of masters to some nodes.

4.4 Assignment Problems and Auctions

4.4.1 Symmetric Assignment Problem

The basic assignment problem is defined on two sets A and B, where the goal is to assign every element (persons) in A to one element (objects) in B. Every possible pair of elements has a cost of the assignment, called aij

for element i ∈ A and j ∈ B. The total cost of the assignment is then P

i

P

jaijxij where the variable xij ∈ {0, 1} is 1 if the pair (i, j) is in the assignment and 0 otherwise. Every person in A can be assigned to one object in B, giving the constraints in the following formulation.

minX

i

X

j

aijxij (4.1a)

s.t.X

i

xij = 1 ∀i ∈ A (4.1b)

X

j

xij = 1 ∀j ∈ B (4.1c)

xij ∈ {0, 1} ∀i ∈ A, ∀j ∈ B (4.1d)

Since the variables xij are binary, the constraint P

ixij = 1 indicate that every element i in A is assigned to just one element j in B. We can also view this as a graph where some node belong to A and some nodes belong to B and the we are to pick edges between A and B so that every element in A is connected to one element in B and vice versa.

(28)

To make use of the auction algorithm to find solutions to these problems without getting stuck in an infinite loop we need the concept of -complementary slackness

Definition 4.8. -Complementary Slackness (-CS) We say that an assign- ment S and a price vectors p satisfy -complementary slackness (-CS) if

aij − pj ≥ max

j {aij − pj} −  (4.2) where the price variable p is from the dual problem

minp,π

X

i∈A

πi+X

j∈B

pj (4.3)

s.t. πi+ pj ≥ aij ∀(i, j) (4.4) The method used in this report to solve the assignment problem is called auction algorithms and build on the concept of real life auctions. At every step it may changes both the primal and dual costs until it finds an optimal solution. They are describes in depth in [9].

The algorithm proceeds in iteration and terminated when every object is assigned.

In every iteration the prices of the objects that receive bids are changed and the increase is at least , since biji = aiji− wi+  ≥ aiji− vi = pji+ . That is  larger then the current price. To see why this is important we look at a proposition from [9].

Lemma 4.2. -complementary slackness is preserved in each iteration of the auction algorithm.

Proof. [9] Let pj and p0j be the prices before and after a given iteration. If j∗ received a bid during the iteration then

pj0= aij∗+ wi+  and we then get

aij∗+ pj0 = wi−  = max

j∈A(i),j6=j∗

{aij− pj} − 

(29)

Algorithm 1 Auction Algorithm for regular assignment

1: repeat

2: for every unassigned persons i ∈ B do

3: ji = argmaxj∈A(i){aij − pj}

4: vi= maxj∈A(i){aij − pj}

5: wi = maxj∈A(i),j6=ji{aij − pj} . wi= −∞ if A(i) only has one element

6: biji = pji+ vi− wi+ 

7: i bid on j with bid bij

8: end for

9: for each object j ∈ A do

10: pj = maxithat bid onjbij

11: unassign any previous assignment to j, argmaxi{bij} is assigned to j

12: end for

13: until all elements assigned

The fact that prices always increase, that is p0j ≥ pj means that aij∗− pj0 ≥ max

j∈A(i){aij − pj} − 

where the last line is the definition of -CS. This shows that -CS holds if an object receives a bid during the iteration. If it does not then the price is unaffected and the condition still holds. Thus the condition holds for all assignments during each iteration, showing that -CS is preserved during the algorithm.

Bertsekas [9] lists three observation that holds for the auction algorithm that he uses to prove another important proposition.

1. Once an object j ∈ B is assigned, it remains assigned for the rest of the duration of the algorithm. This is because an iteration can result in an object being reassigned or assigned, but never unassigned. This means that except at termination, there is at least one unassigned object.

2. Every time an object receives a bid, it’s price increases by at least .

That means that if an object receives an infinite number of bids, it’s price is ∞.

(30)

3. Consider the scalar

vi = max

j∈A(i)

{aij− pj}.

For every |A(i)| bids, the amount of objects that i can bid on, vi is decreased by at least . The reason for this is that every bid must decrease vi by  or leave it unchanged because there is some other object attaining the maximum above. However, if that is the case, then the price of the object receiving the bid must decrease and so that object will not receive a bid by i again until vi decreases by at least . In conclusion, if i bids an infinite number of times, then vi→ −∞.

Given these three observation Bertsekas proves the optimality of the auction algorithm in the following proposition (7.2 in the book) [9]. This is what motivates the use of auctions to perform assignments.

Proposition 4.1. If at least one feasible assignment exists then the auction algorithm terminates with a feasible assignment that is within n of being optimal (and is optimal if problem data is integer and  < 1/n).

Proof. [9] If termination never occur, then some person bid an infinite num- ber of times, call this subset I, and some objects receive an infinite amount of bids, call these J. From the observation above we see that the price of that object must tend to infinity and then the scalar vi tends to −∞ for all i ∈ I. This implies that

A(i) ⊂ J, ∀i ∈ I

and that after a finite number of iterations each object in Jwill be assigned to a person from I. Since after a finite number of iterations at least one person in I will be unassigned at the start of that iterations it follows that there are more persons in I then there are objects in J. This is a contradiction to the fact that there is a feasible assignment, since the implication above shows that there is an object for every person in I. Therefore the algorithm must terminate if there is a feasible assignment.

The final assignment satisfies the -CS

maxj {aij− pj} −  ≤ aiji − pji and by adding these together we get

D

n

X

1

(maxj {aij − pj} + pji

n

X

1

aiji+ n ≤ A+ n

(31)

where A is the optimal total assignment which by proposition 1.3 in [9] is equal to the optimal cost of the dual problem Dwe have that the algorithm terminates within n of being optimal.

If we then suppose that the parameters aij are all integers, or rational, so they can be scaled up to integers, then the total assignment is also integer. If then n < 1 then any complete assignment that is within n of being optimal is also optimal. We can choose  suitably to achieve optimality.

4.4.2 Multiple Assignment Problem

A variation of the problem is when the elements j ∈ B can be assigned up to n+j elements in A and at least nj elements, thus giving the following problem, known as the multiple assignment problem

minX

i

X

j

aijxij (4.5a)

s.t.X

i

xij = 1 ∀i ∈ A (4.5b)

nj ≤X

j

xij ≤ n+j ∀j ∈ B (4.5c)

xij ∈ {0, 1} ∀i ∈ A, ∀j ∈ B (4.5d)

We will need the dual of this problem which is

minp, π

X

i

πi+X

j

pj− λ(m+− m) (4.6a)

s.t. πi+ pj ≥ aij ∀i ∈ A, ∀j ∈ B (4.6b)

λ ≤ pj ∀j ∈ B (4.6c)

This dual problem is where we find the price vectors for the problem. The dual variables act like prices in the auction algorithm during the bidding, hence the name. The algorithm used to solve these problems require a spe- cial variant of complementary slackness.

(32)

Definition 4.9. -Complementary Slackness for multiple assignment prob- lem (-CSM) We say that an assignment S and a pair of price vectors p and π satisfy -complementary slackness (-CSM) if

πi+ pj ≥ aik− , ∀(i, j) ∈ A (4.7) πi+ pk= aij, ∀(i, j) ∈ S (4.8)

pk≤ min

k:assigned under Spk, ∀j that are unassigned under S (4.9) This definition of -CSM take into account the dual variables of both objects and persons and this means that the auction that solves this will make changes to both of these. This can be seen in algorithm 4 where in addition to slaves bidding on masters, we also have masters bidding on slaves if they are not yet assigned one.

For the multiple assignment problem the same principles apply and variants of the propositions that work for this problem can be found in [10]. The principles behind the auction algorithm is still the same and the full algo- rithm used here described in section 4. -CSM is preserved in every iteration and the algorithm terminated at within n of being optimal.

4.5 Spanning Tree Construction

There are a few algorithms that produce minimal spanning trees (MST) and we will now look at one from [16] and [18] that is distributed and can be modified according to our needs.

Definition 4.10. A fragment of a graph is a connected subset of that graph.

The fragments will be the building blocks that eventually grow into a com- plete spanning tree. The procedure takes advantages of the following prop- erty

Definition 4.11. The minimum weight outgoing edge (MWOE) of a frag- ment is the edge with one node in the fragment that has the lowest weight.

The MWOE is the edge that we use to build an optimal tree thanks to the following lemma.

(33)

Lemma 4.3. The MWOE of every subtree of the MST is part of the mini- mum spanning tree.

Proof. Suppose that there is another edge e in the MST that connects a fragment to the rest of the tree, if we also add the MWOE to the subgraph we form a cycle. We can then remove edge e and get a tree that by definition of the MWOE is less costly then before. This is a contradiction.

In other words, the MWOE of a fragment is also in the tree, so this lemma explained why the minimum weight outgoing edge is the key to constructing minimum spanning trees. Every subtree of a MST is connected to the rest of the tree by one of these edges. The simple thing to do then is to take the fragments and grow them until there are no more such edges, then we have a minimal spanning tree.

Here is the Gallager-Humblet-Spira algorithm as explained in [18]. The complete algorithm where no parts are simplified can be found in the original paper by Gallager et.al [16].

Algorithm 2 GHS (Gallager-Humblet-Spira)

1: Initially each node is the root of it own fragment

2: repeat

3: All nodes learn the fragment ID of their neighbors.

4: The root of each fragment use flooding/echo in its fragment to de- termine the MWOE b = (v, u) of that fragment

5: The root sends a message to node u; while forwarding the message on the path from the root to node u all parent-child relations are inverted such that u is the new temporary root of the fragment

6: node u sends a merge request over the blue edge b = (u, v).

7: if node v also sends a merge request over the same edge b then

8: either u or v (the one with the smallest ID) is the new fragment root

9: else

10: node v is the new parent of node u

11: end if

12: the newly elected root node informs all nodes in its fragment about its identity

13: until all nodes are in the same fragment (i.e no outgoing edges are left) The algorithm stops when the nodes can no longer find a neighbor that

(34)

belong to another fragment. When all nodes decide that they see no other fragment other then their own, they stop looking and the fragment is a minimal spanning tree.

In the original paper by Gallager et.al. [16], the complexity of their algo- rithm is shown to be 2E + 5N log2N where E and N are the number of edges and nodes in the graph. The main difference between this and the original algorithm is that this use simpler rules for internal communication.

The nodes that are part of a fragment has a leader, but the leadership can change back and forth depending on where the MWOE is. The basic concept of this approach is that a fragment is grown by the best possible edge until all nodes belong to the same fragment, that fragment is then the minimal spanning tree of the graph.

(35)

Chapter 5

Algorithms

The proposed heuristic solution is comprised of three major steps. First we form form a maximal independent subset of the nodes where the nodes with higher battery is taken into account along with the number of neighbors.

This constructs a subset of the nodes such that every node has one of these nodes as a neighbor. These nodes make up the masters of the network.

The second step is that every other node connects to one master according to a distributed auction algorithm so the sum of costs of these connections is minimized.

The next step is to use these smaller networks as building block in the al- gorithm that forms a degree constrained spanning tree, a structure where all nodes are in the same network also formed by edges of smallest cost.

This step finds the best interconnections between the clusters around each master by letting some nodes become bridges to other masters.

5.1 Master Selection

The first goal when finding a solution to to Problem 3.1 is to partition the nodes into masters and non-masters. We select masters from the available nodes depending on their suitability, that is we want nodes that have a high battery capacity since the masters are expected to handle large amount of traffic. Structurally in the network we must select the masters such that every node is adjacent to at least one master. If any node is not adjacent to

(36)

Every node is initialized

with a price and a vector of costs of it’s

neighbors.

Find a maximal indepen- dent subset

of nodes that make

up the master nodes.

Every node assigns itself to one master through an auction.

Clusters compare possible intercon-

nections and form a bridge if they agree on the best connection.

Figure 5.1: A flowchart where each step of the proposed heuristic solution is described.

at least one master, then that node can’t join the network and the problem has no solution. The masters must then form a so called dominating subset S, a set such that every node in G is adjacent to one node in S. A special case of dominating sets widely used for building this kind of networks is the maximal independent subset. A maximal independent subset is a set of nodes such that no two nodes are adjacent to each other and no node can be added without violating that fact.

This constraints on the nodes chosen as masters means that every node in the network is directly neighboring at least one master. It also means that two masters are never adjacent. This is good since two masters cannot connect directly and adjacent nodes likely share many neighbors.

There is a greedy way to select the masters and that is to pick the devices that are connected to a power supply. A problem with this approach is when the number of supplied devices are large or badly distributed. A slave might have few or no possible masters to connect to and some master might have very many possible slaves. Here an algorithm is borrowed (and slightly modified) from the book on Distributed Computing by Peleg [19] for finding maximal independent networks.

The difference from the original algorithm is here the concept of utility of a node. The original only specifies that every node is given a unique identifier, and by specifying that identifier we give priority to certain nodes. Therefore the utility of a node i was chosen to be

U (i) = k · Ni+ bi (5.1)

(37)

Algorithm 3 Simple distributed algorithm to find a MIS

1: while v has not made a decision to join or not join the MIS do

2: if for every neighbor n of v, U (n) < U (v) or n has decided to not join then

3: v joins the MIS

4: end if

5: end while

so priority is given to nodes with higher battery power and nodes with many neighbors. This makes sure that the maximal independent network that make up the masters does not consist of higher battery power nodes on the edge of the graph and that the number of piconets is relatively small. The constant k is set depending on how the battery values are represented.

This algorithm will produce a maximal independent network as no node joins the MIS unless it’s utility is larger then all it’s neighbors or the neighbors has decided to not join. No node will ever join if one of it’s neighbors has joined and if all it’s neighbors are not in the MIS, it will join.

A property of this algorithm is that it adds at least one node every round and so it will terminate in at most n steps, where n is the number of nodes in the network.

If a node v joins the set, the last step makes sure that none of it’s neigh- bors joins the set at a later time, and the middle steps makes sure that the neighboring nodes joins the set at the same round. Therefore the algorithm produces an independent set.

Proposition 5.1. The time complexity of the above algorithm is O(n) in time and O(m) in messages.

Proof. The worst case scenario of this algorithm is when the nodes are in a line and sorted. Then there is only one node that does something at each time and so the time complexity is proportional to the number of nodes.

The same can be said about the number of messages, thus the message complexity is O(m).

(38)

5.2 Assignment

When we have a set of masters we can focus on the problem of deciding which connections to pick to form piconets, how every node is connected to one master. We call this the assignment part. The constraints here are that every slave is to be connected to one master. The masters themselves can connect up to seven other devices and must connect to at least one. We can formulate this as a linear optimisation problem

min X

i∈S

X

k∈M

−aikxik+X

j∈G

X

l∈{G∪M }

−ajlxjl (5.2a)

s.t. X

k∈M

xik = 1 ∀i ∈ S (5.2b)

1 ≤X

i∈S

xik+X

j∈G

xjk ≤ 7 ∀k ∈ M (5.2c)

X

l∈{G∪M }

xjl= 2 ∀j ∈ G (5.2d)

X

j0∈G

xjj0 ≤ 1 ∀j ∈ G. (5.2e)

xjj0 = 0 if xjk = 1 = xj0k ∀k ∈ M, ∀j, j0∈ G (5.2f)

Graph is connected. (5.2g)

The constraints here are in order from top to bottom:

(5.2b) Every slave is connected to one master.

(5.2c) Every master is connected to at least one and at most seven other nodes.

(5.2d) Every gateway is connected to two masters or gateways or one of each.

(5.2e) Every gateway is connected to at most one other gateway, to ensure that no gateway is connected to two gateways.

(5.2f) Two gateways that share the same master are not connected.

(5.2g) The graph itself is connected, so every node can reach any other node.

This optimisation problem is far from something we can easily solve. The constraint that the solution form a connected sub-graph is one that often

(39)

causes problem, for examples we can look in Bertsekas [9]. To see that we can not just relax the problem to a linear optimisation problem we check if the matrix that defines the constraints is totally unimodular.

Proposition 5.2. The matrix defining problem (5.2) is not totally unimod- ular.

Proof. A special case of the above problem with three gateways that has each other as neighbors has a sub-matrix

0 1 1 1 0 1 1 1 0

with determinant equal to 2. Therefore the matrix defining this special case is not totally unimodular, and the general case can’t be either.

A famous result is that if the matrix is totally unimodular then the problem has integral solutions [20]. This is not the case here so we can not attack it with methods from linear programming and still expect a nice solution.

The lack of total unimodularity also excludes the possibility of transforming it into, for example, a cost flow problem. As stated in [20] we have to resort to a different kind of solution procedure.

The method proposed in this report is that the problem above is split into two parts. The first part finds masters for every device and the second turns the whole system into a tree. By taking out the constraints that handles the master-slave connection we transform the first part of the problem into a multiple assignment problem. This problem can be written as

min X

i∈S∪G

X

k∈M

−aikxik (5.3a)

s.t. X

k∈M

xik = 1 ∀i ∈ S ∪ G (5.3b)

1 ≤X

i∈S

xik+X

j∈G

xjk ≤ 7 ∀k ∈ M (5.3c)

and is a multiple assignment problem like the one as stated in [10]. It can then be solved with the methods presented there. The partitioning of roles

(40)

of gateways and slaves does not have to be decided upon before or dur- ing this stage, as the assignment can be performed before the appointment of some roles as gateways. We only need every device to connect to a Master.

When we consider the rest of the constraints the optimisation problem for the remainder of the problem, i.e. the edges that we have yet to consider, becomes

min X

j∈G

X

l∈{G∪M }

−ajlxjl (5.4a)

s.t. 1 ≤ X

k∈M

xjk +X

j0∈G

xjj0 ≤ 2 ∀j ∈ G (5.4b)

X

j0∈G

xjj0 ≤ 1 ∀j ∈ G. (5.4c)

xjj0 = 0 if xjk = 1 = xj0k ∀k ∈ M, ∀j, j0 ∈ G (5.4d)

The graph is connected (5.4e)

The remainder of the constraints handled in this second part require a dif- ferent approach then the one used for the assignment problem for mainly two reasons. The first is the constraints that the solution form a connected sub-graph. The seconds is that the set of nodes in this graph does not form a bipartite set. In the second part the nodes that are regular slaves are already assigned to a master and only the gateways and the masters are in- volved but the gateways can connect not only to a master but also to other gateways to form two step interconnections. This means that we can not partition the nodes into two sets, where every node in one set is assigned to one node in the other.

It remains to be shown that every feasible solution to the series of two problems is a feasible solution to the original problem. For this to be true we need that no edge picked in the series of problem violates the constraints in the series of problems.

In the first of the two problems we can never pick an edge that violates the constraints since the edges are all between a master and another node.

The first problem make sure that every master is assigned a slave and no more then seven of the slaves. The difference appears when we introduce the solution from the first problem into the second. No edge in the first problem

(41)

causes a node to have too many connections and the next step handles the edges that remain. The constraints in the second step makes sure that no edge is picked that violate the constraints for G. Therefore, as long as no constraint in step 2 is violated, no constraint in the main problem is violated.

A solution to the series of problems that can not form a tree can never be feasible, since every connected graph is a tree or has a sub-graph that is, but if the pair of problems has a connected solution then the original has too.

The approach taken in this report is a two-step solution to this problem.

The first of the above two steps is called the assignment problem and a solution to that is found using auctions. The second is that of forming the interconnections.

The algorithm that the slaves follow when they are connecting to masters is algorithm 4. In this first part the slaves bid for a master until every slave has one. The second part is followed when the bidding stops and masters are making sure they are connected to at least one slave. At this stage a slave may receive a bid from a master that did not receive a slave in step one.

The first part of algorithm 5 is followed by the masters when the slaves are bidding for masters. When the bidding stops the masters follow the second part of the algorithm to make sure that they are connected to at least one slave.

Since this algorithm is not modified compared to the one in [10] we know that this produces an assignment that is optimal with regards to the costs aij on the edges.

The complexity of this algorithm is shown by Yuzhe [10] to be O

 nE∆





(5.5) where ∆ = max(i,j)aij − min(i,j)aij and n and E the number of nodes and edges in the possible assignment.

5.3 Spanning Tree Formation

The first of the two problems above forms islands in the graph, with a master in the center and slaves around it. Then the rest of the problem presented

(42)

Algorithm 4 Distributed Auction Algorithm for Slave i

1: Initialize πi= ∞, ki = ∅, pi

2: if ki = ∅ then . Bid for best master

3: k0i← arg max k∈M (i){aik− [pi]k}

4: ui ← max k∈M (i){aik− [pi]k}

5: wi← max k∈M (i)\{k0

i}{aik− [pi]k}

6: bi ← [pi]k0

i+ ui− wi+ 

7: Bid for Master ki0 with bi

8: Receive response, (y or n) and pk0

i

9: if response contains y then

10: πi ← aik0

i− pk0

i, ki ← ki0 . Associate with Master k0i

11: end if

12: [pi]k0

i ← pk0

i

13: end if

14: if receive request from Master k and bk then

15: if bk− πi >  then . If an empty master gives a better bid, switch.

16: πi ← bk, send y and πi to master k

17: Send n and πi to master ki

18: ki ← k . Connect to Master k

19: else

20: Send n and πi to k

21: end if

22: end if

(43)

Algorithm 5 Distributed Auction Algorithm for Master k

1: Initialize pk = 0, ik= ∅, πk= 0

2: if Receive request from slave l and bl then

3: if |ik| < 7 then

4:k]l← alk− bl, ik← ik∪ {l}

5: if |ik| = 7 then

6: pk ← minr∈ikark− [πk]r

7: end if

8: Send y and pk to l

9: else if bl≥ pk+  then

10: lk0 ← arg minr∈iark− [πk]r 11: ik← ik\ {i0k} ∪ {l}

12:k]l← alk− bl

13: pk← minr∈i

k}ark− [πk]r

14: Send y and pk to l and associate with it

15: Send n and pk to slave i0k

16: end if

17: end if

18: if the cardinality |ik| < 1 and all slaves/gateways are assigned then

19: jk← arg max j∈G(k){ajk− [πk]j}

20: uk ← maxj∈G(k){ajk− [πk]j}

21: wk← max j∈G(k)\{j

k}{ajk − [πk]j}

22: bk← [πk]jk+ uk− wk+ 

23: Bid for jk with bk

24: Receive response, (y or n) and πjk

25: if response contains y then

26: Connect to gateway jk, and ik← ik∪ ik

27: end if

28:k]jk ← πjk

29: end if

(44)

Figure 5.2: An example of a network generated by this algorithm. Square nodes are masters, circles are slaves. Bold blue lines means that slave is assigned to that master and a dotted green line means that edge is an inter- connection and that those slaves that are connected by it are gateways. The numbers on the nodes are the ID and weight of that node and the number on the edges are the edge weights.

above must be solved by finding a network that is connected and does not violate the degree constraints. We can use the fact that a solution forms a degree constrained spanning tree and use methods that has been developed to find such trees.

Here we view every island as a separate entity, then the task is to find a spanning tree of the islands. If the network does not form a tree then some edge is unnecessary as there is more then one path between some nodes or some pair of nodes does not have a path between them. This tree must in turn be made up of a tree of island, therefore we can use the islands as starting blocks to form a tree. The last part of the problem is finding the edges that connect these islands into a tree and does so in an optimal manner.

Constructing a tree of the smallest edges is called finding a minimal spanning tree. The constraints that every node is limited in their degree, master at degree seven and gateways at degree two, complicates things. The problem

(45)

Figure 5.3: Another example of a network generated by this algorithm.

Square nodes are masters, circles are slaves. Bold blue lines means that slave is assigned to that master and a dotted green line means that edge is an interconnection and that those slaves that are connected by it are gateways. The numbers on the nodes are the ID and weight of that node and the number on the edges are the edge weights

of finding a minimal spanning tree is less complicated then that of finding one with degree constraints, where the degree constrained variant is NP- complete [14].

Since we want a special structure on the tree we can use the island struc- ture from the last part as a starting block when constructing a spanning tree.

When we construct a tree of islands, every pair of islands that are to form an interconnection pick the cheapest way to connect by upgrading some of it’s slaves to gateways. This is a matter of picking the cheapest of all possible ways to connect to the masters out of the three possibilities. Either one of the masters can upgrade one of their nodes to a gateway and this node connects to the other master, or both can upgrade one of there slaves to gateways and the two gateways connect.

From a graph point of view this means finding the cheapest path between

(46)

the two masters that is shorter then three step. When we have that path we upgrade the intermediate slave or slaves to gateways. When real Bluetooth devices are used there are more intricate details in the definition of the gateways and how they are connected. Here the gateways are simply the nodes that has more than one connections, and is not a master.

The final part of our algorithm takes the structures produced by the previous step and connects them into a tree that has degree constraints imposed so that no master exceeds it’s seven allowed connections and no slaves gets more then one additional connection. The slaves, that in this step becomes part of an interconnection connecting two masters, are what we call gateways. The algorithm to find a degree constrained spanning tree on our network is based on the algorithm developed by Gallagher, Humblet and Spira [16]. There are some slight modification made here compared to their method. The first is that the starting conditions are not each individual node, instead we use the clusters produced in the previous step as fragments, and connections between those fragments form the complete tree. The other modification is regarding the degree constraint, the original algorithm computes a minimal spanning tree with no constraints as to degree.

To use that algorithm here, to find a degree constrained spanning tree, we instead let nodes ignore edges that would break the degree constraint.

When a node is marked as ignored we ignore it and try instead to connect the fragments by the next cheapest edge.

When an edge would violate a constraint, it is marked as ignored and will not be picked again. The next time the process picks its minimum weight outgoing edge, it will again try to pick the best edge that won’t violate the constraint. It will do this until it finds an edge that does not violate any constraints. This also means that the algorithm might never finish as the edges can run out. To see this consider a network of two piconets that both are stars with a master in the center and seven slaves, like the one in Figure 5.4. These two piconets can never connect to each other as that would violate the constraint of a maximum of seven connections per master.

In practice this algorithm is more complicated, as the mechanism for noti- fying the nodes in the fragment can be handled in many ways. This is a simple sketch meant to demonstrate how the degree constraints is handled.

The complexity of the original algorithm is shown in [18] to be O(n log n).

The modification made to unviolate the degree constraints makes it worse though. Finding the complexity after the modifications means little as it might never finish. Then the complexity of the algorithm is O(∞).

References

Related documents

Almén and Båth (108) have suggested a conceptual framework where the appropriate exposure from introduced examination types are assessed in four steps, including a

The overall aim of the work presented in this thesis was to develop methods and strategies for the optimisation process prescribed by legal authorities for medical X- ray imaging.

ISBN 978-91-7833-684-5 (PRINT) ISBN 978-91-7833-685-2 (PDF) Printed by BrandFactory, Gothenburg.

Vidare forskning skulle också kunna undersöka huruvida de alternativa undervisningssätten ger ett bättre resultat än traditionell undervisning eller ej, samt vilken

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

The increasing availability of data and attention to services has increased the understanding of the contribution of services to innovation and productivity in

I relation till tidigare forskning och det teoretiska ramverket fick vi en tydlig vision om hur medielandskapet samt porträtteringen av kvinnor och män ser ut, och det här gjorde

Plots of measured horizontal and vertical displacements of pillar reference points at sites in the SWEPOS network.. Reports in Geodesy and Geographical Information Systems