SensorBaysianGlobal

39
SensorBaysianGlobal SensorBaysianGlobal Alfredo Garcia Enrique Campos-Nanez Matt Spear

description

SensorBaysianGlobal. Alfredo Garcia Enrique Campos-Nanez Matt Spear. Agenda. The Algorithm: A Quick Overview The Simulator: Structure The Simulator: Examples The Messages An Alternative formulation of the algorithm. The Algorithm: Definitions. - PowerPoint PPT Presentation

Transcript of SensorBaysianGlobal

Page 1: SensorBaysianGlobal

SensorBaysianGlobalSensorBaysianGlobal

Alfredo GarciaEnrique Campos-Nanez

Matt Spear

Page 2: SensorBaysianGlobal

AgendaAgenda

1. The Algorithm: A Quick Overview

2. The Simulator: Structure

3. The Simulator: Examples

4. The Messages

5. An Alternative formulation of the algorithm

Page 3: SensorBaysianGlobal

The Algorithm: DefinitionsThe Algorithm: Definitions• A node is covered iff it or one of its neighbors is ON• is the probability that a node will be ON• A node is ON iff it is sensing• For now we assume that a nodes communication radius is the same

as its sensor radius.• Nodes are static and have a position in R3

• Nodes have a list of their neighbors• Turning ON has a COST · 1/(|Neighbors|)• A Node has two functions:

• Update• For each neighbor update the information ( and the state of

said node)• BR (Best reply)

• Decide the best course of action given the probability that a neighbor node is on

Page 4: SensorBaysianGlobal

The Algorithm: General FormulationThe Algorithm: General Formulation

If sensors could see all other sensors, they will choose their actions to solve a common payoff function. This way sensor i, will choose its action ai = {0, 1} to solve the optimization problem:

maxUai(ai, a-i) = j=1N(1{sensor j covered under (ai, a-i)} – c · aj)

With c < 1, the cost of a Node turning on.

Page 5: SensorBaysianGlobal

The Algorithm: Local FormulationThe Algorithm: Local FormulationLet N(i) = {j | j can cover i}, i.e. the neighbors of i, and let N(i) = N(i) [ {i}.Sensor i’s view of the problem is to choose between the action ON, or OFF.To select its best action given an action profile a−i for the other sensors, sensor i can compare

U(1, a-i) – U(0, a-i) = |N(i)| - c – Ki(0, a-i)Where

Ki(0, a-i) = j 2 N(i)(1{sensor j covered under action profile})Notes:• Ki(0, a-i) is simply the number of Nodes that can cover i if i is OFF• All information can be computed locally

Page 6: SensorBaysianGlobal

The Algorithm: The Algorithm:

Sensor i keeps track of an empirical frequency () for each neighbor where:

a-i) = (Iterations in which a-i was used) / (Total iterations)

With the best reply is selected by comparing:

E[U(1, a-i)] - E[U(0, a-i)]

And this expectation is taken with respect to

Page 7: SensorBaysianGlobal

The Algorithm: UpdateThe Algorithm: UpdateUpdate() {

foreach(Node n 2 Neighbors) {n.isOn = IsNeighborOn(n);if(n.isOn)

n. = T/(T+1) · n. + 1/(T+1);else

n. = T/(T+!) · n.;}if(received reply from all neighbors) {

Me.isOn = BR();if(Me.isOn)

Me. = T/(T+1) · Me. + 1/(T+1);else

Me. = T/(T+!) · Me.;}

}

Page 8: SensorBaysianGlobal

The Algorithm: BRThe Algorithm: BR

State BR() {COST = 1/(|Neighbors|);probMeCovered = 1 – Node n 2 Neighbors)(1 – n.);if(COST – 1 > -1 · probMeCovered)

return OFF;else

return ON;}

Page 9: SensorBaysianGlobal

The SimulatorThe SimulatorMain goal was to make it extensible and to implement the algorithm we

were testing, the following is our framework.Five main classes:1. Node.java

• Abstract, subclasses must override Update()• Represents the information of a Node

