• Nie Znaleziono Wyników

The knapsack problem Formulation. Given (i) m ∈ N, (ii) volumes a

N/A
N/A
Protected

Academic year: 2021

Share "The knapsack problem Formulation. Given (i) m ∈ N, (ii) volumes a"

Copied!
3
0
0

Pełen tekst

(1)

The knapsack problem

Formulation. Given (i) m ∈ N,

(ii) volumes a1, . . . , am > 0, (iii) values c1, . . . , cm > 0, (iv) the total volume b, find

max m

i=1cixi subject to m

i=1aixi � b, where xi ∈ N ∪ {0}.

Binary version: As above but here xi ∈ {0, 1}.

Assumptions: ai, b ∈ N, ai are pairwise different.

1

(2)

2

Algorithm of Gilmore and Gomory

Notation. For k � m and y ∈ {0, 1, . . . , b} write F(k, y) = max

k

i=1cixi : k

i=1aixi � y, xi ∈ N

. Remarks.

(1) The knapsack problem is to find F (m, b);

(2) F (k, 0) = 0; F (1, y) = c1[y/a1].

Recurrence formulas.

F(k, y) = max{jck + F (k − 1, y − jak : j � y/ak} F(k, y) = max (F (k − 1, y), ck + F (k − 1, y − ak))

(3)

3

Example

max 5x1 + 10x2 + 12x3 + 6x4

subject to 4x1 + 7x2 + 9x3 + 5x4 � 15

F(k, y) = max (F (k − 1, y), ck + F (k, y − ak))

k / y 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 0 0 0 0 5 5 5 5 10 10 10 10 15 15 15 15 2 0 0 0 0 5 5 5 10 10 10 10 15 15 15 20 20 3 0 0 0 0 5 5 5 10 10 12 12 15 15 17 20 20 4 0 0 0 0 5 6 6 10 10 12 12 15 16 17 20 20

Cytaty

Powiązane dokumenty

Applying the simplex method with this point as starting one, we shall obtain a solution of the problem (30)- (31) within …nite steps (from Theorem 2 it follows that inf. u2U J (u)

The co-operation of parallel simulated annealing processes to solve the vehicle routing problem with time windows (VRPTW) is considered.. The objective is to investigate how the

The algorithm finishes if the number of generations in the steady state is larger than the defined maximum, maximal number of generations maxGen is reached or the maximal

In this note we are going to consider a queueing system which con ­ sists of n serves heaving a bounded number — m of waiting places, and also a system with an

Г In the compensating computation the so-called compensation of the direct conditioned observations leads to looking for corrections V fulfilling conditions (3),

(We follow the popular shorthand of writing with probability one for a probability that approaches 1 as n in- creases. In our case, the probability approaches 1 exponentially fast.)

NNB parent (a non-native bilingual parent) – in the context of the research on NNB in Poland it means a person who, while being a Pole and living in Poland, talks to the child in

Onimiczny obraz świata w tłumaczeniu poprzez język trzeci na przykładzie antroponimów