You can try a treemap. Sort the boxes store the first into a tree and split the tree on both axis. Find the best fit for the next box and rinse and repeat.

algorithm,optimization,bin-packing

If the problem under consideration is the generalized assignment problem, it is NP-hard but admits an approximation algorithm. From a brief look, the approximation ratio depends on the approximation ratio of an approximation algorithm for the knapsack problem, which in turn admits a fully polynomial time approximation scheme. In total....

This seems related to the set partitioning problem, which is NP-hard but fortunately admits lots of good approximation algorithms and pseudopolynomial-time dynamic programming algorithms. You may want to look into those as a starting point, since there's already quite a lot of work that's been done in this area. Hope...

python,html,algorithm,sorting,bin-packing

You define the class but the layout of your code never actually runs anything. move everything after if __name__ == "__main__": #(the first one) BEFORE it under a function like so: def main(): paste the data from below Then it will automatically run your code upon calling it. Also I...

algorithm,geometry,computational-geometry,bin-packing

here something unsophisticated unoptimal but easy as a start point Based on mine comments exploiting common container size 480px Algorithm: rotate all containers (bins) to get 480 height sort bins by width after rotation descending need ceil(1080/480)=3 lines of 480px bins use the widest bins to fill all the lines...

algorithm,optimization,np-complete,np,bin-packing

There is a much better approach to solving the optimization problem based on the decision problem, note that your solution is exponential (pseudo-polynomial, but still exponential) in the size of the input, since if you have an algorithm that runs in T(n) on the decision problem, the suggested solution runs...

Figured I'd answer my own question for the sake of future visitors... Loop through items largest to smallest Does it fit wholly (overstuffing ok) in the first open bin? ...Yes Place it ...No Does it fit wholly (overstuffing ok) in the next bin? ...Yes Place it ...No Does it fit...

algorithm,scheduling,job-scheduling,bin-packing

Take a look at the Constraint Satisfaction Problems. Your problem falls in that category. Also, for a quick review of the problem class and some toy examples take a look here. This is the (publicly available) chapter where the slides were taken from. The constraint you will need are more...

I think there is no special name for this variant. Although the coloring constraint first gives the impression it's graph coloring related, it's not. It's simply a limitation on the values for a variable. In a typical solver implementation, each product (= item) will have a variable to which container...

algorithm,game-physics,bin-packing

As you only need a heuristic, and not an optimal solution (which nobody can give you ATM, as "distances between items are maximized" is a vague term): Though bin-packing seems to be the "opposite", it can be used. Take a smaller (smallest) box that they fit into, and do the...