1 Combinatorial Problem. 2 Graph Partition Undirected graph G=(V,E) V=V1  V2, V1  V2=  minimize the number of edges connect V1 and V2.

Slides:



Advertisements
Similar presentations
Constraint Optimization We are interested in the general non-linear programming problem like the following Find x which optimizes f(x) subject to gi(x)
Advertisements

School of Computer Science
1 Transportation problem The transportation problem seeks the determination of a minimum cost transportation plan for a single commodity from a number.
Greedy Algorithms Greed is good. (Some of the time)
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
Genetic Algorithms Contents 1. Basic Concepts 2. Algorithm
1 APPENDIX A: TSP SOLVER USING GENETIC ALGORITHM.
Tuesday, May 14 Genetic Algorithms Handouts: Lecture Notes Question: when should there be an additional review session?
Chapter 3 The Greedy Method 3.
1 Lecture 8: Genetic Algorithms Contents : Miming nature The steps of the algorithm –Coosing parents –Reproduction –Mutation Deeper in GA –Stochastic Universal.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
Evolutionary Computational Intelligence
CPSC 411, Fall 2008: Set 4 1 CPSC 411 Design and Analysis of Algorithms Set 4: Greedy Algorithms Prof. Jennifer Welch Fall 2008.
Population New Population Selection Crossover and Mutation Insert When the new population is full repeat Generational Algorithm.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
COMP305. Part II. Genetic Algorithms. Genetic Algorithms.
EAs for Combinatorial Optimization Problems BLG 602E.
Chapter 14 Genetic Algorithms.
Ch 13 – Backtracking + Branch-and-Bound
Genetic Algorithms by Dr. Sadiq M. Sait & Dr. Habib Youssef (special lecture for oometer group) November 2003.
Backtracking.
CPSC 411, Fall 2008: Set 4 1 CPSC 411 Design and Analysis of Algorithms Set 4: Greedy Algorithms Prof. Jennifer Welch Fall 2008.
Christoph F. Eick: Applying EC to TSP(n) Example: Applying EC to the TSP Problem  Given: n cities including the cost of getting from on city to the other.
Genetic Algorithm.
Genetic Algorithms and Ant Colony Optimisation
Computer Implementation of Genetic Algorithm
Physical Mapping of DNA Shanna Terry March 2, 2004.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Genetic Operators for TSP Chapter 8 in Michalewicz and Fogel, How to Solve It: Modern Heuristics, Springer, 2000.
Nattee Niparnan. Easy & Hard Problem What is “difficulty” of problem? Difficult for computer scientist to derive algorithm for the problem? Difficult.
SOFT COMPUTING (Optimization Techniques using GA) Dr. N.Uma Maheswari Professor/CSE PSNA CET.
Intro. ANN & Fuzzy Systems Lecture 36 GENETIC ALGORITHM (1)
Ch.12 Machine Learning Genetic Algorithm Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2011.
CSCI 115 Chapter 7 Trees. CSCI 115 §7.1 Trees §7.1 – Trees TREE –Let T be a relation on a set A. T is a tree if there exists a vertex v 0 in A s.t. there.
More on Heuristics Genetic Algorithms (GA) Terminology Chromosome –candidate solution - {x 1, x 2,...., x n } Gene –variable - x j Allele –numerical.
1 Chapter 14 Genetic Algorithms. 2 Chapter 14 Contents (1) l Representation l The Algorithm l Fitness l Crossover l Mutation l Termination Criteria l.
GENETIC ALGORITHMS.  Genetic algorithms are a form of local search that use methods based on evolution to make small changes to a popula- tion of chromosomes.
Greedy Methods and Backtracking Dr. Marina Gavrilova Computer Science University of Calgary Canada.
1 Combinatorial Problem. 2 Graph Partition Undirected graph G=(V,E) V=V1  V2, V1  V2=  minimize the number of edges connect V1 and V2.
Crossovers and Mutation Richard P. Simpson. Genotype vs. Phenotype The genotype of a chromosome is just the basic data structure (it bits in a binary.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
1 Genetic Algorithms and Ant Colony Optimisation.
Genetic Algorithms Przemyslaw Pawluk CSE 6111 Advanced Algorithm Design and Analysis
UNIT 5.  The related activities of sorting, searching and merging are central to many computer applications.  Sorting and merging provide us with a.
Bijective tree encoding Saverio Caminiti. 2 Talk Outline Domains Prüfer-like codes Prüfer code (1918) Neville codes (1953) Deo and Micikevičius code (2002)
Trees Thm 2.1. (Cayley 1889) There are nn-2 different labeled trees
D Nagesh Kumar, IIScOptimization Methods: M8L5 1 Advanced Topics in Optimization Evolutionary Algorithms for Optimization and Search.
N- Queens Solution with Genetic Algorithm By Mohammad A. Ismael.
Chapter 13 Backtracking Introduction The 3-coloring problem
GENETIC ALGORITHMS Tanmay, Abhijit, Ameya, Saurabh.
1 Contents 1. Basic Concepts 2. Algorithm 3. Practical considerations Genetic Algorithm (GA)
On the Ability of Graph Coloring Heuristics to Find Substructures in Social Networks David Chalupa By, Tejaswini Nallagatla.
Genetic Algorithms And other approaches for similar applications Optimization Techniques.
1 Genetic Algorithms Contents 1. Basic Concepts 2. Algorithm 3. Practical considerations.
CSG3F3/ Desain dan Analisis Algoritma
Chapter 14 Genetic Algorithms.
School of Computer Science & Engineering
Example: Applying EC to the TSP Problem
Genetic Algorithms Permutation crossovers
Comparing Genetic Algorithm and Guided Local Search Methods
Genetic Algorithms CPSC 212 Spring 2004.
Example: Applying EC to the TSP Problem
Introduction to Operators
Example: Applying EC to the TSP Problem
نعيمه خاكزاد سودابه سليماني خدايار خليلي استاد مربوطه: مهندس گرجي زاده
Searching for solutions: Genetic Algorithms
Backtracking and Branch-and-Bound
The Theory of NP-Completeness
Presentation transcript:

1 Combinatorial Problem

2 Graph Partition Undirected graph G=(V,E) V=V1  V2, V1  V2=  minimize the number of edges connect V1 and V2

3 Graph Partition Binary coding: 0-->V1, 1-->V2 Fitness function: the number of edges connect V1 and V2

4 Knapsack max  pi  xi s.t.  si  xi  C xi={0,1}

5 Binary coding 0-->not in the knapsack 1-->in the knapsack The problem is how to get feasible solution

6 Penalty function fitness=  pi  xi+g(x) If  si  xi  C, then g(x)=0 If  si  xi>C, then g(x)=  (C-  si  xi)

7 Repair algorithm If the chromosome is not feasible, choose some genes and convert them to 0 1) Random choose the genes 2) Choose according to the order of pi/si

8 Crossover c1=p1 AND p2 c2=p1 OR p2

9 Permutations: Now it Gets Interesting! Use permutations when bit strings fall short: TSP Knapsack Graph coloring N Queens

10 TSP The TSP was proved to be NP-hard. It arises in numerous applications and the number of cities might be quite significant: 1) Circuit board drilling application with up to 17,000 cities 2) X-ray crystallography instances with up to 14,000 cities 3) VLSI fabrication with as many as 1.2 million cities TSP has an extremely easy fitness function. In a population of tours, we can easily compare any two of them. However the choice of the representation of a tour and the choice of operators to be used are far from clear. There is an agreement in the GA community that the binary representation of tours is not well suited for the TSP.

11 TSP The expression of the chromosome Ordinal Adjacency Path

12 Ordinal expression The ith gene belongs to the region [1,n-i+1]. It determines which city will be chosen from the city list. City list ( ) Chromosome ( ) Then the path is ( )

13 Adjacency expression Why adjacency expression? Schemata analysis

14 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path:

15 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path:

16 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path: 1-2

17 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path: 1-2

18 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path: 1-2-4

19 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path: 1-2-4

20 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path:

21 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path:

22 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path:

23 Adjacency expression If and only if go from city i to j, city j is on the position i chromosome ( ) path: For every path there is only one adjacency expression, some adjacency expression may be illegal. ( ) will leads to ( )

