Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
METAHEURISTIC Jacques A. Ferland Department of Informatique and Recherche Opérationnelle Université de Montréal [email protected] March 2015 Overview • Heuristic Constructive Techniques: Generate a good solution • Local (Neighborhood) Search Methods (LSM): Iterative procedure improving a solution • Population-based Methods: Population of solutions evolving to mimic a natural process Population-based Methods • • • • • • • Genetic Algorithm (GA) Hybrid GA-LSM Genetic Programming (GP) Adaptive Genetic Programming (AGP) Scatter Search (SS) Ant Colony Algorithm (ACA) Particle Swarm Optimiser (PSO) Genetic Algorithm (GA) • Population based algorithm • At each generation three different operators are first applied to generate a set of new (offspring) solutions using the N solutions of the current population P: selection operator: selecting from the current population parent-solutions that reproduce themselves crossover (reproduction) operator: producing offspring-solutions from each pair of parent-solutions mutation operator: modifying (improving) individual offspring-solution • A fourth operator (culling operator) is applied to determine a new population of size N by selecting among the solutions of the current population and the offspring-solutions according to some strategy Two variants of GA • At each generation of the Classical genetic algorithm: • At each generation of the Steady-state population genetic algorithm: - N parent solutions are selected and paired two by two - An even number of parent-solutions are selected and paired two by two - A crossover operator is applied to each pair of parent-solutions according to some probability to generate two offspring-solutions. Otherwise the two parent-solutions become their own offspring-solutions - A crossover operator is applied to each pair of parent-solutions to generate two offspring-solutions. - A mutation operator is applied according to some probability to each offspring-solution. - A mutation operator is applied according to some probability to each offspring-solution. - The population of the next generation includes the offspring-solutions -The population of the next generation includes the N best solutions among the current population and the offspringsolutions Problem used to illustrate • General problem min f x xX • Assignment type problem: Assignment of resources j to activities i f x min m s.t. x j 1 ij 1 xij 0 or 1 i 1, ,n i 1, , n ; j 1, ,m Encoding the solution • The phenotype form of the solution x є ℝp is encoded (represented) as a genotype form vector z є ℝn (or chromozome) where m may be different Assigning resources j to activities i from n. min f x m Subject to x 1 • For example in the assignment type problem: x 0 or 1 let x be the following solution: for each 1≤ i ≤ n, xij(i) = 1 xij = 0 for all other j j 1 ij x є ℝnxm can be encoded as z є ℝn where zi = j(i) i = 1, 2, …, n i.e., zi is the index of the resource j(i) assigned to activity i ij i 1, ,n i 1, ,n j 1, ,m Genetic Algorithm (GA) • Population based algorithm • At each generation three different operators are first applied to generate a set of new (offspring) solutions using the N solutions of the current population P: selection operator: selecting from the current population parent-solutions that reproduce themselves crossover (reproduction) operator: producing offspring-solutions from each pair of parent-solutions mutation operator: modifying (improving) individual offspring-solution • A fourth operator (culling operator) is applied to determine a new population of size N by selecting among the solutions of the current population and the offspring-solutions according to some strategy Selection operator • This operator is used to select an even number (2, or 4, or …, or N) of parent-solutions. • Each parent-solution is selected from the current population according to some strategy or selection operator. • Note that the same solution can be selected more than once. • The parent-solutions are paired two by two to reproduce themselves. • Selection operators: Random selection operator Proportional (or roulette whell) selection operator Tournament selection operator Diversity preserving selection operator Random selection operator • Select randomly each parent-solution from the current (entire) population • Properties: Very straightforward Promotes diversity of the population generated Proportional (Roulette whell) selection operator • Each parent-solution is selected as follows: i) Consider any ordering of the solutions z1, z2, …, zN in P ii) Select a random number α in the interval For the problem min f (x) [0, ∑1≤k≤ N ( 1 / f( zk) )] where x is encoded as z iii) Let τ be the smallest index such that 1/f (z) measures ∑1≤k≤ τ (1 / f( zk ) ) ≥ α the fittness of the τ iv) Then z is selected solution z 1 / f( z1 ) | | 1 / f( z2 ) 1 / f( z3) | | τ 1 / f( zN) … | | α The chance of selecting zk increases with its fittness 1 / f( zk) Tournament selection operator • Each parent-solution is selected as the best solution in a subset of randomly chosen solutions in P: i) Select randomly N’ solutions one by one from P (i.e., the same solution can be selected more than once) to generate the subset P’ ii) Let z’ be the best solution in the subset P’: z’ = argmin z є P’ f(z) iii) Then z’ is selected as a parent-solution Elitist selection • The main drawback of using elitist selection operator like Roulette whell and Tournament selection operators is premature converge of the algorithm to a population of almost identical solutions far from being optimal. • Other selection operators have been proposed where the degree of elitism is in some sense proportional to the diversity of the population. Genetic Algorithm (GA) • Population based algorithm • At each generation three different operators are first applied to generate a set of new (offspring) solutions using the N solutions of the current population P: selection operator: selecting from the current population parent-solutions that reproduce themselves crossover (reproduction) operator: producing offspring-solutions from each pair of parent-solutions mutation operator: modifying (improving) individual offspring-solution • A fourth operator (culling operator) is applied to determine a new population of size N by selecting among the solutions of the current population and the offspring-solutions according to some strategy Crossover (recombination) operators • Crossover operator is used to generate new solutions including interesting components contained in different solutions of the current population. • The objective is to guide the search toward promissing regions of the feasible domain X while maintaining some level of diversity in the population. • Pairs of parent-solutions are combined to generate offspringsolutions according to different crossover (recombination) operators. One point crossover • The one point crossover generates two offspring-solutions from the two parent-solutions z1 = [ z11, z21, …, zn1] z2 = [ z12, z22, …, zn2] as follows: i) Select randomly a position (index) ρ, 1 ≤ ρ ≤ n. ii) Then the offspring-solutions are specified as follows: oz1 = [ z11, z21, …, zρ1, zρ+12, …, zn2] oz2 = [ z12, z22, …, zρ2, zρ+11, …, zn1] Hence the first ρ components of offspring oz1 (offspring oz2) are the corresponding ones of parent 1 (parent 2), and the rest of the components are the corresponding ones of parent 2 (parent 1) Two points crossover • The two points crossover generates two offspring-solutions from the two parent-solutions z1 = [ z11, z21, …, zn1] z2 = [ z12, z22, …, zn2] as follows: i) Select randomly two positions (indices) μ,ν, 1 ≤ μ ≤ ν ≤ n. ii) Then the offspring-soltions are specified as follows: oz1 = [ z11, …, zμ-11, zμ2, …, zν2, zν+11, …, zn1] oz2 = [ z12, …, zμ-12, zμ1, …, zν1, zν+12, …, zn2] Hence the offspring oz1 (offspring oz2) has components μ, μ+1, …, ν of parent 2 (parent 1), and the rest of the components are the corresponding ones of parent 1 (parent 2) Uniform crossover • The uniform crossover requires a vector of bits (0 or 1) of dimension n to generate two offspring-solutions from the two parent-solutions z1 = [ z11, z21, …, zn1] , z2 = [ z12, z22, …, zn2] : i) Generate randomly a vector of n bits, for example [0, 1, 1, 0, …, 1, 0] ii) Then the offspring-solutions are specified as follows: parent 1: [ z11, z21, z31, z41,…, zn-11, zn1] parent 2: [ z12, z22, z32, z42,…, zn-12, zn2] Vector of bits: [ 0 , 1 , 1 , 0 , …, 1 , 0 ] Offspring oz1 : [ z11, z22, z32, z41,…, zn-12, zn1] Offspring oz2: [ z12, z21, z31, z42,…, zn-11, zn2] Uniform crossover • The uniform crossover requires a vector of bits (0 or 1) of dimension m to generate two offspring-solutions from the two parent-solutions z1 = [ z11, z21, …, zn1] , z2 = [ z12, z22, …, zn2] : i) Generate randomly a vector of bits, for example [0, 1, 1, 0, …, 1, 0] ii) Then the offspring-solutions are specified as follows: parent 1: [ z11, z21, z31, z41,…, zn-11, zn1] Hence the ith component of oz1 parent 2: [ z12, z22, z32, z42,…, zn-12, zn2] (oz2) is the ith component of Vector of bits: [ 0 , 1 , 1 , 0 , …, 1 , 0 ] Offspring oz1 : [ z11, z22, z32, z41,…, zn-12, zn1] Offspring oz2: [ z12, z21, z31, z42,…, zn-11, zn2] parent 1 (parent 2) if the ith component of the vector of bits is 0, otherwise, it is equal to the ith component of parent 2 (parent 1) Path relinking Let d z1 , z 2 the Hamming distance between z1 and z 2 : Denote by N z1 the set of d z1 , z 2 number of components of feasible solution obtained by modifying slightly z1. z1 and z 2 that are different. • The path relinking procedure generates a sequence of feasible solutions along a path linking two solutions xz1 and xz22 Path relinking procedure: 1. ps z and ps z 1 1 2 2 Let also N ps1 , ps 2 = z N ps1 : d z, ps 2 d ps1 , ps 2 2. Use the roulette whell selection operator to select z N p s1 , p s 2 If f ( z ) f ( z1 ) and f ( z ) f ( z 2 ), stop with z 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ps1 , ps 2 0, then stop with z; otherwise repeat 2 1. ps1 z1 and ps 2 z 2 2. Use the roulette whell selection operator to select z N p s1 , p s 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 z1 z2 1. ps1 z1 and ps 2 z 2 2. Use the roulette whell selection operator to select z N p s1 , p s 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 ps1 z1 2 ps 2 z 1. ps1 z1 and ps 2 z 2 Let also 2. Use the roulette whell selection operator to select z N p s1 , p s 2 N ps1 , ps 2 = z N ps1 : d z, ps 2 d ps1 , ps 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 ps1 z1 2 ps 2 z 1. ps1 z1 and ps 2 z 2 2. Use the roulette whell selection operator to select z N p s1 , p s 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 z ps z 1 1 2 ps 2 z 1. ps1 z1 and ps 2 z 2 2. Use the roulette whell selection operator to select z N p s1 , p s 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 z 1 ps 2 2 ps1 z 1. ps1 z1 and ps 2 z 2 Let also 2. Use the roulette whell selection operator to select z N p s1 , p s 2 N ps1 , ps 2 = z N ps1 : d z, ps 2 d ps1 , ps 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 z 1 ps 2 2 ps1 z 1. ps1 z1 and ps 2 z 2 2. Use the roulette whell selection operator to select z N p s1 , p s 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 z 1 ps 2 2 ps1 z z 1. ps1 z1 and ps 2 z 2 2. Use the roulette whell selection operator to select z N p s1 , p s 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 z 1 ps1 z2 ps 2 1. ps1 z1 and ps 2 z 2 Let also 2. Use the roulette whell selection operator to select z N p s1 , p s 2 N ps1 , ps 2 = z N ps1 : d z, ps 2 d ps1 , ps 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 z 1 ps1 z2 ps 2 1. ps1 z1 and ps 2 z 2 2. Use the roulette whell selection operator to select z N p s1 , p s 2 If f ( z ) f ( z ) and f ( z ) f ( z ), stop with z 1 2 3. Otherwise ps1 ps 2 , and ps 2 z 4. If d ( ps1 , ps 2 ) 0, then stop with z; otherwise repeat 2 z 1 ps1 z z2 ps 2 Ad hoc crossover operator The preceding crossover operators are sometimes too general to be efficient. Hence, whenever possible, we should rely on the structure of the problem to specify ad hoc problem dependent crossover operator in order to improve the efficiency of the algorithm. Recovery procedure Furthermore, whenever the structure of the problem is such that the offspring-solutions are not necessarily feasible, then an auxiliary procedure is required to recover feasibility. Such a procedure is used to transform the offspring-solution into a feasible solution in its neighborhood. Genetic Algorithm (GA) • Population based algorithm • At each generation three different operators are first applied to generate a set of new (offspring) solutions using the N solutions of the current population P: selection operator: selecting from the current population parent-solutions that reproduce themselves crossover (reproduction) operator: producing offspring-solutions from each pair of parent-solutions mutation operator: modifying (improving) individual offspring-solution • A fourth operator (culling operator) is applied to determine a new population of size N by selecting among the solutions of the current population and the offspring-solutions according to some strategy Mutation operator • Mutation operator is an individual process to modify offspring-solutions • In traditional variants of Genetic Algorithm the mutation operator is used to modify arbitrarely each componenet zi with a small probability: For i = 1 to n Generate a random number β [0, 1] If β < βmax then select randomly a new value for zi where βmax is small enough in order to modify zi with a small probability • Mutation operator simulates random events perturbating the natural evolution process • Mutation operator not essential, but the randomness that it introduces in the process, promotes diversity in the current population and may prevent premature convergence to a bad local minimum Hybrid GA - LSM Genetic Algorithm (GA) Hybrid GA - LSM • Population based algorithm • At each generation three different operators are first applied to generate a set of new (offspring) solutions using the N solutions of the current population P: selection operator: selecting from the current population parent-solutions that reproduce themselves crossover (reproduction) operator: producing offspring-solutions from each pair of parent-solutions mutation operator: modifying (improving) individual offspring-solution improve each offspring-solution using a LSM • A fourth operator (culling operator) is applied to determine a new population of size N by selecting among the solutions of the current population and the offspring-solutions according to some strategy HybridGA Methods Hybrid - LSM • This is a good strategy since it is well known that in general, Genetic Algorithms GA(and population based algorithms in general) are very time consuming and generate worse solutions than LSM • Strength of hybrid methods comes from combining complementary search strategy to take advantage of their respective strength. For instance, - Intensify the search in a promissing region with the LSM - Diversify the search through the selection operator, crossover operator of the GA Genetic Programming GP Genetic GeneticProgramming Algorithm (GA) GP • Population based algorithm At each generation, use the solutions in the current population P to • generate At eachoffspring generation three different operators are firstof applied to generate a : - solutions to create the population the next generation set of new (offspring) solutions using the N solutions of the current population P: Repeat the following process until N offspring-solutions are generated: Select randomly a generation strategy gs GS : selection operator: selecting from the current population parent-solutions Select parent-solu tions in P themselves for applying the generation strategy that reproduce gs (reproduction) GS : crossover operator: producing offspring-solutions from each pair of parent-solutions Generate offspring-solutions to be included in the intermediary population mutation operator:Pmodifying (improving) individual offspring-solution fourthoperator operator(culling (culling operatoris) applied is applied to determine • A A fourth operator) to determine a newa new population of selecting among the solutions of the current to population ofsize sizeNNbyby selecting solutions in P P according population and some strateg y the offspring-solutions according to some strategy Genetic GeneticProgramming Algorithm (GA) GP • Population based algorithm At each generation, use the solutions in the current population P to • generate At eachoffspring generation three different operators are firstofapplied to generate a : - solutions to create the population the next generation set of new (offspring) solutions using the N solutions of the current population P: Repeat the following process until N offspring-solutions are generated: Select randomly a generation strategy gs GS : selection operator: selecting from the current population parent-solutions Select parent-solu tions in P themselves for applying the generation strategy that reproduce gs (reproduction) GS : crossover operator: producing offspring-solutions from each pair of parent-solutions Generate offspring-solutions to be included in the intermediary population mutation operator:Pmodifying (improving) individual offspring-solution culling ope rator) isisapplied to to determine a new • A fourth operator operator((culling operator) applied determine a new population of in Psolutions P according population ofsize sizeNNby byselecting selectingsolutions among the of the to current some strategand y the offspring-solutions according to some strategy population Generation strategies GS Transfer some of the best parent-solutions of P in P Some iterations of a local search method on a parent-solution Crossover on a pair of parent-solutions Crossover on a pair of parent-solutions + mutation on offsring-solutions Mutation on a parent-solution Descent method One point crossover Tabu Search Two points crossover Simulated annealing Uniform crossover Large Multiple-Neighborhood Search Ad hoc crossover Adaptive Large neighborhood Seach Path relinking Genetic GeneticProgramming Algorithm (GA) GP • Population based algorithm At each generation, use the solutions in the current population P to • generate At eachoffspring generation three different operators are firstofapplied to generate a : - solutions to create the population the next generation set of new (offspring) solutions using the N solutions of the current population P: Repeat the following process until N offspring-solutions are generated: Select randomly a generation strategy gs GS : selection operator: selecting from the current population parent-solutions Select parent-solu tions in P themselves for applying the generation strategy that reproduce gs (reproduction) GS : crossover operator: producing offspring-solutions from each pair of parent-solutions Generate offspring-solutions to be included in the intermediary population mutation operator:Pmodifying (improving) individual offspring-solution culling ope rator) isisapplied to to determine a new • A fourth operator operator((culling operator) applied determine a new population of in Psolutions P according population ofsize sizeNNby byselecting selectingsolutions among the of the to current some strategand y the offspring-solutions according to some strategy population Parent - solution selection Selection operators (like in GA): Random selection operator Proportional (or roulette whell) selection operator Tournament selection operator Diversity preserving selection operator Genetic GeneticProgramming Algorithm (GA) GP • Population based algorithm At each generation, use the solutions in the current population P to • generate At eachoffspring generation three different operators are firstofapplied to generate a : - solutions to create the population the next generation set of new (offspring) solutions using the N solutions of the current population P: Repeat the following process until N offspring-solutions are generated: Select randomly a generation strategy gs GS : selection operator: selecting from the current population parent-solutions Select parent-solu tions in P themselves for applying the generation strategy that reproduce gs (reproduction) GS : crossover operator: producing offspring-solutions from each pair of parent-solutions Generate offspring-solutions to be included in the intermediary population mutation operator:Pmodifying (improving) individual offspring-solution culling ope rator) isisapplied to to determine a new • A fourth operator operator((culling operator) applied determine a new population of in Psolutions P according population ofsize sizeNNby byselecting selectingsolutions among the of the to current some strategand y the offspring-solutions according to some strategy population Generation strategies GS Transfer some of the best parent-solutions of P in P Some iterations of a local search method on a parent-solution Crossover on a pair of parent-solutions Crossover on a pair of parent-solutions + mutation on offsring-solutions Mutation on a parent-solution Descent method Tabu Search Genetic One point crossover Two) points crossover Algorithm (GA Simulated annealing Uniform crossover Large Multiple-Neighborhood Search Ad hoc crossover Adaptive Large neighborhood Seach Path relinking Adaptive Genetic Programming AGP Adaptive Genetic min(GA) g AGP Genetic Programming GP GeneticProgram Algorithm • Population based algorithm At each generation, use the solutions in the current population P to • generate At eachoffspring generation three different operators are firstofapplied to generate a P : - solutions to create the population the next generation set of new (offspring) solutions using the N solutions of the current population P: Repeat the following process until N offspring-solutions are generated: Select ran domly a generation strateg strategy randomly y gs GS :according to its score gs : selection operator: selecting from the current population parent-solutions Select parent-solu tions in P themselves for applying the Adaptive layer : generation strategy that reproduce gs (reproduction) GS : crossover operator: producing offspring-solutions j from each Probabilistic choices on to specify pair of parent-solutions Generate offspring-solutions to be included in the intermediary i population mutation operator:Pmodifying (improving) individual offspring-solution the intervals in the roulette wheel selection culling ope rator) isisapplied to to determine a new • A fourth operator operator((culling operator) applied determine a new population of in Psolutions P according population ofsize sizeNNby byselecting selectingsolutions among the of the to current some strategand y the offspring-solutions according to some strategy population Adaptive Genetic min(GA) g AGP Genetic Programming GP GeneticProgram Algorithm • Population based algorithm At each generation, use the solutions in the current population P to • generate At eachoffspring generation three different operators are firstofapplied to generate a P : - solutions to create the population the next generation set of new (offspring) solutions using the N solutions of the current population P: Repeat the following process until N offspring-solutions are generated: Select ran domly a generation strateg strategy randomly y gs GS :according to its score gs : selection operator: selecting from the current population parent-solutions Select parent-solu tions in P themselves for applying the generation strategy that reproduce gs (reproduction) GS : Score: crossover operator: producing offspring-solutions from each pair of parent-solutions Generate offspring-solutions to be included the intermediary Pastinperformance to contribute population mutation operator:Pmodifying (improving) individual during offspring-solution the solution process culling ope rator) isisapplied to to determine a new • A fourth operator operator((culling operator) applied determine a new population of in Psolutions P according population ofsize sizeNNby byselecting selectingsolutions among the of the to current some strategand y the offspring-solutions according to some strategy population Adaptive Genetic ing Genetic Programming GP AGP GeneticProgramm Algorithm (GA) • Population based algorithm At each generation, use the solutions in the current population P to • generate At eachoffspring generation three different operators are firstofapplied to generate a P : - solutions to create the population the next generation set of new (offspring) solutions using the N solutions of the current population P: Repeat the following process until N offspring-solutions are generated: Score update:Select ran domly a generation strateg strategy randomly y gs GS :according to its score gs : selection operator: selecting from the current population parent-solutions New best solution Select parent-solu tions in P themselves for applying the generation strategy that reproduce Better solution gs than (reproduction) GSparent-solutions : crossover operator: producing offspring-solutions from each Not previously visited solutions pair of parent-solutions Generate offspring-solutions to be included in the intermediary Worsemutation solution than paren ions (improving) individual offspring-solution modifying population Pt-solut operator: Update the score gs Sc update praocess: culling ope rator) isisapplied toore determine new • A fourth operator operator((culling operator) applied to determine a new population of in P P according solutions at population ofsize sizeNNby byselecting selectingsolutions among the ofobtained the to current i : the score some strategand y the offspring-solutions according to some strategy population the current iteration Then i : i 1 i