33
When Ants Attack! Ant Algorithms for Subset Selection Problems Derek Bridge Finbarr Tarrant Christine Solnon University College Cork University of Lyon

When Ants Attack! Ant Algorithms for Subset Selection Problems Derek BridgeFinbarr TarrantChristine Solnon University College CorkUniversity of Lyon

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

When Ants Attack!Ant Algorithms for

Subset Selection Problems

Derek Bridge Finbarr Tarrant Christine Solnon

University College Cork University of Lyon

Overview

Ant Algorithms for Best Hamiltonian Path-Finding Problems Subset Selection Problems

Definitions and examples Ant-SS, an Ant Algorithm for Subset Selection Problems

Solution construction step Pheromone updating step Parameters

Experimental Results Conclusions

Ant Algorithms

Find solutions or near-solutions to intractable discrete optimization problems

Inspired by the behaviour of real ants Ants communicate indirectly by laying trails of

pheromone “stigmergy”

Enables the ants to find shortest paths between nest and food

Ant Algorithms

Problem is modelled as a search for a minimum cost path in a graph

Artificial ants complete a series of walks of the graph Each path corresponds to a potential solution They deposit pheromone on their path in proportion

to its quality Unlike real ants, typically

the pheromone is deposited on completion of the path only the best paths receive pheromone (“elitism”)

Ant Algorithms

The ants choose between destinations probabilistically based on a combination of the cumulated pheromone τ, and an heuristic factor η

AB

C

Τ<A,B>

Τ<A, C>

η<A,B>

η<A,C>

Ant Algorithms

The pheromone intensifies search around the most promising paths

But to avoid stagnation, we need techniques to diversify search, e.g: raise the importance of the heuristic factor evaporate some pheromone impose lower and upper bounds on the

pheromone (MAX-MIN Ant Systems)

Travelling salesperson problem

Find the minimum length route that: starts in, e.g., Cork; visits each town exactly once; returns to Cork.

And now the bad news...Num of towns,

n

Num of routes,

(n – 1)! ÷ 2Time to find shortest

route

28

21 A 19-digit number

52 mins3 billion(10-digit number)

360 microsecs360

14

7

Nearly 40,000years

A 28-digit number2 trillioncenturies

Demo

Best Hamiltonian Path-Finding Problems Ant algorithms have been used for

Travelling salesperson problems Quadratic assignment problems Vehicle routing problems Permutation constraint satisfaction problems

Characteristics ants must visit every vertex in the graph heuristic factor is often inverse of edge cost

Subset Selection Problems

Intuition: Given a set S, find a subset S’ S

that satisfies certain properties and/or optimizes some objective function

Example: the multidimensional 0-1 knapsack problem Choose which objects to put

into the knapsack but total weight < 15kg

(and perhaps other properties) and maximise monetary value

Subset Selection Problems

An SS problem may be defined by a triple

(S, Sfeasible, f) where S is a set of objects; Sfeasible (S) is a set that contains all feasible subsets

of S; f : Sfeasible is an objective function that associates a

real-valued cost f(S’) with every feasible subset of objects S’ Sfeasible.

The goal of an SS problem (S, Sfeasible, f) is to find

S* S such that S* Sfeasible and f(S*) is maximal.

Multidimensional knapsack as a SS Problem S is the set of objects; Sfeasible contains every subset that satisfies all

the resource constraints, i.e.

Sfeasible = {S’ S | i1..m, jS’, rij < bi} where m is the number of resources,

rij is the consumption of resource i by object j, and bi is the available quantity of resource i;

f returns the total profit, i.e.,

S’Sfeasible, f(S’) = jS’ pj where pj is the profit associated with object j.

Other SS Problems

Maximum Clique Maximum Boolean Satisfiability Maximum Constraint Satisfaction Minimum Vertex Cover Graph Matching Edge-Weighted k-Cardinality Tree

Ant-SS Initialise pheromone repeat

for each ant k, construct a solution Sk as follows: Randomly choose a first object oi S Sk {oi} Candidates {oj S \ oi | Sk {oj} Sfeasible} while Candidates

Choose an object oi Candidates with probability p(oi, Sk) based on τ(oi, Sk) and η(oi, Sk)

Sk Sk {oi} Remove oi from Candidates Remove from Candidates every object oj such that Sk {oj} Sfeasible

end while end for Optionally, apply local search Update the pheromone

until maximum number of cycles reached or acceptable solution found

Sfeasibe must be defined in such a way that feasible subsets can be constructed incrementally

Pheromone update

In SS Problems, the order in which objects are selected is not significant hence rewarding consecutively visited vertices (by

placing pheromone on visited edges) is not meaningful Vertex pheromone strategy

reward solution Sk by associating pheromone with each object oi Sk

Clique pheromone strategy reward solution Sk by associating pheromone with each

pair of different objects (oi, oj) Sk Sk

Vertex Pheromone Strategy

Pheromone is laid on objects represents the learned desirability of selecting

that object

1

23

4

5

1

23

4

5

The ant’s walk Where pheromone is laid

How does this affect candidate selection? Initialise pheromone repeat

for each ant k, construct a solution Sk as follows: Randomly choose a first object oi S Sk {oi} Candidates {oj S | Sk {oj} Sfeasible} while Candidates

