• 沒有找到結果。

題目: 以基因演算法求解雙酶切問題

N/A
N/A
Protected

Academic year: 2022

Share "題目: 以基因演算法求解雙酶切問題 "

Copied!
60
0
0

加載中.... (立即查看全文)

全文

(1)

中 華 大 學 碩 士 論 文

題目: 以基因演算法求解雙酶切問題

A Genetic Algorithm for the Double Digest Problem

系 所 別 : 資訊工程研究所

學 號 姓 名 : E08902002 易 聲 宏 指 導 教 授 : 侯 玉 松 博 士

中 華 民 國 九 十 二 年 一 月

(2)

以基因演算法求解雙酶切問題

研究生:易聲宏 指導教授:侯玉松 博士 中華大學資訊工程研究所

摘 要

在生物資訊研究領域中,雙酶切問題(Double Digest Problem, DDP)是 實踐「限制輿圖」 (restriction mapping)法所要解決的重要問題。在文獻中 指出,雙酶切問題是 NP-難(NP-hard)問題,尚未發展出多項式時間之演算 法解決這個問題。在本論文中,我們將設計基因演算法(genetic algorithm) 求解雙酶切問題,並開發電腦程式,檢討其執行成效,並提出加快計算速 度之建議。

(3)

A Genetic Algorithm for the Double Digest Problem

Student:Sheng-Hung Yi Advisor:Dr. Y.S. Hou Institute of Computer Science and Information Engineering

Chung Hua University

ABSTRACT

In the field of computational biology, Double Digest Problem(DDP) is an important issue of reconstructing the restriction maps of DNA sequences. DDP has been proven to be NP-hard, and no algorithm with polynomial time complexity was developed.

This thesis presents a new approach to solve DDP using a genetic algorithm. At the end of thesis, we evaluated its performance and offered some suggestions to speed up computation.

(4)

iii

誌 謝

本論文能順利完成,皆蒙指導教授侯玉松老師之諄諄教誨與悉心 指導,由於侯老師無比的愛心與耐心,使本論文自孕育之初,乃至方 向的確立、研究的過程、撰寫定稿,皆受益匪淺;每當研究期間遭逢 挫折難題,老師總是不厭其煩地予以指正與鼓勵,終能撥雲見日、豁 然開朗。於此編寫誌謝之際,深感師恩昊大,內心充滿無限之謝意與 敬意。

此外要感謝資工所諸位師長,願意犧牲假日在週末時間授課。尤 其要感謝吳哲賢老師,不論公事私事,吳老師都不吝耗費時間在學生 身上,在此特別致謝。最後要感謝王裕國同學,沒有您的鞭策與鼓勵,

這篇論文無法如期完成。

謹以此篇論文獻給所有關心我的人。

(5)

目 錄

摘 要 ...i

ABSTRACT ...ii

致 謝 ...ii

目 錄 ...iiv

圖 表 ...vi

第一章 簡介 ...1

1-1 概要 ...1

1-2 實體輿圖的繪製方法 ...2

1-3 雙酶切問題 ...3

第二章 文獻回顧 ...5

第三章 雙酶切問題之基因演算法設計 ...7

3-1 基因演算法概述 ...7

3-2 雙酶切問題的基因演算法 ...9

3-2-1 向量表示方式...9

3-2-2 適應函數... 11

3-2-3 染色體互換...13

3-2-4 基因突變...14

第四章 程式設計 ...15

4-1 改良 GA 演算法 ...15

4-2 選擇配種代表 ...16

4-3 加速優化人口適應力 ...17

4-4 演化停滯 ...18

(6)

4-4-1 同值異形染色體向量...18

4-4-2 處理演化停滯問題...19

4-5 最佳解、完美解與正解 ...19

4-6 程式參數 ...20

4-7 系統開發環境 ...20

4-8 程式流程 ...21

第五章 結果與討論 ...22

5-1 程式執行結果 ...22

5-1-1 實驗數據...22

5-1-2 實驗方法...23

5-1-3 結果...24

5-2 結論 ...24

5-2-1 以 GA 求解 DDP 的可行性...24

5-2-2 執行效能...25

5-3 討論 ...25

5-3-1 加速演化的動力...25

5-3-2 育種的效果...26

第六章 建議 ...27

6-1 計算大量人口的分散式系統 ...27

6-2 育種式的分散式系統 ...29

參考文獻 ...31

附錄一 ...34

附錄二 ...35

附錄三 ...36

(7)

圖 表

表一:程式自訂參數列表...20

表二:程式執行結果...24

表三:育種與無育種之效果比較...26

1 : 雙酶切問題 三個試瓶內的 DNA 小片段長度資訊 ...3

2 : 滿足限制酶 A、B、A+B 所切割之小片段長度資料的排列方式之一 ....4

3 : 基因演算法示意圖 ...8

4:基因演算法的一般程序 ...8

5:與圖 2 相似的小片段排列 ... 11

6:改良後的基因演算法程序 ...16

7:俄羅斯輪盤選擇法程序 ...16

8:俄羅斯輪盤選擇法 ...17

9:程式流程圖 ...21

10:雙酶切實驗數據 ...23

11:實驗程序...23

12:計算大量人口的分散式系統主行程的虛擬程式碼 ...28

13:計算大量人口的分散式系統僕行程的虛擬程式碼 ...28

14:育種式的分散式系統示意圖 ...29

15:育種式的分散式系統主行程的虛擬程式碼 ...30

16:育種式的分散式系統僕行程的虛擬程式碼 ...31

(8)

第一章 簡介

1-1 概要

அӰ(Gene)࢐ؚۡᒸ༈੫኉ޟஅҏ൐՝Ȃҥў੊ਯᗞਯሖ(DNA)ᄺԙȄӵҡ ސжࣨϛȂᙏ൐ޟԃ੾ࢳȂፒᚕޟԃΡ᜸Ȃ഍࢐оѲᆍਯҠሖȂϷտҢѲএԅҔ ȞAȃTȃCȃGȟޟ஝ጆלԒфߒȂ஠ᒸ༈ଉ਀ᓽԆӵߝᜦ DNA ϷυϛȂ࡚ᄺ Οҡڼ༹ફޟᙢყȄծ࢐೻ӋҡڼᙢყፒᚕᛁσȂᜲо၌᠞ȄоΡ᜸࣏ٽȂ൷Ԥ 30 ቇᄇਯҠሖȂѓ֤घԤ 3 ࿲Ս 10 ࿲এஅӰ[17]Ȅ

ӵϷυҡސᏰۦҐี৤оࠉȂᒸ༈Ᏸড়оᖅ෥ᄂᡛंـஅӰϞ໢ޟᜰᖒȂᛲ ᇧюஅӰޟ೿ᚇᗖყ(linkage map)Ȅڏন౩࢐ٷᐃӣΙࢗՓᡝΰޟஅӰȂष܄Ԫ ޟ՝ညࣺߖȂ٥ቄಠफ໌՗෵ኵϷນלԙᆠυᇄ֊υਢȂӵࢗՓᡝ܄ԪҺ඲ޟႆ

แϛȂࣺߖޟஅӰϷ໠ޟޟᐠ౥࡞ճȄІϞȂष࢐ΠএஅӰຽᚔልሉȂϷນޟᐠ

ོ൷࡞σȄငҥσ໔ᖅ෥ᄂᡛȂᢎᄆኵ̈এжфޟড়ఊفᜊᒸ༈੫኉ȂၼҢಛॎ

ޟПݲ൷џоᘪઽюஅӰϞ໢ޟຽᚔᜰ߽ȂᛲᇧюஅӰ೿ᚇᗖყȄኞਲ਼(T.H.

Morgan)้Ρ։࢐ցҢ೿ᚇޟݲࠌȂᛲᇧюݎᜁޟஅӰ೿ᚇᗖყȄծ࢐೻ᆍПݲ

҆໸ငႆᖅ෥ᄂᡛȂϚᎌҢܻΡ᜸ȄՄиσഋϷΡ᜸ড়৳ޟΡοኵ഍ЊЍȂζฒ ݲ౰ҡٗஊޟಛॎኺҏհᘪઽϷݙȄདौоஅӰ೿ᚇᗖყПԒ၌᠞ᐌএҡڼᙢ ყȂߨல֨ᜲȄ

ᓍ๿ऋ׬ޟ໌৤ȂऋᏰড়໠ีюӻᆍ׬೚Ȃџоޢ௥ᐇհ DNAȄٽԃ३ڙ 酶(restriction enzyme)џоϸᘞߝᜦ DNA ޟ੫ۡޟ՝ညȂٺϞԙ࣏ DNA аࢲȄ Ⴋݨݲ(gel-electrophoresis)џ໔ก DNA аࢲߝ࡙Ȅᆹӫ酶೿ᚇІᔖ(polymerase chain reaction, PCR)ȂցҢ DNA ޟӫԙሕશ໌՗டΙܒޟ೿ᚇፒᇧȂџо஠Ι ࢲDNA ፒᇧ࣏নپޟΙԻቇՍΙνቇॻȄ᏿Ԥ೻᜸ώڎࡣȂϷυҡސᏰড়໠ۖ

(9)

კၐ௃Ϸυ઻ཌᢎޟُ࡙၌᠞ҡڼᙢყȂᛲᇧᄂᡝᗖყ(physical map)Ȃ஠அӰޟ ܚӵ՝ညᆠጂӴජक़юپȄ

1-2 實體輿圖的繪製方法

ӵҡސၥଉंـሴ୿ϛȂᄂᡝᗖყ(physical mapping)୰ᚠ࢐ବᄇΙࢲ DNA аࢲȂौײюѺӵஅӰᡝ(genome)ϛܚ৴ဣޟ՝ညȄҬࠉᄂᡝᗖყ୰ᚠޟ၌ؚП ݲ Ȃ к ौ Ԥ ڍ ᆍ Ȉ Ι ࢐ ३ ڙ ᗖ ყ(restriction mapping) ݲ Ȃ Ѫ Ι࢐ᚕ Һ ᗖ ყ (hybridization mapping)ݲ[6]Ȅ

३ڙᗖყݲ࢐ցҢ३ڙ酶(restriction enzyme)ོӵ੫ۡ௶Ӗޟᢃஅ՝ညΰϸ

໠ߝᜦ DNA ޟ੫ܒȂᙤҥۡ՝ю೻ٲ੫ۡޟϸᘈ(sites)ȂऋᏰড়ঈுоᛲᇧю ᐌࢲDNA ޟᄂᡝᗖყȄ1973[9]Ρ᜸ᇧюޟ಑ΙӋᄂᡝᗖყȈ੾ࢳ SV40Ȃ൷࢐

ցҢ३ڙ酶HindII ོϸ໠ DNA ΰޟ GTGCAC ᇄ GTTAAC ΠᆍਯҠሖוӖޟ੫ ܒȂо३ڙᗖყݲᛲᇧՄԙȄӵᄂሬᔖҢΰȂϷݙDNA וӖȃᛲᇧஅӰಢޟђ

૖ყᜊȃंـ DNA ޟฒܒᖅ෥ȃᄺ࡚அӰМ৲(gene library)ᇄஅӰࡾ઴(gene fingerprint)้ώհȂ࡚ҳ३ڙ酶ᗖყ഍࢐ϚџીЍޟᕗ࿽Ȅ

ᚕҺᗖყݲ࢐оߝ࡙ 8~30 এਯҠሖȂϐۡוޟ฻ DNA аࢲ࿋հ௤ବ (probe)Ȃ஠ڏᇄٱӑՌᚖ޶Ϸᚔ࣏൐޶ޟ࡟กၐ DNA ౅ӫȄӰ࣏ሖҠሖԤ A-T, C-G Ռଢ଼଩ᄇޟ੫ܒȂ࿋ DNA аࢲϛԤᇄ௤ବϣ၄(complementary)ޟਯҠሖו ӖȂ௤ବོᇄϞ೿๖Ȃᆎ࣏ᚕҺ(hybridize)Ȅٽԃ௤ବ ACCGTGGA ོᇄ DNA а

CCCTGGCACCTA ᚕҺȂӰڏளԤᇄ௤ବϣ၄ޟਯҠሖוӖ TGGCACCTȄϷ

