Subset Sum

Subset Sum

Die Untermengensumme (engl. Subset Sum) ist ein berühmtes Problem der Informatik und des Operations Research. Es ist ein spezielles Rucksackproblem.

Problembeschreibung

Gegeben sei eine Menge von ganzen Zahlen I = {w1,w2,...,wn}. Gesucht ist eine Untermenge, deren Elementsumme maximal, aber nicht größer als eine gegebene obere Schranke c ist (oft ist auch gefragt, die Schranke c exakt zu erreichen).

Formal: \operatorname{max} \sum_{j=1}^n {w_j x_j} so dass \sum_{j=1}^n {w_j x_j} \le c mit x_j \in \{0,1\}.

NP-Vollständigkeit

Das Problem ist NP-vollständig und somit vermutlich nicht effizient lösbar. Es kann mit der Branch-and-Bound-Methode gelöst werden.

Der Beweis der NP-Schwere erfolgt durch eine Reduktion von 3-SAT. Für eine gegebene Klauselmenge C_1 \wedge C_2 \wedge \ldots C_m mit den Variablen x_1 \ldots x_n werden die Zahlen w_1 \ldots w_{m+n} sowie die Schranke c anhand einer Tabelle konstruiert. Es wird vorausgesetzt, dass keine Klauseln vorhanden sind, die xi und \overline{x_i} gleichzeitig enthalten; dies ist keine Einschränkung, da eine solche Klausel immer erfüllt wäre und somit weggelassen werden kann, ohne den Sinn zu verändern.

Beispielsweise wird die Formel (x_1 \vee \overline{x_2} \vee x_3) \wedge (x_1 \vee x_2 \vee x_3) \wedge (\overline{x_1} \vee \overline{x_2} \vee \overline{x_3}) wie folgt verarbeitet.

  • Die ersten n Zeilen sind lediglich eine Codierung der Formel selbst: w1 = 100110 besagt, dass x1 in den Klauseln C1 und C2, aber nicht C3 vorkommt. w2 setzt das für \overline{x_1} um, w3 für x2, w3 für \overline{x_2} etc.
  • Die Zeilen wn + 1 bis wn + m sind "Korrekturzeilen", die nur auf der Diagonalen jeweils abwechselnd den Wert 1 oder 2 haben.
  • Die Zahl c besteht nur aus n Einsen und m Vieren. Dies bewirkt, dass bei Addition der Spaltenwerte, an den ersten n Stellen nur entweder w1 oder w2; w3 oder w4 etc. ausgewählt werden kann, wodurch in der Formel xi auf true oder false gesetzt wird. Die Vieren sind so gewählt, dass zusätzlich zu den beiden Korrekturwerten, die zusammen nur 1+2=3 ergeben, noch mindestens eine der Variablen in den Klauseln vorhanden sein muss, um auf 4 zu kommen. Sind mehr Variablen verfügbar, können entsprechend Korrekturzeilen weggelassen werden.
x1 x2 x3 C1 C2 C3
w1 1 0 0 1 1 0
w2 1 0 0 0 0 1
w3 0 1 0 0 1 0
w4 0 1 0 1 0 1
w5 0 0 1 1 1 0
w6 = n 0 0 1 0 0 1
w7 0 0 0 1 0 0
w8 0 0 0 2 0 0
w9 0 0 0 0 1 0
w10 0 0 0 0 2 0
w11 0 0 0 0 0 1
w12 = n + m 0 0 0 0 0 2
c 1 1 1 4 4 4

Besitzt nun die boolesche Formel eine erfüllende Belegung, so nehmen wir falls xi=true die Zahl w2i − 1 auf; falls xi=false die Zahl w2i. Damit sind schon die Einsen in c korrekt. Da eine erfüllende Belegung existiert, ist in den gerade hinzugefügten Zahlen in jeder Klausel mindestens eine erfüllte Variable vorhanden, somit tritt zu den möglichen Korrekturvariablen 1+2 noch jeweils mindestens eine 1 von der weiter oben erfüllten Variable, so dass in jedem Fall mindestens die gewünschte 4 erreicht wird. Sollten mehrere Variablen in einer Klausel erfüllt sein, so werden nach Bedarf Korrekturzahlen weggelassen. Mit der konstruierten Menge ist es so möglich, genau c zu erreichen, wenn die Formel erfüllbar ist.

