Code covered by the BSD License  

Highlights from
KP01

Be the first to rate this file! 8 Downloads (last 30 days) File Size: 3.49 KB File ID: #27238

KP01

by Jonas Lundgren

 

13 Apr 2010 (Updated 21 Nov 2011)

Solves the 0-1 knapsack problem using preprocessing and dynamic programming.

| Watch this File

File Information
Description

[FMAX,X] = KP01(W,P,C) solves the combinatorial optimization problem

      maximize F = SUM(P.*X),
      subject to SUM(W.*X) <= C,

where the solution X is a binary vector of 0s and 1s. W and P are vectors
of weights and profits and C is the capacity of the knapsack. Weights must
be positive integers.

The knapsack solver uses preprocessing with estimation of lower and upper
bounds to reduce the problem to a core problem. The core problem is solved
by standard dynamic programming.

P = [] invokes the subset-sum solver. A subset-sum problem is the special
case P = W. The subset-sum solver uses preprocessing with small random
perturbations to reduce the problem size (if possible). The reduced problem
is solved by dynamic programming.

Acknowledgements

0 1 Knapsack inspired this file.

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
dynamic programming, knapsack, mathematics, optimization, preprocessing, subsetsum
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
20 Apr 2010

Subfunction mygcd updated.

08 Dec 2010

Improved subset-sum solver

08 Feb 2011

One example added

21 Nov 2011

New contact info

Contact us