$30 off During Our Annual Pro Sale. View Details »

TwoBinPack - Scala architecture for two-dimensional packing

TwoBinPack - Scala architecture for two-dimensional packing

Operations Research is the science and art of solving practical - often very difficult - problems with mathematical elegance, minimalism and efficiency.

Two-dimensional packing consists of paramount, well-known classes of problems that can arise in a wide variety of contexts - from warehouse stocking to cargo loading, or wood craftsmanship and page layouts, ...

TwoBinPack is a comprehensive Scala architecture, employing hybrid OOP-FP techniques, designed to interactively tackle the above problems and study - via dedicated, extensible analytics tool - how they are usually solved by people, therefore enabling both practical solving and long-term statistical analysis, to gather further insight on the topic.

Last but not least, it is my MSc project in Computer Engineering! ^__^

Official website: http://gianlucacosta.info/TwoBinPack/

Gianluca Costa

December 19, 2016

More Decks by Gianluca Costa

Other Decks in Programming


  1. Gianluca Costa
    Scala architecture for two-dimensional packing

    View Slide

  2. Two-dimensional packing problems

    View Slide

  3. There are several algorithms, but...
    ...what about
    human reasoning?

    View Slide

  4. Main requirements
    We need a dedicated software tool
    Create problem
    Let users play and
    find solutions
    Gather solutions and
    consult analytics
    We need to…

    View Slide

  5. TwoBinPack – ScalaFX apps

    Create problem instances

    Export problem bundles

    Import solutions created by TwoBinGame

    Consult analytics

    Play with two-dimensional packing problems

    Create solution files for TwoBinManager

    View Slide

  6. TwoBinPack – Basic workflow
    TwoBinManager TwoBinGame
    Problem Bundle
    User Solutions

    View Slide

  7. TwoBinManager – Main window

    View Slide

  8. TwoBinGame – Game window

    View Slide

  9. Architecture layers

    View Slide

  10. Architecture details

    Written in Scala, with just a handful of POJOs (Plain Old
    Java Objects)

    Extensive test coverage; tests are all based on the
    expressive Scalatest framework

    Open source, published on GitHub under the GPLv3
    OOP FP

    View Slide

  11. Integration with external systems
    External system
    Standard Problem

    View Slide

  12. Extensible architecture
    Generators Importers
    Analytics Providers

    View Slide

  13. First tests – Setup

    8 bundles, then 16

    Each bundle contains 7 problems of different
    estimated difficulty – from fairly easy (but not
    trivial) to very difficult

    Each problem has a time limit, according to
    the above difficulty

    User base of ~200 students, at the universities
    of Bologna and Reggio Emilia
    These data are courtesy of the Operations Research groups at Unibo and Unimore.

    View Slide

  14. First tests – Result excerpts
    Frame height
    % of optimal
    10 40%
    15 21%
    20 6%
    % of optimal
    No 19%
    Yes 26%
    Time limit
    (in minutes)
    Average % gap from
    optimal solution
    4 9.8%
    5 8.7%
    6 6.6%
    7 6.7%
    These data are courtesy of the Operations Research groups at Unibo and Unimore.
    Medium-difficulty problem, assigned to everyone

    View Slide

  15. Official website

    View Slide

  16. Conclusions
    Open source
    Plugins &
    New apps

    View Slide

  17. Special thanks

    Special thanks, for their valuable advice and
    suggestions, to:
    – Professor Silvano Martello
    – Prof. Manuel Iori
    – Prof. Enrico Malaguti
    – Dr. Maxence Delorme

    View Slide

  18. Elegance always matters
    Thanks for your attention! ^__^!

    View Slide