ݙ௤ବᇄDNA аࢲޟᚕҺ௑ݷȂ൷џоᛲᇧ၎ DNA аࢲޟᄂᡝᗖყȄष஠ӻ এ௤ବ௶ӖӵஅݖΰȂџоΙԩ୎กኵএ੫ۡਯҠሖוӖȂᆎ࣏DNA වа(DNA Chip)ȄҡϽᏰড়லҢޟࠒПᚕҺݲ(Southern hybridization)[4]։࢐ᚕҺᗖყݲޟ

(10)

ᔖҢȄ

1-3 雙酶切問題

ӵ३ڙᗖყݲϛȂԤΙᆍ׬೚࢐஠ငႆσ໔պ໪(cloning)ޟ DNA аࢲϷ၆ ΣέЛၐ౭ȂցҢڍᆍϚӣޟ३ڙ酶ϷտᅎΣ಑Ιᇄ಑ΠЛၐ౭Ȃ஠ၐ౭ϱޟ DNA ϸസԙωаࢲȄӔ஠ڍᆍ३ڙ酶౅ӫᅎΣ಑έЛၐ౭ȂᡱڏӣਢհҢȄ಑

έЛၐ౭ϱޟDNA Ӱڧڗڍᆍ३ڙ酶ੑϽȂོೝϸு؁ಠȄᓗညΙࢲਢ໢Ȃጂ

߳३ڙ酶ޟੑϽႆแϐӒഋׇԙȂӔоႫݨݲϷտ଄ᓃέএၐ౭ϱޟωаࢲޟߝ

࡙ȄցҢ೻ٲߝ࡙ၥਟȂ१ಢೝ३ڙ酶ੑϽޟӨএωаࢲޟ௶ӖԩוȂԪ։ᚖ酶 ϸ୰ᚠ(double digest problemȂᙏᆎ DDP)ȄоٽΙᇳ݂Ȉ

ٽΙȈ୅೩࢚DNA аࢲȂٺҢ३ڙ酶 A ёоϸസȂџுڗ 4 ಢωаࢲȂڏߝ࡙

Ϸտ࣏3ȃ5ȃ8ȃ9ȇٺҢ३ڙ酶 B ёоϸസȂһџுڗ 4 ಢωаࢲȂڏߝ࡙Ϸ տ࣏ 3ȃ4ȃ7ȃ11ȇӣਢٺҢ३ڙ酶 A ᇄ B ёоϸസȂџоுڗ 7 ಢωаࢲȂ ڏߝ࡙Ϸտ࣏2ȃ3ȃ3ȃ4ȃ4ȃ4ȃ5Ȅԃყ 1 ܚҰȄ

ყ1Ȉᚖ酶ϸ୰ᚠέএၐ౭ϱޟ DNA ωаࢲߝ࡙ၥଉ

(11)

ցҢΰक़ϞӨၐᆓϱ DNA ωаࢲߝ࡙ၥଉȂϷտᄇ३ڙ酶 A ᇄ B ܚϸസ ޟ4 ᆍωаࢲୈ௶ӖȂٺڏ֛ӫӣਢٺҢ३ڙ酶 A ᇄ B ܚϸസޟ 7 ಢωаࢲޟ ߝ࡙Ȃڏ၌ٮϚ୲ΙȂԃყ2 ։࣏ΙᆍᅖٗనӇޟ௶ӖПԒȄ

ყ2Ȉᅖٗ३ڙ酶 AȃBȃAɮB ܚϸസϞωаࢲߝ࡙ၥਟޟ௶ӖПԒϞΙ

ᜰܻDDP ޟंـМᝦϛȂGoldstein ᇄ Waterman ӵ[10]ϛϐᜌ݂ DDP ࢐ NP-

ᜲ(NP-hard)୰ᚠȂܚоҬࠉۦҐี৤юӻ໶Ԓਢ໢Ϟᅋᆗݲ၌ؚ೻এ୰ᚠȄҏ

፣Мᔣ௴ҢஅӰᅋᆗݲ(genetic algorithmȂᙏᆎ GA)ПԒپ၌ DDPȂڥڏܾܻϷ ඹԒ೎౩ޟᓺᘈȄٮӵএΡႫသΰี৤แԒȂᄂሬຟեڏஈ՗ਝ૖Ȅ

ҏМӵ಑Πണӱ៫DDP ޟ၌ݲȂ಑έണ஠ϭಝ DDP ޟ GA ޟ೩ॎ྅܈Ȃ಑

ѲണϭಝแԒ೩ॎ१ᘈȂ಑Ϥണᔮଆڏஈ՗ਝ૖Ȃ಑ϲണඪю׽๡࡚ដȄ

(12)

第二章 文獻回顧

Ռ1970 ԑ[5] Hamilton Smith ี౪३ڙ酶ࡣȂоᚖ酶ϸ(double digest)ᛲᇧ३ ڙ酶ᗖყԙ࣏ҡϽᄂᡛࡉலҢޟ׬೚ϞΙȄծᚖ酶ϸ୰ᚠ੫ԤޟፒᚕܒΙޢ֨ᘙ

๿ҡϽᏰড়Ȅоᅋᆗݲُ࡙پࣼȂDDP ਢ໢ፒᚕ࡙࣏ O(n!2)Ȃॎᆗ໔ོᓍ๿а ࢲኵ໔ቨёՄ֕ࡾኵԙߝȄо[14]࣏ٽȂ

ٽΠȈ ୅೩࢚ DNA аࢲȂٺҢ३ڙ酶 A ёоϸസȂџுڗ 16 ಢωаࢲȂ Ϸտ࣏{1, 1, 3, 3, 3, 3, 4, 4, 5, 6, 7, 19, 21, 23, 23, 24}ȇٺҢ३ڙ酶 B ёоϸസȂһџுڗ16 ಢωаࢲȂڏߝ࡙Ϸտ{1, 1, 1, 2, 2, 4, 4, 5, 9, 9, 9, 15, 15, 19, 19, 35}ȇӣਢٺҢ३ڙ酶 A ᇄ B ёоϸസȂџоு

ڗ31 ಢωаࢲȂڏߝ࡙Ϸտ࣏{1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 6, 7, 8, 9, 9, 9, 10, 10, 15, 23}Ȅषоጏᖞݲؑ၌ȂӓԤ (16!×16!)ʝ(2!7×3!2×4!)=3.96×1021ᆍ௶ӖȄ

Ԟӵ1987[10]Ᏸޱ൷ϐᜌ݂ DDP ࢐ NP-Hard ୰ᚠȄᐣԑپϐԤ೨ӻᏰޱඪ ю ӻ ᆍ ᅋ ᆗ ݲ ؑ ၌ DDP Ȅ ٽ ԃ Ԟ ෈ ޟ ጏ ᖞ ݲ [18] ȃ ዁ ᔣ ଝ Ь ݲ (simulated annealing)[10,1] ȃаࢲШᄇݲ(fragment matching)[20,12,16]ᇄΡώසኋ [13] Ȅ W. Schmitt ᇄ Waterman ඪ ю о њ ֈ Һ ඲ (cassette exchange) ᇄ њ ֈ І ৢ (cassette reflection) [19] ௰Ᏺ DDP ޟӻ१၌ (multiple solutions) Ȅ1994 छ୽डᏇ σᏰᚂᏰ଱໠ีюৈ၆แԒ ”Double Digester” [11]ȂᐌӫᄂᡛኵᐃᒯΣȃᅋᆗݲ

ॎᆗᇄᛲყ้ђ૖ȂП߯ҡϽᏰড়ᛲᇧ३ڙ酶ᗖყȄߖέԑپࠌԤ Ming-Yang Kao ้έΡඪю Enhanced Double Digest Problem [15]Ȃӵ੫ۡనӇήȂџ஠ DDP Ͻᙏ࣏ਢ໢ፒᚕ࡙࣏ጣܒӻ໶Ԓޟ୰ᚠȄYin Zhang ้ΠΡඪюо౅ӫᐌኵጣܒ

ೣგ (mixed-integer linear programming)[22]ȂԤਝ౥Ӵ೎౩σ໔аࢲޟᚖ酶ϸ୰

(13)

ᚠȄ

ҏМඪюѪѴΙᆍПԒؑ၌ DDPȂ։அӰᅋᆗݲ(Genetic Algorithm, ᙏᆎ GA)Ȃ஠ӵ಑έണ၏क़ϞȄ

(14)

第三章 雙酶切問題之基因演算法設計

3-1 基因演算法概述

அӰᅋᆗݲ࢐John Holland ܻ 1975 ԑॶӑඪю[3,7]ȄGA ࢐ശٹϽཪ൶ᐠ ڙϞΙȂ೻࢐ΙᆍӒ୿ᓍᐠ൶ᓺᅋᆗݲȂѺ዁ҽҡސ໌ϽޟႆแȂоȶᓺഽӛఁȷ ޟনࠌپᓺϽ၌๎Ȃംᅚؑுശٹ၌ȄGA џоӵ࡞σޟ၌໱ӫު໢ϛȂפഀཪ

൶юശٹ၌Ȅ࡞ӻޟंـϐငᜌ݂ΟGA ӵώแᔖҢᇄശٹϽޟԤਝܒȄᇄ༈ಛ ኵ঄Пݲޟ൐ᘈᐿҳཪ൶ПԒШၶଔپȂஅӰᅋᆗݲޟӻᘈཪ൶ٮҺ඲ၥଉޟ੫ ܒȂڎരҁ՗ϽၼᆗޟዖΨȂ࡞ᎌӫҢܻפഀؑ၌DDPȄ

GA ޟώհন౩࢐அܻႀᅭМޟ໌Ͻ፣ᏰᇳȂоᐠడПݲ዁ᔣ໌Ͻ౩፣Ȅॶ ӑӵ၌໱ӫު໢ϛᓍᐠࢅᒵюኵএ၌Ȃୈ࣏ߑۖΡο(initial population)ȂӔആႆ

ᎌ࿋ޟᎌᔖڒኵ(fitness function)ᄇܚԤএᡝ (individual)ȂϷտॎᆗڏᎌᔖ࡙Ȃ ёᖂܚԤএᡝޟᎌᔖ࡙ȂӔϷտॎᆗএտএᡝᎌᔖ࡙঄ћӒഋΡοᖂᎌᔖ࡙ᖂڷ ޟШٽȂ࿋հೝᒵᐅ࣏଩ᆍфߒޟᐠ౥Ȅณࡣਲ਼ᐃԪᐠ౥ϷշȂӵܚԤএᡝϛᒵ ю଩ᆍфߒȂցҢࢗՓᡝϣ඲(crossover)ᇄएᡐ(mutation)้ᒸ༈ၼհ(genetic operator)౰ҡཱིҡф(new generations)Ȅٮ௃଩ᆍфߒоѴޟএᡝϛȂоཱིҡфᓍ ᐠڥфϞȂо౰ҡ಑ΠфΡοȄԃԪ໊ՄඈۖȂӔ౰ҡ಑έфȃ಑Ѳф…ȂࠌΡ οޟᎌᔖ࡙஠ོംᅚඪଽȂശࡣ஠౰ҡശᓺؾࠢᆍȂ։ശٹ၌Ȅყ3 ࣏ΰक़ႆแ ҰཎყȄ

(15)

ყ3ȈஅӰᅋᆗݲҰཎყ

ყ4[2]஠ΰक़Ϟ GA ώհন౩оᅋᆗݲПԒߒҰȂᢎ܈؁ё఼ཿȄ 1. Choose a population size.

2. Choose the number of generations NG.

3. Initialize the population and record the fitness of each individual.

4. Repeat the following for NG generations:

4.1 Select a given number pairs of individuals from the

population probabilistically after assigning each structure a probability proportional to observed performance.

4.2 Copy the selected individuals, then apply genetic operators (crossover and mutation) to them to produce new individuals.

4.3 Select other individuals at random and replace them with the new individuals.

4.4 Observe and record the fitness of the new individuals.

5. Output the fittest individual as the answer.

ყ4ȈஅӰᅋᆗݲޟΙૡแו

(16)

3-2 雙酶切問題的基因演算法

೩ॎGA ޟкौՃኌӰશ࣏Ȉө໔ߒҰПԒ(vector representation)ȃᎌᔖڒ ኵޟ೩ॎȃࢗՓᡝϣ඲ޟПԒȃоЅஅӰएᡐޟПԒȄоή൷೻Ѳ໶ӰશϷक़ԃ ήȈ

