SlideShare ist ein Scribd-Unternehmen logo
1 von 29
게임 인공지능
                                                                   GameAI




                 그래프 탐색 알고리즘
                 By Changhoon Park
                 http://changhoonpark.wordpress.com
                                                      Last Update : 2011. 08. 28

11년 9월 19일 월요일
경로: 1 - 2 - 3

                                                         경로: 1 - 5 - 4 - 3




             2


                 그래프 탐색 알고리즘   무정보 그래프 탐색     에지완화
                               비용 기반 그래프 탐색   Dijkstra 알고리즘
                                              A*

                                                                               By Changhoon Park
                                                                         http://changhoonpark.wordpress.com

11년 9월 19일 월요일
3


                 그래프 탐색 알고리즘   무정보 그래프 탐색     에지완화
                               비용 기반 그래프 탐색   Dijkstra 알고리즘
                                              A*

                                                                    By Changhoon Park
                                                              http://changhoonpark.wordpress.com

11년 9월 19일 월요일
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


                 그래프 탐색 알고리즘   무정보 그래프 탐색     에지완화
                               비용 기반 그래프 탐색   Dijkstra 알고리즘
                                              A*

                                                                    By Changhoon Park
                                                              http://changhoonpark.wordpress.com

11년 9월 19일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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


                 그래프 탐색 알고리즘   무정보 그래프 탐색     에지완화
                               비용 기반 그래프 탐색   Dijkstra 알고리즘
                                              A*

                                                                    By Changhoon Park
                                                              http://changhoonpark.wordpress.com

11년 9월 19일 월요일
22


                 그래프 탐색 알고리즘   무정보 그래프 탐색     에지완화
                               비용 기반 그래프 탐색   Dijkstra 알고리즘
                                              A*

                                                                    By Changhoon Park
                                                              http://changhoonpark.wordpress.com

11년 9월 19일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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일 월요일
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


                 그래프 탐색 알고리즘   무정보 그래프 탐색     에지완화
                               비용 기반 그래프 탐색   Dijkstra 알고리즘
                                              A*

                                                                    By Changhoon Park
                                                              http://changhoonpark.wordpress.com

11년 9월 19일 월요일

Weitere ähnliche Inhalte

Andere mochten auch

WoM & Strategische Marketing - Nyenrode 2008
WoM & Strategische Marketing - Nyenrode 2008WoM & Strategische Marketing - Nyenrode 2008
WoM & Strategische Marketing - Nyenrode 2008Willem Sodderland
 
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 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 ArchShaker Mohammed Sr. Draftsman Arch
Shaker Mohammed Sr. Draftsman ArchMOHD SHAKER
 
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008Willem Sodderland
 
Terminos carga viva, inercia y flexion
Terminos carga viva, inercia y flexionTerminos carga viva, inercia y flexion
Terminos carga viva, inercia y flexionrutsimar quintanillo
 
Buzz Awards Seminar 2009 Willem Sodderland
Buzz Awards Seminar 2009 Willem SodderlandBuzz Awards Seminar 2009 Willem Sodderland
Buzz Awards Seminar 2009 Willem SodderlandWillem Sodderland
 
Social media en internet voor lokaal klein bedrijf
Social media en internet voor lokaal klein bedrijfSocial media en internet voor lokaal klein bedrijf
Social media en internet voor lokaal klein bedrijfErno Hannink
 
Watson IBM Group1_StartSmart
Watson IBM Group1_StartSmartWatson IBM Group1_StartSmart
Watson IBM Group1_StartSmartTirso Alberto Pi
 
Succesvol Facebook pagina's gebruiken voor je bedrijf
Succesvol Facebook pagina's gebruiken voor je bedrijfSuccesvol Facebook pagina's gebruiken voor je bedrijf
Succesvol Facebook pagina's gebruiken voor je bedrijfErno Hannink
 
Education for all 20161001 v8
Education for all 20161001 v8Education for all 20161001 v8
Education for all 20161001 v8ISSIP
 
Piano di Sviluppo 2016-2019 | SINTESI
Piano di Sviluppo 2016-2019 | SINTESIPiano di Sviluppo 2016-2019 | SINTESI
Piano di Sviluppo 2016-2019 | SINTESIpugliacreativa
 