Wenn nun c genau erreicht werden kann, so muss die Teilmenge der wi zunächst jeweils genau ein w1 oder w2; w3 oder w4 etc. enthalten, weil sonst die Einsen in c nicht erfüllt wären. Somit ist gewährleistet, dass eine Variable tatsächlich true oder false (und nicht keins oder beides) ist. Durch diese Auswahl der Teilmenge muss dann auch jede Klausel erfüllt sein, denn wenn in einer Klausel keine Variable durch die Belegung erfüllt wäre, so würde die Addition nicht die notwendige Vier in c ergeben. Daher ist die boolesche Formel insgesamt erfüllbar.

Literatur

  • Soma, Nei Y. Toth, Paolo: An exact algorithm for the subset sum problem. European Journal of Operational Research 136 S. 57-66
  • Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, und Clifford Stein. Algorithmen - Eine Einführung. Oldenbourg-Verlag, 2004. ISBN 3-486-27515-1. Seiten 1017ff.

Wikimedia Foundation.

Игры ⚽ Поможем решить контрольную работу

Schlagen Sie auch in anderen Wörterbüchern nach:

  • Subset-Sum — Die Untermengensumme (engl. Subset Sum) ist ein berühmtes Problem der Informatik und des Operations Research. Es ist ein spezielles Rucksackproblem. Problembeschreibung Gegeben sei eine Menge von ganzen Zahlen I = {w1,w2,...,wn}. Gesucht ist eine …   Deutsch Wikipedia

  • Subset sum problem — In computer science, the subset sum problem is an important problem in complexity theory and cryptography. The problem is this: given a set of integers, does the sum of some non empty subset equal exactly zero? For example, given the set { −7, −3 …   Wikipedia

  • Sum-free set — In additive combinatorics and number theory, a subset A of an abelian group G is said to be sum free if the sumset A⊕A is disjoint from A. In other words, A is sum free if the equation a + b = c has no solution with . For example, the set of odd… …   Wikipedia

  • Direct sum of groups — In mathematics, a group G is called the direct sum of a set of subgroups {Hi} if each Hi is a normal subgroup of G each distinct pair of subgroups has trivial intersection, and G = <{Hi}>; in other words, G is generated by the subgroups… …   Wikipedia

  • Clique-sum — A clique sum of two planar graphs and the Wagner graph, forming a K5 free graph. In graph theory, a branch of mathematics, a clique sum is a way of combining two graphs by gluing them together at a clique, analogous to the connected sum operation …   Wikipedia

  • Direct sum — The symbol denotes direct sum; it is also the astrological and astronomical symbol for Earth, and a symbol for the Exclusive disjunction. In mathematics, one can often define a direct sum of objects already known, giving a new one. This is… …   Wikipedia

  • Riemann sum — In mathematics, a Riemann sum is a method for approximating the total area underneath a curve on a graph, otherwise known as an integral. It may also be used to define the integration operation. The sums are named after the German mathematician… …   Wikipedia

  • Divergence of the sum of the reciprocals of the primes — The sum of the reciprocals of all prime numbers diverges, that is: This was proved by Leonhard Euler in 1737, and strengthens Euclid s 3rd century BC result that there are infinitely many prime numbers. There is a variety of proofs of Euler s… …   Wikipedia

  • Zero-sum problem — In number theory, zero sum problems are a certain class of combinatorial questions. In general, a finite abelian group G is considered. The zero sum problem for the integer n is the following: Find the smallest integer k such that any sequence of …   Wikipedia

  • NP-equivalent — In computational complexity theory, the complexity class NP equivalent is the set of function problems that are both NP easy and NP hard.[1] NP equivalent is the analogue of NP complete for function problems. For example, the problem FIND SUBSET… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”