Suche senden
Hochladen
비용 기반 그래프 탐색
•
0 gefällt mir
•
656 views
H
Hoseo University
Folgen
http://wawworld.me changhoonpark@gmail.com
Weniger lesen
Mehr lesen
Bildung
Technologie
Business
Melden
Teilen
Melden
Teilen
1 von 29
Empfohlen
Eurycoma longifolia extract - capsules 400mg, 60 კაფსულა
Eurycoma longifolia extract - capsules 400mg, 60 კაფსულა
David Gachechiladze
Calendario 2015
Calendario 2015
angeles loures
Driving Sustainable Product Design through Standardization and New End-of-Lif...
Driving Sustainable Product Design through Standardization and New End-of-Lif...
Sustainable Brands
Voice of Brands 2011
Voice of Brands 2011
Willem Sodderland
Word of Mouth Marketing - Euroforum Masters of Online Marketing 2008
Word of Mouth Marketing - Euroforum Masters of Online Marketing 2008
Willem Sodderland
Minuta 12
Minuta 12
Daniel Salcedo
Clase 7 - Unidad 4
Clase 7 - Unidad 4
María de los Ángeles C.
Minuta 11 ds
Minuta 11 ds
Daniel Salcedo
Empfohlen
Eurycoma longifolia extract - capsules 400mg, 60 კაფსულა
Eurycoma longifolia extract - capsules 400mg, 60 კაფსულა
David Gachechiladze
Calendario 2015
Calendario 2015
angeles loures
Driving Sustainable Product Design through Standardization and New End-of-Lif...
Driving Sustainable Product Design through Standardization and New End-of-Lif...
Sustainable Brands
Voice of Brands 2011
Voice of Brands 2011
Willem Sodderland
Word of Mouth Marketing - Euroforum Masters of Online Marketing 2008
Word of Mouth Marketing - Euroforum Masters of Online Marketing 2008
Willem Sodderland
Minuta 12
Minuta 12
Daniel Salcedo
Clase 7 - Unidad 4
Clase 7 - Unidad 4
María de los Ángeles C.
Minuta 11 ds
Minuta 11 ds
Daniel Salcedo
WoM & Strategische Marketing - Nyenrode 2008
WoM & Strategische Marketing - Nyenrode 2008
Willem Sodderland
20- hacialaprevencion
20- hacialaprevencion
Educación Familia
Rohan Akriti - 1 BHK , 2 BHK and 3 BHK Residential Apartments in Kanakapura ...
Rohan Akriti - 1 BHK , 2 BHK and 3 BHK Residential Apartments in Kanakapura ...
Rohan Builders
Shaker Mohammed Sr. Draftsman Arch
Shaker Mohammed Sr. Draftsman Arch
MOHD SHAKER
Indicador 2.1 fuentes de energia
Indicador 2.1 fuentes de energia
Maria Isabella Muñoz Hernandez
Buzzer, WoM & Blauwselect
Buzzer, WoM & Blauwselect
Willem Sodderland
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Willem Sodderland
Terminos carga viva, inercia y flexion
Terminos carga viva, inercia y flexion
rutsimar quintanillo
Buzz Awards Seminar 2009 Willem Sodderland
Buzz Awards Seminar 2009 Willem Sodderland
Willem Sodderland
Social media en internet voor lokaal klein bedrijf
Social media en internet voor lokaal klein bedrijf
Erno Hannink
Watson IBM Group1_StartSmart
Watson IBM Group1_StartSmart
Tirso Alberto Pi
Succesvol Facebook pagina's gebruiken voor je bedrijf
Succesvol Facebook pagina's gebruiken voor je bedrijf
Erno Hannink
Education for all 20161001 v8
Education for all 20161001 v8
ISSIP
Piano di Sviluppo 2016-2019 | SINTESI
Piano di Sviluppo 2016-2019 | SINTESI
pugliacreativa
Life cycle assessment of bags final
Life cycle assessment of bags final
Tejas Metaliya
Banner
Banner
jiandan sheji
100 años con Roald Dahl
100 años con Roald Dahl
Biblioabrazo.Ana Nebreda
Progetto di territorio
Progetto di territorio
Confartigianato Imprese Varese Campiotti
Game ai.fsm.02
Game ai.fsm.02
Hoseo University
Game ai.fsm.01
Game ai.fsm.01
Hoseo University
Game math.points and lines
Game math.points and lines
Hoseo University
Esl podcast 743 – writing a story
Esl podcast 743 – writing a story
Hoseo University
Weitere ähnliche Inhalte
Andere mochten auch
WoM & Strategische Marketing - Nyenrode 2008
WoM & Strategische Marketing - Nyenrode 2008
Willem Sodderland
20- hacialaprevencion
20- hacialaprevencion
Educación Familia
Rohan Akriti - 1 BHK , 2 BHK and 3 BHK Residential Apartments in Kanakapura ...
Rohan Akriti - 1 BHK , 2 BHK and 3 BHK Residential Apartments in Kanakapura ...
Rohan Builders
Shaker Mohammed Sr. Draftsman Arch
Shaker Mohammed Sr. Draftsman Arch
MOHD SHAKER
Indicador 2.1 fuentes de energia
Indicador 2.1 fuentes de energia
Maria Isabella Muñoz Hernandez
Buzzer, WoM & Blauwselect
Buzzer, WoM & Blauwselect
Willem Sodderland
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Willem Sodderland
Terminos carga viva, inercia y flexion
Terminos carga viva, inercia y flexion
rutsimar quintanillo
Buzz Awards Seminar 2009 Willem Sodderland
Buzz Awards Seminar 2009 Willem Sodderland
Willem Sodderland
Social media en internet voor lokaal klein bedrijf
Social media en internet voor lokaal klein bedrijf
Erno Hannink
Watson IBM Group1_StartSmart
Watson IBM Group1_StartSmart
Tirso Alberto Pi
Succesvol Facebook pagina's gebruiken voor je bedrijf
Succesvol Facebook pagina's gebruiken voor je bedrijf
Erno Hannink
Education for all 20161001 v8
Education for all 20161001 v8
ISSIP
Piano di Sviluppo 2016-2019 | SINTESI
Piano di Sviluppo 2016-2019 | SINTESI
pugliacreativa
Life cycle assessment of bags final
Life cycle assessment of bags final
Tejas Metaliya
Banner
Banner
jiandan sheji
100 años con Roald Dahl
100 años con Roald Dahl
Biblioabrazo.Ana Nebreda
Progetto di territorio
Progetto di territorio
Confartigianato Imprese Varese Campiotti
Andere mochten auch
(18)
WoM & Strategische Marketing - Nyenrode 2008
WoM & Strategische Marketing - Nyenrode 2008
20- hacialaprevencion
20- hacialaprevencion
Rohan Akriti - 1 BHK , 2 BHK and 3 BHK Residential Apartments in Kanakapura ...
Rohan Akriti - 1 BHK , 2 BHK and 3 BHK Residential Apartments in Kanakapura ...
Shaker Mohammed Sr. Draftsman Arch
Shaker Mohammed Sr. Draftsman Arch
Indicador 2.1 fuentes de energia
Indicador 2.1 fuentes de energia
Buzzer, WoM & Blauwselect
Buzzer, WoM & Blauwselect
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Terminos carga viva, inercia y flexion
Terminos carga viva, inercia y flexion
Buzz Awards Seminar 2009 Willem Sodderland
Buzz Awards Seminar 2009 Willem Sodderland
Social media en internet voor lokaal klein bedrijf
Social media en internet voor lokaal klein bedrijf
Watson IBM Group1_StartSmart
Watson IBM Group1_StartSmart
Succesvol Facebook pagina's gebruiken voor je bedrijf
Succesvol Facebook pagina's gebruiken voor je bedrijf
Education for all 20161001 v8
Education for all 20161001 v8
Piano di Sviluppo 2016-2019 | SINTESI
Piano di Sviluppo 2016-2019 | SINTESI
Life cycle assessment of bags final
Life cycle assessment of bags final
Banner
Banner
100 años con Roald Dahl
100 años con Roald Dahl
Progetto di territorio
Progetto di territorio
Mehr von Hoseo University
Game ai.fsm.02
Game ai.fsm.02
Hoseo University
Game ai.fsm.01
Game ai.fsm.01
Hoseo University
Game math.points and lines
Game math.points and lines
Hoseo University
Esl podcast 743 – writing a story
Esl podcast 743 – writing a story
Hoseo University
Property
Property
Hoseo University
목적이 부여된 에이전트 행동
목적이 부여된 에이전트 행동
Hoseo University
실질적인 길 계획하기
실질적인 길 계획하기
Hoseo University
FoundationKit
FoundationKit
Hoseo University
Raven
Raven
Hoseo University
프로젝트 구성
프로젝트 구성
Hoseo University
구성(Composition)
구성(Composition)
Hoseo University
Objective-C에서의 OOP
Objective-C에서의 OOP
Hoseo University
Dt2210.01.syllabus
Dt2210.01.syllabus
Hoseo University
Dt3160.01
Dt3160.01
Hoseo University
Mehr von Hoseo University
(14)
Game ai.fsm.02
Game ai.fsm.02
Game ai.fsm.01
Game ai.fsm.01
Game math.points and lines
Game math.points and lines
Esl podcast 743 – writing a story
Esl podcast 743 – writing a story
Property
Property
목적이 부여된 에이전트 행동
목적이 부여된 에이전트 행동
실질적인 길 계획하기
실질적인 길 계획하기
FoundationKit
FoundationKit
Raven
Raven
프로젝트 구성
프로젝트 구성
구성(Composition)
구성(Composition)
Objective-C에서의 OOP
Objective-C에서의 OOP
Dt2210.01.syllabus
Dt2210.01.syllabus
Dt3160.01
Dt3160.01
비용 기반 그래프 탐색
1.
게임 인공지능
GameAI 그래프 탐색 알고리즘 By Changhoon Park http://changhoonpark.wordpress.com Last Update : 2011. 08. 28 11년 9월 19일 월요일
2.
경로: 1 -
2 - 3 경로: 1 - 5 - 4 - 3 2 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
3.
3
그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
4.
if (TotalCostToThisNode[t] >
TotalCostToThisNode[n] + EdgeCost(n-to-t)) { TotalCostToThisNode[t] = TotalCostToThisNode[n] + EdgeCost(n-to-t)); Parent(t) = n; } 4 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
5.
5
그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
6.
NextClosestNode =
3.1 3 T 2 0.8 1.9 3.7 5 S pq.insert(m_iSource); 3.0 4 2.9 1.1 6 1 1.0 1 2 3 4 5 6 SPT SF 0-0 0-0 0-0 0-0 0-0 0-0 CTN 0.0 0.0 0.0 0.0 0.0 0.0 IPQ 5 6 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
7.
NextClosestNode = 5
3.1 3 T 2 0.8 1.9 3.7 1] int NextClosestNode = pq.Pop(); 5 S 2] m_ShortestPathTree[5] = m_SearchFrontier[5]; 3.0 4 2.9 3] if (NextClosestNode == m_iTarget) return 1.1 6 1 1.0 1 2 3 4 5 6 SPT 0-0 SF 0-0 0-0 0-0 0-0 0-0 0-0 CTN 0.0 0.0 0.0 0.0 0.0 0.0 IPQ 5 7 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
8.
NextClosestNode = 5
3.1 3 T 2 for (const Edge* pE=ConstEdgeItr.begin(); 0.8 !ConstEdgeItr.end(); pE=ConstEdgeItr.next()) 1.9 3.7 5 { S double NewCost = m_CostToThisNode[NextClosestNode] + pE->Cost(); 3.0 4 2.9 if (m_SearchFrontier[pE()->To()] == 0) 1.1 { 6 m_CostToThisNode[pE()->To()] = NewCost; 1 1.0 pq.insert(pE()->To()); m_SearchFrontier[pE()->To()] = pE(); } else if ( (NewCost < m_CostToThisNode[pE()->To()]) && 1 2 3 4 5 6 (m_ShortestPathTree[pE()->To()] == 0) ) { SPT 0-0 m_CostToThisNode[pE()->To()] = NewCost; SF 0-0 5-2 0-0 0-0 0-0 5-6 pq.ChangePriority(pE()->To()); CTN 0.0 1.9 0.0 0.0 0.0 3.0 m_SearchFrontier[pE()->To()] = pE(); } IPQ 2 6 } 8 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
9.
NextClosestNode = 2
3.1 3 T 2 0.8 1.9 3.7 5 S 3.0 4 2.9 1.1 6 int NextClosestNode = pq.Pop(); 1 1.0 m_ShortestPathTree[2] = m_SearchFrontier[2]; if (NextClosestNode == m_iTarget) return 1 2 3 4 5 6 SPT 5-2 0-0 SF 0-0 5-2 0-0 0-0 0-0 5-6 CTN 0.0 1.9 0.0 0.0 0.0 3.0 IPQ 2 6 9 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
10.
NextClosestNode = 2
3.1 3 T 2 for (const Edge* pE=ConstEdgeItr.begin(); 0.8 !ConstEdgeItr.end(); pE=ConstEdgeItr.next()) 1.9 3.7 5 { S double NewCost = m_CostToThisNode[NextClosestNode] + pE->Cost(); 3.0 4 2.9 if (m_SearchFrontier[pE()->To()] == 0) 1.1 { 6 m_CostToThisNode[pE()->To()] = NewCost; 1 1.0 pq.insert(pE()->To()); m_SearchFrontier[pE()->To()] = pE(); } else if ( (NewCost < m_CostToThisNode[pE()->To()]) && 1 2 3 4 5 6 (m_ShortestPathTree[pE()->To()] == 0) ) { SPT 5-2 0-0 m_CostToThisNode[pE()->To()] = NewCost; SF 0-0 5-2 2-3 0-0 0-0 5-6 pq.ChangePriority(pE()->To()); CTN 0.0 1.9 5.0 0.0 0.0 3.0 m_SearchFrontier[pE()->To()] = pE(); } IPQ 3 6 } 10 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
11.
NextClosestNode = 6
3.1 3 T 2 0.8 1.9 3.7 5 S 3.0 4 2.9 1.1 6 int NextClosestNode = pq.Pop(); 1 1.0 m_ShortestPathTree[6] = m_SearchFrontier[6]; if (NextClosestNode == m_iTarget) return 1 2 3 4 5 6 SPT 5-2 0-0 5-6 SF 0-0 5-2 2-3 0-0 0-0 5-6 CTN 0.0 1.9 5.0 0.0 0.0 3.0 IPQ 3 6 11 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
12.
NextClosestNode = 6
3.1 3 T 2 for (const Edge* pE=ConstEdgeItr.begin(); 0.8 !ConstEdgeItr.end(); pE=ConstEdgeItr.next()) 1.9 3.7 5 { S double NewCost = m_CostToThisNode[NextClosestNode] + pE->Cost(); 3.0 4 2.9 if (m_SearchFrontier[pE()->To()] == 0) 1.1 { 6 m_CostToThisNode[pE()->To()] = NewCost; 1 1.0 pq.insert(pE()->To()); m_SearchFrontier[pE()->To()] = pE(); } else if ( (NewCost < m_CostToThisNode[pE()->To()]) && 1 2 3 4 5 6 (m_ShortestPathTree[pE()->To()] == 0) ) { SPT 5-2 0-0 5-6 m_CostToThisNode[pE()->To()] = NewCost; SF 0-0 5-2 2-3 6-4 0-0 5-6 pq.ChangePriority(pE()->To()); CTN 0.0 1.9 5.0 4.4 0.0 3.0 m_SearchFrontier[pE()->To()] = pE(); } IPQ 3 4 } 12 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
13.
NextClosestNode = 4
3.1 3 T 2 0.8 1.9 3.7 5 S 3.0 4 2.9 1.1 6 int NextClosestNode = pq.Pop(); 1 1.0 m_ShortestPathTree[4] = m_SearchFrontier[4]; if (NextClosestNode == m_iTarget) return 1 2 3 4 5 6 SPT 5-2 6-4 0-0 5-6 SF 0-0 5-2 2-3 6-4 0-0 5-6 CTN 0.0 1.9 5.0 4.4 0.0 3.0 IPQ 3 4 13 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
14.
NextClosestNode = 4
3.1 3 T 2 for (const Edge* pE=ConstEdgeItr.begin(); 0.8 !ConstEdgeItr.end(); pE=ConstEdgeItr.next()) 1.9 3.7 5 { S double NewCost = m_CostToThisNode[NextClosestNode] + pE->Cost(); 3.0 4 2.9 if (m_SearchFrontier[pE()->To()] == 0) 1.1 { 6 m_CostToThisNode[pE()->To()] = NewCost; 1 1.0 pq.insert(pE()->To()); m_SearchFrontier[pE()->To()] = pE(); } else if ( (NewCost < m_CostToThisNode[pE()->To()]) && 1 2 3 4 5 6 (m_ShortestPathTree[pE()->To()] == 0) ) { SPT 5-2 6-4 0-0 5-6 m_CostToThisNode[pE()->To()] = NewCost; SF 0-0 5-2 2-3 6-4 0-0 5-6 pq.ChangePriority(pE()->To()); CTN 0.0 1.9 5.0 4.4 0.0 3.0 m_SearchFrontier[pE()->To()] = pE(); } IPQ 3 } 14 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
15.
NextClosestNode = 3
3.1 3 T 2 0.8 1.9 3.7 5 S 3.0 4 2.9 1.1 6 int NextClosestNode = pq.Pop(); 1 1.0 m_ShortestPathTree[4] = m_SearchFrontier[4]; if (NextClosestNode == m_iTarget) return 1 2 3 4 5 6 SPT 5-2 2-3 6-4 0-0 5-6 SF 0-0 5-2 2-3 6-4 0-0 5-6 CTN 0.0 1.9 5.0 4.4 0.0 3.0 IPQ 3 15 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
16.
template <class graph_type
> class Graph_SearchDijkstra { private: typedef typename graph_type::EdgeType Edge; typedef typename graph_type::NodeType Node; private: const graph_type & m_Graph; std::vector<const Edge*> m_ShortestPathTree; std::vector<double> m_CostToThisNode; std::vector<const Edge*> m_SearchFrontier; int m_iSource; int m_iTarget; void Search(); 16 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
17.
public:
Graph_SearchDijkstra(const graph_type& graph, int source, int target = -1) :m_Graph(graph), m_ShortestPathTree(graph.NumNodes()), m_SearchFrontier(graph.NumNodes()), m_CostToThisNode(graph.NumNodes()), m_iSource(source), m_iTarget(target) { Search(); } std::vector<const Edge*> GetAllPaths()const; std::list<int> GetPathToTarget()const; double GetCostToTarget()const; }; 17 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
18.
template <class graph_type>
void Graph_SearchDijkstra<graph_type>::Search() { IndexedPriorityQLow<double> pq(m_CostToThisNode, m_Graph.NumNodes()); pq.insert(m_iSource); while(!pq.empty()) { int NextClosestNode = pq.Pop(); m_ShortestPathTree[NextClosestNode] = m_SearchFrontier[NextClosestNode]; if (NextClosestNode == m_iTarget) return; 18 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
19.
graph_type::ConstEdgeIterator ConstEdgeItr(m_Graph, NextClosestNode);
for (const Edge* pE=ConstEdgeItr.begin(); !ConstEdgeItr.end(); pE=ConstEdgeItr.next()) { double NewCost = m_CostToThisNode[NextClosestNode] + pE->Cost(); if (m_SearchFrontier[pE->To()] == 0) { m_CostToThisNode[pE->To()] = NewCost; pq.insert(pE->To()); m_SearchFrontier[pE->To()] = pE; } 19 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
20.
else if (
(NewCost < m_CostToThisNode[pE->To()]) && (m_ShortestPathTree[pE->To()] == 0) ) { m_CostToThisNode[pE->To()] = NewCost; pq.ChangePriority(pE->To()); m_SearchFrontier[pE->To()] = pE; } } } } 20 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
21.
21
그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
22.
22
그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
23.
template <class graph_type,
class heuristic> class Graph_SearchAStar { private: typedef typename graph_type::EdgeType Edge; private: const graph_type& m_Graph; std::vector<double> m_GCosts; std::vector<double> m_FCosts; std::vector<const Edge*> m_ShortestPathTree; std::vector<const Edge*> m_SearchFrontier; int m_iSource; int m_iTarget; 23 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
24.
public:
Graph_SearchAStar(graph_type& graph, int source, int target) :m_Graph(graph), m_ShortestPathTree(graph.NumNodes()), m_SearchFrontier(graph.NumNodes()), m_GCosts(graph.NumNodes(), 0.0), m_FCosts(graph.NumNodes(), 0.0), m_iSource(source), m_iTarget(target) { Search(); } std::vector<const Edge*> GetSPT()const; std::list<int> GetPathToTarget()const; double GetCostToTarget()const; }; 24 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
25.
static double Calculate(const
graph_type& G, int nd1, int nd2); =================================================================== class Heuristic_Euclid { public: Heuristic_Euclid(){} template <class graph_type> static double Calculate(const graph_type& G, int nd1, int nd2) { return Vec2DDistance(G.GetNode(nd1).Position, G.GetNode(nd2).Position); } }; 25 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
26.
template <class graph_type,
class heuristic> void Graph_SearchAStar<graph_type, heuristic>::Search() { IndexedPriorityQLow<double> pq(m_FCosts, m_Graph.NumNodes()); pq.insert(m_iSource); while(!pq.empty()) { int NextClosestNode = pq.Pop(); m_ShortestPathTree[NextClosestNode] = m_SearchFrontier[NextClosestNode]; if (NextClosestNode == m_iTarget) return; graph_type::ConstEdgeIterator ConstEdgeItr(m_Graph, NextClosestNode); 26 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
27.
for (const Edge*
pE=ConstEdgeItr.begin(); !ConstEdgeItr.end(); pE=ConstEdgeItr.next()) { double HCost = heuristic::Calculate(m_Graph, m_iTarget, pE->To()); double GCost = m_GCosts[NextClosestNode] + pE->Cost(); if (m_SearchFrontier[pE->To()] == NULL) { m_FCosts[pE->T()] = GCost + HCost; m_GCosts[pE->To()] = GCost; pq.insert(pE->To()); m_SearchFrontier[pE->To()] = pE; } 27 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
28.
else if ((GCost
< m_GCosts[pE->To()]) && (m_ShortestPathTree[pE->To()]==NULL)) { m_FCosts[pE->To()] = GCost + HCost; m_GCosts[pE->To()] = GCost; pq.ChangePriority(pE->To()); m_SearchFrontier[pE->To()] = pE; } } } } 28 그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일
29.
29
그래프 탐색 알고리즘 무정보 그래프 탐색 에지완화 비용 기반 그래프 탐색 Dijkstra 알고리즘 A* By Changhoon Park http://changhoonpark.wordpress.com 11년 9월 19일 월요일