Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This program can quickly solve the 2D bin packing problem for any number of any
### How to use
Download the python file, navigate to its location and run it like this:

`python3 polygon_packer.py [n] [nsi] [nsc]`
`python3 polygon_packer.py -n [n] -nsi [nsi] -nsc [nsc]`
- Replace `[n]` with the number of inner polygons you want to solve for
- Replace `[nsi]` with the number of sides of the inner polygons (e.g. 4 for a square)
- Replace `[nsc]` with the number of sides of the container polygon
Expand Down
8 changes: 4 additions & 4 deletions polygon_packer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
from joblib import Parallel, delayed
import argparse

arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("inner_polygons", type=int, help="Number of inner polygons")
arg_parser.add_argument("inner_sides", type=int, help="Number of sides of the inner polygons")
arg_parser.add_argument("container_sides", type=int, help="Number of sides of the container polygon")
arg_parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
arg_parser.add_argument("-n", "--inner_polygons", type=int, required=True, default=argparse.SUPPRESS, help="Number of inner polygons")
arg_parser.add_argument("-nsi", "--inner_sides", type=int, required=True, default=argparse.SUPPRESS, help="Number of sides of the inner polygons")
arg_parser.add_argument("-nsc", "--container_sides", type=int, required=True, default=argparse.SUPPRESS, help="Number of sides of the container polygon")
arg_parser.add_argument("--attempts", type=int, default=1000, help="Number of attempts to run")
arg_parser.add_argument("--tolerance", type=float, default=1e-8, help="Overlap penalty tolerance. Probably best left at default")
arg_parser.add_argument("--finalstep", type=float, default=0.0001, help="How small the last theoretical step in container size decrease will be (it gets smaller over time)")
Expand Down