Package: hyperpack
Problem descriptionThe hyperpack library is an API for solving instances of the2D Binpacking problemand
also - as of v1.1.0 - strip packing instances!The library ismultiprocessing enabledto minimize execution times andutilizes only pure python, making
the package dependency free.Many different variations can be created and solved, accordind to the instantiation data.
The solvable variants can be summarized in the below characteristics:
- Any number and sizes of (rectangular) items.
- Any number and sizes of (rectangular) bins (containers).
- The items can be rotated or not.The above items’ charascteristics can also be applied to strip packing problems.The bin/strip packing problem has been used in many sectors of the industry, and mostly where manufacturing or
industrial management needs arise.The theory of this library’s implementation and mechanics can be found in author’s
document“A hyper-heuristic for solving variants of the 2D bin packing problem”.InstallationInstall using pip:pip install hyperpackQuickstartA quickstart for testing the library can be made through thegenerate_problem_datautility function.>>>fromhyperpackimportgenerate_problem_data,HyperPack>>>problem_data=hyperpack.generate_problem_data(containers_num=2)Containersnumber=2Containers:{"container-0":{"W":48,"L":53},"container-1":{"W":53,"L":49}}Itemsnumber=60>>>problem=HyperPack(**problem_data)>>>problem.hypersearch()>>>problem.create_figure(show=True)>>># figure opened in default browser>>>>>># to see parameter explanation do:>>>help(generate_problem_data)Defining the problemInstantiate your problem with proper arguments>>>fromhyperpackimportHyperPack>>>problem=hyperpack.HyperPack(>>>containers=containers,# problem parameter>>>items=items,# problem parameter>>>settings=settings# solver/figure parameters>>>)According to the arguments given, the corresponding problem will be instantiated, ready to be solved
with provided guidelines. The items and containers (bins) structure:containers={"container-0-id":{"W":int,# > 0 container's width"L":int# > 0 container's length},"container-1-id":{"W":int,# > 0 container's width"L":int# > 0 container's length},# ... rest of the containers# minimum 1 container must be provided}items={"item-0-id":{"w":int,# > 0 item's width"l":int,# > 0 item's length},"item-1-id":{"w":int,# > 0 item's width"l":int,# > 0 item's length},# ... rest of the items# minimum 1 item must be provided}See documentation for detailed settings structure.UsageDo Local search with default settings:>>>fromhyperpackimportHyperPack>>>problem_data={>>>"containers":containers,>>>"items":items,>>>"settings":settings>>>}>>>problem=HyperPack(**problem_data)>>>problem.local_search()After solving has finished, the solution can be found inproblem.solutioninstance attribute.Alternatively for a deep search and maximum bin utilization in mind:>>>problem=HyperPack(**problem_data)>>>problem.hypersearch()Solution loggingUse thelog_solutionmethod to log an already found solution:>>>problem.log_solution()SolutionLog:Percenttotalitemsstored:100.0000%Container:container-0-id60x30[util%]:100.0000%Container:container-1-id60x50[util%]:91.2000%Remainingitems:[]Create a figureWarning: plotly (5.14.0 or greater) is needed for figure creation and kaleido (0.2.1 or greater)
for figure exportation to image. These libraries are not listed as dependencies providing liberty
of figure implementation.>>>problem.create_figure(show=True)The figure below is opened in default browser:For more information, visit the documentation page.Future developmentMany ideas and concepts can be implemented in this library. The most propable depending on
the community’s interest:Augmentation of the objective function to deal with a bigger plethora of problems.Implementation of the strip packing problem.Django integrations.Large Neighborhood Search for big instances of the problem.Other shapes of the container.A dynamic live terminal display.Execution speed optimization.Multiprocessing for the local search alone (combined with Large Neighborhood Search).More detailed figures.Figures with other libraries (matplotlib).If interested with development with some of these features please contact me.Theoretical foundationsThis packages inner mechanics and theoretical design are based upon thisdocumentation.HelpingCreating issues wherever bugs are found and giving suggestions for upcoming versions
can surely help in maintaining and growing this package.