knapsack-problem

canonical problems list

Does anyone known of a a good reference for canonical CS problems? I'm thinking of things like "the sorting problem", "the bin packing problem", "the travailing salesman problem" and what not. edit: websites preferred ...

What is a good algorithm for compacting records in a blocked file?

Suppose you have a large file made up of a bunch of fixed size blocks. Each of these blocks contains some number of variable sized records. Each record must fit completely within a single block and then such records by definition are never larger than a full block. Over time, records are added to and deleted from these blocks as records ...

How can I programmatically determine how to fit smaller boxes into a larger package?

Does anyone know of existing software or algorithms to calculate a package size for shipping multiple items? I have a bunch of items in our inventory database with length, width and height dimesions defined. Given these dimensions I need to calculate how many of the purchased items will fit into predefined box sizes. ...

Possible Combination of Knapsack problem and ???

Alright quick overview I have looked into the knapsack problem http://en.wikipedia.org/wiki/Knapsack_problem and i know it is what i need for my project, but the complicated part of my project would be that i need multiple sacks inside a main sack. The large knapsack that holds all the "bags" can only carry x amount of "bags" (lets s...

Algorithm to Divide a list of numbers into 2 equal sum lists

There is a list of numbers. The list is to be divided into 2 equal sized lists, with a minimal difference in sum. The sums have to be printed. #Example: >>>que = [2,3,10,5,8,9,7,3,5,2] >>>make_teams(que) 27 27 Is there an error in the following code algorithm for some case? How do I optimize and/or pythonize this? def make_teams(q...

Multiple Constraint Knapsack Problem

If there is more than one constraint (for example, both a volume limit and a weight limit, where the volume and weight of each item are not related), we get the multiply-constrained knapsack problem, multi-dimensional knapsack problem, or m-dimensional knapsack problem. How do I code this in the most optimized fashion? Well, one can dev...

How to ensure Java threads run on different cores

Hello, I am writing a multi-threaded application in Java in order to improve performance over the sequential version. It is a parallel version of the dynamic programming solution to the 0/1 knapsack problem. I have an Intel Core 2 Duo with both Ubuntu and Windows 7 Professional on different partitions. I am running in Ubuntu. My prob...

C/C++ implementation of a subset sum kind of problem

I think that stackoverflow is rendering me even lazier than usual, but... The problem is simpler than knapsack (or a type of it, without values and only positive weights). It consists on checking if a number can be a combination of others, and the function shall return true or false. Ex: 112 and a list with { 17, 100, 101 } should retu...

Designing a different kind of tag cloud.

Rather than having a bunch of links that are all different sizes, I want all of my tags to be the same size. However, my goal is to minimize the amount of space required to make the cloud, aka minimizing the number of lines used. Take this example: Looks like any normal tag cloud. However, look at all that extra space around the 'rou...

Divide people into teams for most satisfaction

Just a curiosity question. Remember when in class groupwork the professor would divide people up into groups of a certain number (n)? Some of my professors would take a list of n people one wants to work with and n people one doesn't want to work with from each student, and then magically turn out groups of n where students would be ma...

Improved Genetic algorithm for multiknapsack problem

Hello guys, Recently i've been improving traditional genetic algorithm for multiknapsack problem. So My Improved Genetic Algorithm is working better then Traditional Genetic Algorithm. I tested. (i used publically available from OR-Library (http://people.brunel.ac.uk/~mastjjb/jeb/orlib/mknapinfo.html) were used to test the GAs.) Does any...

how to solve the linear programming relaxed MKP

Hi guys, I am studying about Knapsack problem. So i do not understand one thing here. the profit/pseudo-resource consumption ratios Uj=Pj/Wj with Wj=Rji*Aj; I hope so you people know this equation thus i think no need more explanation. I wanted to calculate Aj here. What is that LP relaxation . How they are calculating using total capa...

linear programming relaxed for MKP

how to calculate to find this relaxation. What should i know to find it. Suppose i have n items and m knapsack . So i wanted to know the number of m relaxation. Does anybody can give me some idea at least. I have been searching it for while. There is some article on internet but not much clear. Please at least someone say to me you shoul...

Calculate a rough estimate for shipping box size

I'm trying to find the best way to calculate the box size needed for shipping. I have 3 shipping containers with different sizes. I have the product's width, length, depth, and mass defined in the database. I would like to know how to find the smallest amount of boxes needed to ship, and also the smallest dimensions of those boxes give...

VB.NET - Genetic Algotithm - Knapsack Problem

I have been working on the Knapsack problem using genetic algorithms. But I have run into a few difficulties... First off the user generates a data set which is stored in a text document. From there I read the data in to the program. I do fine getting the program to calculate fitness values, select parents, produce children, then muta...

Cutting Stock Problem

Does anyone know how to implement the algorithm for this problem using the Knapsack algorithm? The method I'm using at present makes extensive use of LINQ and Collections of Collections and a few Dictionaries. For those who dont know what I'm talking about check out The Cutting Stock Problem. ...

Bounded Knapsack Problem set-up. Want: a list of all possible packings

Rather than optimize anything, I want to list all the possible - including "incomplete" - packings of the knapsack. Of course, I could loop through all subsets of the set of objects and pick the ones satisfying the weight constraint (can be improved by placing an upper bound on the size of the subsets to look through), but I'd really lik...

Algorithm that is a combination of the continuous knapsack problem and the variable size bin packing problem

Hello, I'm trying to solve a problem (in php, but programming language doesn't matter). I'm having a n number of persons that have paid money, and I have got a m number of persons that are going to pay the same amount as the sum of what the n number of people have paid. I want to calculate the shortest route of money transfers between th...

Knapsack with items to consider constraint

I have items I1, I2, I3, I4 with weights W1...W4 and Values V1...V4. I want to maximize values with minimum weights. This is a traditional Knapsack. However there is small constraint some items cannot go together. So lets say I2 and I3 cannot go together. Can anyone provide a dynamic programming solution or any other solution for the sam...