1 / 11

A* 알고리즘으로 푼 하노이 탑

A* 알고리즘으로 푼 하노이 탑. 2003181007 김동완 2003182032 이지하. 변수. Ctower : 노드 . vector< int > pillar[3] : 3 개의 기둥 value : 휴리스틱 값 Temp_Node : vector< Ctower > 임시로 한번에 생성되는 노드들 Sum_Node : vector< Ctower > 최단 경로 노드들을 저장. 함수. bool Search_min ( CTower temp1,CTower temp2)

Download Presentation

A* 알고리즘으로 푼 하노이 탑

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A* 알고리즘으로 푼 하노이 탑 2003181007 김동완 2003182032 이지하

  2. 변수 • Ctower : 노드. • vector<int> pillar[3] : 3개의 기둥 • value :휴리스틱 값 • Temp_Node : vector<Ctower> 임시로 한번에 생성되는 노드들 • Sum_Node: vector<Ctower> 최단 경로 노드들을 저장 .

  3. 함수 • boolSearch_min(CTower temp1,CTower temp2) • 두개의Ctower를 비교해서, 앞의 노드가 작으면 true를 반환한다. • Create_Node(CTower parent) • 3개의 변수를 생성해서 휴리스틱 값 설정 • void print(CTower temp); • 노드안의 기둥들을 출력 • intCTower::tower_value(std::vector<int> temp) • 노드안의 기둥 안의 값들을 저장한다.(휴리스틱 설정에 사용)

  4. STL 사용 함수 • 자료형: vector . • 디스크: vector<int>, 노드:vector<Ctower> • find() : 부모, 조상 노드와 겹치는 노드를찾는다. • for_each() : 최단 경로 노드 전체 출력, • 노드에휴리스틱 값 설정 • min_element() : 휴리스틱 최소 값을 가진 최단 경로 노드를 찾는다.

  5. 디스크의 출력 • 각 디스크들은 숫자로 표기. • 디스크는 크기에 따라 숫자를 정한다 • Console 창의 출력은 디스크에 따라 가로로 출력

  6. 이동 순서 (홀수 , 짝수) 디스크의 개수에 따른 이동의 순서 차이

  7. 함수의 설정 함수 포인터를 이용. 경우에 맞게 분기하도록 설정(홀수 , 짝수) for_each()에서 노드의 휴리스틱값 설정에 이용

  8. 홀수의 이동 예

  9. 휴리스틱의 가중치 case:0 case:4 case:1 case:5 case:2 case:0 case:3 case:1

  10. 홀수 디스크의 경우

  11. 짝수 디스크의 경우

More Related