Coder Social home page Coder Social logo

csp2d's Introduction

Two-Dimensional Cutting Stock Problem

The Two-Dimensional Cutting Stock Problem (2D CSP) deals with planning the cutting of rectangular pieces from given panels.

Quick start

Clone this project, install required packages and compile the native implementation:

$ git clone [email protected]:jaburjak/csp2d.git
$ cd csp2d/
$ python -m venv env
$ source env/bin/activate
$ pip install -r requirements.txt
(env) $ doit

Usage

To solve your Two-Dimensional Cutting Stock Problem, run the opcut module:

(env) $ cd src_py/
(env) $ python -m opcut calculate --input-format yaml --output result.json << EOF
cut_width: 1
min_initial_usage: false
panels:
    panel1:
        width: 100
        height: 100
items:
    item1:
        width: 10
        height: 10
        can_rotate: false
EOF

Output:

{
    "params": {
        "cut_width": 1,
        "min_initial_usage": false,
        "panels": {
            "panel1": {
                "width": 100,
                "height": 100
            }
        },
        "items": {
            "item1": {
                "width": 10,
                "height": 10,
                "can_rotate": false
            }
        }
    },
    "used": [
        {
            "panel": "panel1",
            "item": "item1",
            "x": 0.0,
            "y": 0.0,
            "rotate": false
        }
    ],
    "unused": [
        {
            "panel": "panel1",
            "width": 89.0,
            "height": 10.0,
            "x": 11.0,
            "y": 0.0
        },
        {
            "panel": "panel1",
            "width": 100.0,
            "height": 89.0,
            "x": 0.0,
            "y": 11.0
        }
    ]
}

Acknowledgements

This project is a fork of Bozo Kopic’s CSP solver with nothing added, and everything except for the CLI interface removed.

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.