java – Application that performs Bin Packing

Write an application that performs bin packing: The input consists of a sequence of packages'' whose sizes are coded as nonnegative integers along with a sequence of bins” whose capacities are are coded also by an integer. (For simplicity, we assume that all bins have the same capacity.) The program assigns each package to a bin such that no bin’s capacity is exceeded. The objective is to use the minimum number of bins to hold all the packages. Attempt these implementations:

  1. Smallest packages first: The packages are sorted by size and smallest packages are used first.
  2. Largest packages first: The packages are sorted by size and largest packages are used first.
  3. Random filling: The packages are used in the order they appear in the input.
    (Hint: read the Supplement section on sorting.)
    After you have implemented all three programs, perform case studies to determine when one strategy performs better than another. This problem is famous because there is no efficient algorithm for best filling the bins.

Describe a Monte Carlo algorithm for the Triangle Packing problem

Book: Parameterized Algorithms by Marek Cygan (free to download legally)

Chapter about Multivariate polynomials on Page 353 (In the book not the pdf) Question 10.19:

Describe a Monte Carlo $2^{3k}n^{O(1)}$ – time polynomial-space algorithm for the Triangle Packing problem: given a graph $ G $ and a number $ k in N $, decide whether $ G $ contains
$ k $ disjoint triangles (subgraphs isomorphic to K3).

Hint 10.19 in Page 354: Use a similar approach as in the $2^{k}n^{O(1)}$ -time algorithm for $k$-path from this
chapter (Page 333).

I tried to solve the problem using the hint, but without success unfortunately, there are solutions to the book? I would be happy to get help if it can be solved even without official solutions of the book but it is important to solve it using the hint they brought in order to use the tools learned in the same chapter.

Thanks in advance.

K disjoint Triangles Packing Problem

I’m trying to figure out how to use Narrow Sieves in Packing problems.. specifically in the K disjoint triangles packing problem.
Is there any intuition I can use to answer these questions?


clothing – Is a leather jacket + layers good enough for an European winter? (Back packing)

It should definitely be enough but you should take the warm jacket with you just in case.