Life cycle assessment of bags final
Life cycle assessment of bags finalLife cycle assessment of bags final
Life cycle assessment of bags finalTejas Metaliya
 

Andere mochten auch (18)

WoM & Strategische Marketing - Nyenrode 2008
WoM & Strategische Marketing - Nyenrode 2008WoM & Strategische Marketing - Nyenrode 2008
WoM & Strategische Marketing - Nyenrode 2008
 
20- hacialaprevencion
20- hacialaprevencion20- 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 ...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 ArchShaker Mohammed Sr. Draftsman Arch
Shaker Mohammed Sr. Draftsman Arch
 
Indicador 2.1 fuentes de energia
Indicador 2.1 fuentes de energiaIndicador 2.1 fuentes de energia
Indicador 2.1 fuentes de energia
 
Buzzer, WoM & Blauwselect
Buzzer, WoM & BlauwselectBuzzer, WoM & Blauwselect
Buzzer, WoM & Blauwselect
 
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
Buzzer & WoMMarketing - NVZ/NCV - Nunspeet 2008
 
Terminos carga viva, inercia y flexion
Terminos carga viva, inercia y flexionTerminos carga viva, inercia y flexion
Terminos carga viva, inercia y flexion
 
Buzz Awards Seminar 2009 Willem Sodderland
Buzz Awards Seminar 2009 Willem SodderlandBuzz 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 bedrijfSocial media en internet voor lokaal klein bedrijf
Social media en internet voor lokaal klein bedrijf
 
Watson IBM Group1_StartSmart
Watson IBM Group1_StartSmartWatson IBM Group1_StartSmart
Watson IBM Group1_StartSmart
 
Succesvol Facebook pagina's gebruiken voor je bedrijf
Succesvol Facebook pagina's gebruiken voor je bedrijfSuccesvol Facebook pagina's gebruiken voor je bedrijf
Succesvol Facebook pagina's gebruiken voor je bedrijf
 
Education for all 20161001 v8
Education for all 20161001 v8Education for all 20161001 v8
Education for all 20161001 v8
 
Piano di Sviluppo 2016-2019 | SINTESI
Piano di Sviluppo 2016-2019 | SINTESIPiano di Sviluppo 2016-2019 | SINTESI
Piano di Sviluppo 2016-2019 | SINTESI
 
Life cycle assessment of bags final
Life cycle assessment of bags finalLife cycle assessment of bags final
Life cycle assessment of bags final
 
Banner
BannerBanner
Banner
 
100 años con Roald Dahl
100 años con Roald Dahl100 años con Roald Dahl
100 años con Roald Dahl
 
Progetto di territorio
Progetto di territorioProgetto di territorio
Progetto di territorio
 

Mehr von Hoseo University (14)

Game ai.fsm.02
Game ai.fsm.02Game ai.fsm.02
Game ai.fsm.02
 
Game ai.fsm.01
Game ai.fsm.01Game ai.fsm.01
Game ai.fsm.01
 
Game math.points and lines
Game math.points and linesGame math.points and lines
Game math.points and lines
 
Esl podcast 743 – writing a story
Esl podcast 743 – writing a storyEsl podcast 743 – writing a story
Esl podcast 743 – writing a story
 
Property
PropertyProperty
Property
 
목적이 부여된 에이전트 행동
목적이 부여된 에이전트 행동목적이 부여된 에이전트 행동
목적이 부여된 에이전트 행동
 
실질적인 길 계획하기
실질적인 길 계획하기실질적인 길 계획하기
실질적인 길 계획하기
 
FoundationKit
FoundationKitFoundationKit
FoundationKit
 
Raven
RavenRaven
Raven
 
프로젝트 구성
프로젝트 구성프로젝트 구성
프로젝트 구성
 
구성(Composition)
구성(Composition)구성(Composition)
구성(Composition)
 
Objective-C에서의 OOP
Objective-C에서의 OOPObjective-C에서의 OOP
Objective-C에서의 OOP
 
Dt2210.01.syllabus
Dt2210.01.syllabusDt2210.01.syllabus
Dt2210.01.syllabus
 
Dt3160.01
Dt3160.01Dt3160.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일 월요일