Algorithm to fill a truck with pallets At work we build large machines, these get deconstructed, placed i crates and shipped away to the client.
Now we are just guessing how many trucks we need and how we lay the crates out to fit as many of them inside a truck.

For example:

We have a truck and want to load 8 crates of equal size into it. There are 2 possible "solutions" to this problem.

But here you can see that the second option is better in space used (all pallets fit).

Now the real question. Is there a algorithme out there that can do this, even with irregular crates (meaning diffrent in size). Or do i need to invent one myself?

EDIT: Some more details:

The crates can vary in dimensions. But are always rectacles or squares.

The crate dimensions voor in the form of an Excel file where width height and lenght are defined.
This already exists, but might not be what you are looking for.

While this might not be a problem for your application, notice that this is a more general problem than the (already NP-hard) bin packing problem, so for a large amount of crates finding the optimal solution will be hard. 

On the other hand, for a small enough number of crates, brute force might be sufficient. For example, you could round all dimensions to multiples of 10cm and look at the trucks in terms of 10x10 tiles that crates can occupy, giving you a finite (hopefully small enough) number of potential solutions.