Catalog npm
Back to packageRELEASE DETAILS

1.0.5

npm

3d-bin-packing

Packer, 3D-Bin-Packing with multiple Boxes.

3d bin packing3d bin packing with multiple boxesboxing optimizationpacker
Published21 Dec 2016
Direct dependencies11
Transitive dependenciesNot calculated

README

Current package documentation

Packer

3D Bin Packing with multiple wrappers (boxes).

Red Printing

Red-Printing is a brand name of printing service supported by Betterway-systems.

레드 프린팅은 베러웨이시스템즈에서 실시하는 인쇄 서비스의 브랜드 명입니다. 많은 이용 바랍니다.

Packer를 이용하시는 여러분, 인쇄 주문은 꼭 레드프린팅에서 해 주세요.

http://redprinting.co.kr/

Author

References

Demo

Packer Demo GIF

Programming
Algorithm from Airforce Bin Packing

Installation

Node.JS
npm install -g 3d-bin-packing
tsd install 3d-bin-packing
TypeScript (JavaScript) only

If you want the TypeScript (JavaScript) only mode, any installation procedure is not required.

Build Cloud Server

However, if you want to install the C++ mode, you've to install Visual C++ Redistributable for Visual Studio 2015. After the installation, execute release/cpp/Packer.exe. Then a cloud server deducting packer solution will be opened. After running the cloud server, open release/browser/index.html.

You also can separate cloud server(C++) and clients(Web), let users to connect remote Packer server, by editing ip address in release/browser/server.xml

Implementation

Design

alt text

Languages
  • C++
    • Server solving packing problem.
    • Deduct the best optimization result with genetic algorithm
  • TypeScript
    1. Act a role of client connecting to C++ server.
    2. Do packing itself without C++ server and do not use genetic algorithm.
    • The optimization result can be inferior than C++
Dependency

Usage

TypeScript (Node.JS)
import packer = require("3d-bin-packing");
import samchon = require("samchon-framework");

function main(): void
{
    ///////////////////////////
    // CONSTRUCT OBJECTS
    ///////////////////////////
    let wrapperArray: packer.WrapperArray = new packer.WrapperArray();
    let instanceArray: packer.InstanceArray = new packer.InstanceArray();

    // Wrappers
    wrapperArray.push
    (
        new packer.Wrapper("Large", 1000, 40, 40, 15, 0),
        new packer.Wrapper("Medium", 700, 20, 20, 10, 0),
        new packer.Wrapper("Small", 500, 15, 15, 8, 0)
    );

    ///////
    // Each Instance is repeated #15
    ///////
    instanceArray.insert(instanceArray.end(), 15, new packer.Product("Eraser", 1, 2, 5));
    instanceArray.insert(instanceArray.end(), 15, new packer.Product("Book", 15, 30, 3));
    instanceArray.insert(instanceArray.end(), 15, new packer.Product("Drink", 3, 3, 10));
    instanceArray.insert(instanceArray.end(), 15, new packer.Product("Umbrella", 5, 5, 20));

    // Wrappers also can be packed into another Wrapper.
    instanceArray.insert(instanceArray.end(), 15, new packer.Wrapper("Notebook-Box", 2000, 30, 40, 4, 2));
    instanceArray.insert(instanceArray.end(), 15, new packer.Wrapper("Tablet-Box", 2500, 20, 28, 2, 0));

    ///////////////////////////
    // BEGINS PACKING
    ///////////////////////////
    // CONSTRUCT PACKER
    let my_packer: packer.Packer = new packer.Packer(wrapperArray, instanceArray);

    ///////
    // PACK (OPTIMIZE)
    let result: packer.WrapperArray = my_packer.optimize();
    ///////

    ///////////////////////////
    // TRACE PACKING RESULT
    ///////////////////////////
    let xml: samchon.library.XML = result.toXML();
    console.log(xml.toString());
}

main();
C++
#include <iostream>
#include <bws/packer/Packer.hpp>

#include <bws/packer/WrapperArray.hpp>
#include <bws/packer/InstanceArray.hpp>
# include <bws/packer/Product.hpp>
# include <bws/packer/Wrapper.hpp>

using namespace std;
using namespace samchon::library;
using namespace bws::packer;

