跳到主要内容

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

Author

itsuitsuki

Description

品物 はそれぞれ重量 で価値 (ここで ) を持つ。最大重量限界 のナップサックに出来るだけ合計価値が大きくなるように品物を詰める問題をナップサック問題といい、一般的に次のように定式化することができる。

[問題 A0] 最大化 条件 , ( をナップサックに詰める時に となる)

ここで具体的なナップサック問題としては次の [問題 A1] を考える。

[問題 A1] 最大化 条件

最も直接的な解法は列挙法であり、全ての場合を生成して調べる。[問題 A1] の具体例では場合数 で十分計算可能な範囲であるが、品物数 の増大につれて、場合数は指数的に増大する。そこでここでは、(1) 分枝限定法 (branch and bound method) と (2) 動的計画法 (dynamic programming) の二つの方法により効率的探索を図ることを考える。

(1) 分枝限定法による探索

(1-1) 目的関数最大化を求める分枝限定法の動作について、以下の用語を使用して説明せよ。 「分枝操作」、「部分問題(子問題)」、「暫定値」、「上界値」、「限定操作」、「実行可能解」。

(1-2) ナップサック問題の場合、品物は単位重量当たりの価値の順にソートされていると都合良く、上記 [問題 A1] では、 の順に単位重量当たりの価値が高くなっている。 の条件を緩和し、 とした緩和問題の解はこの場合には容易に求めることができ、 の時、最大価値 を得ることができる。この推定値が の条件の場合の合計価値の上界を与える。この緩和問題による上界の計算は、部分問題でも同様に利用することができる。 [問題 A1] について、 の順に、かつ の値の順に具体化していく縦型(深さ優先)探索において、上記の分枝限定法の探索を行い解を求めよ。 解答には探索木とナップサックに詰める品物 と最大合計価値を示せ。

(2) 動的計画法による計算

同じナップサック問題の解を動的計画法によって求めることを考える。なお、ここでは一般性を失うことなく、一般化した [問題 A0] における は正の整数とする。そして次の関数 を定める (ここで は整数で )。 : 重量制限 以下のなかに詰める品物の候補を に限定した時に得られる最大の合計価値

明らかに であり、[問題 A1] に対して となる。そして、[問題 A1] の最終的な最大合計価値は として求められ、[問題 A0] の最終的な最大合計価値は として求められることになる。

(2-1) この あるいは から出発し、一般的な問題である [問題 A0] において を順次増やしながら最終的に を計算する方法を得たい。 (ここで ) が求められている場合、この を用いて を求める方法を式として示せ。但し が負の整数の時は便宜的に として式を得ることを可とする。

(2-2) 上記の結果を利用し、[問題 A1] に対して下に示す の表を順次計算することにより、[問題 A1] を解け。 解答には数値を計算した の表と、ナップサックに詰める品物、最大合計価値を示すこと。

[問題 A1] に対する の表

0123456789
00000000000
1001414141414141414
2
3
4
5

Description (English)

Goods have their weights and value (), respectively. The problem of packing the maximum total value of goods into a knapsack with a weight limit is called the knapsack problem, which can be generally formulated as

[Problem A0]

Here, we specifically consider the following knapsack problem [Problem A1].

[Problem A1]

The most straightforward approach to this problem is the enumeration method, in which all the cases are generated and evaluated. Although the number of possible cases in [Problem A1] is and fully within a computable range, this number grows exponentially as the number of possible goods increases. Then, we here try to achieve efficient searches through two methods, namely, (1) the branch and bound method and (2) dynamic programming.

(1) Search by the branch and bound method

(1-1) Explain the behavior of the branch and bound method maximizing an objective function, using the following terms: "branching operation", "sub-problems (child problems)", "incumbent value", "upper bound value", "bounding operation", and "feasible solution"

(1-2) In the knapsack problems, it is convenient if the goods are sorted according to the values per unit weight. In [Problem A1], are sorted to have higher values per unit weight in this order. A solution of this relaxed problem, where the constraint is relaxed to , can be easily obtained with the maximum value when . This estimate gives an upper bound of the total value for the original knapsack problem with . Upper bound calculation by employing such relaxed problems can be used also for sub-problems. In a depth-first search instantiating to and in this order for [Problem A1], execute a search based on the above branch and bound method to find the solution. Show the resultant search tree, the goods to be packed into the knapsack and the maximum total value obtained.

(2) Computation by dynamic programming

We consider here to solve the same knapsack problem by employing dynamic programming. Without a loss of generality, we assume here that and in the general problem of [Problem A0] are positive integers. Then we define the following function where and are integers with and .

: The maximum total value when limiting the candidates of the goods to which can be packed into the knapsack under the maximum weight constraint .

Apparently, is 0, and in [Problem A1], and . Eventually, the final answer of the maximum total value for [Problem A1] can be obtained as , and the final answer for [Problem A0] can be obtained as .

(2-1) Starting from these or , we want to get a method of eventually calculating for the general problem of [Problem A0] by incrementing in sequence. When where are calculated, show a method of calculating as an equation using these . Here, you can show the equation for convenience by letting when is a negative integer.

(2-2) Using the result of the above question, solve [Problem A1] by calculating cell values of the table shown below in sequence. Show the table with the calculated values , goods to be packed into the knapsack, and the maximum total value.

Table of for [Problem A1]

0123456789
00000000000
1001414141414141414
2
3
4
5