Choose an object oi Candidates with probability p(oi, Sk) based on τ(oi, Sk) and η(oi, Sk)

Sk Sk {oi} Remove oi from Candidates Remove from Candidates every object oj such that Sk {oj} Sfeasible

end while end for Optionally, apply local search Update the pheromone

until maximum number of cycles reached or acceptable solution found

Vertex Pheromone Strategy: how it affects candidate selection

1

23

4

5

1

23

4

5

Suppose the ant has selectedobjects 1, 2 and 4.

The probability of selecting object 5 is based on•the pheromone on object 5;•the heuristic value of object 5

Τ5η5

Clique Pheromone Strategy

Pheromone is laid on pairs of objects represents the learned desirability of selecting

one object given that another has been selected

1

23

4

5

1

23

4

5

The ant’s walk Where pheromone is laid

Clique Pheromone Strategy: how it affects candidate selection

1

23

4

5

1

23

4

5

Suppose the ant has selectedobjects 1, 2 and 4.

The probability of selecting object 5 is based on•the pheromone between objects 1 & 5, 2 & 5, and 4 & 5;•the heuristic value of object 5

Τ5 = Τ(1,5) + Τ(2, 5) + Τ(4, 5)η5

Comparison

Vertex Pheromone Strategy evaporation: O( |S| ) reward of subset Sk: O( |Sk| )

Clique Pheromone Strategy evaporation: O( |S|2 ) reward of subset Sk: O( |Sk|2 )

Experiments

τmin = 0.01; τmax = problem-dependent

Evaporation rate, ρ = 0.01 Number of ants = 30 Pheromone factor weight = 1 Heuristic factor = problem-dependent Heuristic factor weight = problem-dependent Pheromone update strategy: tried both Local search: tried without/with

Maximum Clique Problem

τmax = 6

Heuristic factor, η = 1 (in effect, none) Heuristic factor weight = 0 Results averaged over 50 runs

Solution Quality Results

Without local search With local search

Graph ω(G) Vertex Clique Vertex Clique

C125.9 34 34.0 34.0 34.0 34.0

C250.9 44 43.9 44.0 44.0 44.0

C500.9 57 55.2 55.6 55.3 55.9

C1000.9 68 65.3 66.0 65.7 66.2

C2000.9 78 73.4 74.1 74.5 74.3

All variants find optimal solutions to ‘easy’ instances

On harder instances, Clique outperforms Vertex

Incorporating local search improves solution quality

Solution Time Results

Without local search With local search

Vertex Clique Vertex Clique

CyclesTime (secs)

CyclesTime (secs)

CyclesTime (secs)

CyclesTime (secs)

C125.9 60 0.1 126 0.2 14 0.0 23 0.0

C250.9 359 0.8 473 1.7 172 0.5 239 1.0

C500.9 722 3.8 923 8.9 477 4.6 671 8.6

C1000.9 1219 13.2 2359 55.0 832 23.4 1242 49.8

C2000.9 1770 41.3 3268 214.4 1427 112.4 2067 238.7

Vertex needs fewer cycles than Clique

Hence, and because it is cheaper, Vertex converges in less time than Clique

Local search reduces Cycles but not always Time

Convergence (C500.9)

Comparisons with other algorithms

In other experiments on maximum clique problems (Solnon), Ant-SS outperforms a genetic algorithm is comparable to an adaptive greedy search is slightly outperformed by a tabu search

Constraint Satisfaction Problems

τmax = 4

Heuristic factor η is select variable based on smallest-domain heuristic factor of variable’s value is inversely

proportional to the number of additional constraints that would be violated

Heuristic factor weight = 10 Results averaged over 100 runs

Solution Quality Results

Without local search With local search

pt κ Vertex Clique Vertex Clique

0.20 0.74 100% 100% 100% 100%

0.23 0.87 45% 93% 91% 100%

0.26 1.00 89% 97% 99% 100%

0.29 1.14 100% 100% 100% 100%

All variants find solutions to ‘easy’ instances

On harder instances, Clique outperforms Vertex

Incorporating local search improves solution quality

All instances are solvable. We show % of runs that succeeded in finding

a solution

Solution Time Results

Without local search With local search

Vertex Clique Vertex Clique

CyclesTime (secs)

CyclesTime (secs)

CyclesTime (secs)

CyclesTime (secs)

0.20 90 1.2 63 4.8 2 0.0 2 0.0

0.23 1084 19.5 849 78.2 472 30.8 230 31.6

0.26 1019 18.1 737 66.1 365 26.9 260 38.7

0.29 449 7.8 516 45.2 27 1.8 38 5.4

Clique needs fewer cycles than Vertex!!!

But, because it is cheaper, Vertex converges in less time than Clique

Local search reduces Cycles but not always Time

Comparisons with other algorithms

In other experiments on constraint satisfaction problems (Solnon), Ant-SS outperforms a genetic algorithm because

Clique nearly always finds a solution even on harder instances, but the genetic algorithm does not

is slower than a complete search on smaller instances but much faster on larger instances

Conclusions

We defined Subset Selection Problems We have defined the Ant-SS algorithm

with two pheromone strategies, Vertex and Clique

We have evaluated on a number of problem instances good performance relative to other algorithms Clique typically finds better quality solutions

but Vertex generally requires less CPU time