3-2-1 向量表示方式

௃಑1.3 ω࿽џޣȂᚖ酶ϸ୰ᚠ։࢐ؑ३ڙ酶 A ܚϸസޟωаࢲȂᇄ३ڙ酶 B ܚϸസޟωаࢲޟᎌ࿋௶ӖȂٺு૖֛ӫ A ᇄ B ӓӣϸസޟωаࢲߝ࡙ၥਟȄ ܚоȂ३ڙ酶A ܚϸസޟωаࢲȂᇄ३ڙ酶 B ܚϸസޟωаࢲޟӈཎ௶ӖȂ֯

࣏DDP Ϟџ૖၌Ȅ

ԃդ஠௶ӖߒҰ࣏ө໔ȉӵႆўGA Мᝦϛ଄ၷȂ೨ӻᏰޱෆंـȶਡ՗௰

᎛ষ୰ᚠȷ(traveling salesman problemȂᙏᆎ TSP)Ȃ։७ᖝԃդ஠௶ӖߒҰ࣏ө ໔ޟ୰ᚠȂӵМᝦ[23]ϛϷ࣏έ᜸Ȉၯ৷ߒҰݲ(path representation) ȃ᎑ߖߒҰ ݲ(adjacency representation)ȃоЅוኵߒҰݲ(ordinal representation)Ȅ

ၯ৷ߒҰݲ࢐ӑ஠TSP ყלޟؐΙএ࿽ᘈ(node)ጡဴȂө໔ϛޟϯશ঄фߒ Ιএ࿽ᘈȂٷוӖюө໔ϛޟϯશȂ։фߒࡶ೤ၯ৷Ȃ೻࢐ശޢឈޟߒҰݲȄ᎑

ߖߒҰݲ࢐஠ؐΙএө໔ϯશ՝ညᇄ঄ޟಢӫфߒTSP ყלޟΙএ᜞(edge)Ȃٽ ԃष಑j এϯશ՝ညޟ঄࣏ kȂфߒ edge (j,k)ѓ֤ܻࡶ೤ၯ৷ϞϛȄוኵߒҰݲ

୅೩1ȃ2ȃ…ȃn ौୈ௶ӖȂӑ೩ۡΙএஅᙃ௶ӖȂ೽ல࢐(1 2 … n)Ȃᄇ 1ȃ2ȃ…ȃ n ޟӈཎ௶ӖՄِȂ։џٺҢΙএ n ᆰө໔ߒҰȂө໔ϛޟ಑ i এϯશ঄ϭܻ 1 ڗn – i + 1 Ϟ໢ȂߒҰ၎௶Ӗޟ಑ i এኵԅȂӵஅᙃ௶Ӗޟ഻Ꮇኵԅϛޟ಑ඁ՝Ȅ ڏϛޟוኵߒҰݲܾܻᄂհࢗՓᡝϣ඲ᇄएᡐȂܚоרঈ௴ڥ೻ᆍߒҰݲȂڏ၏

ಠᇳ݂ԃٽέȈ

(17)

ٽέȈ୅೩n = 5Ȃࠌஅᙃ௶Ӗ S = (1 2 3 4 5)Ȅᄇ௶Ӗ(1 2 5 3 4)ՄِȂџоߒҰ

࣏ө໔(1 1 3 1 1)ȂॶӑȂӰ࣏௶Ӗ(1 2 5 3 4)ޟ಑Ιএኵԅ࢐ 1Ȃ࢐ S ϛ಑Ι՝Ȃ ܚоө໔ޟ಑Ιϯશ࣏1Ȅ௶Ӗ(1 2 5 3 4)ޟ಑Πএኵԅ࢐ 2Ȃ࢐ S ўଶ 1 Ϟࡣޟ

഻Ꮇኵԅ௶Ӗޟ಑Ι՝Ȃܚоө໔ޟ಑Πϯશ࣏1Ȅӣ౩Ȃ5 ࢐ S Ϟ഻Ꮇኵԅޟ

಑έ՝Ȃܚоө໔ޟ಑έϯશ࢐3ȄᎷ᜸௰Ȅ

וኵߒҰݲޟᓺᘈ࢐ܾܻࢗՓᡝϣ඲Ȃѫौ஠ڍএஅӰޟࡣࢲוӖޢ௥Һ඲

։џȄծ࢐ڏીᘈ࣏ڍஅӰޟࠉࢲוӖۖತϚᡐȂᄇᔖޟ౪ຫ࢐௶Ӗޟࠉࢲኵԅ ЅԩוۖತϚᡐȂԃݎࠉࢲኵԅЅԩוᇄџ՗၌ޟ௶ӖϚಒȂࠌ஠ฒݲആႆࢗՓ ᡝϣ඲౰ҡџ՗၌ޟ௶ӖȂ஠Ᏺमॎᆗਢ໢۽᰹Ȃӵ[23]ϛ଄ၷȂԃݎਡ՗௰᎛

ষ୰ᚠٺҢוኵߒҰݲ೩ॎGAȂڏॎᆗਝ૖ϚٹȄ

࣏Ο׽໌೻໶ીᘈȂቨ໌அӰࠉࢲוӖޟᓍᐠܒȂרঈ௃ቨёஅᙃ௶Ӗኵ๿

ЙȂᘗшஅᙃ௶Ӗ࣏அᙃ௶Ӗ໱ӫS’Ȉ

ᘗш࣏அᙃ௶Ӗ໱ӫϞࡣȂࢗՓᡝө໔(chromosome vector)ሯቨёΙএஅᙃ

୤ኵȂߒҰԪө໔ܚ୤Ճޟஅᙃ௶Ӗ࢐SiȄоٽѲᇳ݂Ȉ

例四:୅೩S’ = {(1 2 3 4 5)ȃ(2 3 4 5 1)ȃ(3 4 5 1 2)ȃ(4 5 1 2 3)ȃ(5 1 2 3 4)}Ȃࠌ ө໔(1 1 3 1 1)ӵஅᙃ୤ኵ = 1 ਢȂфߒ௶Ӗ(1 2 5 3 4)ȇӵஅᙃ୤ኵ = 3 ਢȂф ߒ௶Ӗ(3 4 2 5 1)Ȅ

ܚоӵࢗՓᡝө໔џϷ࣏ڍഋϷȈוኵө໔ᇄஅᙃ୤ኵȂҏМ஠Ԫᆍө໔ߒ Ұݲᆎ࣏ȶᘗш࠮וဴߒҰݲȷ(extended ordinal representation)Ȅ࣏ቨёஅӰࠉ

{ 1 , , } ( 1 1 2 1 )

' = S i = n S = i i + n i

S

i

K 此處

i

K K

(18)

ࢲוӖޟᓍᐠܒȂӵୈࢗՓᡝϣ඲ਢȂଶΟוኵө໔ޟࡣࢲϣ඲ѴȂӔՃኌࢗՓ ᡝө໔ޟஅᙃ୤ኵ࢐֏Һ඲ȂڏҺ඲ᐠ౥࣏pȂζ࢐ҏ፣Мกᡛџ፡ᐌޟ୤ኵȄ

ࢗՓᡝϣ඲ޟڏтഋϷӵ಑3-2-3 ω࿽ϛӔक़Ȅ

3-2-2 適應函數

ӵМᝦ[14]ޟ DDP ዁ᔣଝЬᅋᆗݲϛȂڏ૖໔ڒኵ(energy function)࢐ਲ਼ᐃ ȶ᜸խњПྥࠌȷ(chi-square-like criteria)پ೩ॎȂӑ஠዁ᔣଝЬᅋᆗݲܚ౰ҡϞ ३ڙ酶A ᇄ B ӓӣϸസޟ DNA ωаࢲߝ࡙Ȃ௃ωڗσ௶וȂ࣏ c1’ȃc2’ȃȃ ct’ȂӔᇄ DDP Ҭ኿ DNA ωаࢲߝ࡙(һ௃ωڗσ௶ו) c1ȃc2ȃȃctȂϷտॎ

ᆗຽᚔҁПޟࣺᄇ঄(cj - cj’)2/ cjȂj = 1, …, tȂӔ஠೻ t এࣺᄇ঄ёᖂȂ։࣏ڏ૖

໔ڒኵ঄Ȅӵี౪ғጂޟ३ڙ酶AȃB ϸസޟ DNA ωаࢲ௶ӖਢȂڏ૖໔ڒኵ

঄஠࣏0Ȃ֏ࠌڏ঄σܻ 0Ȅ

ΰक़૖໔ڒኵᗴൕωаࢲޟߝູ࡙ࣺߖȂࠌڏ௶Ӗູོᗍߖܻғጂޟ௶ӖȄ רঈᇯ࣏೻ኺޟᗴൕϚᅾณϸӫᄂሬޑݷȂоήҢٽϤᇳ݂Ȉ

ٽϤȈԃӣٽΙޟDDPȂԃݎ३ڙ酶 A ᇄ B ܚϸസޟωаࢲࡸྱყ 2 ПԒ௶ӖȂ

஠ுڗ३ڙ酶A+B ޟғጂ๎ਰȂڏߝ࡙௶וࡣ࣏ 2ȃ3ȃ3ȃ4ȃ4ȃ4ȃ5Ȃषѫ

஠३ڙ酶A ܚϸസޟശࡣΠএωаࢲϣ඲՝ညȂࠌོு३ڙ酶 A+B ܚϸസޟω аࢲޟ௶ӖПԒԃყ5Ȃڏߝ࡙௶וࡣ࣏ 1ȃ2ȃ3ȃ3ȃ4ȃ5ȃ7Ȅ

ყ5Ȉᇄყ 2 ࣺխޟωаࢲ௶Ӗ

(19)

ყ5 ޟ A ޟωаࢲ௶ӖПԒᇄყ 2 ࣺխȂծ࢐ყ 5 ϛ A ޟ௶Ӗོٺ A+B ϸ സਢ౰ҡߝ࡙1ȃ3ȃ7 ޟωаࢲȂՄੑѶߝ࡙ 3ȃ4ȃ4 ޟωаࢲȂߝ࡙ 1 ӵ௶ו ࡣོಋڗശࠉ७Ȃߝ࡙3 ΙቨΙ෵ฒኇ៪Ȃߝ࡙ 7 ོಋڗശࡣ७ȂོٺுඁнӒ ഋޟߝ࡙঄ޟ௶ו՝ညөѾܖөѡ՝ಋΙ՝ȂӔᇄғጂ๎ਰޟߝ࡙঄ڍڍॎᆗࣺ

ᄇຽᚔҁПᇄڏᖂڷȂོԤ࡞σޟюΣȄ

ณՄᢎᄆყ2 ᇄყ 5ȂA+B ϸസޟωаࢲޟ௶ӖПԒȂӰ࣏ѫ׽ᡐ A ޟശ ࡣΠωаࢲ՝ညȂܚоڍޱA+B ࠉ७Ѳωаࢲޟ௶ӖϚᡐȂѫԤࡣ७έаࢲڧ ڗኇ៪Ȅܚо೩ॎᎌᔖڒኵᔖ၎оڍޱϞωаࢲߝ࡙֛ӫኵ࣏кौՃ໔Ȃࣺխޟ ωаࢲ௶Ӗϗ૖ுڗࣺߖޟᎌᔖڒኵ঄Ȅ

ҥܻࣺխޟωаࢲ௶ӖПԒȂѫԤ׋ഋωаࢲޟ՝ညࣺ౴ȂՄσഋϷڏтω аࢲޟ՝ည࢐ࣺӣޟȂ஠ٺ३ڙ酶A+B ϸസϞωаࢲ௶Ӗ՝ညᇄߝ࡙σᡝΙ मȂڏᎌᔖڒኵ঄ᔖࣺխȂܚоҏ፣Мޟᎌᔖڒኵۡဎ࣏ȶڎԤࣺӣߝ࡙ϞA+B ϸസϞωаࢲᖂኵޟҁПȷȂӰ࣏ڎԤࣺӣߝ࡙ϞA+B ϸസϞωаࢲᖂኵູσȂ ڏีҡᐠ౥ོࡨഀᡐωȂоዅആிڔШൕȂᄇϛϲጆᇄϤጆኵԅȂࣺᄇܻᄇϛϤ ጆᇄѲጆኵԅȂᗶณ഍ѫࣺ৯ΙጆȂծ࢐ᄇϛϤጆኵԅޟᐠ౥࢐ᄇϛϲጆޟ216 ॻȂՄᄇϛѲጆኵԅޟᐠ౥࢐ᄇϛϤጆޟ43.75 ॻȂܚоᄇϛϲጆᇄϤጆޟிߜ ৯᚞ȂШᄇϛϤጆᇄѲጆޟ৯᚞ौσுӻȂᎌᔖڒኵ᜸խிߜޟђ૖Ȃܚо௴Ң ҁПၼᆗܜσڏᎌᔖڒኵ঄ޟ৯঄Ȅ