2. SBGNode.java• The implementation of the Node that uses this algorithm

3. Communicator.java• Static class that allows a Node to send a message to its neighbors

(those within its communication radius)4. Simulator.java

• Abstract, subclasses must override Update(int numSteps)5. SBGSimulator.java

• The implementation of our simulator.6. SimGUI.java

• The GUI for the simulator (only allows visualization of nodes in R2)

Page 10: SensorBaysianGlobal

The Simulator: NodeThe Simulator: NodeNode.java maintains:• int id The unique ID for the node• double x, y, z The position in R3• double sensorRadius The sensor radius• double commRadius The communication radius• boolean on If the node is ON• ArrayList neighbors The set of neighbors• int myTime The local time• ArrayList messages The queue of messages• double batteryLife The percentage of battery left

SBGNode.java also maintains:• double cost The cost of turning on• double lambda The • int countOfNodes The number of Nodes that have

responded

Page 11: SensorBaysianGlobal

The Simulator: SimulatorThe Simulator: Simulator

Simulator.java maintains/implements:• static int time The actual time• static ArrayList nodes The set of nodes to simulate• static int maxTime The maximum time to run• double width, height, depth The volume the nodes are in• boolean isNeighbors(Node a, Node b) True if a is within b’s comm. radius• int numberOn() The number of Nodes that are ON• int numberOff() The number of Nodes that are OFF

SBGSimulator.java simply implements:• Update(int numSteps) Runs the simulation numSteps• int numberCovered() The number of covered Nodes

Page 12: SensorBaysianGlobal

The Simulator: CommunicationThe Simulator: Communication• Communication is broadcast to all Nodes in the initiator’s

communication radius

• Messages are a byte array and a timestamp of when they are sent (used to determine which Messages are available to a Node and which have not reached it, i.e. as the Simulator is synchronous “later” Nodes receive message for the current time but these would actually not be seen until the next time step in an asynchronous environment so they should be ignored)

• Communicator.java adds the Message to a Node’s Message queue

• Will explain Messages we defined later.

Page 13: SensorBaysianGlobal

The Simulator: GUIThe Simulator: GUIThe dialog box to create a new simulation. Specify:1. Width2. Height3. Location to save the CSV output to4. Location to save the sequence of images to (as

png)5. The number of nodes6. The sensor radius7. The amount of change for the sensor radius8. The communication radius9. The amount of change for the communication

radius10. The maximum simulation time11. Whether to draw images12. Whether to draw the comm. radius13. Whether to draw the sensor radius (if the Node

is on)14. Grid drop (rounds number of nodes as needed)

or randomly dropped

Page 14: SensorBaysianGlobal

The Simulator: GUIThe Simulator: GUI

The simulator with a grid, 31x31 size, sensor radius only.

The simulator with random, 31x31 size, comm. and sensor radius.

The simulator draws Nodes as circles, green denoting ON and red denoting off, yellow for the sensor radius, blue for the comm. radius, all colors are alpha-blended; clicking run runs the simulation until max time is reached.

Page 15: SensorBaysianGlobal

The Simulator: OutputThe Simulator: OutputGrid: 143 nodes, 31x31, c.r = s.r = 3.0, c.r.Grid: 143 nodes, 31x31, c.r = s.r = 3.0, c.r. = s.r. = s.r. = 0.0 = 0.0

Page 16: SensorBaysianGlobal

The Simulator: OutputThe Simulator: OutputGrid: 143 nodes, 31x31, c.r = s.r = 3.0, c.r.Grid: 143 nodes, 31x31, c.r = s.r = 3.0, c.r. = s.r. = s.r. = 0.0 = 0.0

Coverage

-17

3

23

43

63

83

103

123

143

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

Time

Nu

mb

er o

f N

od

es

Covered

Not Covered

The Simulator: OutputThe Simulator: Output

Page 17: SensorBaysianGlobal

