All Projects → skjolber → 3d Bin Container Packing

skjolber / 3d Bin Container Packing

Licence: apache-2.0
A variant of the Largest Area Fit First (LAFF) algorithm + brute force algorithm

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to 3d Bin Container Packing

Dnsbrute
DNS Sub-domain brute forcer, in Python + gevent
Stars: ✭ 40 (-72.41%)
Mutual labels:  brute-force
C Jwt Cracker
JWT brute force cracker written in C
Stars: ✭ 1,282 (+784.14%)
Mutual labels:  brute-force
Oscp Automation
A collection of personal scripts used in hacking excercises.
Stars: ✭ 118 (-18.62%)
Mutual labels:  brute-force
Hackphiles
BruteForce Tool For both Instagram and Facebook
Stars: ✭ 57 (-60.69%)
Mutual labels:  brute-force
Saydog Framework
Saydog Framework
Stars: ✭ 71 (-51.03%)
Mutual labels:  brute-force
Web Brutator
Fast Modular Web Interfaces Bruteforcer
Stars: ✭ 97 (-33.1%)
Mutual labels:  brute-force
Leviathan
wide range mass audit toolkit
Stars: ✭ 862 (+494.48%)
Mutual labels:  brute-force
Minimalistic Offensive Security Tools
A repository of tools for pentesting of restricted and isolated environments.
Stars: ✭ 135 (-6.9%)
Mutual labels:  brute-force
Koa2 Ratelimit
Rate-limiting middleware for Koa2 ES6. Use to limit repeated requests to APIs and/or endpoints such as password reset.
Stars: ✭ 81 (-44.14%)
Mutual labels:  brute-force
Elpscrk
A Common User Passwords generator script that looks like the tool Eliot used it in Mr.Robot Series Episode 01 :D :v
Stars: ✭ 113 (-22.07%)
Mutual labels:  brute-force
Bitp0wn
Algorithms to re-compute a private key, to fake signatures and some other funny things with Bitcoin.
Stars: ✭ 59 (-59.31%)
Mutual labels:  brute-force
Wifisuite
Enterprise WPA Wireless Tool Suite
Stars: ✭ 68 (-53.1%)
Mutual labels:  brute-force
Hacking
Ha3Mrx Pentesting and Security Hacking
Stars: ✭ 102 (-29.66%)
Mutual labels:  brute-force
Pythem
pentest framework
Stars: ✭ 1,060 (+631.03%)
Mutual labels:  brute-force
Faitagram
(Doesn't work anymore)
Stars: ✭ 117 (-19.31%)
Mutual labels:  brute-force
Brutex
Automatically brute force all services running on a target.
Stars: ✭ 974 (+571.72%)
Mutual labels:  brute-force
Instabrute
Instagram password bruteforcer
Stars: ✭ 91 (-37.24%)
Mutual labels:  brute-force
Pydictor
A powerful and useful hacker dictionary builder for a brute-force attack
Stars: ✭ 2,055 (+1317.24%)
Mutual labels:  brute-force
Stegbrute
Fast Steganography bruteforce tool written in Rust useful for CTF's
Stars: ✭ 134 (-7.59%)
Mutual labels:  brute-force
Hyprpulse
Brute force multiple accounts at once
Stars: ✭ 105 (-27.59%)
Mutual labels:  brute-force

Build Status Coverage Status

3d-bin-container-packing

This library does 3D rectangular bin packing; it attempts to match a set of 3D items to one or more in a set of 3D containers. The result can be constrained to a maximum number of containers.

Projects using this library will benefit from:

  • short and predictable calculation time,
  • fairly good use of container space,
  • brute-force support for low number of boxes, and
  • intuitive use for a human

So while the algorithm will not produce the theoretically optimal result (which is NP-hard), its reasonable simplicity means that in many cases it would be possible to stack the resulting container for a human without instructions.

In short, the library provides a service which is usually good enough, in time and reasonably user-friendly ;-)

Bugs, feature suggestions and help requests can be filed with the issue-tracker.

Obtain

The project is implemented in Java and built using Maven. The project is available on the central Maven repository.

Example dependency config:

<dependency>
    <groupId>com.github.skjolber.3d-bin-container-packing</groupId>
    <artifactId>core</artifactId>
    <version>1.2.13</version>