But you can judge yourself. Temperature Averages in Paris in November are about 7°C (41°F) and it can be quite rainy (15 rainfall days in december as seen on A rainjacket is advised, but depends on your personal preference. If you don’t mind holding your umbrella, then of course you don’t need a rain jacket.

In the other places the temperature will probably be similar or a bit higher (up to a 10°C/50°F average in sicily’s december.) with similar rainfall days.

Keep in mind that these are the average temperatures and it can get colder than that.

I live in Switzerland, where it can get quite cool in November/December and on a cold day, a tshirt, hoodie and warm jacket keep me warm. But then again, you are probably used to warmer temperatures, so a layer more won’t hurt.
If you can easily take the warm jacket, then do it, because it does get chilly, especially if you plan on visiting “mountain-y areas”.

Better be safe than sorry, so pack the warm jacket also and test whether or not you need it.

Have a good and warm time in Europe.

algorithms – What kind of bin packing problem is this?

I have a problem formulation but it does not resemble the usual packing problem I find in the literature but it is a usual problem in the packing industry. I just do not know the name for it.
The problem formulation is as follows:
Ich have a certain amount of objects with different weights (around 10000) and I want to pack them in boxes. The objective is that all boxes should have the same weight (at least within a predefined boundary). It is not mandatory that all objects are distributed.

How can I formulate this optimization problem and what algorithms may suitable to solve this problem?

data structures – Packing a sphere with cuboids

This question on the Mathematics SE addresses how to pack a sphere with unit cubes. This addresses how to pack a 2D grid with rectangles.

We can pack a sphere with the minimum number of unit cubes $m$ of a certain minimum volume $v$, necessary to capture fraction $f$ of the total volume inside the sphere, using octrees.

Is there a similar algorithm for the minimum number of cuboids?

pr.probability – Does there exist a scale invariant random packing of circles in the plane?

I want to construct a scale invariant random packing of the plane with circles.

Here is a way to construct a rotationally invariant, but not scale invariant random packing of the plane with circles:
Suppose I have a Poisson point process in the plane (with say intensity 1 and time parametrised). After some fixed timestep $t_0$ I temporarily stop the PPP. Then start to grow a circle from each point (with the same speed for all circles) until the circle touches another circle then stop. This is also called the random Poisson lilypond model.
Now, we continue the Poisson point process and for every point arriving we grow a circle around the point until it touches one of the other circles.
Continuing this we get a random packing of the plane with circles. The packing must be rotationally invariant since it was construct rotationally invariant. However, it is quite clear that it is not scale-invariant.

Is there a way to construct a random circle-packing which is also scale invariant?

Ideas: Maybe one can change this construction slightly. For example one could do it on the hyperbolic plane, in the disc and do inversion, on the sphere and do stereographic projection or something along those lines.

Further motivation is provided by the interfaces in the Ising model which have a scaling limit which is even conformally invariant. But the interfaces have a structure which is very difficult to think about so I was wondering whether one could find some of these properties just with circles.
Here is an example of how such a circle packing could look. From arXiv:cond-mat/0203252v2

Create circle packing charts in google sheets

I am trying to find a way to add a circle packing chart to a Google sheet, using the data in a google sheet as its data source

The only possibility I have found is this from DHUMANITIES

But, either it no longer works or I am not configuring the data properly

Does anyone know how to do this, create circle packing charts in google sheets?

Thank you

algorithms – One-dimensional packing problem: Optimal decomposition of music structure

I am currently working on my Master thesis on the visualization of music structure and I’m looking to find an optimal description of repetitions found in a piece of music.

Problem Description

Given a section range in a song in seconds (or samples) , e.g. (10,20), I can look up where this section is repeated. Then we end up with a set of repeating sections like: ((10,20), (40,50), (70,80)). We call this a group. A group has a certain fitness given to it.

(As a sidenote, the fitness of a group is defined as a combination of the sum of similarity values and how much of the song they cover alltogether)

Our goal is to find a set of disjoint groups that altogether have the highest fitness; the optimal decomposition of the repetitions. Below are two different valid decompositions of the same song, one course, and one fine decomposition.

Course decomposition

Fine decomposition

We are provided with a set of all candidate groups, here’s a small selection, sorted top to bottom by fitness:
Example of candidates

Current Greedy Method

  1. Sort all candidates by fitness
  2. Pick group G with the highest fitness
  3. Remove any groups from candidates if they have overlap with G
  4. Repeat from step 2 until no candidates are left


Sometimes the candidates overlap every so slightly, which in the context should perhaps not immediately lead to disqualification.

Example of slight overlap

There are options to relax the no-overlap rule. Note that each of the sections in a group has a different brightness. This brightness corresponds to a confidence, so in a group some sections are more certain to be proper repetitions than others.

For a group of sections G that we wish to add to a set of groups of sections S, we can:

  • simply remove sections from G if they overlap with any sections in S
  • trim the sides of to-be-added sections from G if they overlap with any sections in S
  • keep the overlapping sections in G

I hope this problem is interesting enough to you to give it a shot!
Thank you!

clothing – Optimal packing method for bras?

Whenever the topic of packing something in an optimal way comes up, it’s useful to see if the Navy has anything to say about it. The Navy is a good place to look because sailors need to be especially diligent about packing economically, and women sailors are no exception.

Specifically, women in the US Navy are issued 11 bras and should have 2 in their seabag ready for deployment. The rest should be stored in their locker at port. These are of the type: sports, white or beige. Your question did not specify a given bra type, so this answer would apply to sports bras rather than the cantilevered or balconette or contoured or other bra types.

Pursuing this topic, it turns out that the US Naval Academy provides female midshipmen with instructions on folding their bras…

enter image description here

b. Brassieres. Divide into thirds; fold right third and then left third back; fold top straps down to form a square; stack in locker with bottom sweatbands flush and facing out (Figure 6-B).

…and to help get the point across, they provide an image…

enter image description here

Source: Midshipmen Uniform Regulations

Presumably the required square shape is the result of computing optimized surface area versus volume.

They make a point of explaining how the bras should be stored in the locker, but it’s implied that storage for deployment would follow the same pattern. It’s a good bet that the Navy hired external contractors to study the problem and produce a report which then informed the regulations.

Nobody likes a tired, frumpy bra that’s been crushed in a suitcase, and if you eschew the sports bra in favour of the cupped bra style, then consider some of the recent innovations in specialist luggage.