int main()
{
	///////////////////////////
	// CONSTRUCT OBJECTS
	///////////////////////////
	shared_ptr<WrapperArray> wrapperArray(new WrapperArray());
	shared_ptr<InstanceArray> instanceArray(new InstanceArray());
	
	// Wrappers
	wrapperArray->emplace_back(new bws.packer.Wrapper("Large", 1000, 40, 40, 15, 0));
	wrapperArray->emplace_back(new Wrapper("Medium", 700, 20, 20, 10, 0));
	wrapperArray->emplace_back(new Wrapper("Small", 500, 15, 15, 8, 0));
	
	///////
	// Each Instance is repeated #15
	///////
	instanceArray->insert(instanceArray->end(), 15, make_shared<Product>("Eraser", 1, 2, 5));
	instanceArray->insert(instanceArray->end(), 15, make_shared<Product>("Book", 15, 30, 3));
	instanceArray->insert(instanceArray->end(), 15, make_shared<Product>("Drink", 3, 3, 10));
	instanceArray->insert(instanceArray->end(), 15, make_shared<Product>("Umbrella", 5, 5, 20));
	
	// Wrappers also can be packed into another Wrapper.
	instanceArray->insert(instanceArray->end(), 15, make_shared<Wrapper>("Notebook-Box", 2000, 30, 40, 4, 2));
	instanceArray->insert(instanceArray->end(), 15, make_shared<Wrapper>("Tablet-Box", 2500, 20, 28, 2, 0));
	
	///////////////////////////
	// BEGINS PACKING
	///////////////////////////
	// CONSTRUCT PACKER
	Packer packer(wrapperArray, instanceArray);
	GAParameters gaParams = {500, 100, 50, 0.2};
	
	///////
	// PACK (OPTIMIZE)
	///////
	shared_ptr<WrapperArray> &result = packer.optimize(gaParams);
	
	///////////////////////////
	// TRACE PACKING RESULT
	///////////////////////////
	shared_ptr<XML> xml = result->toXML();
	cout << xml->toString() << endl;
	
	return 0;
}

License

BSD v3.

Copyright (c) 2016, betterwaysystems All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of packer nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 11

Native requirements
11 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^6.0.52runtime
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
^0.14.55runtime
@types/react-data-grid
Environment
{
  "local_name": "@types/react-data-grid",
  "alias": false,
  "peer_metadata": null
}
^1.0.6runtime
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
^0.14.19runtime
@types/three
Environment
{
  "local_name": "@types/three",
  "alias": false,
  "peer_metadata": null
}
0.0.27runtime
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^15.3.2runtime
react-data-grid
Environment
{
  "local_name": "react-data-grid",
  "alias": false,
  "peer_metadata": null
}
~1.0.18runtime
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^15.3.2runtime
samchon-framework
Environment
{
  "local_name": "samchon-framework",
  "alias": false,
  "peer_metadata": null
}
~2.0.0-rc.5-aruntime
three
Environment
{
  "local_name": "three",
  "alias": false,
  "peer_metadata": null
}
~0.79.0runtime
tstl
Environment
{
  "local_name": "tstl",
  "alias": false,
  "peer_metadata": null
}
~1.3.1runtime

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "b6db492e6b0d2117a88746039e9eec3e56f75e99",
  "tarball": "https://registry.npmjs.org/3d-bin-packing/-/3d-bin-packing-1.0.5.tgz",
  "integrity": "sha512-TV2jyZ4v/Cniw4Auv1thBQM01OkjHpFAX7Zo2gM1R8B2Zsjxca16wlb17StoSM6hMFdtWUMwpLthuoDjkNdeDg==",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEYCIQD0hdrOA9BmlRb7kX6KOqZCE8dqVM/Gv5W8Fg9PexuOVQIhANSB5IzruAEmlPxndhckTP7oLzVcvdfnIndgqO+1FxSC"
    }
  ]
}

Repository

PENDING
betterwaysystems/packer

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 19:32 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:d990e21daf9a4ec03c1fe9a2f3664dfddc924f63f9beff4d30dbbcce889eec86

Other collected versions

1.1.323 Apr1.1.26 Jan1.1.12 Jan1.1.021 Dec1.0.621 Dec1.0.421 DecView all collected versions →