The Simulator: OutputThe Simulator: OutputGrid: 143 nodes, 31x31, c.r = s.r = 3.0, c.r.Grid: 143 nodes, 31x31, c.r = s.r = 3.0, c.r. = s.r. = s.r. = 0.0 = 0.0

On Vs Off

-17

3

23

43

63

83

103

123

143

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

Time

Nu

mb

er o

f n

od

es

On

Off

The Simulator: OutputThe Simulator: Output

Page 18: SensorBaysianGlobal

The Simulator: OutputThe Simulator: OutputRandom: 150 nodes, 31x31, c.r = s.r = 3.0, c.r.Random: 150 nodes, 31x31, c.r = s.r = 3.0, c.r. = s.r. = s.r. = 0.0 = 0.0

The Simulator: OutputThe Simulator: Output

Page 19: SensorBaysianGlobal

The Simulator: OutputThe Simulator: OutputRandom: 150 nodes, 31x31, c.r = s.r = 3.0, c.r.Random: 150 nodes, 31x31, c.r = s.r = 3.0, c.r. = s.r. = s.r. = 0.0 = 0.0

Coverage

-10

10

30

50

70

90

110

130

150

Time

Nu

mbe

r of

nod

es

Covered

Not Covered

The Simulator: OutputThe Simulator: Output

Page 20: SensorBaysianGlobal

The Simulator: OutputThe Simulator: OutputRandom: 150 nodes, 31x31, c.r = s.r = 3.0, c.r.Random: 150 nodes, 31x31, c.r = s.r = 3.0, c.r. = s.r. = s.r. = 0.0 = 0.0

On Vs Off

-10

10

30

50

70

90

110

130

150

Time

Nu

mbe

r of

nod

es

On

Off

The Simulator: OutputThe Simulator: Output

Page 21: SensorBaysianGlobal

The Simulator: OutputThe Simulator: OutputRandom: 1500 nodes, 31x31, c.r = s.r = 1.5, c.r.Random: 1500 nodes, 31x31, c.r = s.r = 1.5, c.r. = s.r. = s.r. = 0.0 = 0.0

The Simulator: OutputThe Simulator: Output

Page 22: SensorBaysianGlobal

Coverage

1 13 25 37 49 61 73 85 97 109

121

133

145

157

169

181

193

205

217

229

241

253

265

277

289

301

313

325

337

349

361

373

385

397

409

421

433

445

457

469

481

493

Time

Nu

mb

er o

f n

od

es

Covered

Not Covered

The Simulator: OutputThe Simulator: OutputRandom: 1500 nodes, 31x31, c.r = s.r = 1.5, c.r.Random: 1500 nodes, 31x31, c.r = s.r = 1.5, c.r. = s.r. = s.r. = 0.0 = 0.0

The Simulator: OutputThe Simulator: Output

Page 23: SensorBaysianGlobal

The Simulator: OutputThe Simulator: OutputRandom: 1500 nodes, 31x31, c.r = s.r = 1.5, c.r.Random: 1500 nodes, 31x31, c.r = s.r = 1.5, c.r. = s.r. = s.r. = 0.0 = 0.0

On Vs Off

-100

100

300

500

700

900

1100

1300

1500

1 13 25 37 49 61 73 85 97 109

121

133

145

157

169

181

193

205

217

229

241

253

265

277

289

301

313

325

337

349

361

373

385

397

409

421

433

445

457

469

481

493

Time

Nu

mb

er o

f n

od

es

On

Off

The Simulator: OutputThe Simulator: Output

Page 24: SensorBaysianGlobal

The MessagesThe MessagesDefined five messages for the

algorithm:1. PING (1 byte)

• Discovery packet

2. PONG (5 bytes)• Reply to a ping

3. STATE_REQUEST (5 bytes)• A request for the states of

the neighbors

4. STATE_REPLY (6 bytes)• A reply to a state request

5. QUIT (Not used)

Page 25: SensorBaysianGlobal

Alternative Algorithm: Compact RepAlternative Algorithm: Compact Rep

A key note is that the difference:

E[U(1, a-i)] - E[U(0, a-i)] = |N(i)| - c - a-i[j 2 N(i)}(Ki(0, a-i) )] · (a-i)

Can be computed with local information. This can be achieved if sensor i maintains:

k) = (Iterations in which k nodes were covered) / (Total iterations)

With this representation i will choose to be ON if the difference

E[U(1, a-i)] - E[U(0, a-i)] = |N(i)| - c - k = 0|N(i)|[k · (k)] > 0

Page 26: SensorBaysianGlobal

Alternative Algorithm: ExampleAlternative Algorithm: ExampleGrid: 7Grid: 722

Page 27: SensorBaysianGlobal

Alternative Algorithm: ExampleAlternative Algorithm: ExampleGrid: 10Grid: 1022

Page 28: SensorBaysianGlobal

Alternative Algorithm: ExampleAlternative Algorithm: ExampleRandom: 50Random: 50

Page 29: SensorBaysianGlobal

Alternative Algorithm: ExampleAlternative Algorithm: ExampleRandom: 500Random: 500

Page 30: SensorBaysianGlobal

Alternative Algorithm: Duty CyclesAlternative Algorithm: Duty CyclesSuppose we want to build M partitions of the sensors such that the nodes in each partition can cover all other nodes, and that energy consumption is minimized. This can be used to build fixed time duty cycles (as in ASCENT), where nodes in each partition alternate their ON and OFF states.

Instead of selecting an action ai 2 {0, 1}, we can model the game as sensor i choosing which partition to join, i.e. ai 2 {0, 1, . . . ,M}. The overall utility can be written as:

U(a) = i = 1N[m = 1

M(1{i covered in partition m under action profile})] – c · 1{ai 0}

Page 31: SensorBaysianGlobal

Alternative Algorithm: Duty CyclesAlternative Algorithm: Duty CyclesSimilar to our prior analysis, sensor i can decide which partition, if any, to join using only local information, namely, the number of covered sensors in the neighborhood on each partition.

Given an action profile a−i, sensor i can compare between actions m, m’ > 0 by looking at the difference:

U(m, a-i) – U(m’, a-i) = Kim(0, a-i) – Ki

m’(0, a-i)

Where Kim(0, a-i) is the number of sensors in the neighborhood

N(i) covered under partition m.

Let m* = argminm = 1, …, M[Kim*(0, a-i)], then i should choose to join

m* if

|N(i)| - c - Kim*(0, a-i) > 0

I.e. if it is economical to turn on given the coverage in partition m*

Page 32: SensorBaysianGlobal

Duty Cycles: ExampleDuty Cycles: ExampleGrid: 7Grid: 722, M = 2, M = 2

Page 33: SensorBaysianGlobal

Duty Cycles: ExampleDuty Cycles: ExampleGrid: 10Grid: 1022, M = 2, M = 2

Page 34: SensorBaysianGlobal

Duty Cycles: ExampleDuty Cycles: ExampleGrid: 10Grid: 1022, M = 3, M = 3

Page 35: SensorBaysianGlobal

Duty Cycles: ExampleDuty Cycles: ExampleGrid: 10Grid: 1022, M = 3, M = 3

Page 36: SensorBaysianGlobal

Duty Cycles: ExampleDuty Cycles: ExampleRandom: 50, M = 2Random: 50, M = 2

Page 37: SensorBaysianGlobal

Duty Cycles: ExampleDuty Cycles: ExampleRandom: 500, M = 4Random: 500, M = 4

Page 38: SensorBaysianGlobal

• A better coverage test. Verify that all of a sensor’s radius of action is covered (Voronoi test).

• Adaptive partitioning. Suppose that the number of partitions depends on recharge (solar) ability

• Convergence to Endogenous Correlated Equilibria. since the localized versions of the algorithm shown here are equivalent to the global game (with sensors accessing all available information), we speculate that a minor revision of Garcia’s et al (2005) will show convergence to ECE’s.

Work In ProgressWork In Progress

Page 39: SensorBaysianGlobal

Questions?Questions?