Ant Colony NETWORK PLANNING - GUC

18
NETWORK PLANNING Ant Colony 1

Transcript of Ant Colony NETWORK PLANNING - GUC

Page 1: Ant Colony NETWORK PLANNING - GUC

NETWORK PLANNINGAnt Colony

1

Page 2: Ant Colony NETWORK PLANNING - GUC

How to Apply Ant Colony on Bin Packing Problem (BPP)

2

Packing number of items in bins of a fixed (maximum) capacity.

Pack items into as few bins as possible (minimize the number of bins).

Inefficient solution

34

6 7

What is BPP ?

46

37

So if we have items with values 3,4,6,7 and the maximum

capacity of bin is 10

Optimal solution

36

4 7

Page 3: Ant Colony NETWORK PLANNING - GUC

Ant Colony Algorithm

3

No

Initialize pheromonestrails

Construct Ant Solution

Apply Local Search(optional)

Update Pheromones

Termination Condition?Yes

Finish

Page 4: Ant Colony NETWORK PLANNING - GUC

Initialize pheromones trails

4

Pheromones are deposited by ants as long as

they move in a route.

The density of these pheromones is proportional

to the number of ants.

BPP

It encodes combination of sizes for these items.

Initialize pheromones

trails

Construct Ant Solution

Apply Local Search

(optional)

Update Pheromones

Termination Condition?

Yes

Finish

No

Page 5: Ant Colony NETWORK PLANNING - GUC

Construct Ant Solution

5

Choose number of ants for your solution.

Every ant will start with an empty bin

New Items are added to each ant partial

solution.

Allowed items are those who are still small

enough to fit in the bin.

Initialize pheromones

trails

Construct Ant Solution

Apply Local Search

(optional)

Update Pheromones

Termination Condition?

Yes

Finish

No

Page 6: Ant Colony NETWORK PLANNING - GUC

Apply Local Search (optional)

6

Initialize pheromones

trails

Construct Ant Solution

Apply Local Search

(optional)

Update Pheromones

Termination Condition?

Yes

Finish

No

In every antโ€™s solution, the least full bins are opened

and their contents are made free.

Items in the remaining bins are replaced by larger

free items.

This gives fuller bins with larger items and free the

smaller items to reinsert.

We will proceed until no further improvement is

possible.

Page 7: Ant Colony NETWORK PLANNING - GUC

Example for local search

7

Page 8: Ant Colony NETWORK PLANNING - GUC

Update Pheromones

8

Initialize pheromones

trails

Construct Ant Solution

Apply Local Search

(optional)

Update Pheromones

Termination Condition?

Yes

Finish

No

Pheromone trail will evaporate with a small amount after

each iteration.

The left part makes the pheromone on all edges decay.

The speed of this decay is defined by ๐œŒ, the evaporation

parameter.

The right part increases the pheromone on all the edges

visited by ants. The amount of pheromone m ants deposit

on an edge. In this way, the increase of pheromone for an

edge depends on the number of ants that use this edge,

and on the quality of the solutions found by those ants.

m indicates how many times i and j go together in the

best solution

ฯ„ ๐‘–, ๐‘— = ๐œŒ๐œ ๐‘–, ๐‘— + ๐‘š๐‘“(๐‘ ๐‘๐‘’๐‘ ๐‘ก)

Page 9: Ant Colony NETWORK PLANNING - GUC

Termination Condition

9

Initialize pheromones

trails

Construct Ant Solution

Apply Local Search

(optional)

Update Pheromones

Termination Condition?

Yes

Finish

No

Examples of termination Conditions:

Reaching specific number of iterations.

The optimization solution doesnโ€™t change for

specific number of iterations.

Page 10: Ant Colony NETWORK PLANNING - GUC

Example

10

The items that we have: 3 1 2 4 6 3 3 5 2 4 5 2 3 7

Capacity of each bin = 10

Start with 2 ants

