GithubHelp home page GithubHelp logo

pack's Introduction

Copyright (c) 2016 by James Bremner
Copyright (C) 2012 by Arash Sharif

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


The code is based on Arash Sharif's 2012 packit4me, which is no longer supported.
I have modified the modified Sharif's code to:

- build on windows using codeblocks
- utilize C++11 features, particularly shared pointers
- merge fragmented unused space in the bins
- record locations of items in bins
- output 2D cutting list
- optional limit to exactly one bin
- positional constraints


An approximation algorithmis used, called first-fit decreasing
(FFD). The elements are sorted in decreasing order of
size, and the bins are kept in a fixed order. Each element
is placed into the first bin that it fits into, without exceeding
the bin capacity. How good is the approximation?  The algorithm is guaranteed
to return a solution that uses no more than 11/9 of the optimal number of bins
(Johnson 1973).  For example, on problems of 90 items, where
the items are uniformly distributed from zero to one million,
and the bin capacity is one million, the algorith uses an average
of 47.732 bins. On these same problem instances, the optimal solution
averages 47.680 bins. The FFD solution is optimal 94.694%
of the time on these problem instances. (Korf 2002 http://www.aaai.org/Papers/AAAI/2002/AAAI02-110.pdf)
------------------------------------------------------------------------------------------------


This project is a library for best-fit bin packing.  It is designed to be one
native call and it will figure out the best way to pack 1d, 2d or 3d bin(s) with item(s).

The bins should be passed in the following format:

"id:dim_unit:quantity:size1xsize2xsize3:weight"

The items passed like so:

"id:dim_unit:constraints:quantity:size1xsize2xsize3:weight"

id could be a stock or order number.

example:

53443:5x5x5

constraints are for each item and if the item can be rotated:

constraint = position_constraint + rotation_constraint

position constraint

0     :  anywhere
100   :  bottom only
200   :  top only

rotation constraint

0     :  Any
1     :  Length axis only
2     :  Width axis only
3     :  Height axis only
7     :  No ratiation allowed


Dependencies:
1.  To compile the algorithm you need to make sure you have boost for c++ installed



run ./packit4me or ./packit4me -help for options


pack's People

Contributors

gustav21 avatar jamesbremner avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.