ٽϲȈٽΙϞ३ڙ酶A+B ϸസϞωаࢲߝ࡙Ϸտ࣏ 2ȃ3ȃ3ȃ4ȃ4ȃ4ȃ5Ȃٽ ϤϞ३ڙ酶A+B ϸസϞωаࢲߝ࡙Ϸտ࣏ 1ȃ2ȃ3ȃ3ȃ4ȃ5ȃ7ȂШၶڍޱȂ ڏϛ2ȃ3ȃ3ȃ4ȃ5 Ϥএኵ঄ࣺӣȂ࢈ڎԤࣺӣߝ࡙Ϟωаࢲᖂኵ࣏ 5Ȃܚоڏ ᎌᔖڒኵ঄࣏52 = 25Ȅ

(20)

ॎᆗᎌᔖڒኵޟᅋᆗݲ࡞ᙏ൐Ȃӑ஠ڍޱޟߝ࡙঄௃ωڗσ௶וȂӔցҢ᜸

խӫځ௶וݲ(merge sort)ޟӫځၼᆗȂ௃ωڗσ௭ජΙԩȂ։џײюࣺӣኵ঄ޟ Ӓഋ଩ᄇȂॎᆗڏ଩ᄇᖂኵࡣӔҁП։џȄ

3-2-3 染色體互換

Ӱ࣏௴ҢוኵߒҰݲȂܚоࢗՓᡝϣ඲Ϸ࣏ڍഋϷȂΙ࢐וኵө໔ޟҺ඲Ȃ ѪΙ࢐அᙃ୤ኵޟҺ඲Ȅוኵө໔ޟҺ඲ПԒᇄ༈ಛޟGA Һ඲ПԒࣺӣȂ։ڥ

༄ኵо౰ҡҺ඲ᘈ(crossover point)Ȃ஠Һ඲ᘈѡПϞࡣࢲוኵө໔ϣ඲։џȄ அᙃ୤ኵࠌ࢐Ѫڥ༄ኵؚۡ࢐֏Һ඲Ȃஅᙃ୤ኵޟҺ඲஠ོഅԙܚфߒޟ௶

ӖׇӒ׽ᢎȂᡐଢ଼ൽ࡙ႆσȂܚоஅᙃ୤ኵҺ඲ޟีҡᐠ౥ϚۣЊσȄ

ٽΜȈ۽៉ٽѲȄ௶ӖX ޟוኵө໔(1 1 3 1 1)Ȃஅᙃ୤ኵ = 1 ਢȂфߒ௶Ӗ(1 2 5 3 4)Ȃ௶Ӗ Y ޟוኵө໔(4 4 1 2 1)Ȃஅᙃ୤ኵ = 2 ਢȂфߒ௶Ӗ(5 1 2 4 3)Ȅष Һ඲ᘈϭܻ՝ည2 ᇄ 3 Ϟ໢Ȃࠌ X ޟוኵө໔ᡐԙ(1 1 1 2 1)ȂY ޟוኵө໔ᡐ ԙ(4 4 3 1 1)Ȃ։וኵө໔ࡣࢲ(1 2 1)ᇄ(3 1 1)ϣ඲ȂX ᡐԙ(1 2 3 5 4)ȂY ᡐԙ(5 1 4 2 3)ȂѫԤࡣࢲέኵԅޟ௶Ӗԩו׽ᡐȄ

षӔ஠X ᇄ Y ޟஅᙃ୤ኵϣ඲Ȃ։ X ޟஅᙃ୤ኵᡐ࣏ 2ȂY ޟᡐ࣏ 1Ȃࠌ X ᡐԙ(2 3 4 1 5)ȂY ᡐԙ(4 5 3 1 2)ȂᇄୈࢗՓᡝϣ඲ࠉࣺШȂؐএ՝ညΰޟኵԅ Ӓ഍ϚӣȄ

(21)

3-2-4 基因突變

அӰएᡐޟПԒᇄ༈ಛGA एᡐࣺխȂӵוኵө໔ᇄஅᙃ୤ኵϛᓍᐠڥюΙ এኵԅȂӔڥ༄ኵڥфϞ։џȄ௙ሯಒӫוኵө໔঄ᇄஅᙃ୤ኵޟጒ൜Ȃ։וኵ ө໔಑i ᆰኵ঄ϭܻ 1 ᇄ n – i + 1 Ϟ໢Ȃஅᙃ୤ኵࠌϭܻ 1 ᇄ k Ϟ໢Ȃڏϛ k ࣏ அᙃ௶ӖᖂኵȂ፜၏َ3-2-1 ω࿽Ȅ

ٽΤȈ۽៉ٽΜȄष௶ӖX ޟוኵө໔ޟ಑Πᆰ࡙ᡐԙ 2Ȃ։וኵө໔ᡐԙ(1 2 3 1 1)Ȃஅᙃ୤ኵϫ࣏ 1Ȃࠌ X ᡐԙ(1 3 5 2 4)Ȅ

(22)

第四章 程式設計

4-1 改良 GA 演算法

ٷྱყ4 ޟ GA ᅋᆗ؏᡽ 4.3Ȃ

4.3 Select other individuals at random and replace them with the new individuals.

ᓍᐠӴ్؜ߨ଩ᆍфߒȂٮоཱིҡΡοڥфϞȄԪ؏᡽ᗴൕӵᐌএ໌Ͻႆแ ϛȂΡοᖂኵϚᡐȄषоҡސ໌Ͻޟُ࡙پࣼȂᓍ๿ᐌᡝΡοޟᎌᔖΨംᅚඪ ଽȂΡοᔖ၎ོᓍϞቨёȇІϞȂषΡοޟᎌᔖ࡙ϚيȂࠌኵҬོ෵ЍȄӵՌ ณࣨϛΡοኵҬᔖ၎ོᡐଢ଼ȂՄߨھۡ঄ȄՄи࿋ཱིҡΡοኵӻܻߨ଩ᆍфߒ ਢȂһฒݲஈ՗ყ3 ޟ؏᡽ 4.3Ȃ࢈҆໸ёоওғȄ

ӵҏМϛȂҐೝᒵ࣏଩ᆍфߒޱȂӰஅӰฒݲ༈ሎڗήΙфȂแԒ೩ۡ஠

ڏӒഋ్؜Ȅ෵ЍޟΡοଶΟџՌཱིҡΡο၄шϞѴȂىᆍԱ(َ಑ 4-3 ω࿽) ϱޟᓺؾএᡝζོёΣȄҏМ׽يყ4 ޟ኿ྥ GA ᅋᆗ؏᡽Ȃԃყ 6 ܚҰȄ಑

Ϥണଆ፣׽يࡣޟਝઉȄ

1. Choose the initial population size.

2. Choose the number of generations NG.

3. Initialize the population record the fitness of each individual.

4. Repeat the following for NG generations:

4.1 Copy the outstanding individuals, whose fitness is above a given level, into the breeding pool.

4.2 Select a given number pairs of individuals from the

(23)

population probabilistically after assigning each structure a probability proportional to observed performance.

4.3 Copy the selected individuals, then apply genetic operators (crossover and mutation) to them to produce new individuals.

4.4 Eliminate all other individuals. Add the new individuals and the individuals in breeding pool to the population.

4.5 Observe and record the fitness of the new individuals.

5. Output the fittest individual as the answer.

ყ6Ȉ׽يࡣޟஅӰᅋᆗݲแו

4-2 選擇配種代表

ӵՌณࣨϛȂᓺؾޟএᡝШၶৠܾײڗ଩ୋᖅ෥Ȃܖ࢐ᇳȂᓺؾޟএᡝШၶ ৠܾ֜Е౴ܒଡؑȂٮ౰ҡήΙфȄоᅋϽޟُ࡙پࣼȂᎌᔖΨၶ஼ޟএᡝȂᖅ

෥ήΙфޟᐠ౥ШၶଽȄӵஅӰᅋᆗݲϛȂᒵᐅ଩ᆍфߒޟᐠڙԤ࡞ӻᆍȂҏМ

௴Ңȶᎈዺᒵᐅݲȷ(roulette wheel selection) [8]Ȅყ 7 ஠߼ᛳ඼ᎈዺᒵᐅݲώհ ন౩оᅋᆗݲПԒߒҰȄ

1. Compute the partial sum Sk =

= k i

individual th

i of fitness

1

'

, for k = 1,… ,n,

where n is the total number of the individuals.

2. Generate an integer random number (r) in [0,Sn].

3. Return 1 when r ≤ S1 and return k when Sk-1 < r ≤ Sk for k ≥ 2.

ყ7Ȉ߼ᛳ඼ᎈዺᒵᐅݲแו

(24)

೻ᆍПݲᙏ൐ܾҢȂՄиৠܾΟ၌Ȅԃყ 8 ܚҰȂᐌএᎈዺޟ७ᑖ࣏ SnȂ

୅೩1 ဴএᡝ(individual)ޟᎌᔖ࡙঄ശωȂ࢈ܚћ७ᑖശωȇ4 ဴএᡝޟᎌᔖ࡙

঄ശσȂܚћ७ᑖζശσȄᒵᐅ଩ᆍфߒȂ൷჋ᙽᎈዺৢॴᜪΙኺȂ७ᑖσޱೝ

ᒵϛᐠ౥ၶଽȄ

ყ8Ȉ߼ᛳ඼ᎈዺᒵᐅݲ

4-3 加速優化人口適應力

! ! ىᆍ(breeding)࢐Ρώᖅ෥ޟ१ौ׬ѽȂᒵю੫տᓺؾޟএᡝҺ଩Ȃџоפ

ഀஉىю౩དޟࠢᆍȄҏМЕ໌Ԫᆍᢎ܈Ȃ೩ॎΙএடߞԆܹ੫տᓺؾΡοޟى ᆍԱ(breeding pool)ȄӵแԒ዁ᔣ໌ϽޟႆแȂፒᇧؐжфᎌᔖ࡙঄ശσޟࠉέ ӪΡοܻىᆍԱϱȄؐ౰ҡΙএཱིжфȂ൷౅ΣىᆍԱϱಣᑖӨжфޟᓺؾΡ οȂ୤ᇄཱིжфޟ଩ᆍႆแȄٮ३ڙپՌىᆍԱޟᓺؾΡοϚு຺ႆ၎жфΡο ኵޟ30%Ȃо߳੼ؐΙжфஅӰޟᐿ੫ܒȄᇳ݂ԃ಑ 21 ॲყ 9Ȅ

ցҢىᆍ׬ѽȂငᄂᡛᜌ݂Ȃጂᄂ૖ёפᓺϽႆแȂ੼࡟಑Ϥണଆ፣Ȅ

(25)

4-4 演化停滯

GA ॎᆗႆแϛȂषҁ֯Ροᎌᔖ࡙঄ϚӔᓍ๿жфᅋϽՄԤ໌৤ȂՄиএ տΡοᎌᔖ࡙঄ᗍܻΙमȂ։࣏ีҡᅋϽୄᅗȄีҡԪޑݷࡣȂ୲ԤᎬஅӰएᡐ ϗ૖׽ᡐΡοᎌᔖ࡙঄Ȅծ࢐அӰएᡐีҡᐠ౥࡞ճȂՄиσഋϷޟएᡐ഍Ϛց

ܻᎌᔖ࡙ȂएᡐΡο࡞פ൷ೝ్؜Ȅ։ٺएᡐΡοᓺܻҁ֯঄ȂծएᡐΡኵ໔ᇄ ᖂΡοኵࣺШϞήཌϚٗၾȂ࡞ᜲ׽๡ᖂᡝΡοࠢ፴Ȅ࢈ΙีҡᅋϽୄᅗȂ൷࡞

