AilurusUmbra
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: 107-2, EC, GA --- # 演化計算 Final Exam > [color=#0d965d] 連結:http://bit.ly/EC_exam_0416235 > > [name=**0416235 劉昱劭**] ![](https://i.imgur.com/EnyeePo.jpg) --- ## 1. GA Let $S_1=$ `**1****10***` and $S_2=$ `*1*0*1******` be two schema * (a) Give the order $o(\cdot)$ and the defining length $\delta(\cdot)$ of $S_1$ & $S_2$ order 表 schema 中被定義位元 (i.e. not don't care) 的數量。 defining length 表第一個和最後一個被定義位元的距離。 $o(S_1)$ = 3, $~\delta(S_1)$ = 9 - 3 = 6 $o(S_2)$ = 3, $~\delta(S_2)$ = 5 - 1 = 4 > > (b)~(e) > >* **Holland's schema theorem (Approximated)**: > > * 此定理描述: > > 隨著 generation 經過, order 和 defining length 較短、且 fitness 在平均之上的 schemata 較容易繼續存活於 population。 > > * ![](https://i.imgur.com/c6JLC5g.png) > > * $m(H,t)$ 描述在第 t 代,符合 schema $H$ 的 indiviudal 數量。 > > * $f(H)$ 表 schema H 的 fitnessX > > * $\overline{f}$ 表所有符合此 schema 的 individuals 的平均 fitness * (b) Probability for a 1-point crossover operator with a crossover rate $p_c$ to break $S_1$ * 由 crossover 破壞 schema $S_1$ 的機率:$p_c\dfrac{\delta(S_1)}{l{S_1}-1} = p_c\times\dfrac{6}{11}$ * (c\) Probability for a mutation operator with a mutation rate $p_c$ to break $S_1$ * 由 mutation 破壞 schema $S_1$ 的機率:$o(S_1)p_m= 3\times p_m$ * (d) Proabability that $S_1$ survives from (b) & (c\)'s operation * $1 - p_c\dfrac{\delta(S_1)}{l_{S_1}-1} - o(S_1)p_m ~= ~1-\dfrac{6p_c}{11}-3p_m$ * (e) * 由 crossover 破壞 schema $S_2$ 的機率:$p_c\dfrac{\delta(S_2)}{l_{S_2}-1} = p_c\times\dfrac{4}{11}$ * 由 mutation 破壞 schema $S_2$ 的機率:$o(S_2)p_m= 3\times p_m$ * schema $S_2$ 存活的機率: $1 - p_c\dfrac{\delta(S_2)}{l_{S_2}-1} - o(S_2)p_m ~= ~1-\dfrac{4p_c}{11}-3p_m$ >> **Building Block Hypothesis of Genetic Algorithm** >> * Building blocks are defined as: >> low order, low defining-length schemata with above average fitness. >> * Building blocks 提供有用的 (因 fitness 高,可能有用) 資訊,比起去嘗試所有可能的 schemata,不如留下又短又優秀的這些 schemata (i.e. building blocks) 來做 crossover。 >> * Holland's schema theroem 便是在說 building block 傾向於留在 population 參與往後的 operation。 * (f) * $S_1, S_2$ 以 order 和 defining length 都蠻短的 (當然,是否足夠短其實要看問題決定),尤其是 defining length 較短的 $S_2$,以這點來說他們也許可當作 building block 的候選人。 * 但因我們不知道這兩個 schema 的 fitness 好壞,因此無法確定他們是否該做為 building blocks。 ## 2. Niching techniques | Fitness | 10 | 20 | 30 | 40 | | ------- |---|---|---|---| | Fitness Sharing| 100|200|300|400| | Deterministic Crowding| 250|250|250|250| >> 結果應類似此圖: >> ![](https://i.imgur.com/StG8oqX.png) * Fitness sharing 和 Deterministic crowding 都是維持 niche 的方式。 * Fitness sharing 的概念較像是環境負載力,每個 local optimum 不能無上限的容納一堆 individual,若有多個 individual 能達到同一個 local optimum,其 fitness (像是環境負載力) 會相對下降,以阻止其他 individual 繼續往同一個 optimum 靠近。 * 我們設計一個 sharing function 將 individual 和其 neighbors 的 fitness 一起下降,因此能用 selection 自動砍掉一些**相似度很高的 individual** (i.e. 佔據相同 peak 的 individuals),以此分散 individual 的分布,或說維持 population 的多樣性。 * Fitness sharing 期望的結果是 individual 數量和 fitness 成比例的分配。 * 題目的 fitness function 有四個 peak,10:20:30:40。 * individual 數量的分布也應維持相同比例 100:200:300:400 * crowding 期望完全均分 individual 到每一個 optimum 上,因此此題期望的分布會是 250:250:250:250 = 1:1:1:1 * 我們設計一個量測 individual 間 distance(similarity) 的函式, 每次 crossover(or other binary operator) 產生子代時,量測不同的 pair 方式 (p1o1+p2o2 或 p1o2+p2o1) 的 distance,取較聚集的那種來進入 survival selection。 * 相較於 Fitness sharing 由 selection 機制,自動將過於擁擠的 individual 淘汰,Deterministic crowding 像是多插入一個 crowding operator 在 selection 之前,相對主動地保證 population 有達到 crowding/niching 的效果。 --- ## 3. Local Search (memetic algorithm) * 假設我們設計了一個 Larmarkian 的 local search operator $L(x)$, 和一個 Baldwinian 的 local search operator $B(x)$: |Local search|After $L(x)$|After $B(x)$| |------- | --------------|---| |individual $x$| $x^*=L(x)$ | $x$ | |fitness $f(x)$| $f(L(x))=f(x^*)$| $f(B(x))=f(x^*)$| |Search space|spikely reduce to discrete grid| no change * Larmarkian local search 會直接將 individual $x$ 用 local search 找到的 local optimum $x^*$取代,並更新該 individual 的 fitness 成 $f(x^*)$。 * 如果對 population 內所有 individual 做 Larmarkian local search,population 的多樣性會急速下降。 * 如果 fitness function 是有很多 local optimum (e.g. Ackley function),那可能多樣性會衰減慢一點,越少 local optimum 的 local function,越可能在很少的 (甚至一、兩個) generation 之內,就會直接收斂成所有 individual 都長一樣。 * 全部的 individual 都變成 local optimum,也就是 fitness function 上的 peak,search space 會退化到類似 grid search,因 individual 只有可能位在那幾個 peak (像是格子點)。 * Baldwinian local search 只會更新 fitness 成 $f(x^*)$,而 individual 會保持原狀,所以 search space 並不會因 Baldwinian local search 而改變。 * 長期來看,靠近較好 optimum 的那些 individual,因為擁有較高的 fitness,可能會慢慢 dominate 整個 population,因此 Baldwinian local search 有可能使得所有 individual 都收歛到 global optimum 上 (當然,要先有 individual 在 global optimum 附近)。 ## 4. Multiobjective problem ### 4-1. 考慮 search space * feasible region 是由兩個不等式畫開的右半平面 * 兩條邊界有一個交點 (0.8, 1),可得 $x_1\ge0.8$ > ![](https://i.imgur.com/Z0B0Zui.png =500x) ### 4-2. 考慮目標函式 | |$min~ f_1=2.5x_1-2$|$min~ f_2=\dfrac{1+x_2}{x_1}$| |------- | --------------|---| |search space| 若要最小化 $f_1$,<br>則應該取靠左的點,<br>即在右半平面上,<br>兩條邊界上的所有點 | 若要最小化 $f_2$,因 $x_1$ 恆正,因此應取越小的 $x_2$ 越好,<br>應取靠下的點,即在右半平面上,下面那條邊界上的所有點:| |optimal solutions| $\{(x_1, x_2)~ \vert$<br>$(~5x_1−3x_2=1 \lor 5x_1+2x_2=6)$<br>$\land ~x_1 \ge 0.8 \}$| $\{(x_1, x_2)~ \vert ~5x_1+2x_2=6 \land x_1 \ge 0.8 \}$| |Plot|![](https://i.imgur.com/3Ys3XPR.png =350x)|![](https://i.imgur.com/Z2jFDTE.png =350x)| * 取兩組 optimal solutions 的交集,即 $f_2$ 的最佳解 $\{(x_1, x_2)~ \vert ~5x_1+2x_2=6 \land x_1 \ge 0.8 \}$ --- ### 4-3. 畫出 pareto front 跟其對應的 solutions $(x_1, x_2)$ * 下圖藍點可看到 $x_1$ 最小的那個 solution 是 (0.8, 1) > ![](https://i.imgur.com/A8BtucY.png) * 任取線上的另一點,大約是 (4.8, -9),也落在$~5x_1+2x_2=6$,如同上面分析的, 能造成最佳 fitness 的 solutions 就是 $~5x_1+2x_2=6 \land x_1 \ge 0.8$ 上的點。 >![](https://i.imgur.com/VVwA1Q7.png) --- ### 4-4. MATLAB code for **problem 4** ```matlab= % To plot search space [x, y] = meshgrid(v); conditions = (5*x+2*y>=6) & (5*x-3*y>=1); cond = zeros(length(v)); % Initialize cond(conditions) = NaN; surf(x, y, cond) view(0,90) ``` ```matlab= % To plot the pareto front & corresponding solutions function f=my_first_multi(x) f(1)=x(1)*2.5 - 2; f(2)=( 1 + x(2) )./x(1); end fitnessfcn=@my_first_multi; nvars=2; lb=[-100,-100]; ub=[100,100]; A=[-5 -2; -5 3]; b=[-6; -1]; Aeq=[];beq=[]; opt=optimoptions('paretosearch','PlotFcn',{'psplotparetof' 'psplotparetox'}); [x,fval] = paretosearch(fitnessfcn,nvars,A,b,Aeq,beq,lb,ub,[],opt); ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully