Tài liệu giải thuật di truyền

20 88 0
Tài liệu giải thuật di truyền

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

ị nguyên – Tập có thứ tự ký tự • Các kiểu biến dị khác 41 Lai ghép đồng • • • • 42 Lai ghép hay đột biến Gán ‘đầu’ Gá đầu vào ccha, a, ‘đuôi’ đuô vào cchaa khác ác Tung đồng xu cho gene Làm đảo gene cho thứ Sự kế thừa độc lập vị trí – Phụ thuộc vào tốn, tốn – Tốt nên có – Nếu đột biến, tiến hóa – Nếu lai ghép , khơng tiến hóa 43 44 11 7/21/2012 Lai ghép hay đột biến Lai ghép hay đột biến Khám phá: Phát vùng hứa hẹn khơng gian tìm • Chỉ có lai ghép kết hợp thông tin từ hệ cha kiế tứ kiếm, tức lấy lấ đđược thô thông tin ti từ toán t Khai thác: Tối ưu hóa vùng hứa hẹn, tức sử dụng thơng tin • Chỉ có đột biến tạo thơng tin (gene) • lai ghép khơng thay đổi tần suất gene quần thể • Để đạt kết tối ưu, cần chút may mắn phép đột biến Thường kết hợp phương pháp a ghép g ép làà việc v ệc khám phá, p á, nóó làà bước nhảy ảy đế đến miền ề • Lai cá thể bố mẹ • Đột biến việc khai thác, tạo thay đổi nhỏ, gần miền cha 45 Các cách biểu diễn khác 46 Biểu diễn dạng số nguyên Có thể mã hóa biến số trực tiếp dạng: • Mộ Một số ố toán sử ddụng số ố nguyên ê để biể biểu diễ diễn h xử lý ảnh • Một số tốn khác sử dụng giá trị từ tập cố định, vd {blue, green, yellow, pink} • Có thể sử dụng phép tốn lai ghép điểm N điểm • Số nguyên • Các biến dấu phẩy động 47 48 12 7/21/2012 Biểu diễn dạng số thực Chuyển số thực dạng chuỗi bit z ∈ [x,y] ⊆ ℜ chuyển dạng {a1,…,aL} ∈ {0,1}L • VD VD: tốn tối ối ưu tham h sốố dạng d liên liê tc n f: ặ Hm Ackley [x,y] {0,1}L • Hàm Γ: {0,1}L → [x,y] xác định phép biểu diễn Γ( a1 ,, ,, aL ) = x + y − x L−1 ⋅ ( ∑ aL− j ⋅ j ) ∈ [ x, y ] L − j =0 • Chỉ biểu diễn qua 2L giá trị • L định độ xác ca phng phỏp chớnh xỏc cao ặ cỏ thể dài Ỉ hội tụ chậm 49 Phép đột biến dấu phẩy động Đột biến dấu phẩy động Sơ đồ tổng qt • Đột biến khơng nhất: x = x1 , , xl → x ′ = x1′ , , xl′ xi , xi′ ∈ [LBi , UBi ] z – Có nhiều phương pháp, vd thay đổi theo khoảng thời gian – Phần lớn lược đồ xác suất, thường tạo nên thay đổi nhỏ giá trị – Phương pháp thông dụng thêm sai số ngẫu nhiên vào biến,, lấyy giá g trịị dựa ự pphân bố Gaussian N(0, σ) sau rút gọn cho khoảng định – Độ lệch chuẩn σ kiểm soát số thay đổi (2/3 độ lệch khoảng (- σ đến + σ) Đột biến điểm z 50 X’i chọn ngẫu nhiên khoảng [LBi,UBi] 51 52 13 7/21/2012 Lai ghép với số thực Lai ghép theo công thức đơn • Rời rạc – Mỗi NST cá thể z lấy từ cá thể bố mẹ (x y) với xác suất zi = xi or yi (x,y) – Có thể sử dụng n điểm điểm • Liên tục – Tạo “giữa” cha (sử dụng cơng thức tốn học để kết hợp) – zi = α xi + (1 - α) yi với α : ≤ α ≤ 1 – α : • • • Bố mẹ: 〈x1,…,xn 〉 〈y1,…,yn〉 Lấ ngẫu Lấy ẫ nhiên hiê NST k Con thứ • • Con thứ ngược lại VD: α = 0.5 x1 , , xk , α ⋅ yk + (1 − α ) ⋅ xk , , xn • Hằng số • Biến • Lấy ngẫu nhiên lần thực 53 54 Lai ghép theo cơng thức đơn • • Lai ghép tồn theo cơng thức Bố mẹ: 〈x1,…,xn 〉 〈y1,…,yn〉 Lấy ngẫu nhiên NST k Sau điểm này, giá trị x , , x , α ⋅ y + (1 − α ) ⋅ x , , α ⋅ y + (1 − α ) ⋅ x k k +1 k +1 n n • • Con thứ ngược lại VD: α = 0.5 55 • • • Hay dùng Bố mẹ: 〈x1,…,xxn 〉 〈y1,…,yyn〉 Con 1: • • Con thứ ngược lại VD: α = 0.5 a ⋅ x + (1 − a ) ⋅ y 56 14 7/21/2012 Biểu diễn phép hoán vị: VD toán TSP Biểu diễn phép hốn vị • • • Bài tốn p thứ tự ự VD: thuật toán xếp: thành phàn quan trọng xếp trước VD toán người du lịch - Travelling Salesman Problem (TSP) : • Bài tốn: • Có n thành phố • Tìm hành trình với độ dài ngắn • Mã hóa: • Các thành phố 1,2, … , n • đường hồn chỉnh phép h vịị (vd hốn ( d n =4 [1,2,3,4], [1 4] [3,4,2,1] ) • Khơng gian tìm kiếm lớn : 30 thành phố Ỉ 30! ≈ 1032 hành trình 57 Phép đột biến cho hoán vị 58 Đột biến kiểu chèn • Các phép đột biến thông thường đem lại giải pháp vi phạm điều kiện tốn • Cần thay đổi biến • Tham số cho đột biến phản ánh xác suất số thao tác áp dụng cho tồn xâu, thay cho vịị trí 59 • Lấy ngẫu nhiên NST • Chuyển NST thứ theo sau thứ 1, dịch phần lại sang phải • Phép đột biến giữ lại hầu hết trật tự NST thông g tin ự liền kề chúng g 60 15 7/21/2012 Đột biến kiểu đảo Đột biến kiểu trộn • Lấy ngẫu nhiên NST đổi chỗ chúng • Giữ lại hầu hết thơng tin liền kề chúng, phá vỡ trật tự nhiều • Lấy ngẫu nhiên NST đổi chỗ NST nằm chúng • Giữ lại hầu hết thông tin liền kề chúng, phá vỡ trật tự NST 61 Đột biến kiểu ngẫu nhiên 62 Phép lai ghép cho chuỗi hoán vị • “Normal Normal” crossover operators will often lead to inadmissible solutions • Lấy ngẫu nhiên tập NST • Sắp xếp lại cách ngẫu nhiên NST (các tập khơng thiết phải liên tục) t c) 63 12345 12321 54321 54345 • Many specialised operators have been devised which focus on combining order or adjacency information from the two parents64 16 7/21/2012 4| 3| Order crossover 5|example 9| Order crossover • Idea is to preserve relative order that elements occur p • Informal procedure: Choose an arbitrary part from the first parent Copy this part to the first child Copy the numbers that are not in the first part, to the first child: • starting right from cut point of the copied part, • using the order of the second parent • and wrapping around at the end Analogous for the second child, with parent roles reversed • Copy randomly selected set from first parent • Copy C restt from f secondd parentt in i order d 1,9,3,8,2 19382 65 66 4| 3| PMX example 5| 9| Partially Mapped Crossover (PMX) Informal procedure for parents P1 and P2: Choose random segment and copy it from P1 Starting from the first crossover point look for elements in that segment of P2 that have not been copied For each of these i look in the offspring to see what element j has been copied in its place from P1 Place i into the position occupied j in P2, since we know that we will not be putting j there (as is already in offspring) If the place occupied by j in P2 has already been filled in the offspring k, put i in the position occupied by k in P2 Having dealt with the elements from the crossover segment, the rest of the offspring can be filled from P2 Second child is created analogously 67 • Step • Step • Step 68 17 7/21/2012 4| 3| 5| 9| Cycle crossover2 example Cycle crossover Basic idea: Each allele comes from one parent together with its position • Step p 1: identifyy cycles y Informal procedure: Make a cycle of alleles from P1 in the following way (a) Start with the first allele of P1 (b) Look at the allele at the same position in P2 (c) Go to the position with the same allele in P1 (d) Add dd thiss allele a e e too thee cycle cyc e (e) Repeat step b through d until you arrive at the first allele of P1 • Step 2: copy alternate cycles into offspring Put the alleles of the cycle in the first child on the positions they have in the first parent Take next cycle from second parent 69 145932786 Edge Recombination 257891634 • Works by constructing a table listing which edges g are present p in the two parents, p , if an edge is common to both, mark with a + • e.g [1 9] and [9 4] 70 Edge Recombination Informal procedure once edge table is constructed Pick an initial element at random and put it in the offspring Set the variable current element = entry Remove all references to current element from the table Examine list for current element: – If there is a common edge, pick that to be next element – Otherwise pick the entry in the list which itself has the shortest list – Ties are split at random In the case of reaching an empty list: – Examine the other end of the offspring is for extension – Otherwise a new element is chosen at random 71 72 18 7/21/2012 145932786 Edge Recombination 7example 891634 Population Models • SGA uses a Generational model: – each individual survives for exactly one generation – the th entire ti sett off parents t is i replaced l d by b the th offspring ff i • At the other end of the scale are Steady-State models: – one offspring is generated per generation, – one member of population replaced, • Generation Gap – the proportion of the population replaced – 1.0 for GGA, 1/pop_size for SSGA 73 74 Fitness Based Competition Example application of order based GAs: JSSP • Selection can occur in two places: – Selection from current generation to take part in mating (parent selection) – Selection from parents + offspring to go into next generation (survivor selection) • Distinction between selection – operators: define selection probabilities – algorithms: define how probabilities are implemented 75 Precedence ecede ce constrained co st a ed job shop s op scheduling sc edu g problem p ob e • • • • • • J is a set of jobs O is a set of operations M is a set of machines Able ⊆ O × M defines which machines can perform which operations Pre ⊆ O × O defines which operation should precede which Dur : ⊆ O × M → IR defines the duration of o ∈ O on m ∈ M The goal is now to find a schedule that is: • Complete: all jobs are scheduled • Correct: all conditions defined by Able and Pre are satisfied • Optimal: the total duration of the schedule is minimal 76 19 7/21/2012 Precedence constrained job shop scheduling GA • Representation: individuals are permutations of operations • Permutations are decoded to schedules by a decoding procedure – take the first (next) operation from the individual – look up its machine (here we assume there is only one) – assign the earliest possible starting time on this machine, subject to • machine occupation • precedence relations holding for this operation in the schedule created so far • fitness of a permutation is the duration of the corresponding schedule (to be minimized) • use any suitable mutation and crossover • use roulette wheel parent selection on inverse fitness • Generational GA model for survivor selection • use random initialisation 77 20 ... gần miền cha 45 Các cách biểu di n khác 46 Biểu di n dạng số nguyên Có thể mã hóa biến số trực tiếp dạng: • Mộ Một số ố toán sử ddụng số ố nguyên ê để biể biểu di di n h xử lý ảnh • Một số toán... VD: α = 0.5 a ⋅ x + (1 − a ) ⋅ y 56 14 7/21/2012 Biểu di n phép hoán vị: VD toán TSP Biểu di n phép hốn vị • • • Bài tốn p thứ tự ự VD: thuật toán xếp: thành phàn quan trọng xếp trước VD toán... [x,y] {0,1}L • Hàm Γ: {0,1}L → [x,y] xác định phép biểu di n Γ( a1 ,, ,, aL ) = x + y − x L−1 ⋅ ( ∑ aL− j ⋅ j ) ∈ [ x, y ] L − j =0 • Chỉ biểu di n qua 2L giá trị • L định độ xác phng phỏp chớnh

Ngày đăng: 08/05/2019, 11:41

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan