Download presentation
Presentation is loading. Please wait.
Published byHamdani Tanudjaja Modified over 6 years ago
1
Design & Analysis of Algorithms Combinatorial optimization
SCHOOL OF COMPUTING Design & Analysis of Algorithms Combinatorial optimization Pasi Fränti
2
Optimization techniques
Local search Stochastic variations of local search Genetic algorithms Swarm Intelligence
3
Knapsack problem Simplified
Input: Weight of N items {w1, w2, ..., wn} Knapsack limit S Output: Selection for knapsack: {x1,x2,…xn} where xi {0,1}. 5 3 7 Sample input: wi={2,3,5,7,11} S=15 Max 15 2 11
4
Knapsack as decision tree
Yes No Chooce 2 2 - Yes No Yes No Chooce 3 5 2 3 - Yes No Yes No Yes No Yes No Chooce 5 10 5 7 2 8 3 5 - Yes No Yes Chooce 7 17 10 12 5 5 14 9 2 15 8 10 3 12 5 7 - … … … … No 28 12 14 13 26 15 12 -
5
In context of search tree
Brute force: search full tree 2 - 5 2 3 - Heuristics Greedy 10 5 7 2 8 3 5 - 17 10 12 5 5 14 9 2 15 8 10 3 12 5 7 - … … … 28 10 12 14 13 26 15 12 - Local search
6
Local search
7
Main principle of local search
Select one and move
8
Structure of local search
Generate initial solution REPEAT Generate a set of new solutions Evaluate the new solutions Select the best solution UNTIL stopping criterion met best 13 15 9 12 11 7 13 21 9 12 14 17 best
9
Components of local search
Representation of solution Bit string ( …) Problem-domain data structure {1, 3, 5, 2…} Neighborhood function (move) Bits: ( …) ( …) Application domain: {1, 3, 5, 2…} {1, 5, 3, 2…} Search strategy Best-improvement: try all, select best First-improvement: select first that improves. TSP
10
Movement in neighborhood
Study neighbor solutions
11
Search strategy Best improvement: First improvement: first best
13 21 9 12 14 17 12 first best 21 13 Hill-climbing (max!) / Descendent (min! 15 13 21 9 12 14 17 8 dead end 7 6 8 11 10 9 5 4 8 7
12
Accept only better solutions
Hill climbing Accept only better solutions
13
Local and global maxima
14
Combining local search and hill-climbing
15
Local search for Knapsack
16
Representation of knapsack
Represent solution as bit string (x1x2,…xn), where xi {0,1}. Problem instance: wi= (2,3,5,7,11), S=15. Solution with elements 2,3 and 7 is represented as
17
Move in knapsack S=15 W=[2, 3, 5, 7, 11] Single bit change: 01 or 10
18
Extended neighborhood
S=15 W=[2, 3, 5, 7, 11] Two operations: 01 or 10 Swap bit location 10011
19
Local maximum S=15 W=[2, 3, 5, 7, 11]
20
Tabu search S=15 W=[2, 3, 5, 7, 11] Prevents search to return previously visited solutions Tabu! Select the next best
21
Tabu search (2nd iteration)
S=15 W=[2, 3, 5, 7, 11]
22
Traveling salesman problem
Permute local changes in given route ... pi-1 pi pi+1 ... ... pi-1 pi+1 pi ... ... pi pi-1 pi+1 ... ... pi pi+1 pi-1 ... ... pi+1 pi pi-1 ... ... pi+1 pi-1 pi ...
23
Local search for TSP
24
TSP example E F G H A 4 + + 2 + = 2 + 6
E F H G A = min! E G F H A + = 3 + 3 E G H F A = 2 + 5 E H G F A + = 2 + 5 E H F G A + 2 = 1 + 6
25
Genetic algorithm
26
Genetic algorithm (GA)
Needs more material!
27
Main structure of GA Generate a set of initial solutions. REPEAT
Generate new solutions by crossover. Mutate the new solutions (optional). Evaluate the candidate solutions. Retain best candidates and delete the rest. UNTIL stopping criterion met.
28
Permuting pairs for crossover
Elitist approach using zigzag scanning among the best solutions
29
Chess playing
30
Minmax technique
31
Tic-tac-toe example
32
Optimizing chess playing
Revise
33
Evaluation function
34
Minmax example Redraw 34
35
Minmax playing: Min’s move
35
36
Minmax playing: Max’s move
Minimax maximizes the worst-case outcome for max 36
37
Chess Game tree
38
Beyond the horizon What value is the position?
39
Evaluating Chess position
40
Positional factors
41
Initial value range
42
Result of optimization
43
Swarm intelligence
44
Swarm intelligence (SI)
Social intelligence: individual behavior maybe naive but joint effect can be intelligent. Decentralized: no central control of the individuals of the colony Self-organized: individual adapts to environment and other members of colony Robust: Task is completed even if some individuals fail
45
Ant colony optimization (ACO)
Main principle: Emitting pheromone between nest and food Joint efforts to carry loads Solving TSP by ants: Sending ants to make randomized tours Short links chosen more often than long ones Good tracks are marked by pheromone Tracks with high pheromone chosen more often
46
Ant colony optimization
Initialization: Generate randomized tours. Smaller links chosen more often than longer ones Simulate pheromone: Subtract cost of the links in best solution (-1) Increase the ones in the worst solution (+1) Tours are evaluated using the original graph.
47
Ant colony optimization 1st round
48
Ant colony optimization 2nd round
49
The end
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.