Top Banner

Click here to load reader

of 52

Biologically Inspired Computing: Indirect Encodings, and Hyperheuristics This is DWCs lecture 7 for `Biologically Inspired Computing Contents: direct.

Jan 19, 2018

Download

Documents

Encoding / Representation Maybe the main issue in (applying) EC Note that: Given an optimisation problem to solve, we need to find a way of encoding candidate solutions There can be many very different encodings for the same problem Each way affects the shape of the landscape and the choice of best strategy for climbing that landscape.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Biologically Inspired Computing: Indirect Encodings, and Hyperheuristics This is DWCs lecture 7 for `Biologically Inspired Computing Contents: direct vs indirect encodings / hyperheuristics Encodings (aka representations) Direct vs Indirect Encoding / Representation Maybe the main issue in (applying) EC Note that: Given an optimisation problem to solve, we need to find a way of encoding candidate solutions There can be many very different encodings for the same problem Each way affects the shape of the landscape and the choice of best strategy for climbing that landscape. Direct encoding for exam timetabling 4, 5, 13, 1, 1, 4, 13, 2 Generate any string of 8 numbers between 1 and 16, and we have a timetable! Fitness may be + + etc , and is to be minimised montuewedthur 9:00E4, E5 E2E3, E7 11:00E8 2:00 4:00E1, E6 Exam1 in 4 th slot Exam2 in 5 th slot Etc - Assume 8 exams, E1E slots (mon9am to thur4pm) - fitness function knows the student data i.e. which students take which exams Mutating a directly-encoded timetable 4, 5, 13, 1, 1, 4, 13, 2 montuewedthur 9:00E4, E5 E2E3, E7 11:00E8 2:00 4:00E1, E6 Using straightforward single-gene mutation Choose a random gene Mutating a directly-encoded timetable 4, 5, 13, 9, 1, 4, 13, 2 montuewedthur 9:00 E5 E2E4E3, E7 11:00E8 2:00 4:00E1, E6 Using straightforward single-gene mutation One mutation changes position of one exam Alternative ways to do it This is called a `direct encoding. Note that: A random timetable is likely to have lots of clashes. The EA is likely (?) to spend most of its time crawling through clash-ridden areas of the search space. Is there a better way? An indirect encoding for exam timetabling 4, 5, 13, 1, 1, 4, 13, 2 MonTuewedthur 9:00 11:00 2:00 4:00E1 Use the 4 th clash-free slot for exam1 The encoded solution tells us how to build the timetable step by step E1 is the first one scheduled, so there are no possible clashes 4 th slot is also 4 th clash-free slot An indirect encoding for exam timetabling 4, 5, 13, 1, 1, 4, 13, 2 MonTuewedthur 9:00 11:00 E2 2:00 4:00E1 Use the 5 th clash-free slot for exam2 The encoded solution tells us how to build the timetable step by step Suppose the problem data tells us that E1 and E2 would clash. 5 th clash-free slot is therefore slot 6 Would clash with E2 No clash with E2 An indirect encoding for exam timetabling 4, 5, 13, 1, 1, 4, 13, 2 MonTuewedthur 9:00 E3 11:00 E2 2:00 4:00E1 Use the 13 th clash-free slot for exam3 The encoded solution tells us how to build the timetable step by step Suppose the problem data tells us that E3 has no clashes with E1 or E2, then 13 th clash-free slot is therefore slot 13 An indirect encoding for exam timetabling 4, 5, 13, 1, 1, 4, 13, 2 MonTuewedthur 9:00 E4 E3 11:00 E2 2:00 4:00E1 Use the 1 st clash-free slot for exam4 The encoded solution tells us how to build the timetable step by step Nothing before now in slot 1, so this is Obviously the 1 st clash-free slot An indirect encoding for exam timetabling 4, 5, 13, 1, 1, 4, 13, 2 MonTuewedthur 9:00 E4 E3 11:00 E5E2 2:00 4:00E1 Use the 1 st clash-free slot for exam5 The encoded solution tells us how to build the timetable step by step Suppose E4 and E5 have students in common, so 1 st clash-free slot for E5 is slot 2 An indirect encoding for exam timetabling 4, 5, 13, 1, 1, 4, 13, 2 MonTuewedthur 9:00 E4 E3 11:00 E5E2,E6 2:00 4:00E1 Use the 4 th clash-free slot for exam6 The encoded solution tells us how to build the timetable step by step Suppose E6 would clash with E4 and E1; so 4 th clash-free slot for E6 is slot 6 An indirect encoding for exam timetabling 4, 5, 13, 1, 1, 4, 13, 2 MonTuewedthur 9:00 E4 E3,E7 11:00 E5E2,E6 2:00 4:00E1 Use the 13 th clash-free slot for exam7 The encoded solution tells us how to build the timetable step by step Suppose E7 has no students in common with any other exam, so 13 th slot is 13 th clash-free slot An indirect encoding for exam timetabling 4, 5, 13, 1, 1, 4, 13, 2 MonTuewedthur 9:00 E4 E3,E7 11:0 0 E5E2,E6 2:00 4:00E1,E8 Use the 2 nd clash-free slot for exam8 The encoded solution tells us how to build the timetable step by step Suppose E8 clashes with E4 and E5 but not E1 MonTuewedthur 9:00 E4 E3,E7 11:00 E5E2,E6 2:00 4:00E1,E8 Mutating an indirectly-encoded timetable 4, 5, 13, 1, 1, 4, 13, 2 Using straightforward single-gene mutation Choose a random gene Mutating an indirectly-encoded timetable 4, 5, 13, 9, 1, 4, 13, 2 Using straightforward single-gene mutation One mutation causes considerable change MonTuewedthur 9:00 E5 E6E4E3,E7 11:00 E2 2:00E8 4:00E1 Direct encoding | an indirect encoding 4, 5, 13, 1, 1, 4, 13, 2 MonTuewedthur 9:00 E4 E3,E7 11:00 E5E2,E6 2:00 4:00E1,E8 4, 5, 13, 1, 1, 4, 13, 2 montuewedthur 9:00E4, E5 E2E3, E7 11:00E8 2:00 4:00E1, E6 There are clashes at Mon 9am and Mon 4pm No clashes, and good slot utilisation Direct encoding Indirect encodings The genotype (the data structure that encodes a solution) is basically the same as the Phenotype (the solution). There is a simple and direct mapping between them. This can help with design and understanding of operators and landscapes. You basically know what type of effect a mutation will have, But: often means very bad solutions can be easily generated. Lots of dross to evolve past. The genotype provides the parameters of and/or inputs to an algorithm that builds the Phenotype (the solution). There is a very indirect mapping between them. This means small changes in the genotype could have huge effects on the phenotype, that are difficult to understand in advance But: often means even the initial random solutions are quite good, and the evolution process focusses only on a much smaller search space of good candidates. Hyper-heuristics: a specific type of indirect encoding Indirect encoding: Dont encode a candidate solution directly instead encode parameters/features for a constructive algorithm that builds a candidate solution Hyperheuristic encoding: Usually, this is an encoding where each gene is a constructive algorithm (usually a simple one) which builds one part of the solution In next few slides we will look at examples of the simple heuristics that hyperheuristic encodings use Then we will look at a simple hyperheuristic encoding. HH have been most commonly researched for: bin- packing problems Including 2D bin-packing (also called stock-cutting) given collection of shapes, find how to cut them out of large lamina leaving the minimum possible wastage. Example using First-Fit Ascending (FFA) constructive algorithm for bin-packing FFA FFA means we pack them one by one, Each time taking the smallest unpacked item First-fit Ascending Example using First-Fit Descending First-fit Descending FFA means we pack them one by one, Each time taking the largest unpacked item First-Fit Descending Other bin-packing - heuristics FFA would choose this: Other bin-packing - heuristics FFD would choose this: Other bin-packing - heuristics But, this one fits exactly into the partially full bin, moving it to capacity Other bin packing heuristics FFA - pack smallest remaining into 1 st available bin it will fit in FFD - pack largest remaining into 1 st available bin it will fit in BF - 1. consider all gaps in partially full bins; find an item that exactly fills a gap. 2. If no such item currently available, do FFA BF(2) - 1. consider all gaps in partially full bins; find an item that exactly fills a gap. 2. If no such item, find a pair of items that will together exactly fill a gap. 3. Otherwise, do FFA FFAH(p) - if the number of Huge items remaining is < p%, use FFA, otherwise use BF FFAS(p) - if the number of Small items remaining is < p%, use FFD, otherwise use BF(2) . Etc many other possibilities Huge (item is >= 2/3 of bin capacity) small ( item is < 1/3 of bin capacity) hyper-heuristics is a research area which is based on the idea of using indirect encodings for logistics problems (mainly), where the genotype is (often) a list of heuristics Used for: timetabling, scheduling, bin-packing, stock-cutting, vehicle routing, etc... Note at least two main kinds of indirect encoding that make use of heuristics. Consider timetabling: A. 1, 2, 4, 1, 7, 6 . Use H1 with parameter 1, use H1 with parameter 2, use H1 with parameter 4, use H1 with parameter 1, etc (our indirect encoding for timetabling was like this) B. 1, 2, 4, 1, 7,6 Use H1, then use H2, then use H4, then use H1, (a hyper-heuristic encoding see next 2 slides) and of course there are approaches that mix up styles A and B It gets called a hyper-heuristic approach if there is a strong type B element. Example simple hyper-heuristic encoding for bin packing weights: bin capacity: 5 encoding 1 = FFA, 2 = FFD, 3 = BF, 4 = BF(2) Genotype is a list of 8 heuristic choices each either 1, 2, 3 or 4 Lets interpret: 3,2,4,2,4,1,2,1 Example simple hyper-heuristic encoding for bin packing weights: bin capacity: 5 encoding 1 = FFA, 2 = FFD, 3 = BF, 4 = BF(2) Genotype is a list of 7 heuristic choices, (why 7 ?), each either 1, 2, 3 or 4 Lets interpret: 3,2,4,2,4,1,2,1 pack first item with BF 0.5 Example simple hyper-heuristic encoding for bin packing weights: bin capacity: 5 encoding 1 = FFA, 2 = FFD, 3 = BF, 4 = BF(2) Genotype is a list of 7 heuristic choices, (why 7 ?), each either 1, 2, 3 or 4 Lets interpret: 3,2,4,2,4,1,2,1 pack next item with FFD 5 Example simple hyper-heuristic encoding for bin packing weights: bin capacity: 5 encoding 1 = FFA, 2 = FFD, 3 = BF, 4 = BF(2) Genotype is a list of 7 heuristic choices, (why 7 ?), each either 1, 2, 3 or 4 Lets interpret: 3,2,4,2,4,1,2,1 pack next item(s) with BF(2) 55 Example simple hyper-heuristic encoding for bin packing weights: bin capacity: 5 encoding 1 = FFA, 2 = FFD, 3 = BF, 4 = BF(2) Genotype is a list of 7 heuristic choices, (why 7 ?), each either 1, 2, 3 or 4 Lets interpret: 3,2,4,2,4,1,2,1 pack next item with FFD 55 4 Example simple hyper-heuristic encoding for bin packing weights: bin capacity: 5 encoding 1 = FFA, 2 = FFD, 3 = BF, 4 = BF(2) Genotype is a list of 7 heuristic choices, (why 7 ?), each either 1, 2, 3 or 4 Lets interpret: 3,2,4,2,4,1,2,1 pack next item(s) with BF(2) 55 5 Example simple hyper-heuristic encoding for bin packing weights: bin capacity: 5 encoding 1 = FFA, 2 = FFD, 3 = BF, 4 = BF(2) Genotype is a list of 7 heuristic choices, (why 7 ?), each either 1, 2, 3 or 4 Lets interpret: 3,2,4,2,4,1,2,1 pack next item(s) with FFA Example simple hyper-heuristic encoding for bin packing weights: bin capacity: 5 encoding 1 = FFA, 2 = FFD, 3 = BF, 4 = BF(2) Genotype is a list of 7 heuristic choices, (why 7 ?), each either 1, 2, 3 or 4 Lets interpret: 3,2,4,2,4,1,2,1 only one item left, use FFD 55 55 The original HH paper: open-shop scheduling Hsiao-Lan Fang, Peter Ross, David Corne. "A promising hybrid GA/heuristic approach for open-shop scheduling problems." In Proc. 11 th European Conf. on Artificial Intelligence, List of choices of these heuristics: Notes: constructive algorithms Each heuristic we have seen is a simple constructive algorithm it performs the next step in constructing a solution to the problem There are many constructive heuristics for bin packing, timetabling, scheduling, etc.... often called dispatch heuristics There are well-known constructive heuristics for many other problems, e.g. Prims algorithm for building the minimal spanning tree (see an earlier lecture), Djikstras shortest path algorithm for networks, etc Suitably engineered, Prims algorithm can be used as part of an indirect encoding for solving hard constrained spanning-tree problems --- similar for Djikstras algorithm and network-path problems. And so on Direct vs Indirect Encodings: summary & other notes Direct: straightforward genotype (encoding) phenotype (actual solution) mapping Easy to estimate effects of mutation Fast interpretation of chromosome (hence speedier fitness evlaluation) Indirect/Hybrid: Easier to exploit domain knowledge (e.g. use this in the constructive heuristic) Hence, possible to `encode away undesirable features Hence, can seriously cut down the size of the search space But, interpretation of genotype could become computationally expensive Neighbourhoods tend to be highly rugged. tradeoff between size of search space and ruggedness - sensible engineering of the indirect encoding often beats the direct - however, direct encodings with smarts built-in to the operators can be the best choice thats for further reading or an advanced module Mandatory reading slides for - Operators (typical mutation and crossover operators for different types of encoding) - Selection (various standard selection methods) - More encodings