๐œ๐‘–,๐‘— ๐‘ก โˆถ ๐‘ก๐‘œ๐‘ก๐‘Ž๐‘™ ๐‘โ„Ž๐‘’๐‘Ÿ๐‘œ๐‘š๐‘œ๐‘›๐‘’ ๐‘‘๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก ๐‘œ๐‘› ๐‘๐‘œ๐‘š๐‘๐‘–๐‘›๐‘Ž๐‘ก๐‘–๐‘œ๐‘›

๐‘๐‘’๐‘ก๐‘ค๐‘’๐‘’๐‘› ๐‘–๐‘ก๐‘’๐‘š๐‘  ๐‘– ๐‘Ž๐‘›๐‘‘ ๐‘— at a given time t

๐œ๐‘–,๐‘—๐‘˜

๐‘ก โˆถ ๐‘โ„Ž๐‘’๐‘Ÿ๐‘œ๐‘š๐‘œ๐‘›๐‘’ ๐‘‘๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก ๐‘๐‘ฆ ๐‘Ž๐‘›๐‘ก ๐‘˜ ๐‘œ๐‘› ๐‘๐‘œ๐‘š๐‘๐‘–๐‘›๐‘Ž๐‘ก๐‘–๐‘œ๐‘›

๐‘๐‘’๐‘ก๐‘ค๐‘’๐‘’๐‘› ๐‘–๐‘ก๐‘’๐‘š๐‘  ๐‘– ๐‘Ž๐‘›๐‘‘ ๐‘— at a given time t๐‘„๐‘˜: ๐‘Ž๐‘š๐‘œ๐‘ข๐‘›๐‘ก ๐‘œ๐‘“ ๐‘โ„Ž๐‘’๐‘Ÿ๐‘œ๐‘š๐‘œ๐‘›๐‘’ ๐‘‘๐‘’๐‘๐‘œ๐‘ ๐‘–๐‘ก ๐‘๐‘ฆ ๐‘Ž๐‘›๐‘ก ๐‘˜ = 3

Page 11: Ant Colony NETWORK PLANNING - GUC

Example (construct antsโ€™ solutions)

11

Items: 3 1 2 4 6 3 3 5 2 4 5 2 3 7

Ant 1 Ant 2

4213

36

253

54

32

737

52

24

35

63

3124

We will assume that ant 1 will start filling the bins with items from left hand side and ant 2 from right hand side.

Page 12: Ant Colony NETWORK PLANNING - GUC

Example (update pheromones)

12

Number of bins used by ant 1 is 6

Number of bins used by ant 2 is 6

๐‘„๐‘˜ = 3

So pheromone update value for ant 1 will be 0.2 andpheromone update value for ant 2 will be 0.2

Ant 1 Ant 2

4213

36

253

54

32

737

52

24

35

63

3124

0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2

Page 13: Ant Colony NETWORK PLANNING - GUC

Example (update pheromones)

13

4213

0.4

36

0.4

253

0.2

54

0.2

32

0.2

7

0.2

37

0.2

52

24

35

0.2 0.2 0.2

Ant 1 Ant 2

4213

36

253

54

32

737

52

24

35

63

3124

0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2

Page 14: Ant Colony NETWORK PLANNING - GUC

Example (Local Search)

14

Ant 1

4213

36

253

54

32

7

10 9 10 9 5 7

4213

36

253

54

10 9 10 9

3 2 7

4213

37

253

54

10 10 10 9

3 2 6

Page 15: Ant Colony NETWORK PLANNING - GUC

Example (Local Search)

15

4213

37

253

532

10 10 10 10

4 6

4213

37

253

532

10 10 10 10

46

10

Page 16: Ant Colony NETWORK PLANNING - GUC

Example (Local Search)

16

Ant 2

37

52

24

35

63

3124

10 7 6 8 9 10

37

35

63

3124

10 8 9 10

5 2 2 437

55

63

3124

10 10 9 10

3 2 2 4

Page 17: Ant Colony NETWORK PLANNING - GUC

Example (Local Search)

17

37

55

64

3124

10 10 10 10

3 3 2 2

37

55

64

3124

3322

10 10 10 10 10

Page 18: Ant Colony NETWORK PLANNING - GUC

THANK YOU

18