Anda di halaman 1dari 32

EXTENDED LOCAL SEARCH

ALGORITHM FOR
BALLS AND BINS
Nitesh Bhargava
Mentor: Prof. C. Pandu Rangan
Indian Institute Of Technology, Madras
June 18, 2014
1

Outline
Introduction
Background and review of related work
Proper Allocation Algorithm/ Local Search Insertion
Extended local search allocation (ELSA)
Load balancing ELSA
Experimental Results
Applications
2

Introduction Problem Statement


Balls and bins Multiple choice
scenarios in abstract setting
Typical aim allocate m = cn balls into
n bins.
Each ball chooses independently and
uniformly at random k 3 bins. We are
looking for an allocation such that each
ball is placed into one of its chosen bins
and no bin has load greater than L.
3

HyperGraph
Let X = (x1, x2, ..., xn) be a finite set. A hypergraph on X is a family H
= (E1,E2, ...,Em) of subsets of X such that

Background Work/ Related Work

L-orientability of Hypergraphs
For any integers k >= 2 and L >= 1, a k-uniform hypergraph is called Lorientable, if for each edge we can select one of its vertices, so that
all vertices are selected at most L times.
Result: A critical quantity c*k,l exists such that with probability 1 o(1) the graph Hn,cn,k has an L-orientation if c < c*k,l , but fails doing
so if c*k,l.
6

Feasibility Analysis of Our Algorithm


From result stated in previous slide: A critical quantity c*k,l exists
such that with probability 1 - o(1) the graph Hn,cn,k has an Lorientation if c < c*k,l , but fails doing so if c*k,l.

We can conclude that such a allocation exists.

Previous Work
No Bound on maximum Load
Random Allocation for m = n, maximum load =

log n
log log n

Azar showed that: if each ball is placed into bin which is least loaded then
log log n
maximum load = log 2

Maximum Load = 1 (find the free bin from the allocation graph)
BFS linear time only in expectation.
Random Walk insertion select uniformly at random a bin from the available
bins -> polylogarithmic bound (with high probability) on maximum allocation
time, but doesn't guarantee on total allocation time (might run forever).
8

Work Done in Project - II

Balls and bins made Faster


Paper published in Aug, 2013 in ESA.
Discusses our problem with L = 1.
Proposes a novel algorithm which provide an allocation with high
probability in linear time.
Talks about the open problem with generalization of L.
This paper is taken as basis for foundation for my work in Project II.

10

Modelling the Problem


Model the problem by a directed
graph G = (V,E).
Set of vertices = bins.
Vertex is occupied, if there is ball
assigned to it, else free.
Vertex with zero outdegree is a
free
vertex
(bin),
F = {Free
Vertices }.
G represents an allocation - graph.

=
Vertex

Bins

Free Vertex

Occupied Vertex/bin

11

Modeling
For vertices u, v V directed
edge (with ball y) e = (u, v) exists
iff u and v are one of choices of
ball y and u is occupied by y.
Label of vertex = shortest
distance from set of free vertex.

Directed Edge

Label = 3

12

Proper Allocation Algorithm/ Local


Search Insertion
Algorithm runs in linear time with high probability.
We assign to each vertex v V an integer label, L(v). Initially all
vertices have 0 as their labels, L(v) = d(v, F ).
When a ball appears, it chooses the vertex with the least label from
among its k choices.
If the vertex is free, the ball is placed and label is set to min of its k-1 choices
+1.
If the vertex is not, previous ball is kicked out, the kicked ball again look for
empty bin.
13

Proper Allocation Algorithm/ Local


Search Insertion
To maintain the label of vertex as the shortest distance to F
Update the labels of neighbors and their neighbors and so on. There are 3
ways to do this.

1. BFS starting from selected vertex.(linear time only in expectation)


O(nlog(n)) run time

2. Random walk Insertion (Naive)


Might run indefinitely for some worst cases.

3. Local Search Allocation


Finds an allocation with high probability (10 times faster than random walk
insertion)

14