ᜲԤᐠོॎᆗю๖ݎȄ

ོีҡԪᆍ౪ຫޟনӰ࢐ӵᐌএжфϛȂσഋϷΡοޟஅӰϱొࣺӣȄܚᒝ அӰϱొࣺӣԤڍᆍџ૖Ȃ಑Ιᆍ࢐அӰׇӒࣺӣޱȂ಑Πᆍ࢐ӣ঄౴לஅӰȄ

4-4-1 同值異形染色體向量

ҏМ௴Ңȶᘗш࠮וဴߒҰݲȷජक़ࢗՓᡝө໔Ȃԃ 3-2-1 ܚक़ȄԪݲھณ П߯ஈ՗ࢗՓᡝϣ඲ၼᆗȂծԤΙ໶੫ᘈȂ։Ιᆍ௶ӖџҢӻএϚӣࢗՓᡝө ໔ߒႀȄҏМ஠ڏᆎ࣏ȶӣ঄౴לȷࢗՓᡝө໔ȂԃٽΞȈ

ٽΞȈ୅೩S’ = {(1 2 3 4 5)ȃ(2 3 4 5 1)ȃ(3 4 5 1 2)ȃ(4 5 1 2 3)ȃ(5 1 2 3 4)}Ȃ ࠌ௶Ӗ (1 3 5 4 2)џҢ அᙃ୤ኵ=1, ө໔(1 2 3 2 1) ߒҰ

ζџҢ அᙃ୤ኵ=2, ө໔(5 2 3 2 1) ߒҰ ζџҢ அᙃ୤ኵ=3, ө໔(4 1 2 1 1) ߒҰ ζџҢ அᙃ୤ኵ=4, ө໔(3 4 2 1 1) ߒҰ ζџҢ அᙃ୤ኵ=5, ө໔(2 3 1 2 1) ߒҰ

(26)

4-4-2 處理演化停滯問題

१ፒᇄӣ঄౴לஅӰӵىᆍԱϱ࡞லَȂԪΝӰ࣏ᓺؾΡο࡞ৠܾೝࢅᒵю پԙ࣏଩ᆍфߒȂΙффᖅ෥ήپȂ೻ٲᓺؾΡοԤߖᒑᖅ෥ޟ༊өȂՄഅԙஅ ӰϚஊӻኺϽȂഅԙᅋϽୄᅗȄҏМ࣏Ο೻এ୰ᚠȂ੫տ೩ॎΠএแԒȂ಑Ιএ แԒȂོւଶىᆍԱϱႆӻ᏿ԤࣺӣஅӰޟᓺؾΡοȂѫ߳੼ΙএȄ಑ΠএแԒ

ོӵᓺؾΡο຺ႆىᆍԱΰ३ਢంଢ଼Ȃւଶႆӻ᏿Ԥӣ঄౴לஅӰޟᓺؾΡοȂ ѫ߳੼ΙএȄԃ಑21 ॲყ 9 ܚҰȄ

4-5 最佳解、完美解與正解

GA ࢐ΙᆍശٹϽཪ൶׬೚Ȃײڗޟ၌๎ᆎ࣏ശٹ၌(optimal solution)ȄΙૡ ᇳپȂശٹ၌ளΣҬ኿ڒኵ(object function)ܚுޟ঄࢐঄୿ު໢ޟ׋ഋശٹ(local optimum)ȂϚ૖߳ᜌ࢐Ӓ঄୿ശٹ(global optimum)ȄषளΣҬ኿ڒኵࡣܚுޟ঄

࢐Ӓ঄୿ശٹȂҏМᆎׇ࣏छ၌(perfect solution)Ȅо GA ؑ၌ DDPȂڏҬ኿ڒ ኵ࣏಑3-2-2 ω࿽ϭಝޟᎌᔖڒኵȂάӰ࣏ҏ፣Мޟᎌᔖڒኵۡဎ࣏ȶڎԤࣺӣ ߝ࡙ϞA+B ϸസϞωаࢲᖂኵޟҁПȷȂ࢈ᎌᔖڒኵޟ঄୿ΰ३fmax࢐ٱӑџޣ ޟȄԃٽΙϛȂϐޣ३ڙ酶A+B ϸസϞωаࢲߝ࡙Ϸտ࣏ 2ȃ3ȃ3ȃ4ȃ4ȃ4ȃ 5ȂӈդΙಢׇछ၌౰ҡޟ A+B аࢲኵһᔖ࣏ 2ȃ3ȃ3ȃ4ȃ4ȃ4ȃ5Ȃڏᎌᔖ࡙

঄࣏72=49Ȃ։ fmax=49Ȅӵ၌ᚠਢȂѫौॎᆗܚுޟശٹ၌ޟᎌᔖ࡙঄้ܻ fmaxȂ

൷џо߳ᜌ೻এശٹ၌൷࢐ׇछ၌ȄแԒ೩ॎӑॎᆗюfmax঄ȂᔮࢥؐфϛܚԤ Ροᎌᔖ࡙঄࢐֏࣏fmaxȂषԤ։ຜ࣏ײڗׇछ၌Ȅ

ᗶณҏ፣МПݲؑுޟശٹ၌൷࢐ׇछ၌Ȃծಒӫfi= fmaxׇछ၌ϚѫΙএȂ

։ٺؑுΟׇछ၌ȂζϚ૖߳ᜌ൷࢐DDP ୲Ιޟғ၌(exact solution)Ȃ೻࢐ DDP ޟӻ१၌୰ᚠ[7]Ȅ

(27)

4-6 程式參數

ҏМ೩ॎϞแԒӓԤΜ໶Ռॏ୤ኵȂ၏क़ԃߒΙȈ

୤ኵӪᆎ ኵ ঄ ᇳ ݂

ratio_to_be_parent 80%

ᖅ෥Ροϛࢅюپ࿋଩ᆍфߒޟШٽ

S_crossover_probability 1%

Һ඲அᙃוဴϞᐠ౥

mutation_probability 3%

அӰएᡐϞᐠ౥

initial_population_no 200

ߑۖΡοኵҬ

uplimit_of_population 200

Ροΰ३

ratio_of_terminator_to_population 30%

پՌىᆍԱޟᓺؾΡοϚு຺ႆ၎жф ΡοኵޟШٽ

ߒΙȈแԒՌॏ୤ኵӖߒ

4-7 系統開發環境

ҏМแԒоMATLAB ᇭِ໠ีȂӵএΡႫသΰஈ՗Ȅفಛ໠ีᕗცԃήȈ

฽ᡝȈAcer Travelmate 351TE, Intel PIII 800MHz CPU/376MB RAM/20GB H.D.

հཾفಛȈWindows XP

ॎᆗفಛȈMATLAB 6.1 Release 12

(28)

4-8 程式流程

ყ9 ࣏فಛแԒࢺแყȂแԒጆၷܻߣᓃέȄ

ყ9ȈแԒࢺแყ

(29)

第五章 結果與討論

5-1 程式執行結果 5-1-1 實驗數據

ҏМᇧհέಢॎᆗ໔σωϚӣޟᚖ酶ϸᄂᡛኵᐃȂԃყ10 ܚҰȄ࣏П߯Ο၌

ॎᆗ໔σωȂ஠A ᇄ B ޟаࢲኵ໔೩࣏ࣺӣ঄ nȂn ঄ཕσфߒॎᆗ໔ཕσȄ

甲. n=16, ॎᆗ໔ (16!×16!)ʝ(2!7×3!2×4!) =3.96×1021 A, B, A+B аࢲߝ࡙ၥਟԃٽΠȄ

乙. n=30, ॎᆗ໔ 30!×30!ʝ(2!7×3!6×4! 2×6!) = 2.84×1052 AȈ {1,1,2,2,2,2,2,2,3,3,5,5,5,7,7,7,9,9,9,10,12,12,14,15,21,21,21,26,32,33}

BȈ {1,1,1,1,3,3,3,3,4,4,4,5,5,5,8,8,9,10,10,12,12,13,14,18,19,21,24,26,26,27}

A+BȈ{1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5,5,5,5,5,7,7,7,7,7,8,8,8,8,!

8,9,9,9,9,10,11,12,13,18,21}

丙. n=100, ॎᆗ໔ 100!×100!ʝ(2!19×3!18×4!8×5!4 ×6! ×9!)= 2.74×10268 AȈ { 1,1,1,1,1,2,2,2,2,3,3,3,4,5,5,5,5,6,6,6,7,7,7,7,7,7,8,8,9,9,9,10,10,10,10,10,11,11,11,11,12,13,

13,13,13,14,14,14,15,15,15,16,16,17,17,17,18,18,18,19,20,20,20,20,20,21,21,21,22,22,23,24,

24,24,25,25,27,29,30,30,31,31,31,34,34,35,35 ,37,38,42,43,44,46,48,53,57,60,64,76,143}

BȈ {1,1,1,1,1,2,2,3,3,3,3,3,3,3,3,3,4,4,5,5,6,6,6,6,7,7,8,8,8,8,9,10,10,11,11,11,11,11,12,12,12,12,12, 13,13,14,14,14,15,16,16,16,17,17,17,18,18,18,19,19,19,21,21,22,23,24,26,26,26,26,27,28,30,31, 31,31,32,32,32,33,34,34,34,35,35,37,37,38,39,40,40,44,50,50,54,56,63,64,64,69}

A+BȈ{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,

(30)

4,4,4,4,4,4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,9, 9,9,9,10,10,10,10,10,11,11,11,11,11,11,11,11,11,11,12,12,12,12,12,12,13,13,13,13,14,

14,14,14,14,14,15,15,15,15,16,16,16,17,17,17,17,17,18,18,18,19,19,19,19,20,20,20,20,20,21,22, 22,23,23,24,24,24,24,25,26,27,28,29,30,30,30,31,33,33,34,38,42,44,48}

ყ10Ȉᚖ酶ϸᄂᡛኵᐃ

5-1-2 實驗方法

ؐಢᄂᡛஈ՗ኵ̈ԩȂࢥᡛ࢐֏ײڗശٹ၌ȉ଄ᓃᅋϽю಑Ιএശٹ၌ޟж фኵҬЅแԒॎᆗਢ໢Ȃแוԃყ11Ȉ

ყ11Ȉᄂᡛแו

(31)

5-1-3 結果

ؐΙಢᄂᡛ഍ஈ՗แԒኵ̈ԩȂࢥᡛ࢐֏џײڗശٹ၌ȉٮ଄ᓃᅋϽю಑

Ιএശٹ၌ޟᖅ෥жфޟԩኵᇄܚሯਢ໢ȄߣᓃΙ࣏ᄂᡛ๖ݎȂಛॎࡣᐌ౩ԃ ߒΠȈ

໶Ҭʞᄂᡛಢտ

Ҧ. n = 16 Κ. n = 30 е. n = 100

ᖅ෥жфΰ३

100 300 300

ᄂᡛஈ՗ԩኵ

57 ԩ 20 ԩ 20 ԩ

ײڗശٹ၌ԩኵ/ԻϷШ

55 ԩ / 96.5% 7 ԩ / 35% 0 ԩ

ײڗ಑Ιএശٹ၌ޟᖅ෥жфኵҬ

(ҁ֯঄)

38.3 ф 229.7 ф -

ײڗ಑Ιএശٹ၌ޟਢ໢(ҁ֯঄)

49.3 ऌ 2,836.9 ऌ -

ߒΠȈแԒஈ՗๖ݎ

5-2 結論

5-2-1

GA 求解 DDP 的可行性

ߒΠᡗҰоGA ؑ၌ DDP ጂᄂџ՗Ȃӵ n=16 ਢџײڗശٹ၌ޟᐠ౥࣏

96.5%Ȃծ೻࢐ᖅ෥жфΰ३೩࣏ۡ 100 фޟ๖ݎȂष፡ᐌแԒ୤ኵȂඪଽᖅ

෥жфΰ३ȂᡱGA ᝷៉ᅋϽȂ൷џо߳ᜌΙۡ૖ײڗശٹ၌Ȅծ೻এПݲϫ Ԥڏ३ڙȂࢋn ঄ᡐσਢȂஈ՗ਢ໢ོ֕ࡾኵࡨቑቨёȄٽԃ࿋ n=30 ਢȂӵ 300 এжфϛײڗശٹ၌ޟᐠ౥ѫԤ 35%Ȃҁ֯ؑ၌ਢ໢घ 45 Ϸមȇn=100 ਢ

