Giter Site home page Giter Site logo

cutting-stock's Introduction

Cutting-Stock

C++ heuristic solver for the Cutting-Stock, a classic Operational Research problem.

Please refer to the CuttingStock.pdf document for a mathematical background and an algorithmic discussion.

WARNING: this project is unmaintained. It needs some refactoring and clean-up. One day I may have time do do that.

Setup

You need to install the GLPK C libraries. On a reasonably recent version of Ubuntu Linux this can be made as follows:

sudo apt-get install libglpk-dev libglpk0

Make sure you have installed a decent version of the gcc c++ (g++) compiler and the make utility.

Compilation

Switch to the Source directory, and run the command make. This will compile the code, and should generate no errors neither warnings.

You can optionally run the unit-test suite to make sure everything is in place:

make unit-tests

Execution

Once you have compiled, execute the program cutting-stock. The usage is as follows:

Usage:  ./cutting-stock [-s strategy] [-b backtracking] [-a] [input-file]
        ./cutting-stock [-h]

input-file is the input file name. If not specified, reads standard input.

-h  : shows this help

-a  : outputs the significant result fields in a parsable, machine-friendly
      way so this program can be easily invoked and processed by automation
      scripts.

-s strategy  : solution strategy to use. Strategy can assume the following
               values (default: heuristic).

               - heuristic: solves an integer heuristic applied on top of a
                   linear relaxation solution.
               - exact: solves an exact integer program based on the
                   Kantorovich formulation.

-b backtracking  : branch-and-bound backtracking mode. Backtracking can assume
                   the following values (default: best-local-bound).

                   - best-local-bound: Best Local Bound backtracking mode.
                   - depth-search: Depth First backtracking mode.

Optionally you can execute the exact integer solution by invoking the GLPK standalone solver (glpsol) with the MathProg model that is defined inside the MathProg directory.

Examples

In order to solve using the heuristic and best-local-bound:

./cutting-stock -s heuristic -b best-local-bound data/instance{i}.dat

where {i} can be from 1 to 24. Ex: data/instance3.dat

To execute the exact solution with depth-first:

./cutting-stock -s exact -b depth-search data/instance{i}.dat

To execute the exact solution by invoking the GLPK standalone solver directly:

glpsol -m MathProg/CuttingStockExactIntegerSolver.mod -d MathProg/test1.dat

cutting-stock's People

Contributors

felipead avatar

Watchers

 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.