Questions tagged [packing]

Use this tag for questions related to packing, which can extend from struct packing to grouping elements together.

In C, will prevent the compiler from adding padding to a struct, which will save some memory, but may affect access speed to the members of the struct (since it may not memory-aligned).

However, has a general meaning as well, when you want to group/cluster similar elements together.

347 questions
8
votes
4 answers

How many squares can be packed into a circle?

How many squares of size a×a can be packed into a circle of radius R? I don't need a solution. I just need some kind of a starting idea.
Transcendental
  • 983
  • 2
  • 11
  • 27
8
votes
0 answers

Photo collage algorithm

I am trying to build a script that will dynamically arrange photos like a collage very similar to what is done on http://lightbox.com/explore#spotlight. I can off course write code that would handle each case with different sets of photos but I…
Surfer
  • 131
  • 1
  • 3
8
votes
2 answers

Tuple declaration in Python

In python, one can declare a tuple explicitly with parenthesis as such: >>> x = (0.25, 0.25, 0.25, 0.25) >>> x (0.25, 0.25, 0.25, 0.25) >>> type(x) Alternatively, without parenthesis, python automatically packs its into a immutable…
alvas
  • 115,346
  • 109
  • 446
  • 738
7
votes
2 answers

Packing items into fixed number of bins

I am looking for an algorithm that will solve my problem in the most efficient way. Problem description: I have a list of items (only positive integers are allowed) and fixed number of bins of identical capacity. So far, I thought about…
solitaire
  • 93
  • 1
  • 5
7
votes
1 answer

Does PIP/Python support multiple versions of the same package?

Let's say I have a package foo, and foo packages up binary shared objects that I use in multiple Python scripts. Foo v1 (shared objects) Bar v1 (requires Foo v1) Baz v1 (requires Foo v1) Now I want to push out a new breaking update to Foo. Foo…
Evan Carroll
  • 78,363
  • 46
  • 261
  • 468
7
votes
1 answer

Are there any guarantees about C struct packing?

Are there any guarantees regarding packing of structs in C? Just as an example, provided that sizeof(double) == 8, is it guaranteed that sizeof(struct { double x, y; }) == 16? I am aware that the intention behind this question conflicts with strict…
Pedro
  • 842
  • 6
  • 16
7
votes
2 answers

Extreme point based-packing algorithm (3D)

I am trying to implement a 3D packing algorithm using the extreme point-based approach. The paper which introduced this approach can be seen here: Extreme Point-Based Heuristics for Three-Dimensional Bin Packing At the end of the paper there is also…
Thomas D.
  • 1,031
  • 6
  • 17
7
votes
9 answers

Getting different header size by changing window size

I have a C++ program representing a TCP header as a struct: #include "stdafx.h" /* TCP HEADER 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 …
Steve Wolfe
7
votes
5 answers

Any tools available for packing 32bit/64bit executables together?

I really like the way the SysInternals utilities (e.g. Process Explorer) handle 64bit compatibility. It looks like the 32bit executable has the 64bit version embedded in it, and extracts it if necessary. I'd like a tool which automates this - i.e.…
snowcrash09
  • 4,694
  • 27
  • 45
6
votes
5 answers

Union and struct packing problem

I'm writing some software where each bit must be exact(it's for the CPU) so __packed is very important. typedef union{ uint32_t raw; struct{ unsigned int present:1; unsigned int rw:1; unsigned int user:1; unsigned int dirty:1; …
Earlz
  • 62,085
  • 98
  • 303
  • 499
6
votes
3 answers

Algorithm to organize rectangles in the fixed rectangular container

My problem is pretty similar to 2D Knapsack problem, or cutting stock with one exception... the rectangles that fit into the container can be resized and cropped. No rotation is allowed though. The challenge is to make as little crops as possible…
beklip
  • 98
  • 1
  • 5
6
votes
1 answer

View how C structs are packed during build time

Is there any way to see how C structs are packed during build time? I've read through several similar posts about how structs may be packed: How structs are saved in memory C Why isn't sizeof for a struct equal to the sum of sizeof of each…
rith87
  • 413
  • 4
  • 10
6
votes
2 answers

How to understand Gtk+ properties and make GtkGrid expand to available area?

I'm stumbling through Gtk+ tutorials and the reference, trying to understand how to get a decent layout done. The docs say you should use GtkGrid instead of the deprecated Box/HBox/VBox, but I’m having trouble getting the GtkGrid to expand to the…
Askaga
  • 6,061
  • 5
  • 25
  • 49
6
votes
6 answers

Packing rectangles for compact representation

I am looking for pointers to the solution of the following problem: I have a set of rectangles, whose height is known and x-positions also and I want to pack them in the more compact form. With a little drawing (where all rectangles are of the same…
stephanea
  • 1,108
  • 8
  • 10
6
votes
0 answers

Packing Rectangles into a polygon using JavaScript

I need to pack n rectangles (n<10) of different size into a simple polygon. I am aware of two possible solutions: Bin packing rectangles into a rectangle. Then the problem becomes finding a rectangle in the polygon that is reasonably large. It…
Zebra Propulsion Lab
  • 1,736
  • 1
  • 17
  • 28
1 2
3
23 24