bin-packing

Creating groups of equal sum in R

孤人 提交于 2020-08-05 06:25:30
问题 I am trying to group a column of my data.frame/data.table into three groups, all with equal sums. The data is first ordered from smallest to largest, such that group one would be made up of a large number of rows with small values, and group three would have a small number of rows with large values. This is accomplished in spirit with: test <- data.frame(x = as.numeric(1:100000)) store <- 0 total <- sum(test$x) for(i in 1:100000){ store <- store + test$x[i] if(store < total/3){ test$y[i] <- 1

Binpacking — multiple constraints: weight+volume

不羁的心 提交于 2020-08-01 09:08:06
问题 I have a dataset with 50,000 orders. Each order has ~20 products. Product volume and weight are present (as well as x,y,z dimensions). I have shipping boxes of constant volume V_max and maximum weight capacity of W_max. Per order I want to minimize the number of boxes used under the constraint that V < V_max, and W < W_max. In searching the web I have come across many binpacking algorithms, but none of them seem to do the trick. Does anyone know of an elegant (and fast) python algorithm for

Bin Packing Js implementation using box rotation for best fit

左心房为你撑大大i 提交于 2020-01-14 03:28:09
问题 I have used the bin packing js implementation here https://github.com/jakesgordon/bin-packing When I specify the frame size as 800x600 and Blocks size as 150x700,150x700 it would say that, it cant accommodate However, there is ample space. The same when 700x150, 700x150 is made, it would fit it. How Do I adapt the code, so that it can dynamically rotate the block size and fits in to the frame. The js packer used here is, Packer = function(w, h) { this.init(w, h); }; Packer.prototype = { init:

Filling bins with an equal size

不羁岁月 提交于 2020-01-11 11:38:09
问题 I have 100 groups and each group has some elements inside. For the cross validation, I want to make five bins which their size is as equal as possible. Is there any algorithm for this purpose. An example for 5 groups and 2 bins: Group_1: 5 Group_2: 6 Group_3: 2 Group_4: 7 Group_5: 1 The two bins will be: G1 and G2 -> their sum is equal to 11. G3, G4 and G5 -> their sum is equal to 10. 回答1: This seems related to the set partitioning problem, which is NP -hard but fortunately admits lots of

Graph partitioning based on nodes and edges weights

风格不统一 提交于 2020-01-06 15:40:10
问题 I have a graph G=(V,E) that both edges and nodes have weights. I want to partition this graph to create equal sized partitions. The definition of the size of partition is sum(vi)-sum(ej) where vi is a node inside that partition and ej is an edge between two nodes in that partition. In my problem the graph is very dense (almost complete). Is there any approximation algorithm for that? This is somehow similar to the problem in bin packing with overlapping objects where bins have the same size.

N-th permutation algorithm for use in brute force bin packaging parallelization (containing the same item more than once)

筅森魡賤 提交于 2020-01-06 15:06:04
问题 I've written a small open-source 3D bin packaging library with a brute-force packager for use in real-time calculation of web shop order shipping cost. Many orders contain a small number of items, making brute-force a fair supplement to other algorithms. As orders can contain the same item more than once (i.e. repeated / duplicate / identical elements), I've gone with the lexographical permutations algorithm. Now I'm attempting to add some paralellization / multi-threading and have found a

Where does this greedy scheduling algorithm become sub-optimal?

眉间皱痕 提交于 2019-12-24 05:16:11
问题 This question is inspired by another question on process allocation. This is a twist on, and enhancement of, the problem discussed there. We have n processes, and we need to allocate them to the fewest possible processors. Each process has a scheduled start and finish time, which we will define in terms of time units , indexed from 1; a process will run for some contiguous sequence of time units. A processor can then be scheduled to run any number of non-overlapping processes. The obvious

bin packing with overlapping objects

杀马特。学长 韩版系。学妹 提交于 2019-12-21 02:59:08
问题 I have some bins with different capacities and some objects with specified size. The goal is to pack these objects in the bins. Until now it is similar to the bin-packing problem. But the twist is that each object has a partial overlap with another. So while object 1 and 2 has sizes s1 and s2, when I put them in the same bin the filled space is less than s1+s2. Supposing that I know this overlapping value for each pair of objects, is there any approximation algorithm like the ones for

Block layout algorithm

一笑奈何 提交于 2019-12-20 10:37:31
问题 I'm looking for help with improving an algorithm for placing blocks of odd shapes. My problem domain is odd, but the best analogy for my blocks is Tetris pieces, except that they can have more than four pieces. The blocks still are composed of only right angles, but they can be long and winding, they can branch, etc. I'm trying to arrange multiple large arbitrarily shaped blocks in minimal space (I know, a bin-packing problem) but my current solution looks ugly. I'm basically placing one,

Fitting rectangles together in optimal fashion

扶醉桌前 提交于 2019-12-18 21:21:14
问题 I was wondering if anyone knows of any algorithms suited to fitting together N number of rectangles of unknown size into the smallest possible containing rectangle. By optimal I mean with reducing the amount of white space left over in the resulting containing rectangle. I would like to use this to generate css sprites from a series of images. Many Thanks, Ian 回答1: Through packing images into square texture and Simon's answer I got to this link http://code.activestate.com/recipes/442299/ I