Skip to content

greydelta/bin-packing-problem

Repository files navigation

Contributors Forks Stargazers Issues License


Logo

Bin Packing Problem

A CLI-based program to solve the Bin Packing Problem with Next Fit & Best Fit Decreasing algorithm
Explore the docs »

View Demo · Report Bug · Request Feature

About The Project

This program aims to demonstrate the use of algorithms to solve the bin packing problem and choose the optimal solution.

The bin packing problem is defined by 2 properties, which are the item sizes and the bin container. In this case, a delivery processing facility is used to simulate a scenario.

  • bin capacity = Truck load
  • item size = Package weight

In each delivery batch, the algorithm would determine which PACKAGE should be loaded into which TRUCK.

The program will require the user to input:

  • Truck capacity / load
  • The weight of the packages

Or conversely, use data from the existing data files:

  • Make changes accordingly in Main.java, under Method B2 - getDataFromFile()

The program will then generate the solutions based on the 2 algorithms:

  • Next Fit Algorithm (Feasible solution)
  • Best Fit Decreasing Algorithm (Optimal solution)

Assumptions:

  1. Weight ----> Measured only in KG (only in Integer)
  2. Num of Packages ----> Any number of packages is acceptable
  3. Size --->
  • Assume that company has estimated that the load limit for each truck has taken into account the size of parcel (regardless of how big or small)
  • Hence, physical size is disregarded in the calculation of the two following approximation algorithms

Implementation Overview:

screenshot

Flowcharts

(Left: BFD Algorithm - Right: NF Algorithm):

flowchart

(back to top)

Sample Output:

screenshot1

(back to top)

Built With

Java

(back to top)

Getting Started

Using Visual Studio Code :

Prerequisites

Installation

  • Import Project Folder in VS Code

Usage

  1. Right click on App.java

  2. Click "Run Java"

(back to top)

Using Eclipse :

Prerequisites

  • Download & install JRE-15 and above according to your OS

Installation

  1. Import Project Folder in Eclipse IDE

  2. Right click on Project Folder in Project Folder View

  3. Click "Build Path"

  4. Click "Configure Build Path"

  5. Under the "Libraries" Tab, click JRE System Library

  6. Click "Edit"

  7. Under "Execution Environment", choose "JavaSE-15 (jre)" from the dropdown

  8. Click "Finish" then "Apply and Close"

Usage

  1. Right click on Project Folder in Project Folder View

  2. Click "Run As"

  3. Click "Java Application"

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact


Project Link: https://github.com/greydelta/bin-packing-problem

(back to top)

Acknowledgments

(back to top)