跳到主要内容

東京大学 情報理工学系研究科 創造情報学専攻 2019年8月実施 筆記試験 第1問

Author

tomfluff, itsuitsuki

Description

点列 をこの順に結んでできる凸 角形が与えられたとき、その凸 角形の三角形分割とは、その内部を重なりなく三角形に分割する方法のことである。

まずは、凸 角形の三角形分割の数を求める。その数を と書く。例えば、 = 2 である。

(1) の値を答えよ。

(2) の各式を用いて書き表せ。ただし、 とする。

(3) 任意の に対する を求めるアルゴリズムは、以下のような疑似コードで表現できる。 に当てはまるコードを答えよ。またこのアルゴリズムの計算量(オーダー)を答えよ。

C[2] = 1; C[3] = 1;
for(i=4...n)
C[i] = 0;
for(i=4...n)
for(j=0...i-3)
[ ① ]
return C[n];

次に、凸 角形のコスト最小三角形分割を求める。ここで、三角形分割のコストとは、構成する三角形のコストの和であるとし、三角形のコストとはその三角形を構成する辺のコストの和であるとする。 また、凸 角形を構成する任意の 頂点 を結ぶ辺のコスト はすべて与えられているものとする。

(4) 与えられた凸 角形のコスト最小三角形分割を求める問題を、小問題に分けて解いていくことを考える。 頂点 から時計回りに 個の頂点を訪問し、 に戻ってくる経路によって囲まれる多角形について、コスト最小の三角形分割のコストを と書くことにする(下図参照)。 ここで、 についてすべて計算済みであるとして、 の式で表せ。ただし、 とする。またその状況を説明する図も付して示せ。

(5) 上記 (4) で得られた関係式を用いて、任意の凸 角形の三角形分割の最小コストを求めるアルゴリズムの疑似コードを、10 行程度で示せ。またその計算量(オーダー)を答えよ。

Description (English)

Given a convex n-gon made by connecting a point sequence in this order, a triangulation of the convex n-gon is a way of dividing its interior into triangles without overlap.

First, we count the number of triangulations of a convex n-gon. We denote the number as : For example, .

Answer the values of , , and .

Represent as a function of , , , ..., and . We define and .

The following pseudo-code implements an algorithm for computing for arbitrary . Answer the code that fills [ ① ]. Also answer the computational complexity (order) of the algorithm.

C[2] = 1; C[3] = 1;
for(i=4...n)
C[i] = 0;
for(i=4...n)
for(j=0...i-3)
[ ① ]
return C[n];

Next, we find the triangulation of a convex n-gon with a minimum cost. Here, the cost of a triangulation is defined as the sum of the cost of triangles in the triangulation, and the cost of a triangle is defined as the sum of the cost of the edges composing the triangle. Assume that all (), the costs of the edges connecting an arbitrary pair of vertices () of the n-gon, are given.

We consider solving the problem of finding a triangulation with a minimum cost by dividing the problem into subproblems. We denote as the cost of triangulating a polygon made by a path starting from , visiting vertices clockwise, and then coming back to (see the figure below). Assume that are all given for and . Represent as a function of and . We define . Also draw a figure explaining the situation.

Give approximately 10-line pseudo-code implementing an algorithm to compute the minimum cost of triangulating an arbitrary n-gon using the formula obtained in (4). Also answer the computational complexity (order) of the algorithm.

Kai

(1)

C[4]=2, C[3]=1, C[2]=1

C[5]=5

C[6]=14

C[7]=42

(2)

Based on the representation we can see that:

(3)

To complete the code we must add:

C[i] = C[i] + C[j+2]*C[i-j-1]

This will allow the sum to equal the equation found in (2).

The time complexity is , and the space complexityu is .

(4)

Tomfluff's solution is wrong. Please refer to here to see his solution. The original problem actually lacks an important assumption: . Without this assumption, % must be in the equation to prevent exceeding . In the following we suppose the assumption holds. 题目实际上缺了一个假设:,如果没有这个假设,我们需要在 index 里包含 % 因为有可能超到 2n 去。下面我们认为题目给了这个假设。

In the figure given (a sub-polygon also a clockwisely arranged point sequence), any triangulation has a triangle including . This triangle has another node . So we can traverse . 在题目给的图(顺时针 sub-polygon)中,任意一种三角剖分必定有一个三角形包含 ,这个三角形另有一个节点 . 所以我们可以遍历 .

For any , the polygon is naturally divided into two clockwise point sequences: with vertices and with vertices which corresponds to E[i,k-i+1] and E[k,i+m-k] respectively.

Also, the triangulation cost in the sub-polygon has the created edge , which corresponds to D[i,i+m-1]; and two edges are connected when we choose corresponding to D[i,k] and D[k,i+m-1].

So

(5)

E[i,j] = 2-D array with all infinity, size n*(n+1)
for i = 0 to n-1
E[i,2] = 0
for m = 3 to n:
for i = 0 to n-m:
for k = i+1 to i+m-2:
E[i,m] = min(E[i,m], E[i,k-i+1]+E[k,i+m-k]+D[i,k]+D[k,i+m-1]+D[i,i+m-1])
return E[0,n]

The time complexity is because of the 3-nested loop, and the space complexity is .