Bin Packing, using optimization to solve the problem!
See https://en.wikipedia.org/wiki/Bin_packing_problem
git
, this repository must be cloned and commands are to be run from the root directorymake
, see https://www.gnu.org/software/make/, managed withMakefile
filepipenv
, see https://github.com/pypa/pipenv, managed withPipfile
andPipfile.lock
filespython 3.8
, to be used in a virtual environment withpipenv
(pipenv --three
can work)
This setup is for development only. Ensure that all requirements are met, especially Docker and that
a virtual environment for Python 3.8 has been created with pipenv
(pipenv --three
can work).
Activate the pipenv
shell environment:
make activate
Install dependencies:
make install
Do some plotting:
make plot
Or run the solver:
make run-solver
Optionally if you are using VSCode you may use the settings in .vscode.example/settings.json
:
cp -r .vscode.example .vscode && echo ".vscode/settings.json" >> .git/info/exclude
The codebase is checked for code formatting with black
(https://github.com/python/black),
mypy
for static typing (http://mypy-lang.org/),
and flake8
for various errors and warnings (https://pypi.org/project/flake8/).
It is strongly recommended to have all of these tools configured within the editor or IDE.
Manual executions of those tools can be done with make
:
# checks:
make flake
make mypy
make black-check
# run all above checks:
make checks
# apply black formatting on the codebase:
make black
Run all tests with:
make test
Or specific tests with something like:
# test a whole file:
make test TARGET=tests.test_directory_1.test_directory_2.test_file
# test a specific test class within a file:
make test TARGET=tests.test_directory_1.test_directory_2.test_file.TestClassName
# test a specific test class method within a file:
make test TARGET=tests.test_directory_1.test_directory_2.test_file.TestClassName.test_method_name
For convenience, a file path may also be used (as "/" characters are replaced with "." characters):
# test a whole file:
make test TARGET=tests/test_directory_1/test_directory_2/test_file
# test a whole file with ".py" extention also ok as ".py" is removed within the make logic:
make test TARGET=tests/test_directory_1/test_directory_2/test_file.py
# test a specific test class within a file:
make test TARGET=tests/test_directory_1/test_directory_2/test_file.TestClassName
# test a specific test class method within a file:
make test TARGET=tests/test_directory_1/test_directory_2/test_file.TestClassName.test_method_name
Install all dependencies (pip
packages including development packages) with:
make install
If new packages are to be added, install them with:
make install PACKAGE=new_package_name
Or new development packages with:
make install DEV_PACKAGE=new_dev_package_name
Always commit Pipfile
and Pipfile.lock
changes.
Update packages with:
make update
Or update a single package with:
make update PACKAGE=some_package_name