</dependency>

Java 11+ projects please use module com.github.skjolber.packing.

Usage

The units of measure is out-of-scope, be they cm, mm or inches.

Largest Area Fit First (LAFF) packager

Obtain a Packager instance:

// initialization
List<Container> containers = new ArrayList<Container>();
containers.add(new Container(10, 10, 3, 100)); // x y z and weight
Packager packager = LargestAreaFitFirstPackager.newBuilder().withContainers(containers).build()

The packager instance is thread-safe.

Packing

Then compose your item list and perform packing:

List<BoxItem> products = new ArrayList<BoxItem>();
products.add(new BoxItem(new Box("Foot", 6, 10, 2, 25), 1));
products.add(new BoxItem(new Box("Leg", 4, 10, 1, 25), 1));
products.add(new BoxItem(new Box("Arm", 4, 10, 2, 50), 1));
	
// match a single container
Container match = packager.pack(products);

The resulting match variable returning the resulting packaging details or null if no match.

The above example would return a match (Foot and Arm would be packaged at the height 0, Leg at height 2).

For matching against multiple containers use

int maxContainers = ...; // maximum number of containers which can be used

// match multiple containers
List<Container> fits = packager.packList(products, maxContainers);

Rotation

By default 3D-rotation is enabled. Configure 2D-only rotation using:

boolean rotate3d = ...;
Packager packager = LargestAreaFitFirstPackager.newBuilder().withContainers(containers).withRotate2D().build();

Brute-force packager

For a low number of packages (like <= 6) the brute force packager might be a good fit.

Packager packager = BruteForcePackager.newBuilder().withContainers(containers).build();

Using a deadline is recommended whenever brute-forcing in a real-time application.

// limit search using 5 seconds deadline
long deadline = System.currentTimeMillis() + 5000;

Container match = packager.pack(products, deadline);

Details

Largest Area Fit First algorithm

The implementation is based on this paper, and is not a traditional Bin packing problem solver.

The box which covers the largest ground area of the container is placed first; its height becomes the level height. Boxes which fill the full remaining height take priority. Subsequent boxes are stacked in the remaining space in at the same level, the boxes with the greatest volume first. If box height is lower than level height, the algorithm attempts to place some there as well.

When no more boxes fit in a level, the level is incremented and the process repeated. Boxes are rotated, containers not.

The algorithm runs reasonably fast, usually in milliseconds.

Brute-force algorithm

This algorithm places the boxes in the same way as the LAFF algorithm, but has no logic for selecting the best box or rotation; running through all permutations, for each permutation all rotations.

The maximum complexity of this approach is exponential at n! * 6^n. The algorithm runs for under a second for small number of products (<= 6), to seconds or minutes (<= 8) or hours for larger numbers.

However accounting for container vs box size plus boxes with equal size might reduce this bound considerably, and the resulting complexity can be calculated using PermutationRotationIterator before packaging is attempted. See example in test sources.

There is also a parallel version of the brute-force packager, for those wishing to use it on a multicore system.

Using a brute-force algorithm might seem to hit a wall of complexity, but taking into account number of items per order distribution for web-shops, a healthy part of the orders are within its grasp.

Note that placing the boxes as the LAFF algorithm is a limitation; the current approach is 'split and drill down', a better approach would be to sort and keep tabs of corners (boxes).

Get involved

If you have any questions, comments or improvement suggestions, please file an issue or submit a pull-request. DO NOT send me emails unless you're prepared to pay for my time.

Feel free to connect with me on LinkedIn, see also my Github page.

License

Apache 2.0. Social media preview by pch.vector on www.freepik.com.

History

  • 1.2.13: Fix for issue #251.
  • 1.2.12: Fix for issue #245.
  • 1.2.11: Add test artifact, improve use of deadline for better performance, some bugfixes.
  • 1.2.10: Tweak LAFF selecetion of 'best space' for equally sized boxes (issue #168).
  • 1.2.9: If the 'remainder' space cannot be used, attempt to expand it with unused space.
  • 1.2.8: Java module for JDK 9+ (multi-release jar). That was painful.
  • 1.2.6: Refactor project structure into multi-module. New group- and artifact-id.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].