24 Crossover Alternating edges Subtour chunks Heuristic crossover

25 Alternating edges Build an offspring by choosing (at random) an edge from the first parent, then selects an appropriate edge from the second parent, etc.----The operator extends the tour by choosing edges from alternating parents. If the new edge (from one of the parents) introduces a cycle into the current (still partial) tour, the operator selects instead a (random) edge from the remaining edges which does not introduce cycles. It can be considered as uniform crossover.

26 p1=( ) tour1=( ) p2=( ) tour2=( ) The offspring might be c=( ) tour=( ) The process starts from the edge (1,2) from p1. The 6th edge should be (6,4) because of the edge (1,2). The 8th edge could be neither (8 5) nor (8 4). It could only be one of (8 3) and (8 6). Since (8 3) will introduce a premature cycle, the 8th edge has to be (8 6).

27 Subtour chunks Construct an offspring by choosing a (random length) subtour from one of the parents, then choosing a (random length) subtour from another parent, etc the operator extends the tour by choosing edges from alternating parents, Again if some edge (from one of the parents) introduces a cycle into the current (still partial) tour, the operator selects instead a (random) edge from the remaining edges which does not introduce cycles.

28 Heuristic crossover Build an offspring by choosing a random city as the starting point for the offspring’s tour. Then it compares the two edges (from both parents) leaving this city and selects the better (shorter) edge. The city on the other end of the selected edge serves as a starting point in selecting the shorter of the two edges leaving this city, etc. If, at some stage, a new edge would introduce a cycle into the partial tour, then the tour is extended by a random edge from the remaining edges which does not introduce cycles.

29 Path expression It is perhaps the most natural representation of a tour. A tour( ) is represented simply as ( )

30 How to Make a initial solution for( i = 1; i <= N; i++ ) P[i] = i; for( i = 1; i <= N; i++ ) { k = random_int( N - i ); interchange P[i] with P[i + k]; } This uniformly generates permutations of {1;  ;N}

31 Crossing Over: the Problem Cross over the two permutations 6 7 | | | | 6 7 by swapping the indicated substrings. The results are not permutations:

32 Repairing the Crossover Damage PMX: "partially matched crossover" OX: "ordered crossover" CX: "cycle crossover"

33 PMX: Partially Matched Crossover Build an offspring by choosing a subsequence of a tour from one parent and preserving the order and position of as many cities as possible from the other parent. A subsequence of a tour is selected by choosing two random cut points, which serve as boundaries for swapping operations.

34 p1=(1 2 3 | | 8 9) p2=(4 5 2 | | 9 3) First the segments between cut points are swapped c1=(x x x | | x x) c2=(x x x | | x x) This swap defines also a series of mappings:

35 We can fill further cities (from the original parents), for which there is no conflict: p1=(1 2 3 | | 8 9) p2=(4 5 2 | | 9 3) c1=(x 2 3 | | x 9) c2=(x x 2 | | 9 3)

36 Finally the first x in c1 (which should be 1, but there is a conflict) is replaced by 4 because of the mapping Similarly the second x in the offspring c1 is replaced by 5, and the x and x in the c2 are 1 and 8. c1=(4 2 3 | | 5 9) c2=(1 8 2 | | 9 3)

37 OX: Ordered Crossover Build offspring by choosing a subsequence of a tour from one parent and preserving the relative order of cities from the other parent. p1=(1 2 3 | | 8 9) p2=(4 5 2 | | 9 3)

38 First the segments between cut points are copied into offspring c1=(x x x | | x x) c2=(x x x | | x x)

39 Next, starting from the second cut point of one parent, the cities from the other parent are copied in the same order, omitting symbols already present. Reaching the end of the string, we continue from the first place of the string. The sequence of the cities in the second parent (from the second cut point) is ( ) (p2=(4 5 2 | | 9 3))

