Skip to content

Generalized solution to Minimization of Unbounded Knapsack Problem.

License

Notifications You must be signed in to change notification settings

danrpts/min_ukp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Problem

Given a set of items each with a weight w_i and cost c_i, add 0 or more of each item to a knapsack such that the total weight of the knapsack is at least some minimum weight W and the total cost C is minimized.

Solution

Let x be the minimum weight desired for some arbitrary knapsack, and let M[x] be its minimum cost. Using dynamic programming, we define M[x] = min_{i=1}^{n} (c_i + m[x - w_i]). The optimal cost for a knapsack with minimum weight W is then given by M[W]. Using a backtracking algorithm the optimal solution can also be found.

About

Generalized solution to Minimization of Unbounded Knapsack Problem.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published