൷ฒݲጂۡ࢐֏૖ӵӫ౩ޟਢ໢ϱײڗശٹ၌Ȃᗙ࢐ฒݲಳᚔNP-hard ޟ႒ ڙȄծҡϽᏰড়ӵᄂᡛࡉᄂሬоᚖ酶ϸ׬೚ᛲᇧ३ڙ酶ᗖყਢȂலٺҢӻಢϚ

(32)

ӣޟᚖ酶ಢӫȂӑӨտ१ಢӨএᚖ酶ϸᄂᡛȂณࡣӔӫځ१ಢȄԃ[21]МᝦϛȂ

൷ٺҢΟ6 ᆍ酶Ȃ7 ಢᚖ酶ϸȂՄڏϸюޟаࢲኵ࣏ 2~7 ࢲȂҥԪџޣ n =16 ϫџᆗ࢐ӫ౩ᄂҢޟኵԅȂџᅖٗᄂᡛࡉޟሯौȄ

5-2-2 執行效能

Waterman ӵ[14]ϛඪڗо዁ᔣଝЬݲؑ၌ DDPȂڏᄂᡛኵᐃᇄ 5-1-1 ޟ Ҧಢॎᆗ໔ࣺ࿋Ȃࣱ࣏(16!×16!)ʝ(2!7×3!2×4!)ȄоԪПݲӵ಑ 1635 এଟ୼ײ ڗ಑Ιಢശٹ၌ȂծМᝦϛٮҐࡾюஈ՗ਢ໢Ȅҏ፣Мҁ֯ӵ಑38.3 фײڗ

಑Ιಢശٹ၌Ȃஈ՗ਢ໢घΙϷមȂਝ૖ۦӵӫ౩ጒ൜ϱȄ

5-3 討論

5-3-1 加速演化的動力

ᅋϽޟଢ଼ΨپՌЈᐅȂ్؜৵ޱȂ߳੼஼ޱоᖅ෥ήΙфȄौёפᅋϽഀ

࡙Ȃ൷҆໸ё஼ЈᐩޟΨ࡙Ȅҏ፣Мᇯ࣏ё஼ޟПөԤΠȈ಑Ι࢐ᝒਿ్؜ȇ

಑Π࢐ඪଽஅӰޟӻኺܒȄᝒਿ్؜џٞഀ஠ӛ፴அӰўଶȂඪଽஅӰӻኺܒ ࠌџጂ߳Ροᖅ෥ਢ౰ҡӻᆍஅӰ࠮ޟཱིҡфȄծ࢐೻ڍএПөधၾՄႻȂᝒ

ਿ్؜৵ޱ༖ོ҆෵ЍΡοȂஅӰޟӻኺܒζོᓍϞ६ճȄԃդঙ៫ΠޱȂҏ МඪюΠএ׽๡ПݲȂ

಑ΙȈ్؜ܚԤҐೝᒵ࣏଩ᆍфߒޟΡοȂԃ4.1 ω࿽ܚक़Ȅ

಑ΠȈ ӵىᆍԱ߳੼ᓺؾΡοޟஅӰȂٮ஠ىᆍԱϱΡο၄шڗΡοϛ

෥Ȃԃ4.3 ω࿽ܚक़Ȅ

(33)

5-3-2 育種的效果

ष஠ߒΙแԒ୤ኵϛپՌىᆍԱޟᓺؾΡοϚு຺ႆ၎жфΡοኵޟШ ٽ६࣏0Ȃᜰഖىᆍђ૖Ȃڏт୤ኵϚᡐȄо 5-1-3 ω࿽ϛޟҦಢᄂᡛኵᐃก ၐȂுڗӵ57 ԩஈ՗ϛԤ 38 ԩџײശٹ၌Ȃᐠ౥࣏ 66.7%Ȅײڗ಑Ιএശٹ

၌ޟҁ֯ᖅ෥жфኵ࣏54.5Ȃҁ֯ૉਢघ 60.9 ऌȄߣᓃΠ࣏ᄂᡛ๖ݎȄ஠๖ ݎᇄԤىᆍᐠڙޟᅋϽШၶԃήȈ

࢐֏ىᆍ

໶Ҭ

Ԥ ฒ

ᖅ෥жфΰ३࣏ 100Ȃײڗശٹ၌ޟᐠ౥ 96.5% 66.7 %

ײڗ಑Ιএശٹ၌ޟᖅ෥жфኵҬ(ҁ֯঄) 38.3 ф 54.5 ф

ײڗ಑Ιএശٹ၌ޟਢ໢(ҁ֯঄) 49.3 ऌ 60.9 ऌ

ߒέȈىᆍᇄฒىᆍϞਝݎШၶ

ҥߒϛ๖ݎџࣼюȂёΟىᆍᐠڙࡣײڗ಑Ιএശٹ၌ޟᖅ෥жфኵҬ௃

54.5 ෵ЍՍ 38.3Ȃॎᆗਢ໢Ռ 60.9 ऌ෵ЍՍ 49.3 ऌȄጂᄂᜌ݂ىᆍ׬೚ጂᄂ џоԤਝёഀᅋϽȄ

(34)

第六章 建議

ӵҡސၥଉሴ୿ϛȂငலю౪NP-hard ୰ᚠȂоЅሯौσ໔ၥਟ೎౩ޟ୰

ᚠȄӰԪȂငலሯौૉາ೨ӻॎᆗਢ໢ᇄ଄ᏹᓽԆު໢Ȅ࣏Οᅖٗ೻ٲሯؑȂϷ ඹԒ೎౩ޟճԙҏȃଽॎᆗ૖໔ᇄ଄ᏹު໢ޟϷඹᓽԆ้੫ܒȂխн࢐௰ଢ଼ҡސ ၥଉޟंـᇄᔖҢޟശٹᒵᐅȄ

ี৤DDP ޟ GA แԒȂ࢐רঈंـҡސၥଉሴ୿ޟ಑Ι؏ȄڏҬޟ࢐הఖ ᙤҥ೻ԩޟკၐȂี௨ҡސၥଉޟϷඹԒ೎౩ӵ฽ᡝȃ೺ᡝᕗცܖᅋᆗݲϚٗϞ

೎Ȃоୈ࣏Ґپี৤ޟஅᙃᇄငᡛȄᄇܻРࡣޟี৤Ȃҏ፣Мඪюоή࡚ដȈ

6-1 計算大量人口的分散式系統

ԃ5-3-1 ܚक़ȂΡοஅӰޟӻኺܒ࢐ёഀᅋϽଢ଼ΨپྛϞΙȂ࢈ቨёΡοኵ ໔૖ёഀᅋϽȄծ࢐Ⴋသॎᆗ໔ོᓍ๿Ροኵ໔ቨёՄᡐσȂؑ၌ഀ࡙Ϛَுོ

ᡐפȄषี৤ϷඹԒفಛȂ஠σ໔ΡοϷඹڗυفಛॎᆗȂᔖ၎૖၌ؚ೻এ୰ᚠȄ ϷඹԒհཾᕗცȂڏ೺ᡝᕗცശலَޟMPI ᇄ PVM فಛȄPVM فಛඪټ к჊(master-slave)ϷඹԒ೎౩ޟ࢜ᄺȄߨலᎌӫี৤ϷඹԒ GAȄڏϛк՗แ (master process)џо॒೰౰ҡଔۖΡοȃ௃ӒഋΡοϛᒵᐅ଩ᆍфߒᇄоཱིҡф ڥф଩ᆍфߒоѴޟഋϷএᡝ้ώհȇ჊՗แ(slave process)џо॒೰ॎᆗഋϷএ ᡝޟᎌᔖڒኵ঄ȃஅӰҺ඲ȃஅӰएᡐ้ώհȄкȃ჊՗แϞ໢ޟၥਟ೽ଉȂџ оٺҢPVM ޟ༈ଚ(send)ᇄ௥ԝ(receive)ࡾхׇԙȄ૭஠кȃ჊՗แޟຎᔣแԒ ጆ(pseudo code)Ϸտਪቸܻყ 12 ᇄყ 13Ȅ

(35)

Procedure master

Generate initial population.

For I = 1 to NG do /* NG is the number of generations */

Send 1/n of individuals to each slave. /* n is the number of slaves */

Receive the fitness values of the individuals from slaves.

Select a given number pairs of individuals from the population.

Send 1/n of selected pairs of individuals to each slave.

Receive individuals from slaves. /* genetic operators are applied */

Select other individuals at random and replace them.

End For

Output the fittest individual as the answer.

End master

ყ12Ȉॎᆗσ໔ΡοޟϷඹԒفಛк՗แޟຎᔣแԒጆ

Procedure slave

Receive individuals from master.

Compute the fitness value for each individual.

Send the fitness values to master.

Receive the pairs of individuals from master.

Apply the crossover operator to the pairs of individuals.

Apply the mutation operator to individuals randomly.

Send these individuals to master.

End slave

ყ13Ȉॎᆗσ໔ΡοޟϷඹԒفಛ჊՗แޟຎᔣแԒጆ

(36)

6-2 育種式的分散式系統

ԤᠧܻىᆍџоԤਝёפᅋϽഀ࡙Ȃҏ፣МඪюѪΙᆍϷඹԒفಛ࢜ᄺȂ஠

ىᆍ྅܈ઽΣ೩ॎȄแԒ೩ॎϛ჊՗แџׇӒᐿҳᅋϽȂ౰ҡଔۖΡοȃॎᆗএ ᡝޟᎌᔖڒኵ঄ȃᒵᐅ଩ᆍфߒȃஅӰҺ඲ȃஅӰएᡐȃоཱིҡфڥф଩ᆍфߒȄ ӵк՗แϛёΣىᆍԱȂ஠჊՗แϛޟᓺؾΡο໱ϛܻԪȂк՗แޟߑۖΡο൷ پՌىᆍԱȂؐфᅋϽ഍్؜ܚԤߨ଩ᆍфߒΡοȂ၄шоىᆍԱϱޟΡοȄყ 14 ࣏ىᆍԒϷඹفಛޟҰཎყȄყ 15 ᇄყ 16 ࣏кȃ჊՗แޟຎᔣแԒጆȄ

ყ14ȈىᆍԒϷඹفಛҰཎყ

(37)

Procedure master

Send a start command to each slave.

Receive individuals from every slave, store them into the breeding pool.

When all the salves’ generation no. are more than SNG, begin following steps:

/* SNG is a specific value which represents the no. of generation of the slaves */

Generate the initial populations from the breeding pool.

For I = 1 to NG do /* NG is the number of generations */

Compute the fitness value for each individual.

Select a given number pairs of individuals from the population as parents.

Apply the crossover operator to the pairs of individuals.

Apply the mutation operator to individuals randomly.

Eliminate the non-parent individuals and resupply from the breeding pool.

End For

Output the fittest individual as the answer.

Send a stop command to each slave.

End master

ყ15ȈىᆍԒޟϷඹԒفಛк՗แޟຎᔣแԒጆ

(38)

Procedure slave

Receive start command from master.

Generate initial population.

Repeat the following procedures until the stop command from master Compute the fitness value for each individual.

Select a given number pairs of individuals from the population.

Apply the crossover operator to the pairs of individuals.

Apply the mutation operator to individuals randomly.

Select other individuals at random and replace them.

Send the best Ns individuals to master’s breeding pool.

/* Ns is a specific value which represents the no. of super individuals */

Send the generation no. to master.

End slave

ყ16ȈىᆍԒޟϷඹԒفಛ჊՗แޟຎᔣแԒጆ

(39)

參考文獻

1. A.V. Grigorjev, A.A. Mironov, Mapping DNA by Stochastic Relaxation: A New Approach to Fragment Sizes, Applic. Biosci., pp. 107-111.

2. D. H. Ballard. An Introduction to Natural Computation. The MIT Press, 1997.

3. Davis L., Handbook of genetic algorithms. Van Nostrand Reinhold. 1991.

4. E. Southern. United Kingdom patent application GB8810400. 1988.

5. H.O. Smith and K.W. Wilcox, A restriction enzyme form Hemophilus in fluenzae.

I. P urification and general properties. Journal of Molecular Biology, pp. 51:

379 - 391, 1970.