Allocation Algorithm AssignBall (x,L,T)

15

Conclusion and Results from Local Search Algorithm


Theorem: Let k 3. For any fixed > 0, set m = (1 - )Ckn. Assume
that each of the m items chooses k random locations (using k random
hash functions)from a table with n locations. Then with high
probability, a proper allocation of these items can be found in time
O(n).
Lemma: Let L* be the set of labels of the vertices after all balls have
been allocated using Algorithm 1. Then the total time required to find
an allocation is O(vV L*(v))
16

Important Conclusion helpful in Project II


Lemma 1: For any > 0, let m = (1- )c*k,n balls are assigned to n bins
using k random choices for each ball. Then the corresponding
allocation graph G = (V, E) satisfies the following with probability 1 O(1/n): for every > 0 there exist C = C(, )> 0 and a subset S of V of
size at least (1- )n such that every vertex v belonging S satisfies d(v,
F) <= C.

17

Proposed Work in Project-III


Design Algorithm which return a L-orientable graph with high
probability with the help of the relation between two lemmas.
Analyze the algorithm and comment on its correctness and its
complexity.
Compare the algorithm with random walk insertion method and
comment on the performance.
18

Extended Local Search Algorithm

We model each bins as a collection of sections where each section/block can


contain at most one ball.

This reduces our problem to LSA algorithm where number of bins is equal to
L*n.

Number of balls is equal to m such that m = c*n.

19

Extended Local search algorithm

20

Extended Local search algorithm (formal)

21

Load Balancing LSA allocation

Assign a ball to a bin, we examine the k choices of the ball.

Choose a bin with minimum load and allocate the ball in that bin.

If the bin gets full by using this allocation

We set the label of that bin one more than the minimum of the k-1 choices of the ball.

22

Load Balancing LSA allocation

If the bin is already full then,

Remove the ball from the bin which has a free section from its other k1 choices.

Replace the ball and apply LBELSA algorithm for the replaced ball.

If there exist no such ball,


Choose a ball randomly from the L balls from the bin and
replace that ball.

If the bin is not full then,

We simply allocate a section to the ball and increment the load of the
concerned bin.

23

Load Balancing LSA allocation Algorithm

Continued
24

Load Balancing LSA allocation Algorithm(contd.)

25

Experimental Results (Varying number of balls)

26

Experimental Results (Varying number of bins)

27

Conclusion

ELSA algorithm successfully allocates m balls into n bins, under the given conditions.

ELSA and Load Balancing ELSA performs about 10 times better than the random walk
method.

Our algorithm requires linear time for finding optimal allocations.

Our algorithm finds maximum matchings in large sparse k-regular random bipartite
graphs in linear time with high probability.
28

Future Work

It would be an interesting direction to extend LSA for finding maximum cardinality


matchings in non-bipartite graphs.

Theoretically prove that the algorithm is linear by proving lemma 1 (Discussed


earlier).

29

Applications

Load balancing
m = identical jobs and n machines, each job may choose randomly among k different
machines.

Parallel Access to Hard Disks


N hard disks to implement a level of data redundancy for fault tolerance, and minimize the
no of I/O steps needed to retrieve data.

Efficient Dictionaries
m = items (balls) and n locations (bins). Each item chooses its preferred k locations by using
k random hash functions. Our aim is to assign each item to one of its chosen locations such
that all items are assigned and no location receives more than 1 item.

30

Any Questions??

31

References
M. Khosla. Balls into bins
Computer Science. Springer, 2013.

made

faster.

In ESA,

Lecture

Notes

in

N. Fountoulakis, M. Khosla, and K. Panagiotou. The multiple- orientability


thresholds for random hypergraphs. In Proceedings of the Twenty-Second Annual
ACMSIAM Symposium on Discrete Algorithms, SODA '11, pages 1222{1236, 2011}.

Y. Azar, A. Broder, A. Karlin, and E. Upfal. Balanced allocations. SIAM Journal on


Computing, 29(1):180-200, 1999.

32

Anda mungkin juga menyukai