黃士昕
    • 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
    Search in Complex Environments 重點整理筆記 == 在前面可以知道用tree可以找到最佳解,但是現實中很多問題都不能用tree來表達 ## Local Search Algorithms and Optimization Algorithms Search algo 如過可以建成一個tree得時候$\equiv$它可以系統化,只要找到goal就可以找到相對應的路徑,但是在很多問題,ex:八皇后(八隻皇后不互相攻擊 ) -> **順序對他來說沒有影響** -> **尋找不在意收尋路徑的algo以解決一般化問題** ### Local Search Local Search -> 以一單一currnt node,只能移動到相鄰的node - 所以memory低(方向選項簡單) - 在很大或是無限大的空間,可以找到不錯的解 適合用來解純的最佳化問題 ![](https://i.imgur.com/Oh59BsX.png) 在電腦中無法看到整個全貌,往往只能找到local最佳解,也很難探測到非常精細的最佳解 有許多algo可以協助找到不錯的解 ### Hill Climbing Search 可以用來找最高峰(最低),**不需要建search tree**,每次找**最棒的鄰居**,只需要跑loop變可以找到local 最佳解 ``` Hillclimbing() current loop do neighbor = 選一個最高value的鄰居 if neighbor.value <= current.value \\currrnt是鄰居中最大的 return current.state current = neighbor ``` 所以也叫做**greedy local search**,簡單效果不錯,但是爾偶會卡住在local maximum, Ridges, Plateaux.... 以八皇后的問題: - 大約14%可以solve,86%會卡在local maximum(很看運氣...) - 執行速度很快,只需4 steps當走對時,3 steps當卡住時,在$8^8$的stae space中,算是很快 如果不每次找最佳的的鄰居,反而更有機會跳出local maximum,找到解的機率14% -> 94%,21 steps 當走對時,64 steps當走錯時,但是**所需花費時間會變多** #### Stochastic Hill Climbing 拜訪過所有鄰居,不用找最強的鄰居,**隨機**在**比current 強**的鄰居中挑一格出來 #### First Choice Climbing 依序visit 鄰居,找到並選擇第一個比current 強的鄰居,而不是拜訪過所有鄰居 #### Random Restart Hill Climbing 隨機跑很多次(因為他速度蠻快的)找很多組解,再從很多組解中挑出最好的 找出的解好不好與state-space, landscape有很大的關聯 ### Simulated Annealing模擬退火 Annealing -> 退火 先把鐵加熱,再把鐵遡行,再冷卻 - 溫度高->好改變 - 溫度低->不好改變 **一開始高溫然後一路往低溫的過程** 一開始在探索,比較可以接受較差的解,隨著不斷重複function,可以接受較差解的機率降低 不是永遠取最佳鄰居,而是**隨機**取周圍鄰居 T = schedule(t) //T會隨著t變大T會越來越小 schedule 可以隨自己的設定下降,看自己目標 ![](https://i.imgur.com/BsdEV95.png) ``` if(deltaE > 0(鄰居條件比current好) 選鄰居 else if(current條件比鄰居好) 還是有一定機率選鄰居 ``` 所以可以說是當 $\Delta$ E越大(鄰居差current很多),其選鄰居的機率越小 $\Delta$ E越小(鄰居差current差不多),其選鄰居的機率越大 又T在一開始很大,在逐漸變小 T 越大,選到差鄰居的機率越大 T 越小,選到差鄰居的機率越小 設定$e^{\Delta E/T}$是為了讓他機率在指數計算可以快速下降,可以在前幾步容錯率高,後面容錯率低 冷卻時程是SA的核心之一,不同的冷卻時程會導致不同的尋優績效, 但目前並沒有一個設計準則可供依循。 由於SA是由現有状態推演出下一状態,一次僅探討一個可行解。因此 在求解大規模問題時,通常需要耗費相當大的電腦執行時間。 ### Local Beam Search(一次處理多個解) 一次處理k個解,每個都去找他們的successor(鄰居),再從這些可能state中挑出最佳的successor(天女散花的感覺)(資訊會傳到彼此) ``` 隨機選k個states while(1) if(找到goal) return solution else 再選k個best successors ``` 跟一次跑一個解跑k次的差別?一次一次跑很容易被一團很強的鄰居吸引(像是idependent跑k次沒有特別意義),但是Local Beam search可以比較全面的去找 **Stochastic Beam Search**不是永遠挑最佳的successor,而是隨機挑successor,多了隨機性 ### Genetic Algo 是Stochastic Beam Search的一種 步驟: 1. Initial Population:先確定大小 2. Fitness funtion:適應函數用來計算染色體( chromosome )好壞的標準,用來篩選出適應程度較佳的個體(染色體)。 3. Selection:想像是我們要做基因改造,會把比較好的基因給留下來,不好的基因給去除這樣的概念。 4. Crossover:兩兩基因進行交配進而產生出新的染色體。而兩兩染色體是否交配也會透過交配機率進行控制,切分有很多切法,看目標自己調配。 5. Mutation:針對單一的染色體,會根據突變機率來改變,這是因為避免最後的結果陷入local最佳解的狀況。 ![](https://i.imgur.com/buVEg5K.png)

    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