6. J. Setubal and J. Meidanis. Introduction to Computational Molecular Biology.

PWS Pub lishing Company, 1997.

7. J. Holland. Adaption in Natural and Artificial Systems. The University of Michigan Press, 1975.

8. K.F. Man, K.S. Tang and S. Kwong, Genetic Algorithms Concepts and Designs, Springer-Verlag London Limited, 1999.

9. K.J. Danna, G.H. Sack, and D. Nathans. Studies of simian virus 40 DNA. VII. A cleavage map of the SV40 genome. Journal of Molecular Biology, pp. 78:263 - 276, 1973.

10. L. Goldstein and M. S. Waterman. Mapping DNA by stochastic relaxation.

Advances in Applied Mathematics, pp. 8:194-207, 1987.

11. L.W. Wright, J.B. Lichter, J. Reinitz, M.A. Shifman, K.K. Kidd, and P.L. Miller, Computer-Assisted Restriction Mapping: An Integrated Ap proach to Handling Experimental Uncertainty, CABIOS, Vol. 10, No. 4, pp. 443-450, 1994.

12. M. Krawczak, Algorithms for the Restriction-Site Mapping of DNA Molecules, Proc. Natl. Acad. Sci. USA, 85, pp. 7298-7301, 1988.

(40)

13. M. Stefik, Inferring DNA Structures from Segmentation Data, Artif. Intell., 11, pp. 85-114, 1978.

14. M.S. Waterman, Introduction to Computational Biology: Sequences, Maps, and Genomes, Chapman Hall, page 78, 1995.

15. Ming-Yang Kao, Jared Samet, and Wing-Kin Sung. The Enhanced Double Digest Problem for DNA Physical Mapping. Proceedings of the 9th

Scandinavian Workshop on Algorithm Theory (SWAT 2000), 383--392, 2000.

16. P. Tuffery, P.Dessen, C. Mugnier, and S. Hazout, Restriction Map Construction Using Complete Sentences Compatibility Algorithm, Comput. Applic. Biosci., 4, pp. 103-110,1988.

17. Venter JC, Adams MD, Myers EW, et al. The sequence of the human genome, Science, 291, pp. 1304-1351, 2001.

18. W. R. Pearson. Automatic Construction of Restriction Site Maps, Nucleic Acids Res., 10, pp. 217-227, 1984.

19. W. Schmitt and M.S. Waterman, Multiple Solutions of DNA Restriction Mapping Problems, Adv. Appl. Math., 12, pp. 412-427, 1991.

20. W.M. Fitch, T.F. Smith, and W.W. Ralph, Mapping the Order of DNA Restriction Fragments, Gene, 22, pp. 19-29, 1983.

21. Yanhua Peng, Fuhua Yang, Yipeng Qi, Yongxin Huang, Location, Sequence and Promoter Structure of Apoptosis-Inhibiting Gene of Leucania seperate Nuclear Polyhedrosis Virus, VIROLOGICA SINICA, No.1 vol.14 1999.

22. Yin Zhang and Zhijun Wu, Solving the Double Digestion Problem as a Mixed-Integer Linear Program, Technical Report (TR), Technical Report TR01-12, Department of Computational and Applied Mathematics, Rice University, 2001.

(41)

23. Z. Michalewicz. Genetic Algorithms + Data Structures = Evolution Programs.

Third Edition. Springer, 1996.

(42)

附錄一

甲組:

n = 16

乙組:

n = 30

丙組:

n = 100

有最佳解 繁殖世代數 執行時間 有最佳解 繁殖世代數 執行時間 有最佳解 繁殖世代數 執行時間

Yes 54 281.05 No 301 5590.8 No 301 29865.4 Yes 27 137.65 Yes 89 1662.6 No 301 23089.4

Yes 18 92.393 No 301 5534.9 No 301 23032.3 Yes 31 160.44 No 301 5585.3 No 301 25189.5 No 101 514.02 No 301 5569.1 No 301 24827.1 Yes 55 283.06 No 301 5884.4 No 301 24360.9 Yes 22 111.87 No 301 5387.7 No 301 23036.4 Yes 33 166.68 No 301 5417.2 No 301 23560.1 Yes 66 337.38 No 301 5323.9 No 301 24966.2 Yes 38 196.22 No 301 5365.2 No 301 25823.8 Yes 28 142.38 No 301 5417.3 No 301 23068.3 Yes 19 95.808 No 301 5400.5 No 301 25139.7 Yes 32 163.78 Yes 170 3078.1 No 301 25628.3 Yes 21 106.4 No 301 5436.6 No 301 25633.9 Yes 72 368.81 No 301 5337.2 No 301 24438.9 Yes 59 303.17 Yes 251 2896.5 No 301 24808.4 Yes 92 473.69 Yes 251 2925.9 No 301 25486.9 Yes 70 353.62 Yes 251 2995.7 No 301 25950.7 Yes 17 85.383 Yes 251 2895.7 No 301 23953.2 Yes 19 97.18 Yes 251 2877.4 No 301 24241.1 Yes 40 199.69

Yes 30 151.47 Yes 9 42.862 Yes 33 168.51 Yes 20 102.13 Yes 93 480.58 Yes 38 195.79 Yes 53 270.44 Yes 28 142.86 Yes 68 350.92 Yes 62 316.07 Yes 39 201.66 Yes 35 177.83 Yes 44 250.29 Yes 54 289.03 Yes 34 175.5 Yes 46 239.09 Yes 32 164.61 Yes 22 113.35 Yes 26 134.48 Yes 44 227.53 Yes 7 32.737 Yes 38 198.01 Yes 4 17.576

No 101 505.84 Yes 43 221.02 Yes 42 216.35 Yes 16 79.995 Yes 21 106.93 Yes 61 313.2 Yes 28 142.43 Yes 40 204.52 Yes 55 281.45 Yes 56 286.85 Yes 47 244.72 Yes 4 17.626

(43)

附錄二

無育種機制:

n =16

有最佳解 繁殖世代數 執行時間

Yes 43 47.328 Yes 97 108.27 No 101 112.24 Yes 61 68.389 Yes 26 29.392 Yes 73 80.976 Yes 64 72.094 Yes 70 78.003 Yes 56 62.63 Yes 77 84.822 No 101 111.76 Yes 48 53.227 Yes 34 37.995 No 101 111.17 No 101 109.81 No 101 124.16 No 101 114.05 No 101 107.8 Yes 15 17.285

No 101 113.32 Yes 58 65.725 Yes 97 107.86 No 101 112.19 No 101 111.1 Yes 9 10.205

No 101 113.83 Yes 55 62.83 Yes 25 27.82 Yes 53 59.285 No 101 110.7 Yes 85 94.256

No 101 111.09 No 101 111.16 Yes 98 108.72

No 101 110.99 Yes 22 24.666 Yes 79 87.366 Yes 87 95.137 Yes 51 57.552 Yes 6 6.78 Yes 26 29.332 Yes 53 60.657 No 101 111.16 Yes 54 60.266 Yes 20 22.893 Yes 79 88.187 Yes 25 28.331 No 101 112.81 Yes 87 98.341 Yes 27 30.894 Yes 70 78.833 Yes 84 93.935 Yes 60 66.125 No 101 110.54 Yes 81 89.81 Yes 17 19.218

(44)

附錄三

1. run.m 主程式

2. GA_for_DDP 基因演算法主程式。以巨集方式描述,由 run.m 主程式呼叫。

3. add_terminator_to_population 將最佳基因與優秀人口加入下一代人口中。

4. breeding.m 繁殖程式(基因交換與突變)。

5. check_repeat.m 巨集-檢查是否為重複向量。

6. clean_matrix.m 刪除人口矩陣內重複的向量。

7. clean_polymophism.m 刪除同值異形向量。

8. clean_zero.m 去掉第一個元素值為零的向量。

9. clean_matrix.m 刪除矩陣中重複的列。

10. crossover.m 染色體交換。

11. eliminate_population.m 淘汰非配種代表。

12. fitness.m 計算適應度值向量。

13. func_value_of_fittness.m 計算每一人口的適應度值。

14. GA_AB_FLA.m 依據 A_SEV 與 B_SEV 向量,計算出對應的 double digest 片段長度向量。

15. gene2road.m 由向量排列基因片段。

16. initial_population.m 產生初始人口。

17. limit_population_no.m 世代交替,維持人口數目 (如果人口數超過人口上 限數,就淘汰適應值低者,直到人口數不超過人口上限)。

18. mutation.m 突變。

19. Noah_ark.m 消滅同質異形的人口,只保留一個同質代表。

20. restriction_map.m 排列出限制輿圖。

21. select_best_gene.m 挑選最佳基因並刪除重複者。

22. select_parent.m 挑選配種代表。

(45)

23. select_terminator.m 挑選出優秀人口並刪除重複者。

24. SEV2FO.m 將含基礎參數擴充基因向量(SEV)轉換成片段長度序列。

25. SEV2ROAD.m 將擴充基因向量轉換成片段排列。

26. size2FLA.m 指定一個數字以產生成片段長度集合。

27. size2SEV.m 指定一個數字以產生成擴充基因向量。

28. update_terminator.m 篩選優秀人口。

(46)

% 1. DDP-GA 主程式 clear all;

format short;

load GA_DATA;

% 宣告全域變數

% =========================================================================

global total_fregment_length; % <--- DNA 總長 global A_FLA; % <--- A 片段長度集合 global B_FLA; % <--- B 片段長度集合 global AB_FLA; % <--- A+B 片段長度集合 global length_of_A_FLA; % <--- --- A 片段數量 global length_of_B_FLA; % <--- B 片段數量 global length_of_AB_FLA; % <--- A+B 片段數量 global S_crossover_probability; % <--- 基本參數 2 ===> 交換基礎序號之機率 global mutation_probability; % <--- 基本參數 3 ===> 基因突變之機率 global max_fittness; % <--- 最大適應度值 global no_of_terminator; % <--- 繁殖池人口數 global mark_of_to_be_parent; % <--- 選為配種代表標記

global ratio_of_terminator_to_population; % < 基本參數 6 ====> 繁殖池人口占總人口數目的比例上 限

%==============================================================================

ratio_to_be_parent=0.8; % <--- 基本參數 1 ===> 繁殖人口中挑出來當親代的比例 S_crossover_probability=0.01; % <--- 基本參數 2 ===> 交換基礎序號之機率

mutation_probability=0.03; % <--- 基本參數 3 ===> 基因突變之機率 initial_population_no=200; % <--- 基本參數 4 ===> 初始人口數目 uplimit_of_population=200; % <--- 基本參數 5 ===> 人口上限

ratio_of_terminator_to_population=0.3;% <--- 基本參數 6 ==> 繁殖池人口占總人口數目的比例上限 total_generation=100; % <--- 基本參數 7 ==> 繁殖世代上限

% 宣告變數 ===============================================================

value_of_fittness=0;

value_of_fittness_of_terminator=0;

terminators=zeros(1,length_of_A_FLA+length_of_B_FLA+2);

best_gene=zeros(1,1);

average_of_population=0;

average_of_terminator=0;

lowest_of_terminator=0;

no_of_population=0;

no_of_generation=1;

no_of_terminator=0;

no_of_best_gene=0;

% (1) 產生初始人口======================================================

populations=initial_population(initial_population_no);

%======================================================================

save run;

analysis_of_GA=zeros(1,length_of_A_FLA+length_of_B_FLA+2);

analysis_generation=zeros(1,2);

total_no_of_best_gene=0;

for run_no=1:57 tic

GA_for_DDP run_time=toc

[no_of_best_gene temp]=size(best_gene);

for i=1:no_of_best_gene

analysis_of_GA(total_no_of_best_gene+i,:)=best_gene(i,:);

end

total_no_of_best_gene=total_no_of_best_gene+no_of_best_gene;

analysis_of_generation(run_no,1)=no_of_generation;

analysis_of_generation(run_no,2)=run_time;

analysis_of_generation(run_no,3)=no_of_best_gene;

save analysis analysis_of_GA analysis_of_generation run_no total_no_of_best_gene clear all

load run load analysis populations=LALA run_no

end

save ANALYSIS_OF_DDP

% 2. GA_for_DDP GA 主程式。以巨集方式描述,由 run.m 主程式呼叫

(47)

while (no_of_generation<=total_generation), %(3) 計算每一人口的適應度

value_of_fittness=func_value_of_fittness(populations);

value_of_fittness_of_terminator=func_value_of_fittness(terminators);

%===================================================================

average_of_population=mean(value_of_fittness);

average_of_terminator=mean(value_of_fittness_of_terminator);

% (4) 挑選出優秀人口並刪除重複者。當優秀人口到達上限時,刪除同型異質基因。

terminators=select_terminator(value_of_fittness_of_terminator,terminators,value_of_fi ttness,populations);

% (4.5) 挑選最佳基因並刪除重複者

best_gene=select_best_gene(no_of_generation,value_of_fittness,populations);

% 如果找到答案就跳出來==============

if best_gene(1,1)~=0 break;

end

%===================================

[no_of_population temp]=size(populations);

% (6) 挑選配種代表

parents=select_parent(value_of_fittness,populations,ratio_to_be_parent);

% (7)(8) 基因交換與突變

new_generation=breeding(populations,parents);

% (9) 淘汰未配種的基因

populations=eliminate_population(new_generation,populations,parents);

% (10) 將優秀人口加入下一代人口中,最佳基因要先加進去

populations=add_terminator_to_population(best_gene,terminators,populations);

% (11) 世代交替,維持人口數目 (如果人口數超過人口上限數,就淘汰適應值低者,直到人口數不超過人口上限 '

populations=limit_population_no(populations,uplimit_of_population);

%=========================================================================

% 顯示每一代的數據

[no_of_population temp]=size(populations);

[no_of_best_gene temp]=size(best_gene);

if best_gene(1,1)==0 no_of_best_gene=0;

end

[int32(no_of_generation) int32(no_of_population) int32(no_of_terminator) int32(no_of_best_gene)]

a=average_of_population/max_fittness;

b=average_of_terminator/max_fittness;

[a b]

aaa(no_of_generation,1)=average_of_population/max_fittness;

aaa(no_of_generation,2)=average_of_terminator/max_fittness;

aaa(no_of_generation,3)=max(value_of_fittness)/max_fittness;

%===============================================================================

no_of_generation=no_of_generation+1;

end

% 3. 將最佳基因與優秀人口加入下一代人口中 ========================

function

populations=add_terminator_to_population(best_gene,terminators,old_populations);

global no_of_terminator;

[no_of_population temp]=size(old_populations);

[no_of_terminator temp]=size(terminators);

[no_of_best_gene temp]=size(best_gene);

if (terminators(1,1)~=0) & ~(isempty(terminators)) %有優秀人口才加上去 for i=1:no_of_terminator

old_populations(no_of_population+i,:)=terminators(i,:);

end end

[no_of_population temp]=size(old_populations);

if (best_gene(1,1)~=0) & ~(isempty(best_gene)) %有最佳基因才加上去 for i=1:no_of_best_gene

(48)

old_populations(no_of_population+i,:)=best_gene(i,:);

end end

[row_size temp]=size(old_populations);

old_populations=sortrows(old_populations);

% 去掉都為 0 的列 zero_row=1;

while old_populations(zero_row,1)==0, zero_row=zero_row+1;

end

populations=old_populations(zero_row:row_size,:);

if isempty(terminators) terminators=0;

end

% 4. 繁殖程式(基因交換與突變)

function new_generation=breeding(populations,parents);

global length_of_A_FLA;

global length_of_B_FLA;

[parent_couple temp]=size(parents);

for i=1:parent_couple

% 基因交換 ====================================

A_SEV1=populations(parents(i,1),1:length_of_A_FLA+1);

A_SEV2=populations(parents(i,2),1:length_of_A_FLA+1);

[crossover_A_SEV1,crossover_A_SEV2]=crossover(A_SEV1,A_SEV2);

B_SEV1=populations(parents(i,1),length_of_A_FLA+2:length_of_A_FLA+length_of_B_FLA+2);

B_SEV2=populations(parents(i,2),length_of_A_FLA+2:length_of_A_FLA+length_of_B_FLA+2);

[crossover_B_SEV1,crossover_B_SEV2]=crossover(B_SEV1,B_SEV2);

% 基因突變 ==================================

mutation_A_SEV1=mutation(crossover_A_SEV1);

mutation_A_SEV2=mutation(crossover_A_SEV2);

mutation_B_SEV1=mutation(crossover_B_SEV1);

mutation_B_SEV2=mutation(crossover_B_SEV2);

% ++++++++++++++++++++++++++++++++++++++++++

new_generation(i,1:length_of_A_FLA+1)=mutation_A_SEV1;

new_generation(i,length_of_A_FLA+2:length_of_A_FLA+length_of_B_FLA+2)=mutation_B_SEV1

;

new_generation(i+parent_couple,1:length_of_A_FLA+1)=mutation_A_SEV2;

new_generation(i+parent_couple,length_of_A_FLA+2:length_of_A_FLA+length_of_B_FLA+2)=m utation_B_SEV2;

end

% 5. 巨集-檢查是否為重複向量 check_repeat = 0;

for ii=2:7;

for jj=1:ii-1

if balls(ii)==balls(jj) check_repeat =1;

end end end

──────────────────────────────────

% 6. 刪除人口矩陣內重複的向量

function matrix=clean_matrix(old_matrix) [row_size column_size]=size(old_matrix);

if row_size<=1

matrix=old_matrix;

return;

(49)

old_matrix=sortrows(old_matrix);

% 去掉都為 0 的列 zero_row=1;

while old_matrix(zero_row,1)==0, zero_row=zero_row+1;

end

old_matrix=old_matrix(zero_row:row_size,:);

[row_size column_size]=size(old_matrix);

new_matrix=zeros(1,column_size);

new_matrix(1,:)=old_matrix(1,:);

is_the_same=zeros(row_size,1);

j=2;i=1;

while i<row_size while j<=row_size

if mean(new_matrix(i,:)==old_matrix(j,:))==1 j=j+1;

if j>row_size break;

end else

new_matrix(i+1,:)=old_matrix(j,:);

i=i+1;

end end

if j>row_size break;

end end

matrix=new_matrix;

──────────────────────────────────

% 7. 去掉同值異形向量

function cleaned_gene=clean_polymophism(gene) global length_of_A_FLA;

global length_of_B_FLA;

global A_FLA;

global B_FLA;

[no_of_gene column_no]=size(gene);

gene_FO_index=zeros(no_of_gene,length_of_A_FLA+length_of_B_FLA+1);

for i=1:no_of_gene

A_SEV=gene(i,1:length_of_A_FLA+1);

B_SEV=gene(i,length_of_A_FLA+2:length_of_A_FLA+length_of_B_FLA+2);

A_FO=SEV2FO(A_SEV,A_FLA);

B_FO=SEV2FO(B_SEV,B_FLA);

gene_FO_index(i,1:length_of_A_FLA)=A_FO;

gene_FO_index(i,length_of_A_FLA+1:length_of_A_FLA+length_of_B_FLA)=B_FO;

gene_FO_index(i,length_of_B_FLA+length_of_B_FLA+1)=i;

end

gene_FO_index=sortrows(gene_FO_index);

flag1=1;

flag2=2;

flag3=1;

index_of_reserve(1)=1;

while flag2<=no_of_gene, if

mean(gene_FO_index(flag1,1:length_of_A_FLA+length_of_B_FLA)==gene_FO_index(flag2,1:le ngth_of_A_FLA+length_of_B_FLA))==1

flag2=flag2+1;

else

flag1=flag2;

flag2=flag2+1;

flag3=flag3+1;

index_of_reserve(flag3)=flag1;

end end

(50)

no_of_cleaned_gene=length(index_of_reserve);

for i=1:no_of_cleaned_gene

cleaned_gene(i,:)=gene(index_of_reserve(i),:);

end

% 8. 去掉第一個值為零的向量

function new_matrix=clean_zero(old_matrix) [row_size column_size]=size(old_matrix);

row_of_new_matrix=0;

new_matrix=zeros(1,column_size);

for i=1:row_size

if old_matrix(i,1)~=0

row_of_new_matrix=row_of_new_matrix+1;

new_matrix(row_of_new_matrix,:)=old_matrix(i,:);

end end

% 9. 刪除矩陣中重複的列

function new_matrix=clear_matrix(old_matrix) [row_size column_size]=size(old_matrix);

old_matrix=sortrows(old_matrix);

new_matrix(1,:)=old_matrix(1,:);

is_the_same=zeros(row_size,1);

j=2;i=1;

while i<row_size while j<=row_size

if mean(new_matrix(i,:)==old_matrix(j,:))==1 j=j+1;

if j>row_size break;

end else

new_matrix(i+1,:)=old_matrix(j,:);

i=i+1;

end end

if j>row_size break;

end end end

% 10. 染色體交換

function [crossover_SEV1,crossover_SEV2]=crossover(SEV1,SEV2) global S_crossover_probability

% (0)

crossover_point=0;

n=length(SEV1);

while crossover_point==0,

crossover_point=ceil(n*rand)-1;

end

% (1)

crossover_SEV1=SEV1;

crossover_SEV2=SEV2;

for i=crossover_point+2:n crossover_SEV1(i)=SEV2(i);

crossover_SEV2(i)=SEV1(i);

end

% (2)

if S_crossover_probability==0

(51)

else if abs(double((rand-0.5)))/S_crossover_probability<=0.5 crossover_SEV1(1)=SEV2(1);

crossover_SEV2(1)=SEV1(1);

end end

% 11. 淘汰非配種代表==========================

function populations=eliminate_population(new_generation,old_populations,parents);

global length_of_A_FLA;

global length_of_B_FLA;

global mark_of_to_be_parent;

[no_of_population temp]=size(old_populations);

[parent_couple temp]=size(parents);

j=1;

next_generation=zeros(1,length_of_A_FLA+length_of_B_FLA+2);

for i=1:no_of_population

if mark_of_to_be_parent(i)>0

next_generation(j,:)=old_populations(i,:);

j=j+1;

end end

n=2*parent_couple;

[nextone temp]=size(next_generation);

for i=1:n

next_generation(nextone+i,:)=new_generation(i,:);

end

clear populations;

populations=next_generation;

% 12. 計算適應度值向量

function fittness_value=fittness(A_SEV,B_SEV) global A_FLA;

global B_FLA;

global AB_FLA;

global length_of_AB_FLA;

% (1)

if mean(A_SEV)==0 fittness_value=0;

return;

end

comp_AB_FLA=GA_AB_FLA(A_SEV,B_SEV);

% (2)

flag1=1;flag2=1;fittness_value=0;

length_of_comp_AB_FLA=length(comp_AB_FLA);

while (flag1<=length_of_AB_FLA)&(flag2<=length_of_comp_AB_FLA), if AB_FLA(flag1)>comp_AB_FLA(flag2)

flag2=flag2+1;

else if AB_FLA(flag1)<comp_AB_FLA(flag2) flag1=flag1+1;

else

fittness_value=fittness_value+1;

flag1=flag1+1;

flag2=flag2+1;

end end end

% (3)

fittness_value=fittness_value*fittness_value;

% 13. 計算每一人口的適應度值

function value_of_fittness=func_value_of_fittness(populations) global length_of_A_FLA;

global length_of_B_FLA;

參考文獻

Outline

相關文件

 Promote project learning, mathematical modeling, and problem-based learning to strengthen the ability to integrate and apply knowledge and skills, and make. calculated

Graduate Masters/mistresses will be eligible for consideration for promotion to Senior Graduate Master/Mistress provided they have obtained a Post-Graduate

推理論證 批判思辨 探究能力-問題解決 分析與發現 4-3 分析文本、數據等資料以解決問題 探究能力-問題解決 分析與發現 4-4

For the primary section, the additional teaching post(s) so created is/are at the rank of Assistant Primary School Master/Mistress (APSM) and not included in calculating the

• Tactics: the art of organizing an army, and using weapons or military units in combination against the enemy in military encounters.. • Operational art: a component of military

4. To apply the basic principles and techniques in preparing personal budget, and 5. To develop a proper attitude towards personal finance.. Resources for the TEKLA curriculum

• The unauthorized disclosure of information could be expected to have a severe or catastrophic adverse effect on organizational operations, organizational assets, or

• The unauthorized disclosure of information could be expected to have a severe or catastrophic adverse effect on organizational operations, organizational assets, or