Skip to content

This code implements a variation of Huang and Korf's optimal rectangle packer, with additional modifications to support static memory allocation.

License

Notifications You must be signed in to change notification settings

mmoffitt/rectpack

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

rectpack

Optimal rectangle packing

This code implements Huang and Korf's (2008, 2009, 2010, 2011) optimal rectangle packer. It also implements Korf's (2003, 2004) and Korf et al.'s (2009) optimal rectangle packer.

The software handles rectangles rotated to be aligned to the x and y axes, handles both oriented and unoriented rectangles, rectangles of high-precision dimensions, and finds the bounding box of smallest area that can contain the input rectangles without overlap.

Dependencies

  • Boost program options, boost graph library, boost spirit v2, boost thread
  • GNU Multi-Precision library (gmp), and C++ wrapper (gmpxx)

Reference

static memory allocation

When using this code for static memory allocation, first create a problem file (such as problem.csv) in the following format:

buffer_id,start,end,offset,size,alignment
1,0,20,0,4,1
2,9,20,0,4,1
3,0,8,0,4,1
4,3,8,0,4,1
5,0,2,0,4,1

To invoke the CSP solver, execute this command:

release/rectpack -2 d -b 0 -o 1 -w 5 -i problem.csv -B 0x12

To invoke the meta-CSP solver, execute this command:

release/rectpack -2 d -b 0 -o 1 -w 6 -i problem.csv -B 0x12

(the program will automatically calculate grid width, hence the '0' in the above box dimensions)

About

This code implements a variation of Huang and Korf's optimal rectangle packer, with additional modifications to support static memory allocation.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.2%
  • Other 0.8%