40 After removal of cities 4, 5, 6 and 7, which are already in the first offspring, we get ( ) This sequence is placed in the first offspring (starting from the second cut point) c1=(2 1 8 | | 9 3) Similarly we get the other offspring c2=(3 4 5 | | 9 2)

41 The OX crossover exploits a property of the path representation, that the order of cities (not their positions) are important, i.e., the two tours ( ) ( ) are in fact identical

42 CX: Cycle Crossover Build offspring in such a way that each city (and its position) comes from one of the parents. It preserves the absolute position of the elements in the parent sequence.

43 CX: Cycle Crossover p1=( ) p2=( ) would produce the first offspring by taking the first city from the first parent c1=(1 x x x x x x x x) and c2=(4 x x x x x x x x)

44 p1=( ) p2=( ) Since every city in the offspring should be taken from one of its parents (from the same position), we do not have any choice now: the next city to be considered must be city 4, as the city from the p2 just “below” the selected city 1. In p1 this city is at position ‘4’, thus c1=(1 x x 4 x x x x x) and c2=(4 x x 8 x x x x x)

45 p1=( ) p2=( ) This, in turn, implies city 8, as the city from p2 just “below” the selected city 4. Thus c1=(1 x x 4 x x x 8 x) Following this rule, the next cities to be included in the first offspring are 3 and 2. However, that the selection of city 2 requires selection of city 1, which is already on the list----thus we have completed a cycle c1=( x x x 8 x)

46 p1=( ) p2=( ) The remaining cities are filled from the other parent c1=( ) Similarly c2=( )

47 Comparison p1=(1 2 3 | | 8 9) p2=(4 5 2 | | 9 3) PMX c1=(4 2 3 | | 5 9) c2=(1 8 2 | | 9 3) OX c1=(2 1 8 | | 9 3) c2=(3 4 5 | | 9 2) CX c1=( ) c2=( )

48 Exercise p1=(9 8 7 | | 2 1) p2=(4 5 2 | | 9 3) PMX c1=( ) c2=( ) OX c1=( ) c2=( ) CX c1=( 9 5 x 6 x x x x x) c2=( )

49 Answer p1=(9 8 7 | | 2 1) p2=(4 5 2 | | 9 3) PMX c1=(9 5 4 | | 2 3) c2=(7 8 2 | | 9 1) OX c1=(1 8 7 | | 9 2) c2=(5 4 3 | | 2 9) CX c1=( ) c2=( )

50 Mutation inversion: the substring between the two selected points is reversed > insertion: selects a city and inserts it in a random place > displacement: selects a subtour and inserts it in a random place > reciprocal exchange: swaps two cities >

51 Knapsack again: Permutation expression Let the GA creatures be permutations of (1;  ;n): Interpret this as a object placement: If the placement of one object cause the solution infeasible, delete this object and consider the next one.

52 Graph coloring Undirected graph G=(V,E) and n colors Every two vertexes connected can not be given the same color Maximize the total weight of the colored vertexes

53 Greedy algorithm Sort the vertexes according to their weight Choose the vertex according to the rank, try to color that vertex Eg: ( ) one color Vertex are colored. The total weight is 32

54 Eg2: ( ) one color Vertex 7 will be chosen and the total weight is 15. The optimal solution is (1 5 3) and the total weight is 35. Only the weight of vertex 7 is larger than 35, greedy algorithm will get the global optimum.

55 Permutation expression Let the GA creatures be permutations of (1;  ;n) Individual = (c1;  ; cN). Interpret this as the order of coloring process. First try to give a color to c1, then consider c2, and so on.

56 N Queens Place N mutually un-attacking Queens on an N  N chess board. (Queens attack on rows, columns, and diagonals.)

57 Permutation Is Placement Let the GA creatures be permutations of (1; 2;  ;N): Individual = (c1;  ; cN). Interpret this as a Queens placement: The Queen in row k is in column ck. Fitness: number of Queens unattacked by other Queens.