亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在大空間尺度上加速A *算法?

如何在大空間尺度上加速A *算法?

如何在大空間尺度上加速A *算法?從http://ccl.northwestern.edu/netlogo/models/community/Astardemo,我通過使用網絡中的節點來定義最低成本路徑來編碼A *算法。代碼似乎有效,但是當我在大空間尺度上使用它時它太慢了。我的景觀有1000個補丁x 1000個補丁,1個補丁= 1個像素。即使我減少400補丁x 400補丁1補丁= 1像素,它仍然太慢(我不能修改我的景觀低于400補丁x 400補丁)。這是代碼:to find-path [ source-node destination-node] let search-done? falselet search-path []let current-node 0set list-open []set list-closed []  let list-links-with-nodes-in-list-closed []let list-links []set list-open lput source-node list-openwhile [ search-done? != true][    ifelse length list-open != 0[   set list-open sort-by [[f] of ?1 < [f] of ?2] list-open    set current-node item 0 list-open    set list-open remove-item 0 list-open    set list-closed lput current-node list-closed   ask current-node   [       if parent-node != 0[     set list-links-with-nodes-in-list-closed lput link-with parent-node list-links-with-nodes-in-list-closed      ]     ifelse any? (nodes-on neighbors4) with [ (xcor = [ xcor ] of destination-node) and (ycor = [ycor] of destination-node)]     [       set search-done? true      ]     [               ask (nodes-on neighbors4) with [ (not member? self list-closed) and (self != parent-node) ]         [           if not member? self list-open and self != source-node and self != destination-node         [           set list-open lput self list-open           set parent-node current-node           set list-links sentence (list-links-with-nodes-in-list-closed) (link-with parent-node)           set g sum (map [ [link-cost] of ? ] list-links)           set h distance destination-node            set f (g + h)         ]       ]     ]   ]][   user-message( "A path from the source to the destination does not exist." )   report []  ]]set search-path lput current-node search-pathlet temp first search-pathwhile [ temp != source-node ][  ask temp[不幸的是,我不知道如何加快這段代碼。是否有解決方案在大空間尺度上快速計算最低成本路徑?非常感謝您的幫助。
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 1144 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號