1 / 12

Optimal polygon triangulation

Optimal polygon triangulation. B98570137 廖柏翰 – 組長 B96570112 陳裕仁 B98570118 詹燿鴻 B98570131 蔡宗翰 B98570153 林承毅. 刻劃最佳解結構. Characterize the structure of an optimal solution 定義 weighting fuction : w (  v i v j v k ) = ( Vi+Vj +Vk) = P i P j P k

gitel
Télécharger la présentation

Optimal polygon triangulation

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. Optimal polygon triangulation B98570137 廖柏翰– 組長 B96570112 陳裕仁 B98570118 詹燿鴻 B98570131 蔡宗翰 B98570153 林承毅

  2. 刻劃最佳解結構 Characterize the structure of an optimal solution 定義weightingfuction :w(vivjvk)= (Vi+Vj +Vk) =PiPjPk We start with vi-1 rather than vi , to keep the structure as similar as possible to the matrix chain multiplication problem. Ai對應於邊 Ai+1..j對應於 故 矩陣連乘為最佳三角化之特例 q = t[i, k]+ t[k+1, j]+w(vi-1vkvj)

  3. Binary Tree for Triangulation: Ex:((A1(A2A3))(A4(A5A6))) The associated binary tree has n leaves, and hence n-1 internal nodes. Since each internal node other than the root has one edge entering it, there are n-2 edges between the internal nodes. full binary tree (n-1 leaves)  triangulation (n sides)

  4. Dynamic Programming A triangulation of a polygon is a set T of chords of thepolygon that divide the polygon into disjoint triangles T contains v0vkvn. w(T)=w(v0vkvn)+t[1,k]+t[k+1,n] The two subproblem solutions must be optimal or w(T) would be less. –Suppose the optimal solution has the first split at position k, we will divide polygon into A1..k (t[i,k]) Ak+1..n (t[k+1,n])

  5. OPTIMAL TRIANGULATION PROBLEM 求邊長數為(n+2)的多邊形切成多個三角形後,內部所有三角形weightingfunction總和最小 值最小。 key: 1.必成(n+2)-2 = n 個三角形, ex: ( 3+2 ) - 2 = 3 2. weightingfunction :W(ΔVi,Vj ,Vk) = Vi+Vj +Vk V0 V1 V4 Input:0,6,4,3,2 V3 V2

  6. Let t[i,j] is W<Vi-1,Vi,….,Vj> • Chose a point k for i≦ k<j • W<Vi-1,Vi,..,Vj> = W<Vi-1,Vi,..,Vk> + W<Vk+1,Vi,..,Vj> ?? Vj Vi-1 Vi The weight of the middle triangle is :W(ΔVi-1+Vk+Vj) Vk

  7. AN OPTIMAL SOLUTION TO A PROBLEM COTAINS WHITIN IT AN OPTIMAL SOLUTION TO SUBPROBLEMS • Let is a optimal answer to V0-7 • The yellow lines is a optimal answer to V0-4,why?? Proof by contradiction

  8. 用遞迴定義最佳解 • Recursively define the value of an optimal solution. Vj Vi-1 M R L Vk

  9. 由下往上計算一個最佳解 • Compute the value of an optimal solution in a bottom‐up fashion. • Example => Input :1 2 3 4 5 6 1 2 6 3 4 5

  10. 由下往上計算一個最佳解 i = 1 , j = 3 , find t[1,3] : • t[1,1] + t[2,3] + w(v0,v1,v3) = 0 + 9 + (1+2+4) = 16 • t[1,2] + t[3,3] + w(v0,v2,v3) = 6 + 0 + (1+3+4) = 14 設W(Vi,Vj,Vk) = Vi + Vj + Vk

  11. 經由計算的資訊建立最佳解 • Construct an optimal solution from computed information. • Output : Triangle<0,1,2> Triangle<0,2,3> Triangle<0,3,4> Triangle<0,4,5>

  12. 程式實作結果 • int WeightingFunction(int i, int j, int k){ • return i+j+k; • } • MatrixChain() • printTable() • OptimalAnswer() • // Polygon Triangulation.c

More Related